[SOLVED] How to get QComboBox arrow width?
-
I mean this:
!http://storage6.static.itmages.ru/i/11/1029/h_1319889058_5951390_a1f85da7d3.png!Is it possible?
I want to add QToolButton just before this arrow. -
getting this size can be achieved by the style, where also QComboBox itself reads it from.
-
I'm misunderstood. Can you give a code example?
Thanks. -
-
Still can't understand :(
-
You need something like:
subclass QCombobox, use "QStyle::subControlRect":http://doc.qt.nokia.com/4.7/qstyle.html#subControlRect
@
MyCombo::foo()
{
QStylre* pStyle = style();
QComboBoxStyleOption opt;
opt.initFrom(this);
QRect rc = pStyle->subControlRect(QStyle::CC_ComboBox, opt, QStyle::SC_ComboBoxArrow, this);
}
@Code just written in the forum, not tested
But take, care, then you overlay the text field.
-
Thanks a lot!
This works for me:
@QStyle *pStyle = style();
QStyleOptionComboBox opt;
opt.initFrom(this);
QRect rc = pStyle->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, this);
qDebug()<<rc.width();@