Solved Regarding QmessageBox ok and cancel button after adding widgets
-
Hi,
I am using QMessageBox , i want to add combobox and label, then display default messagebox button,
but what is happenening is after displaying buttons, then the combobox and label are appearing.,QLabel label; label.setText("Label"); QComboBox comboBox; comboBox.addItem("text 1"); comboBox.addItem("text 2"); QMessageBox msgbox; QLayout *l = msgbox.layout(); msgbox.layout()->addWidget(&label); msgbox.layout()->addWidget(&comboBox); msgbox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgbox.exec();
How can achieve ,
Thanks, -
QMessageBox is not designed to provide combobox.
It is possible to hack it, but then you will have to check that your solution works on every version of Qt.
Subclass QDialog and do there what you want. -