How to let icon be on the left of the text if I use QListView and QStandardItemModel?
-
Hi, Sir:
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);
mListView->setEditTriggers(QAbstractItemView::NoEditTriggers);
mListView->setIconSize(QSize(24, 24));
mListView->setResizeMode(QListView::Adjust);
mListView->setSpacing(1);
mListView->setViewMode(QListView::IconMode);
mListView->setFlow(QListView::TopToBottom);
mListView->setWordWrap(true);
mListView->setWrapping(false);
gridLayout->addWidget(mListView, 0, 0, 1, 1);mQStandardItemModel = new QStandardItemModel(this);@@
mQStandardItemModel->appendRow(new QStandardItem(QIcon(icon), a[i].at(1)));@