Shifted text in skins because of hardcoded font properties

Bug #605530 reported by jus on 2010-07-14
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Mixxx Trunk "(bzr r2432; built on: Jul 14 2010 ; flags: hifieq vinylcontrol midiscript optimize=1 qdebug)
Tested on Mac OS 10.5 & 10.6

Hardcoded font size and alignment properties in src/widget/wnumber.cpp make skins that uses stylesheet to display some text (playposition / duration ) on the wrong position.

In 1.8 beta1 this was was only visible after a skin change, but this bug has turned permanent ( i believe since the extra rebootMixxxView(); introduced in r2381)

Comment out line 69-74 and 81-84 in wnumber.cpp

Side effect:
Commenting out the said lines would make update for skins currently in trunk necessary. They don`t use Qstyle until now.

Related branches

RJ Skerry-Ryan (rryan) on 2010-07-31
Changed in mixxx:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → RJ Ryan (rryan)
milestone: none → 1.8.0
RJ Skerry-Ryan (rryan) wrote :

Marking fixed, Jus correct me if I'm wrong.

Changed in mixxx:
status: Confirmed → Fix Committed
RJ Skerry-Ryan (rryan) on 2010-10-05
Changed in mixxx:
status: Fix Committed → Fix Released
jus (jus) wrote :

Back from the death, bug still stands in current trunk.

Hardcoded alignments override custom stylesheets. It is not possible to align fonts right/center with stylesheets.
The hardcoded font size is somehow no problem with the stylesheet.

My vote for scrapping alignment & fontsize if there is not a good reason to keep.

Affected files:

RJ Skerry-Ryan (rryan) wrote :

Leaving Alignment and FontSize in to old ancient skins that still have them, but making FontSize not set the size unless it was present in the skin. This should allow you to leave out FontSize and Alignment and the stylesheet should work.

jus (jus) wrote :

Hmm, RJ this is marked as fixed in trunk. Could you please check again?
Either the fix is incomplete or not working properly. Looks like there are still hardcoded alignments left, see lp:661493.

RJ Skerry-Ryan (rryan) wrote :

Looks like this is still broken. Judging from the Qt stylesheet reference, the reason text-align doesn't work is that it isn't supported on anything but QProgressBar and QPushButton, which isn't used in any of Mixxx's widgets.
"This property is currently supported only by QPushButton and QProgressBar."

As far as I can tell, there is no way at all to customize the alignment of text in a QLabel via Qt style sheets.

Changed in mixxx:
status: Fix Released → Triaged
RJ Skerry-Ryan (rryan) wrote :

A potential workaround is to use fixed padding amounts -- e.g. padding-left: 10px; to make the text 10px off from the left.

RJ Skerry-Ryan (rryan) on 2011-11-27
Changed in mixxx:
milestone: 1.8.0 → none
RJ Skerry-Ryan (rryan) on 2012-11-21
Changed in mixxx:
assignee: RJ Ryan (rryan) → nobody
jus (jus) wrote :

Better late then never, found this interesting bit in
You can use style sheets not only to set CSS properties, but also to set QObject properties, given that you prefix them with qproperty- (so for example to set the QLabel::alignment property you will have to use qproperty-alignment) so the engine knows you are referring to a QObject property, not a CSS property.
E.g. In the skin.xml:


In the external skin.qss

#TextBpm {
  qproperty-alignment: AlignCenter;

Also see
Tested with latest Github master.

So at least for 1.12+ we can override the hardcoded values.
I think it is save to drop them at all from /src/widget/wlabel.cpp & /src/widget/wnumber.cpp

RJ Skerry-Ryan (rryan) wrote :

Cool stuff. Looking over WLabel and WNumber -- we don't have any hard-coded alignments. We have code that is only triggered with an <Alignment> tag so you can just not provide the <Alignment> tag. Same goes for <FontSize> -- that's only triggered if that tag is present. Are you seeing hard-coded values that take effect without any special tags?

RJ Skerry-Ryan (rryan) wrote :

Marking fix committed because none of our label widgets have hard-coded font properties anymore! They only trigger on <Alignment> and <FontSize>.

Changed in mixxx:
status: Triaged → Fix Committed
RJ Skerry-Ryan (rryan) on 2015-12-30
Changed in mixxx:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers