Hi,
I can't afford to set text or item alignment for the items in the combobox. Is there a way to do this?
King Regards
Hi,
I can't afford to set text or item alignment for the items in the combobox. Is there a way to do this?
King Regards
Qt Code:
for (int i = 0; i < comboBox->count(); ++i) comboBox->setItemData(i, Qt::AlignCenter, Qt::TextAlignmentRole);To copy to clipboard, switch view to plain text mode
J-P Nurmi
Hi,
thanks jpn for your response but it doesn't change the aligment of the item when it is selected. But it worked when the drop down was pressed for the items to be selected.
thanks in advance.
Qt Code:
comboBox->setEditable(true); // force a line edit to be created comboBox->lineEdit()->setAlignment(Qt::AlignCenter); comboBox->lineEdit()->readOnly(true); // make it read-only if you want toTo copy to clipboard, switch view to plain text mode
J-P Nurmi
thanks jpn. it's working with some minor troubles.
Hi,
when I do this, Combobox strangely sets a frame around the lineedit. When I do setEditable(FALSE), after the alignment, alignment crashes.
Bookmarks