Problem with QCheckBox
-
Hi guys, i'm working in a project and i find a problem with the widget QCheckBox
i want to setStyleSheet in the QCheckBox ( color ) and in the same time i want to allign my check in center, but the problem is i can't do this 2 options in the same time ?QCheckBox *check=new QCheckBox(this); check->setStyleSheet("QWidget {background-color:#0000FF;color:white;}"); check->setStyleSheet("margin-left:50%; margin-right:50%;}");this 2 option does not work together, i tried
check->setStyleSheet("QWidget {background-color:#0000FF;color:white;margin-left:50%;margin-right:50%;}");and it didn't work also, can someone help me please ? thanks
-
hi
Seems to work fine for me with
check->setStyleSheet("QWidget {background-color:#0000FF;color:white;margin-left:50%;margin-right:50%;}");
What are you seeing since you say its not working?
-
hi
Seems to work fine for me with
check->setStyleSheet("QWidget {background-color:#0000FF;color:white;margin-left:50%;margin-right:50%;}");
What are you seeing since you say its not working?
-
Hi
butcheck->setStyleSheet("margin-left:50%; margin-right:50%;}");
alone do net center checkmark anyway ?
So is Question how to center checkbox with stylesheet ?
-
Hi
butcheck->setStyleSheet("margin-left:50%; margin-right:50%;}");
alone do net center checkmark anyway ?
So is Question how to center checkbox with stylesheet ?
yeah, i tried to set only color alone , it works
setStyleSheet("QWidget {background-color:#0000FF;color:white};i tried to set in the center alone , it works
setStyleSheet("margin-left:50%; margin-right:50%;}");but when i tried the two options in the same time, only one works (the color) in your exemple
So my is Question how to center checkbox with stylesheet -
yeah, i tried to set only color alone , it works
setStyleSheet("QWidget {background-color:#0000FF;color:white};i tried to set in the center alone , it works
setStyleSheet("margin-left:50%; margin-right:50%;}");but when i tried the two options in the same time, only one works (the color) in your exemple
So my is Question how to center checkbox with stylesheet@Zunneh Hi,
50%doesn't work in stylesheet (except in specific case) so it takes it as50px.
Note also that background is hidden by the margins.@mrjj You could upvote yourslef because you gave me the right way to look https://forum.qt.io/topic/90556/unexpected-behavior-using-percentage-in-stylesheet/2 :)
-
@Zunneh Hi,
50%doesn't work in stylesheet (except in specific case) so it takes it as50px.
Note also that background is hidden by the margins.@mrjj You could upvote yourslef because you gave me the right way to look https://forum.qt.io/topic/90556/unexpected-behavior-using-percentage-in-stylesheet/2 :)