PDA

View Full Version : Aligning a stringlist



impeteperry
22nd May 2006, 17:20
I want to display a QStringList in some form or other. I want each item to be horizontally center aligned.
What is the best widget, among the vast number of widgets, to use for this?
Right now I am using QText Edit and QListWidget to display them, but can't align them in either directly.
If I use added spaces, changing fonts screws it up.
I need to be able to use the "setReadOnly( true/false )" on the listing.

Thanks

wysota
22nd May 2006, 17:45
For QListWidget you can use
setData(Qt::TextAlignmentRole, Qt::AlignHCenter); for each item you want to centre horizontally.