faq
flatforty
contribute
subscribe
configure
search
rdf
main
parent
thread
|
Re: Memory usage..
by jstaniek on Thursday 27/Mar/2008, @02:12
|
"""And the problem is, turning off double buffering in Qt4 globally turns any Qt4 app into a huge flickering mess, with every single widget flickering like crazy, even widgets like menus and toolbars that don't flicker on Qt3 or GTK. So what's the difference? Did Qt3 manually double buffer those widgets?"""
No need to enable/disable double buffering globally. From http://doc.trolltech.com/4.0/qt4-arthur.html#widget-double-buffering:
"Double-buffering is turned on by default, but can be turned off for individual widgets by setting the widget attribute Qt::WA_PaintOnScreen.
unbufferedWidget->setAttribute(Qt::WA_PaintOnScreen);" |
|
|
The Fine Print: The following comments
are owned by whomever posted them.
( Reply )
|
Re: Memory usage..
by Leo S on Thursday 27/Mar/2008, @10:03
|
Yep I've done this before on some special widgets, like one that displays frames from a camera.
However I just did an experiment on an app I'm working on. The biggest memory cost is obviously the main window widget itself. It has a huge double buffering pixmap, and takes the most memory. So what happens if you disable double buffering on just the main widget, but leave it enabled on all others?
Well, on the plus side, there is no added flicker, even if you disable double buffering on the main widget. All the widgets that actually would flicker, like buttons, menus, checkboxes, etc. are still double buffered, so the UI is just as nice as before. And the vast majority of the memory hit is gone. A maximized window takes about 6mb less Xorg memory when I disable double buffering on the main window.
However, there is one downside. Widgets that are transparent now have a grey background instead. So checkboxes have a grey rectangle background instead of letting the default style background show through. This is with the oxygen style.
If you choose the Plastique style instead, then everything looks much better. Because the window background is grey anyway, the fact that checkboxes are not transparent is irrelevant. So in this case you get the 6mb of ram back for basically free. Not really a realistic option for most apps, but hey..
I attached a comparison screenshot of the same app running with double buffering disabled on the main widget, using the oxygen and the plastique style to see the difference.
buffering.png
48KB (49837 bytes)
|
[
Reply To This | View ]
|
Re: Memory usage..
by koos on Thursday 27/Mar/2008, @13:38
|
Sounds like a great idea, since lots of windows are there as a container for other widgets. In my little extra gear project, the main window is completely covered with dock windows.
However with qt4.4 coming soon, there is only one native window and thus one double buffer. Just tried it with trunk and indeed the app looks completely broken with setAttribute(Qt::WA_PaintOnScreen);, docks aren't updated properly neither is the menubar and statusbar.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Leo S on Thursday 27/Mar/2008, @13:57
|
>> However with qt4.4 coming soon, there is only one native window and thus one double buffer.
Are you sure? I think each widget still has its own double buffer. The native window issue is separate.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Anon on Thursday 27/Mar/2008, @14:11
|
Your analysis is correct.
|
[
Reply To This | View ]
|
Re: Memory usage..
by koos on Thursday 27/Mar/2008, @14:38
|
No, just a guess actually. Hmm, I need to figure out why the app is so broken then, maybe paint events aren't passed to child widgets ...
|
[
Reply To This | View ]
|
|
The Fine Print: The previous
comments are owned by whomever posted them.
( Reply )
|
|