How to specify widget coordinates (x, y, width, height) using style sheets?
I know that we can customize the appearance of widgets using style sheets (color, border etc.) but is it possible to specify widget coordinates (x, y, width, height) using style sheets?
I have 5-6 labels. Currently i am using style sheets for the appearance of labels but i have to hard-code the absolute label coordinates. I want to specify those in the style sheet.
Re: How to specify widget coordinates (x, y, width, height) using style sheets?
AFAIK Style Sheets are for styling purposes only, You'll need to use layouts or setPos ,setSize.
Re: How to specify widget coordinates (x, y, width, height) using style sheets?
so this means i can't use style sheets to specify widget coordinates?
Re: How to specify widget coordinates (x, y, width, height) using style sheets?
Sorry I just had a look it to Assistant there are some Properties You might want to look at:
-height
-width
-position
Just have a look at the Qt Style Sheets Reference
Re: How to specify widget coordinates (x, y, width, height) using style sheets?
Quote:
Originally Posted by
Grimlock
Sorry I just had a look it to Assistant there are some Properties You might want to look at:
-height
-width
this ok for a widget, but this works (I mean position) only for sub-controls
Quote:
Originally Posted by
Grimlock
-position
Just have a look at the Qt Style Sheets Reference
so, I'm afraid that there is no possibility to achieve this by using style sheets.
Re: How to specify widget coordinates (x, y, width, height) using style sheets?
Maybe you can use QSettings with *.ini file where you can keep settings and then apply them to labels, if style sheets are not enough.
Re: How to specify widget coordinates (x, y, width, height) using style sheets?
I already went thru the Qt documentation on style sheets and height, width etc. are meant for subcontrols only.
Currently i use a separate file (like .ini) for specifying the position and size of widgets. I was hoping to merge that file into the Qt style sheet but it seems it's not possible to specify position and size of widgets in style sheets.