QT I want to increase the size of comboBox Down list not the drop- Down icon ?
Solved
General and Desktop
-
@amarism
ok.
you need to subclass for that i think.
https://forum.qt.io/topic/30405/how-to-change-qcombobox-popup-widthAlternatively, you canuse toolbutton and QMenu.
-
@amarism
In what way did it not work for you ?
Seems to work as expected.
class WideComboBox : public QComboBox { Q_OBJECT public: explicit WideComboBox(QWidget *parent = nullptr) : QComboBox(parent) {}; ~WideComboBox() {} public: void showPopup() { this->view()->setMinimumWidth(this->view()->sizeHintForColumn(0)); QComboBox::showPopup(); } };
setting it to 400 ;)
-
Additionally to what @mrjj wrote, you should also be able to set the size of the view via a StyleSheet, a viable option if you don't plan to vary the size all to often
ui->comboBox->setStyleSheet("QComboBox QAbstractItemView {min-width: 400px;}"),