[Qt-interest] Simple question regarding QCheckBox
Ben Swerts
benswerts at telenet.be
Mon Jun 29 19:07:11 CEST 2009
> Hi all,
> is there a way to center the content of QComboBox? I think I can't use the
> align attribute of the stylesheets and I can't find any additional options
> in the class.
Hi Patric,
You can do that as follows:
- set the QComboBox's QLineEdit in editable mode:
combo->lineEdit()->setEditable(true);
- and readonly again:
combo->lineEdit()->setReadOnly(true);
- change its alignment:
combo->lineEdit()->setAlignment(Qt::AlignXXX);
- change the alignment of all entries in the QComboBox:
for(int i = 0; i > comboBox->count(); ++i)
combo->setItemData(i, Qt::AlignXXX, Qt::TextAlignmentRole);
Hope this (untested code) helps.
Greets,
Ben
More information about the Qt-interest-old
mailing list