Hello! Tell QCombobox to put the text in the QCombobox in the center. In Google, the main option is the following:
QComboBox comboBox; comboBox.setEditable(true); comboBox.lineEdit()->setReadOnly(true); comboBox.lineEdit()->setAlignment(Qt::AlignCenter); comboBox.addItem("Nemesis"); comboBox.addItem("Erebus"); comboBox.addItem("Nix"); for (int i = 0 ; i < comboBox.count() ; ++i) { comboBox.setItemData(i, Qt::AlignCenter, Qt::TextAlignmentRole);
but comboBox.lineEdit()->setReadOnly(true); and comboBox.lineEdit()->setAlignment(Qt::AlignCenter); can not be executed because lineEdit () has no such methods. Tell me how to be?
PS Qt 5.6