QT I want to increase the size of comboBox Down list not the drop- Down icon ?
-
@mrjj when i use one code :-
ui->comboBox->model()->setData(ui->comboBox->model()->index(0, 0), QSize(100, 100), Qt::SizeHintRole);
this one just increase the size icon index size not the down list width.
Also I dont want to show the icon inside the drop list. -
@mrjj said in QT I want to increase the size of comboBox Down list not the drop- Down icon ?:
Just make all items bigger and dropdown also be bigger.
Sorry i am not getting this thing. item bigger and dropdown bigger. But I want only item width bigger
-
@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;}"),