×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    95

    problem with qt4.6 QwebView kinetic scrolling

    hi there;

    i am having a problem with QWebView's kinetic scrolling feature (added in qt libs v4.6).
    I created a simple qwebview based application and when I try to scroll a webpage (drag the page with finger) the text/content inside the page is selected instead of the page being scrolled (especially when you reach the buttom of the page and still try to scroll down with finger). this behavior prevents the page from being scrolled (since moving the finger on selected text stops the page scrolling).

    that behavior doesn't exist on other browsers (the default web browser/firefox for maemo) as content is not selectable (can't be highlighted) by user

    I tried to disable content editing by calling
    Code:
    ui->webView->page()->setContentEditable(false); // mentioned in Qwebpage's documentation page that it can disable text selection
    but it didn't work
    I couldn't find any APIs in Qwebview,qwebPage or QwebFrame that can disable the text/content selection.

    I also tried to play with the scrolling properties of the webview to make the scrolling more responsive (make the webview scroll as instant/fast as possible that the selection can't occur)
    Code:
    QAbstractKineticScroller *scroller = ui->webView->property("kineticScroller").value<QAbstractKineticScroller *>();
        if (scroller) {
    	scroller->setMode(QAbstractKineticScroller::AccelerationMode);
    	scroller->setPanningThreshold(3);
    	scroller->setDirectionErrorMargin(1);
         }
    but that didn't stop the content selection/highlighting from happening

    I am out of ideas, any hint/note is highly appreciated

    thanx in advance

  2. #2
    Registered User
    Join Date
    Mar 2009
    Location
    Foster City, CA
    Posts
    24

    Re: problem with qt4.6 QwebView kinetic scrolling

    Hi mismael,

    Have you tried this?
    This browser does work fine.

    http://qt.gitorious.org/+qt-develope...5/maemobrowser

  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    95

    Re: problem with qt4.6 QwebView kinetic scrolling

    the example you mentioned doesn't used the QWebView Component, it uses QGraphicsWebView instead

  4. #4
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: problem with qt4.6 QwebView kinetic scrolling

    QWebPage::contentEditable is false by default. One possible workaround could be listening for selectionChanged signal and using findText() with empty string to clear selection.
    However, current behaviour is definitely a bug.

  5. #5
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: problem with qt4.6 QwebView kinetic scrolling

    Kinetic scrolling is working fine in Maemobrowser example, which is one of the default examples shipped with Qt
    http://qt.gitorious.org/+qt-develope...maemo5/webview
    The only thing it's using QGraphicsWebView instead of plain QWebView.
    Last edited by divanov; 2010-05-10 at 21:56. Reason: link was updated

  6. #6
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: problem with qt4.6 QwebView kinetic scrolling

    An article with a sample application demonstrating workaround is available in FN Wiki
    http://wiki.forum.nokia.com/index.ph...iew_on_Maemo_5

  7. #7
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: problem with qt4.6 QwebView kinetic scrolling

    Quote Originally Posted by divanov View Post
    An article with a sample application demonstrating workaround is available in FN Wiki
    http://wiki.forum.nokia.com/index.ph...iew_on_Maemo_5
    But does that workaround really work?

    I built the sample, but I don't quite understand what it is supposed to show? There's no scrolling, and text selection behaves strangely.

    Here - http://doc.qt.nokia.com/qt-maemo-4.6...5-webview.html - is a more complete example that appears to use the very same QWebViewSelectionSuppressor.

    Now, at least for me, [Text Selection Mode] works as intended, but [Scrolling Mode] not only disables text selection, but scrolling as well, which is not the intention as far as I can tell.

    Does it work as intended for someone else?

    Br,
    Johan

  8. #8
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: problem with qt4.6 QwebView kinetic scrolling

    Quote Originally Posted by jhnwkmn View Post
    But does that workaround really work?
    Yes, it does.

    Quote Originally Posted by jhnwkmn View Post
    Here - http://doc.qt.nokia.com/qt-maemo-4.6...5-webview.html - is a more complete example that appears to use the very same QWebViewSelectionSuppressor.
    This is the same code.

  9. #9
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: problem with qt4.6 QwebView kinetic scrolling

    Quote Originally Posted by divanov View Post
    Yes, it does.
    Then there clearly must be something I miss

    I just tried it on the device and the behaviour is the same as on Scratchbox.

    Text Selection Mode enables text selection, disables kinetic scrolling, but scrolls the text if the stylus goes above or below the window.

    Scrolling Mode disables text selection and scrolling. Swiping appears to have no effect whatsoever.

    Br,
    Johan

  10. #10
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: problem with qt4.6 QwebView kinetic scrolling

    Quote Originally Posted by jhnwkmn View Post
    Then there clearly must be something I miss

    I just tried it on the device and the behaviour is the same as on Scratchbox.

    Text Selection Mode enables text selection, disables kinetic scrolling, but scrolls the text if the stylus goes above or below the window.

    Scrolling Mode disables text selection and scrolling. Swiping appears to have no effect whatsoever.

    Br,
    Johan
    Are you talking about wiki workaround or webview example coming with Qt?

  11. #11
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: problem with qt4.6 QwebView kinetic scrolling

    Quote Originally Posted by divanov View Post
    Are you talking about wiki workaround or webview example coming with Qt?
    The example here: http://doc.qt.nokia.com/qt-maemo-4.6...5-webview.html

    I don't understand how this is supposed to work. When enabled, QWebViewSelectionSuppressor installs en event-filter that returns true for MouseMove events.

    That is, the events are not delivered further to the QWebView and, as far as I can tell, to the QAbstractKineticScroller inside it. How could those react to a swipe, if the events describing the swipe never reaches them?

    Br,
    Johan

  12. #12
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: problem with qt4.6 QwebView kinetic scrolling

    Quote Originally Posted by jhnwkmn View Post
    The example here: http://doc.qt.nokia.com/qt-maemo-4.6...5-webview.html

    I don't understand how this is supposed to work. When enabled, QWebViewSelectionSuppressor installs en event-filter that returns true for MouseMove events.

    That is, the events are not delivered further to the QWebView and, as far as I can tell, to the QAbstractKineticScroller inside it. How could those react to a swipe, if the events describing the swipe never reaches them?

    Br,
    Johan
    Suppressor blocks only left button events and mouse move events when left button is pressed.

  13. #13
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: problem with qt4.6 QwebView kinetic scrolling

    Quote Originally Posted by divanov View Post
    Suppressor blocks only left button events and mouse move events when left button is pressed.
    Ok, so how do you generate a mouse move with your finger on the N900, without simultaneously causing the left button to be pressed?

    As far as I can tell a swipe translates into left button press + range of mouse moves with left button down + left button release.

    If those mouse moves are filtered away, then you will not have kinetic scrolling, even if the QAbstractKineticScroller itself is enabled.

    Br,
    Johan

  14. #14
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    54

    Re: problem with qt4.6 QwebView kinetic scrolling

    Not the best solution, but for me definitely the most effective.

    Simply add the following to your body tag in CSS

    -khtml-user-select: none;
    -moz-user-select: none;


    One is for mozilla browsers and the other for webkit.

Similar Threads

  1. N97 kinetic scrolling and CustomItem's pointerDragged
    By shockreaction in forum Mobile Java General
    Replies: 4
    Last Post: 2010-03-06, 21:22
  2. How to implement kinetic scrolling?
    By svdwal in forum Symbian User Interface
    Replies: 8
    Last Post: 2010-01-28, 14:36
  3. When will 5800XM get kinetic scrolling?
    By stolidImran in forum General Development Questions
    Replies: 1
    Last Post: 2009-09-04, 07:48
  4. How to make kinetic scrolling effect on listbox?
    By Mozart2007 in forum Symbian
    Replies: 1
    Last Post: 2009-07-16, 05:08

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •