On lundi 6 mars 2017 18:34:04 CET D. Michael McIntyre wrote:
> On 03/06/2017 12:01 PM, David Faure wrote:
> > Can you describe what the intended effect is?
> 
> The stylesheet uses different gradients and possibly borders to create a
> different visual effect for those combo boxes.  They sit in a toolbar,
> and they're lighter than their surroundings.  I used the same effect on
> tool buttons elsewhere on the toolbar.

OK, so it's for all comboboxes in a toolbar?
I suggest that ThornStyle tests 
qobject_cast<QToolBar*>(widget->parentWidget()) in the right places then
(when painting comboboxes), and paints things differently when that's the 
case.

If it's not for _all_ comboboxes in the toolbar then we need to flag them 
somehow (object name or better: dynamic property).

> Pinpointing the exact differences between the local stylesheet and the
> sprawling top level master stylesheet is somewhat involved, and I
> haven't taken the time to do that.  It seems like more than QPalette
> could handle.
> 
> On the subject of QPalette, we're supposed to be replacing all the
> occurrences of local stylesheets with QPalette, correct?  

No, only if the stylesheets were just setting colors.
If they were doing more (adding gradients that depend on variable sizes, 
changing spacings, position of subcontrols, etc. etc.) then it should be done 
in ThornStyle.

> I just did
> that in one of the 11 or so places left to tackle, and in the course of
> my reading I found a dozen admonitions from Qt people that stylesheets
> are the "preferred way to go" and QPalette "isn't guaranteed to work."

Can you show me? I can't believe that Qt developers would say that in this day 
and age. Maybe when stylesheets went out and they seemed great, but since 
then, everyone has realized their limitations. I work in a company of 70 Qt 
experts, and none of them would recommend stylesheets ;)

Do I need to remind you of all the "argh it doesn't work, I give up" comments 
I found in the code related to stylesheets? ;-)

> Now that I think about it, I seem to remember replacing a lot of broken
> QPalette stuff with stylesheets quite intentionally.

Yes you had to do that once you started using stylesheets, because they made 
QPalette useless.

QPalette is guaranteed to work, as long as you don't use stylesheets.
That is one of the problem with stylesheets, the fact that they break a 
previously very stable and predictible mechanism like palettes.

> I'll take your word for it that this is the right way to go, but I'm
> curious what all the warnings are about.

Me too, because I would really expect to see the opposite warnings..

Stylesheets and QPalette are mutually exclusive, so yes it's valid to write 
both "don't use palettes, they won't work with your stylesheets"
and "don't use stylesheets, they will break your palettes",
but there's 100 other reasons against stylesheets, so this isn't a fair fight 
between the two where either one would be just as good as the other ;)

Reasons against:
 - the unwanted and uncontrollable propagation that started all this (file 
dialogs)
 - the fact that stylesheets break setPalette and setFont
 - the declarative syntax which makes them impossible to debug: if you write a 
bit of qss and it doesn't work, you can't step into code with a debugger, you 
can only try, try again, try differently, and give up crying (trying to step 
into qstylesheetstyle.cpp would possibly work but still would be pretty hard)
 - the syntax leads to lots of duplication (you can count the number of times 
you repeated the same colors or gradients), harming maintainability
 - you couldn't use qss to redefine some standard icons, so you ended up with 
both a widget style and a stylesheet (which is also a widget style) leading to 
strange interactions (like those filedialogs styled with the windows style, the 
base class for the widget style)

I'm not saying that QPalette can do all this. QStyle can.
QPalette is just a small part of the toolbox, just like QFont.

> The particular example I just converted is code that's notoriously hard
> to reach, so I'm not certain my conversion worked as intended.  I need a
> MIDI file with lyrics in an unusual encoding, to trigger the dialog
> where the user helps Rosegarden decide what encoding to use.  I used to
> have a test file for this, but have no memory of what file that was.  I
> need to try my palette conversion on a more accessible patch of code to
> see if I am making any progress.

OK (or hack the code to bring up the dialog in all cases, for testing ;-)

-- 
David Faure, fa...@kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to