Unsolved When should i use a custom layout..?
A Former User last edited by
I want make use of splitters in my application by giving user the ability to resize any widget inside the splitters. Then i found this blog,
Where the author explained how the layout flow works & he also suggested to use a custom layout instead of handling QEvent::layoutRequest(),
The layout management documentation suggests that handling LayoutRequest events in QWidget::event() is an alternative to implementing a custom layout. A potential problem with this is that LayoutRequest events are delivered asynchronously on the next pass through the event loop. If your widget is likely to update its own geometry in response to the LayoutRequest event then this can trigger layout flicker where several passes through the event loop occur before the layout process is fully finished. Each of the intermediate stages will flicker on screen briefly, as the event loop may process a paint event on each pass as well as the layout update, which looks poor. So if you need a custom layout, subclassing QLayout/QLayoutItem is the recommended approach unless you're sure that your widget will always be used as a top-level widget
As we know, Splitter is a container widget & it handles layout itself as it doesn't have a seperate layout. I've a prototype where i noticed that each sub splitter is getting several QEvent::layoutRequest events when it's layout is redone which is what is mentioned in the blog.
So how do i write a custom layout to make my application performant.?
My idea is to have a custom container widget on which i will install my custom layout. Now all my spliiters will be added to this layout but i don't know how efficient this prototype would be.
Any ideas/inputs are greatly appreciated.
Have you ever wrote a custom layout.? If so what was your purpose.?
How can i handle QEvent::layoutRequest efficiently for QSplitter.?
Thanks in advance,
qtProgrammer last edited by
I'm looking for something similar,
any inputs guys.?