Results 1 to 4 of 4

Thread: Remove content type from supported list

  1. #1
    Join Date
    Aug 2017
    Posts
    7
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Windows

    Default Remove content type from supported list

    I found supportedContentTypes() that returns the list of all content types supported by QWebPage but I'd like to remove a content-type from that list. Is that possible? I read QWebPage documentation and QWebView related functions but found nothing would help so far.

  2. #2
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: Remove content type from supported list

    Hm. Can't you just subclass QWebPage and overwrite that method?

    Something along these lines (absolutely untested and not long thought about)
    Qt Code:
    1. class MyWebPage: public QWebPage
    2. {
    3. MyWebPage([whatever is needed]) : QWebPage ([whatever is needed]) {}
    4. QStringList MyWebPage::supportedContentTypes() const {
    5. return QWebPage::supportedContentTypes.removeOne("whateverYoWant");
    6. }
    7. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Aug 2017
    Posts
    7
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Windows

    Default Re: Remove content type from supported list

    I didn't thought this before even albeit I'm overridng QWebPage already. it would solve, I guess, but supportedContentTypes() isn't a virtual method.

  4. #4
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: Remove content type from supported list

    I see two options:
    1. Look into QWebPage source if there are any related virtual methods responsible for the generation of that list. I'd doubt it.
    2. What element is needing the list? Can you intercept / subclass here?
    As you have provided no code I have no idea what you want to achieve.

Similar Threads

  1. remove QVBoxLayout content in QHBoxLayout
    By jackajack01 in forum Qt Programming
    Replies: 1
    Last Post: 6th August 2012, 11:53
  2. QTextEdit content type?
    By BreakBad in forum Qt Programming
    Replies: 5
    Last Post: 27th June 2012, 19:38
  3. QNetworkAccessManager and get FTP content list
    By dickymoe in forum Qt Programming
    Replies: 1
    Last Post: 4th May 2011, 19:37
  4. Replies: 1
    Last Post: 23rd April 2011, 17:33
  5. Reply Header - Content-Type
    By seink in forum Newbie
    Replies: 2
    Last Post: 16th December 2010, 17:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.