Results 1 to 2 of 2

Thread: How do disable painting while dragging?

  1. #1
    Join Date
    May 2009
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Question How do disable painting while dragging?

    Hi,

    I'm currently working on a tool that visualizes a map (using Graphics View). Unfortunately, scrolling the map is very slow, as there are lots of Items that have to be repainted.
    I thought that maybe I could avoid this. It's not really necessary to repaint the whole scene while moving around on the map. Perhaps I could take a "screen shot", then scroll around, and only repaint the whole scene with all its items when the mouse button is released.

    Sadly, I don't know how to implement this idea. How do I tell Qt to refrain from repainting too early/often? How can I tell Qt to render the scene to a "background" that is used while dragging and discarded after the mouse button was released?

    Thanks
    Daniel

  2. #2
    Join Date
    May 2009
    Posts
    62
    Thanks
    2
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How do disable painting while dragging?

    I would override QGraphicsView::drawItems and suppress drawing the items when you are dragging:

    Qt Code:
    1. void MyView::drawItems(QPainter* painter, int numItems, QGraphicsItem* items[], const QStyleOptionGraphicsItem options[])
    2. {
    3. if (!dragging)
    4. {
    5. QGraphicsView::drawItems(painter, numItems, items, options);
    6. }
    7. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. How to disable NextButton in QWizard ?
    By litroncn in forum Qt Programming
    Replies: 3
    Last Post: 27th May 2008, 07:05
  2. Slow painting in QGraphicsView
    By JonathanForQT4 in forum Qt Programming
    Replies: 12
    Last Post: 16th July 2007, 09:54

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.