PDA

View Full Version : QListWidgetItem's icon and text orientation



circass
16th June 2010, 14:30
Hello,
i searched the forum for this problem and tried the solution advices but no one of them worked.
I am trying to set text under the icon in qlistwidgetitem. i tried so many thing but nothing happened.
Is there anyone who is already solved this problem ?
Thank you
Circass

Lykurg
16th June 2010, 15:17
show us your code, what you have tried!

circass
16th June 2010, 15:24
imagePath = createThumbFromLoader(c->getLoader());
QListWidgetItem *i = new QListWidgetItem();
QIcon icon;
icon.addPixmap(QPixmap(QString::fromUtf8(imagePath .toAscii())), QIcon::Normal, QIcon::Off);
i->setIcon(icon);
textWidget = QString("%1\n%2\n%3").arg(c->getLoader()->getID()).arg(c->getLoader()->getSID()).arg(c->getLoader()->getName());
i->setText(textWidget);
i->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
ui.thumbnailWidget->addItem(i);

this is my code.

I tried to set maxwidth and height options manually and they didnt work.
I tried to change viewmode to iconmode and it didnt work to (it changed something but not what i want.)

These are the ways that i tried.
Thank you.
Circass

circass
17th June 2010, 07:03
Any idea about the solution of my problem ?

Lykurg
17th June 2010, 07:45
Your posted code does not say very much... Normally QListView::IconMode is what you are looking for, If it does not what you want, write your own delegate!

circass
17th June 2010, 08:03
Hmm, after you wrote i did try the iconmode again and it worked. I think at first try i gave max size values so it didnt work as i want.
Thank you
Circass