Results 1 to 9 of 9

Thread: Speed problem dragging points

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2009
    Posts
    75
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Speed problem dragging points

    I use xubuntu 16.04 with official qt pakages: qt 5.5.1, qwt 6.1.2.
    The hw is an Intel i7 970, nVidia 460, 12gb RAM

    Best regards
    Max

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Speed problem dragging points

    Sounds like a powerful system - all I can imagine, that might explain the video is when your X11 is totally misconfigured.

    Uwe

  3. #3
    Join Date
    May 2009
    Posts
    75
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Speed problem dragging points

    My computer is six years old, not a recent one, but it is still quite powerfull.
    I'll take a look to x11 config. Until now I trust ubuntu to configure automagically X.
    Anyway, the itemeditor example is fast enough also in full screen mode, and zoomed to have bigger items.

    Best regards
    Max

  4. #4
    Join Date
    May 2009
    Posts
    75
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Speed problem dragging points

    I spent some time investigating X11 config, I installed the new nVidia proprietary driver, I have tested the performance with x11perf. Nothing seems wrong. But the event_filter example was still slow.

    So I decide to have a deeper look to itemeditor example to make event_filter use overlay.

    The result is here:
    ev-filt-overlay.tar.gz
    It is definitely improvable, as coding style, as class usage, but it is fast enough also in fullscreen.
    Can I have your opinion about it?

    I also have a question on itemeditor example.

    about eventFilter method in Editor class:
    Qt Code:
    1. bool Editor::eventFilter( QObject* object, QEvent* event )
    2. {
    3. QwtPlot *plot = qobject_cast<QwtPlot *>( parent() );
    4. if ( plot && object == plot->canvas() )
    5. {
    6. switch( event->type() )
    7. {
    8. case QEvent::MouseButtonPress:
    9. {
    10. const QMouseEvent* mouseEvent =
    11. dynamic_cast<QMouseEvent* >( event );
    12.  
    13. if ( d_overlay == NULL &&
    14. mouseEvent->button() == Qt::LeftButton )
    15. {
    16. const bool accepted = pressed( mouseEvent->pos() );
    17. if ( accepted )
    18. {
    19. d_overlay = new Overlay( plot->canvas(), this );
    20.  
    21. d_overlay->updateOverlay();
    22. d_overlay->show();
    23. }
    24. }
    25.  
    26. break;
    27. }
    28. case QEvent::MouseMove:
    29. {
    30. if ( d_overlay )
    31. {
    32. const QMouseEvent* mouseEvent =
    33. dynamic_cast< QMouseEvent* >( event );
    34.  
    35. const bool accepted = moved( mouseEvent->pos() );
    36. if ( accepted )
    37. d_overlay->updateOverlay();
    38. }
    39.  
    40. break;
    41. }
    42. case QEvent::MouseButtonRelease:
    43. {
    44. const QMouseEvent* mouseEvent =
    45. static_cast<QMouseEvent* >( event );
    46.  
    47. if ( d_overlay && mouseEvent->button() == Qt::LeftButton )
    48. {
    49. released( mouseEvent->pos() );
    50.  
    51. delete d_overlay;
    52. d_overlay = NULL;
    53. }
    54.  
    55. break;
    56. }
    57. default:
    58. break;
    59. }
    60.  
    61. return false;
    62. }
    63.  
    64. return QObject::eventFilter( object, event );
    65. }
    To copy to clipboard, switch view to plain text mode 

    For every event in the switch, it return false (line 61). But in the QT documentation about QObject::eventFilter there is:
    In your reimplementation of this function, if you want to filter the event out, i.e. stop it being handled further, return true; otherwise return false.
    In this case why return false instead of true, since the events are handled?

    best regards
    Max

  5. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Speed problem dragging points

    There are 2 differences between what happens in the itemeditor and the event_filter example.

    a) In the itemeditor example the content of the plot remains unchanged. So when the item is dragged the content can be restored from a pixmap cache without having to do a replot.
    b) Depending on the Mask parameter, the pixels written to the graphics stack might be limited to the pixels, that are really changing.

    As the event_filter has almost no content, the effect of a) should be no factor - for heavy plots it would be significant. So in your case I would expect, that b) is what you are suffering from.

    In case of remote desktops it is obvious, that pushing a fullscreen image ( width * height * 4 ) over the network is slower than a smaller one. Here it might be worth to go back to Qt4 ( graphic system native ), what is much faster for vector graphics. But as you are not using a remote desktop it means, that flushing a RGB buffer is a horrible bottleneck - something that will hit you in many other situations as well.

    Uwe

Similar Threads

  1. Replies: 8
    Last Post: 6th December 2019, 17:11
  2. Replies: 4
    Last Post: 8th October 2012, 06:05
  3. QWebkit and dragging problem
    By .:saeed:. in forum Qt Programming
    Replies: 4
    Last Post: 7th October 2012, 13:56
  4. Problem in dragging and move QDockWidget
    By stilgar in forum Qt Programming
    Replies: 1
    Last Post: 18th April 2012, 10:33
  5. QAbstractItemDelegate painting while dragging problem
    By rickbsgu in forum Qt Programming
    Replies: 0
    Last Post: 25th March 2011, 19:35

Tags for this Thread

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.