PDA

View Full Version : Custom Push Button Size



fruzzo
19th June 2012, 09:39
Hi,
I have a ini file from which I have to load some settings such as widget colors and sizes.
I'm implementing a new qstyle customized according to the settings loaded from the ini file (i.e. I read this file in the new qstyle constructor).
About colors I haven't problems, I read the info from file and set the qpalette properties...instead about widget sizes I have some problems.
QStyle uses qstyleoption subclasses to draw the different widgets, specially about its sizes so how can I set a fixed size for a specific widget through qstyle? For example, if I want to set the size 100x50 fro all the qpushbutton present in my gui, what's the easy way to do this without
using a style sheet?

aamer4yu
19th June 2012, 10:29
Its not a good idea to mix QStyle and stylesheets...
You can read sizes from file and use QWidget::setGeometry or QWidget::resize to set the sizes.

fruzzo
19th June 2012, 14:23
Its not a good idea to mix QStyle and stylesheets...

I'm agree too...but in your opinion, regarding my task, is better using stylesheet or qstyle solution?


You can read sizes from file and use QWidget::setGeometry or QWidget::resize to set the sizes.

Ok but in this way I have to manually set geometry or resize about all widget present in my gui...I want automatically do that in order to unifomize look & feel and size of all my widgest thought a qstyle!