Results 1 to 5 of 5

Thread: QScroller speed and touch screen

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default QScroller speed and touch screen

    Hello,
    I have problem with the touch screen (Win 8.1 - full win - 10' tablet) and touch events.

    1. QScroller - basically everything working fine, except that when placing scroller on i.e. viewport for the QTreeView I can't resize rows when content exceed visible area - QScroller kick in and move view - probably subclass and event propagation would fix that. But what I cant figure out is speed for scroller.
    Question - how to slow dont scroller? My code for scroller:

    Qt Code:
    1. QScroller *scroller = QScroller::scroller(ui_->treeView->viewport());
    2.  
    3. QScrollerProperties prop = scroller->scrollerProperties();
    4.  
    5. prop.setScrollMetric(QScrollerProperties::AxisLockThreshold, 0.66);
    6. prop.setScrollMetric(QScrollerProperties::ScrollingCurve, QEasingCurve(QEasingCurve::OutExpo));
    7. prop.setScrollMetric(QScrollerProperties::DecelerationFactor, 0.05);
    8. prop.setScrollMetric(QScrollerProperties::MaximumVelocity, 0.635);
    9. prop.setScrollMetric(QScrollerProperties::OvershootDragResistanceFactor, 0.33);
    10. prop.setScrollMetric(QScrollerProperties::OvershootScrollDistanceFactor, 0.33);
    11. prop.setScrollMetric(QScrollerProperties::SnapPositionRatio, 0.93);
    12. prop.setScrollMetric(QScrollerProperties::DragStartDistance, 0.001);
    13.  
    14. scroller->setScrollerProperties(prop);
    15.  
    16. scroller->grabGesture(ui_->treeView, QScroller::TouchGesture);
    17. scroller->grabGesture(ui_->treeView, QScroller::LeftMouseButtonGesture);
    To copy to clipboard, switch view to plain text mode 

    Basically when I move by mouse it's work fast but when I use touch screen then its "ultra" fast. Tree contains file model so there is a lot of items and I can move to bottom with single touch move.

    2. Touch events wrong values:

    I want to move widget by touch event. So I do accept touch event on the widget and then on events I do calculate delta and move my widget. It's working fine when using mouse, but when using touch I got big delta.

    Qt Code:
    1. void MainWindow::mousePressEvent(QMouseEvent *e)
    2. {
    3. mPos_ = e->pos();
    4. }
    5.  
    6. void MainWindow::mouseMoveEvent(QMouseEvent *e)
    7. {
    8. if (e->buttons() & Qt::LeftButton && !this->isFullScreen()) {
    9.  
    10. QPoint mP = e->pos() - mPos_;
    11. this->move(mapToParent(mP));
    12. }
    To copy to clipboard, switch view to plain text mode 

    Delta sometimes is 200x100 pix etc. Why? This happens only on touch screen. Also what's strange is that mouse press event is registered twice and what I do is touch screen and slowly move. It's not always but sometimes.

    Any suggestions are more then welcome.

    PS. Tested on Win 8 / Win 8.1 with Qt 5.1.1 and 5.2 with MSVC2010 and MinGW. 32 bit all.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

  2. The following user says thank you to Talei for this useful post:


Similar Threads

  1. QT interfacing with touch screen!!!
    By sanujas in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 5th April 2013, 11:03
  2. Qt Touch Screen Support
    By keyurapatel21 in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 19th October 2011, 18:31
  3. Qt embedded and touch screen
    By webquinty in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 30th June 2011, 17:03
  4. Getting raw touch screen data.
    By mahdi75 in forum Qt Programming
    Replies: 1
    Last Post: 21st March 2011, 08:42
  5. Touch screen
    By rchaitanya in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 19th January 2009, 13:40

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
  •  
Qt is a trademark of The Qt Company.