Results 1 to 4 of 4

Thread: QGraphicsRectItem in FullScreen mode, when mouse dragging, blinking

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    315
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanked 53 Times in 51 Posts

    Default Re: QGraphicsRectItem in FullScreen mode, when mouse dragging, blinking

    I guess (you didn't show any code) that when object resizes (boundingRect changes) you forgot to call QGraphicsItem::prepareGeometryChange!

  2. #2
    Join Date
    Jul 2008
    Location
    Munich
    Posts
    73
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3

    Default Re: QGraphicsRectItem in FullScreen mode, when mouse dragging, blinking

    Quote Originally Posted by MarekR22 View Post
    I guess (you didn't show any code) that when object resizes (boundingRect changes) you forgot to call QGraphicsItem::prepareGeometryChange!
    I do call prepareGeometryChange() when I setRect() in child item (QGraphicsRectItem) inside mouseMoveEvent.

    I get some progress. I found, if in resizeEvent of QGraphicsView, code I has the blinking problem, code II doesn't. I am confused why this can cause such effect. resizeEvent is called only once when going to FullScreen mode, and never reached afterwards when I drag the edge of childItem. I can post the code of the resizeEvent:

    code I:

    Qt Code:
    1. void my_graphicsView::resizeEvent(QResizeEvent *event)
    2. {
    3. setWidth(event->size().width());
    4. setHeight(event->size().height());
    5.  
    6. fitInView(QRectF(0,0,width(),height()),Qt::KeepAspectRatioByExpanding);
    7. arrangeNodes();
    8.  
    9. m_scene->setSceneRect(0,0,width(),height());
    10. this->setSceneRect(0,0,width(),height());
    11.  
    12. update();
    13. }
    To copy to clipboard, switch view to plain text mode 

    code II:

    Qt Code:
    1. void my_graphicsView::resizeEvent(QResizeEvent *event)
    2. {
    3. setWidth(event->size().width());
    4. setHeight(event->size().height());
    5.  
    6. fitInView(QRectF(0,0,width(),height()),Qt::KeepAspectRatioByExpanding);
    7. arrangeNodes();
    8.  
    9. m_scene->update(0,0,width(),height());
    10. update();
    11. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by high_flyer; 30th March 2011 at 18:40. Reason: code tags

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: QGraphicsRectItem in FullScreen mode, when mouse dragging, blinking

    I am not sure what the logic of calling QGrphicsViewe::update() is, it will update the whole visible (maybe even the not visible part, I am not sure) scene as well.
    Why not just call updateScene()?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Hover on mouse over while dragging
    By mooreaa in forum Qt Programming
    Replies: 3
    Last Post: 6th February 2010, 10:31
  2. Hiding mac system menu in fullscreen mode
    By jupi32000 in forum Qt Programming
    Replies: 0
    Last Post: 18th November 2009, 19:32
  3. Custom mouse dragging an entire scene?
    By swbluto in forum Qt Programming
    Replies: 1
    Last Post: 26th October 2009, 15:46
  4. Dragging mouse selection in QTableWidget
    By yartov in forum Qt Programming
    Replies: 1
    Last Post: 12th April 2008, 15:03
  5. mode fullScreen
    By ederbs in forum Qt Programming
    Replies: 4
    Last Post: 20th January 2007, 00:42

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.