PDA

View Full Version : Style size of elements



1111
24th February 2009, 09:40
Hello,

I'm trying to implement custom style for some widgets. I made my own style class, derived from QPlastiqueStyle, that customize widgets. For some widgets I would like to change their size (for instance for ToolBox tab). There is a virtual function sizeFromContents() that should return new element size. However, incoming structure ContentsType (describes widget type) doesn't contain my widget type. Honestly structure quite limited for a number of widgets. :mad:

Does it mean that I cannot change size of ToolBox tabs? In general, does it mean that I can resize only elements from ContentsType structure? If yes is there ant other way to resize toolbox tab?
:confused:

talk2amulya
24th February 2009, 09:42
hv u seen


int QStyle::pixelMetric ( PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) const [pure virtual]

here PixelMetric has many toolbar relative fields, should be helpful to u

1111
24th February 2009, 10:44
here PixelMetric has many toolbar relative fields, should be helpful to u

I have one misprint in my previous post. I would like to resize toolBOX tab, not toolBAR tab.

talk2amulya
24th February 2009, 11:30
u can easily change the size of the tab of a QToolBox widget by calling setGeometry or resize or setFixedSize()..u dont need to create a style for that

1111
24th February 2009, 14:43
I need to make a new style any way. In my case I have a toolbox that has to be in my style with custom view. Unfortunately, when I draw this toolbox via drawControl(), existing area not enough to draw custom toolbox tab. So I would like to extend size of toolbox a little bit, that it can fit my custom view. :)