PDA

View Full Version : alignment in listbox



sk.qt
25th August 2010, 15:07
Hi friends,
I m going to implement aligment in listbox.but der is no direct method do this.so how can i do,please anyone share some idea.
thanks in advance
Thanks
sk

Lykurg
25th August 2010, 15:19
Which version of Qt do you use? Do you mean a QListBox from Qt 3 which is a QListView now or do you talk about QCheckBox?

For QListView/QListWidget see custom delegates in the documentation.

sk.qt
26th August 2010, 06:52
Thanks for reply.here i m using QT 4.so here m making listbox by implementing QAbstractListModel .Here there is no alignment method.should i follow any other approach to acheive.
Thanks
sk

tbscope
26th August 2010, 06:58
If you use a listwidget, you have this option:
http://doc.qt.nokia.com/4.6/qlistwidgetitem.html#setTextAlignment

Lykurg
26th August 2010, 07:38
...and in a not item based model it is Qt::TextAlignmentRole.

sk.qt
26th August 2010, 13:22
Thanks for reply.let me go with ur suggestion.

sk.qt
26th August 2010, 13:30
its sovled now thanks.but the prob is for limited items its ok.if there is huge items then for every item ,have to set the properties like alignment in QListWidgetItem.its tedious process.i think ,i m missing sth.So for this case,what should be.

tbscope
27th August 2010, 05:44
QListWidget is for small lists

If you have hundreds of thousands of items, use a list view.