MuseScore
MuseScore copied to clipboard
Fix #22055: button size changes when button is selected
Resolves: #22055
The size of buttons in the MainToolBar was being determined by the size of the displayed text within them. Since this text size changed when the button was selected (the text becomes bold, thus increasing in size), the button size changed. I have set the button size to always be determined by the Selected Font Size, so size does not change upon selecting the button. A re-centering of the text was also required.
- [x] I signed the CLA
- [x] The title of the PR describes the problem it addresses
- [x] Each commit's message describes its purpose and effects, and references the issue it resolves
- [x] If changes are extensive, there is a sequence of easily reviewable commits
- [x] The code in the PR follows the coding rules
- [x] There are no unnecessary changes
- [x] The code compiles and runs on my machine, preferably after each commit individually
- [] I created a unit test or vtest to verify the changes I made (if applicable)
Note that PageTabButton can also be used in horizontal orientation:
In the horizontal orientation, the text needs to be left-aligned, otherwise the leftmost edges of the different buttons won't line up.
@cbjeukendrup I have updated the code according to the advised changes.
The size used for row width is in fact being automatically (and correctly) calculated as implicitWidth, which is then used on higher levels of the file for any necessary calculations (it already takes into account the calculated textLabel width). As such, I am following your call and removing it from the code, as it is an unnecessary definition
Regarding the vertical menu unalignment, it was something that I had overlooked, and as such have now added a ternary operator to decide wether the alignment will be central or to the left
Finally, to assure I had not missed an important point as I did with the horizontal menus, I ran through the code to check all calls of PageTabButton and assure that the changes made did not, somehow, alter them in an unwanted way.
Approved on my end!
Tested on MacOS 14, Windows 11, Ubuntu 22.04.3. Approved https://github.com/musescore/MuseScore/issues/22055 FIXED
@SirKuzalot One last question, what username did you use on MuseScore.org to sign the CLA?
@cbjeukendrup The account is nicknamed SirKuzalot and the email submitted was the active email for this account: [email protected]
Thanks! Somehow it didn't seem to appear in the list before, but now I see it.