Shifted text in skins because of hardcoded font properties

Bug #605530 reported by jus
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mixxx
Fix Released
Medium
Unassigned
1.10
Won't Fix
Medium
Unassigned
1.11
Won't Fix
Medium
Unassigned
1.9
Won't Fix
Medium
Unassigned
2.0
Fix Released
Medium
Unassigned

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)

Workaround:
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)
Changed in mixxx:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → RJ Ryan (rryan)
milestone: none → 1.8.0
Revision history for this message
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)
Changed in mixxx:
status: Fix Committed → Fix Released
Revision history for this message
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:
wnumber.cpp
wlabel.cpp

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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.

http://doc.qt.nokia.com/latest/stylesheet-examples.html
"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
Revision history for this message
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)
Changed in mixxx:
milestone: 1.8.0 → none
RJ Skerry-Ryan (rryan)
Changed in mixxx:
assignee: RJ Ryan (rryan) → nobody
Revision history for this message
jus (jus) wrote :

Better late then never, found this interesting bit in http://qt-project.org/forums/viewreply/95684/
"
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:

<NumberBpm>
  <ObjectName>TextBpm</ObjectName>
  <Channel>1</Channel>
  <Size>120f,min</Size>
  <Connection>
    <ConfigKey>[Channel1],visual_bpm</ConfigKey>
  </Connection>
</NumberBpm>

In the external skin.qss

#TextBpm {
  qproperty-alignment: AlignCenter;
}

Also see http://qt-project.org/doc/qt-4.8/qlabel.html#alignment-prop
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

Revision history for this message
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?

Revision history for this message
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)
Changed in mixxx:
status: Fix Committed → Fix Released
Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/5459

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.