Matrix/Notation combo plan of attack

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Matrix/Notation combo plan of attack

D. Michael McIntyre-3
The matrix and notation editors use setStylesheet on a few specific
combo boxes to create a particular effect.  The stylesheet refers to
supporting graphics that are no longer present, so the local style as
currently implemented is broken anyway.

The cheap thing to do is put the graphics back and continue using this
handful of local stylesheets.  I am not sure what the elegant solution
is.  I would benefit from guidance here.
--
D. Michael McIntyre

------------------------------------------------------------------------------
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
[hidden email] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
Reply | Threaded
Open this post in threaded view
|

Re: Matrix/Notation combo plan of attack

David Faure
On lundi 6 mars 2017 17:59:25 CET D. Michael McIntyre wrote:
> The matrix and notation editors use setStylesheet on a few specific
> combo boxes to create a particular effect.  The stylesheet refers to
> supporting graphics that are no longer present, so the local style as
> currently implemented is broken anyway.
>
> The cheap thing to do is put the graphics back and continue using this
> handful of local stylesheets.  I am not sure what the elegant solution
> is.  I would benefit from guidance here.

Can you describe what the intended effect is?

--
David Faure, [hidden email], 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
[hidden email] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
Reply | Threaded
Open this post in threaded view
|

Re: Matrix/Notation combo plan of attack

D. Michael McIntyre-3
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.

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?  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."
Now that I think about it, I seem to remember replacing a lot of broken
QPalette stuff with stylesheets quite intentionally.

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.

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.

--
D. Michael McIntyre

------------------------------------------------------------------------------
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
[hidden email] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
Reply | Threaded
Open this post in threaded view
|

Re: Matrix/Notation combo plan of attack

David Faure
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, [hidden email], 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
[hidden email] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
Reply | Threaded
Open this post in threaded view
|

Re: Matrix/Notation combo plan of attack

D. Michael McIntyre-3
On 03/07/2017 03:40 AM, David Faure wrote:

> 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.

I like that idea.  That should work.

> No, only if the stylesheets were just setting colors.

I should have been more clear.  Yes, I understand what QPalette does,
and it isn't going to replace every local stylesheet.  Thus this discussion.

> Can you show me? I can't believe that Qt developers would say that in this day
> and age.

I can't find the thread I was talking about, but it was probably just
old.  The things they were saying resonated with my perspective from
several years ago, but I don't have any trouble appreciating why
thinking would have changed since then.

Stylesheets seemed like the best thing ever, but what I tried to do with
stylesheets was a complete nightmare.  I was already thinking way back
then that QStyle would be a better way to go, now that I remember.

For another thing, I use some commercial Qt software that has exactly
the same problems with file dialogs and random other problems.  All the
screen caps in the manual for that stuff are done with Windows, and it
really highlights how mangled the Linux version is on KDE5.  I can't
whine to developers who are nice enough to offer their product to the
handful of freaks who want to use Linux, but if that software were open
source I would want to go in and fix that.  I imagine the solution for
them is the same: get rid of stylesheets!

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

Ah yes.  Now I remember.

> QPalette is guaranteed to work, as long as you don't use stylesheets.

No danger of that ever happening again.

You forgot one of the reasons against.  From Qt version to Qt version,
subtle things changed and broke along the way.  What was working was no
longer working.  That is one reason why there were so many layers of hacks.

I deeply appreciate the work you did, and am committed to abolishing the
last remaining stylesheets.  I will finish that work as time allows.
Sadly, this has been an especially horrific week.

--
D. Michael McIntyre

------------------------------------------------------------------------------
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
[hidden email] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel