Results 1 to 3 of 3

Thread: atomicy in gui draws

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    371
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default atomicy in gui draws

    Hi,

    I have faced a problem on my mdi library, which I cannot fully understand. The problem is that when you move the focus from one tab to another, and both contain the same type of toolbars, the toolbars flick a lot (see how it's done on KDE for example).

    What happens when you move the focus to a tab is:
    Qt Code:
    1. QToolBar* qmdiActionGroup::updateToolBar( QToolBar *toolbar )
    2. {
    3. if (!toolbar)
    4. toolbar = new QToolBar( name );
    5.  
    6. toolbar->clear();
    7. int i = 0;
    8. foreach( QObject *o, actionGroupItems )
    9. {
    10. QAction *a = qobject_cast<QAction*> (o);
    11. if (a)
    12. toolbar->addAction( a );
    13. else
    14. {
    15. QWidget *w = qobject_cast<QWidget*> (o);
    16. if (w)
    17. {
    18. toolbar->addWidget( w );
    19. w->setVisible(true);
    20. }
    21. }
    22.  
    23. i++;
    24. }
    25.  
    26. if (actionGroupItems.count() == 0)
    27. toolbar->hide();
    28. else
    29. toolbar->show();
    30.  
    31. return toolbar;
    32. }
    To copy to clipboard, switch view to plain text mode 

    As you see, the toolbar will be cleared and populated by the same icons (but different QActions). I tried solving this by adding a toolbar->setUpdatesEnabled() but still I see the flicks. I also tried to lock up the main window, and I still see the flicker.

    Does anyone know some good trick that can help me?

    For details about qmdilib see:
    http://www.qtcentre.org/forum/f-qt-s...-001-2602.html

  2. #2
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: atomicy in gui draws

    I found that some layouts in my ui would still do some weird painting even with updates disabled, until I setVisible(false) on the layouts in addition. You might want to step through the paint source code, if possible.
    Software Engineer



  3. #3
    Join Date
    Jan 2006
    Posts
    371
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: atomicy in gui draws

    Thanks,

    Using setUpdatesEnabled(false) and then hide() does help a lot.

    I am not marking this a "solved" as there are some issues yet. It helps a lot, but I still have problems.

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.