Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946
How to let icon be on the left of the text if I use QListView and QStandardItemModel?
I study some articles to study these model.view and have a test application.
However, no matter what I do, I can not get the result right.
The icons are always on the top of the text instead of the left of text.
So, Could you please teach me how to do that?
QGridLayout * gridLayout = new QGridLayout(this);
mListView = new QListView(this);
gridLayout->addWidget(mListView, 0, 0, 1, 1);
mQStandardItemModel = new QStandardItemModel(this);@
mQStandardItemModel->appendRow(new QStandardItem(QIcon(icon), a[i].at(1)));@
goetz last edited by
Set the view to list mode:
You are the best one!!
Thanks for your help.
I get it done now.
But, I have another question.
This is could I have the text aligned to right side if there is no icon in that row?
andre last edited by
Well, there is always QStandardItem::setTextAlignment() that you could try?
Thanks a lot.
After testing that, I think the ui feeling is not waht I want.
So, I use a fake icon to make the row have "indent" feeling.