Results 1 to 5 of 5

Thread: QWebkit and dragging problem

  1. #1
    Join Date
    Jul 2010
    Posts
    30
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default QWebkit and dragging problem

    As you may know google maps ,see here, are drag-able . I saved this example from google developers and loaded it in a QWebView object. The map itself loads successfully but I have no dragging, no double clicking and no other mouse events. That would be a bug if I'm true. I want to write a program that shows a map to users in a touch-enabled device . So my program needs to be able to be flicked with finger
    Last edited by .:saeed:.; 25th August 2012 at 14:21.
    Impossible = I'mpossible

  2. #2
    Join Date
    May 2012
    Posts
    37
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWebkit and dragging problem

    Create the following class:

    class uaWebPage : public QWebPage
    {
    public:
    explicit uaWebPage(QObject * parent = 0) : QWebPage(parent) {}
    virtual QString userAgentForUrl(const QUrl& url) const
    {
    Q_UNUSED(url);
    return "Chrome/1.0";
    }
    };

    And add this in your derived QWebView constructor (or after you create the default QWebView object, using the correct pointer)
    setPage(new uaWebPage(this));

  3. #3
    Join Date
    Aug 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QWebkit and dragging problem

    That little hack doesn't seem to work anymore!

    Used it for the last 3-4 month and now Google must have changed the way they check for the userAgent.
    Has anyone come up with a new solution that doesn't require to recompile QWebkit?

  4. #4
    Join Date
    May 2012
    Posts
    37
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QWebkit and dragging problem

    Yes, google certainly changed something. I checked the change log and there is some indication about this. Not sure how to get it back working at this point (other than capturing the mouse events myself and calling the pan and zoom through a script). Might be the safest thing to do as any workaround might stop working in the future.

  5. #5
    Join Date
    Oct 2012
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWebkit and dragging problem

    Just have look to here

    I replace
    Qt Code:
    1. return "Chrome/1.0";
    To copy to clipboard, switch view to plain text mode 
    with
    Qt Code:
    1. return "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2";
    To copy to clipboard, switch view to plain text mode 
    and it works fine.

    Didier

  6. The following user says thank you to banjo51 for this useful post:

    Kwakkie (8th October 2012)

Similar Threads

  1. QWebKit + Kendo UI
    By jh in forum Qt Programming
    Replies: 0
    Last Post: 22nd July 2012, 11:28
  2. Problem in dragging and move QDockWidget
    By stilgar in forum Qt Programming
    Replies: 1
    Last Post: 18th April 2012, 10:33
  3. Bus error on QWebkit
    By geoffroylaca in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 24th August 2011, 11:13
  4. Replies: 1
    Last Post: 1st April 2011, 14:29
  5. QAbstractItemDelegate painting while dragging problem
    By rickbsgu in forum Qt Programming
    Replies: 0
    Last Post: 25th March 2011, 19:35

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.