Why so many QStyles

Dominik Haumann dhaumann at kde.org
Sat Oct 4 10:37:02 UTC 2014


On Friday 03 October 2014 00:09:11 Aleix Pol wrote:
> On Thu, Oct 2, 2014 at 10:10 PM, Hugo Pereira Da Costa <hugo.pereira at free.fr
> > wrote:
> > 
> > hi all,
> > 
> > I guess its a question to Qt experts or possibly low level KF5 experts.
> > 
> > When comparing debugging outputs when running app + style against Qt4 and
> > Qt5, I've noticed the following significant difference.
> > In Qt4, as far as I can tell, QStyle was only instanciated one per QApp,
> > and deleted at the end.
> > In Qt5 this seems not to be true anymore and I've seen up to 6 QStyle
> > running concurently for a single Kate Window, increasing to 13 when
> > opening
> > 'open file' dialog, decreasing back to 6 when closing it, etc.
> > Is this a known feature ? Will this stay ?
> > 
> > (I'm running a rather old checkout of Qt-5.4)
> > 
> > If yes, there need to be some design change in Oxygen (as well as in
> > breeze), to use singletons rather than QStyle's QObject's children for
> > many
> > things, with regard for instance caching, configuration, and even possibly
> > even filters, otherwise I foresee quite some overhead ...
> > 
> > Information welcome,
> > 
> > Best regards,
> > 
> > Hugo
> 
> Hi Hugo,
> Thanks for looking into this! :)
> 
> I would recommend to start by adding a breakpoint on the style's
> constructor to see who is calling it. To me it sounds like a bug in Qt, but
> it needs investigation.

Interesting indeed, I'm not aware of any code in Kate that crease an own 
instance of QStyle. I may be wrong, though...

Greetings
Dominik


More information about the Kde-frameworks-devel mailing list