Spinbox StyleSheet Margin create background shift :S
-
Hi,
I add the following stylesheets rules with qtdesigner:
@QWidget{
margin-top: 5px;
}QDoubleSpinBox, QSpinBox {
background : white;
}
@
and I get the following result:
!http://mk1.ti1ca.com/1luwflth.jpg(QSpinbox margin background shift)!the margin shift down the background(by 5pixels) and I don't know why.
It does on QSpinbox and QDoubleSpinBox, but not on QWidget, QLineEdit ...This is a bug ? or I misunderstand something ?
thanks to help :)
-
I've seen this too.
Are you using any layout and if so, can you check whats the top margin value in the layout? -
The point is a different :-)
with
@
QWidget{
margin-top: 5px;
}
@you define a general margin for all widgets, as all widgets are derived from QWidget.
The background of a widget is painted inside the margins, so it will be moved down by 5 pixel.Perhaps a TextEdit (I think the bottom most widget is a text edit) resets this....
-
If I made a rule for my #item only, or QSpinBox, it does the same :/
I'm using QT 4.6.2
-
[quote author="Gerolf" date="1297332205"]
@
QWidget{
margin-top: 5px;
}
@
[/quote]ok to an existing form that i was working on, I just added these 2 spin boxes and the stylesheet. They came up properly. But another graphicsview that was in a different frame ended up with a background offset. How would you explain that since I had not set background for the graphicsview?
-
It does exactly the same with a new frame.
!http://dk9.ti1ca.com/get/141.194.10.62/gui1p48e/form-spinbox.png(form spinbox)!and here is the code:
@#_spin1{
margin-top:5px;
}
#_spin2{
margin-bottom:5px;
}
#_spin3{
margin-left:5px;
}
#_spin4{
margin-right:5px;
}@You can also see a display bug in the down-arrow backgroud texture (kind of backgroud-repeat) .. but i didn't use so big spinbox :D
In my case, my controls are paired label + spinbox in a form layout, so I put a margin on the label and it works.
-
Hi Kytrix,
One workaround would be to use a container (frame) and apply a layout to it. The layout can be set margins. The margins in stylesheet can go. That should probably help ... chk it out.
I think you can log a bug for this "here":http://bugreports.qt.nokia.com -
Yes I have already a Layout, but i don't want to use it margins because I made show/hide on some of my QSpinbox, ands margins stays for hidden widget (not with margin by CSS on widget).
(I can put another layout for each line, but I could not get the same with for all my spinboxs ... theys are in a formlayout with labels)Thanks for the help, my workaround works too :)