Problem with SpinBox Alignment
Environment: Mac OS 10.9.5, Windows 7
I'm trying to use right-alignment in a QtSpinBox, but all I see is left-alignment. This happens in Mac and Windows.
If the spin box just has a number in it, the justification changes as you'd expect. But I'm using a suffix, and in that spin box, everything always looks left-justified.
But in Qt Designer (4.8.5), you do see a difference. For example, in Designer:
!http://feigenson.net/ForumUploads/Screen_Capture_2015-01-28_at_11.56.32_AM-left.png(Left justified in Qt Designer)!
!http://feigenson.net/ForumUploads/Screen_Capture_2015-01-28_at_11.56.11_AM-right.png(Right justified in Qt Designer)!
However, in the application, I see this:
!http://feigenson.net/ForumUploads/Screen_Capture_2015-01-28_at_12.01.35_PM-left.png(Left justified in application)!
!http://feigenson.net/ForumUploads/Screen_Capture_2015-01-28_at_12.00.34_PM-right.png(Right justified in application)!
I get the same result on Mac and Windows.
Here's the relevant segment from the .ui file:
@ <widget class="QSpinBox" name="rate_spinBox">
Does this ring any bells with anyone...?
tarod.net last edited by
Maybe it's due to the style used by Qt in Windows or Mac. In Linux works great.
Could you please try to set a motif style? It is a simple test to check if the problem is the style applied by Qt in those operating systems.
Hmmmm.... I just tried to post a reply and it disappeared :(
Short summary: Not sure what you mean, how would you do that?
In the meantime, I tried this (using PyQt4):
where rate_spinBox is the name of the spin box in question. It had no effect.
Rondog last edited by
I tried this on my Mac. I was able to get a right alignment with a spin box (I am using Qt 5.4.0 not 4.8.x).
Your example doesn't look like a standard style from Qt 4.8.x Maybe the problem is related to the style (QStyle) you are using? Something not implemented properly to handle a right aligned spin box?
tarod.net last edited by
Please, try set a different style using the command line when launching the application.
In this page,
You can find more information:
@All Qt programs automatically support the following command line options:
-style= style, sets the application GUI style. Possible values are motif, windows, and platinum. If you compiled Qt with additional styles or have additional styles as plugins these will be available to the -style command line option.
-style style, is the same as listed above.@
Hi Rondog, thanks for your reply...
[quote author="Rondog" date="1422589181"]I tried this on my Mac. I was able to get a right alignment with a spin box (I am using Qt 5.4.0 not 4.8.x).
Your example doesn't look like a standard style from Qt 4.8.x Maybe the problem is related to the style (QStyle) you are using? Something not implemented properly to handle a right aligned spin box?[/quote]
I'm not using any Qstyles. I'm going from Designer (which generates the UI file) which is driven by Python using PyQt4. Though it's occurred to me that it is right-justified, it's just hard to tell with the size of the field. I'll have to play with that.