utopia500
15th April 2010, 17:53
Hello EveryBody,
I am new to the Qt community and says hello to all of you.
I am trying to build an horizontal QListWidget. This has be done without problem
the problem is with the QListWidetItem objects I want to insert.
These QListWidgetItem contain text and icon and they are presented with the icon left an the text wright.
I'd like to have QListWidgetItem with Icon above and text under the icon
the source code is:
SMListView::SMListView(QWidget *parent) : QWidget(parent)
{
m_listView = new QListWidget(this);
m_listView->setFlow(QListView::LeftToRight);
QListWidgetItem *item1 = new QListWidgetItem(QIcon("_2.BMP"), "elem1", m_listView, QListWidgetItem::UserType);
QListWidgetItem *item2 = new QListWidgetItem(QIcon("_2.BMP"), "elem2", m_listView, QListWidgetItem::UserType);
QListWidgetItem *item3 = new QListWidgetItem(QIcon("_2.BMP"), "elem3", m_listView, QListWidgetItem::UserType);
QListWidgetItem *item4 = new QListWidgetItem(QIcon("_2.BMP"), "elem4", m_listView, QListWidgetItem::UserType);
QListWidgetItem *item5 = new QListWidgetItem(QIcon("_2.BMP"), "elem5", m_listView, QListWidgetItem::UserType);
item1->setTextAlignment(Qt::AlignCenter);
item2->setTextAlignment(Qt::AlignCenter);
item3->setTextAlignment(Qt::AlignCenter);
item4->setTextAlignment(Qt::AlignCenter);
item5->setTextAlignment(Qt::AlignCenter);
}
for example the item1 presentation is icon left and text wright
I'd like to have icon above and the text under the icon
How to do?
I'd thank all developpers that have a solution for me.
Best Regards
I am new to the Qt community and says hello to all of you.
I am trying to build an horizontal QListWidget. This has be done without problem
the problem is with the QListWidetItem objects I want to insert.
These QListWidgetItem contain text and icon and they are presented with the icon left an the text wright.
I'd like to have QListWidgetItem with Icon above and text under the icon
the source code is:
SMListView::SMListView(QWidget *parent) : QWidget(parent)
{
m_listView = new QListWidget(this);
m_listView->setFlow(QListView::LeftToRight);
QListWidgetItem *item1 = new QListWidgetItem(QIcon("_2.BMP"), "elem1", m_listView, QListWidgetItem::UserType);
QListWidgetItem *item2 = new QListWidgetItem(QIcon("_2.BMP"), "elem2", m_listView, QListWidgetItem::UserType);
QListWidgetItem *item3 = new QListWidgetItem(QIcon("_2.BMP"), "elem3", m_listView, QListWidgetItem::UserType);
QListWidgetItem *item4 = new QListWidgetItem(QIcon("_2.BMP"), "elem4", m_listView, QListWidgetItem::UserType);
QListWidgetItem *item5 = new QListWidgetItem(QIcon("_2.BMP"), "elem5", m_listView, QListWidgetItem::UserType);
item1->setTextAlignment(Qt::AlignCenter);
item2->setTextAlignment(Qt::AlignCenter);
item3->setTextAlignment(Qt::AlignCenter);
item4->setTextAlignment(Qt::AlignCenter);
item5->setTextAlignment(Qt::AlignCenter);
}
for example the item1 presentation is icon left and text wright
I'd like to have icon above and the text under the icon
How to do?
I'd thank all developpers that have a solution for me.
Best Regards