Hi,
I add thumbanil images to a list widget and display the same in an icon mode along with text. However, due to the aspect ratio of the thumnails , i get the images up and down and not in a uniform line. Could you please help me ? I have attached the image of how it is now and how i want it to be
HOW IT IS NOW
listWidget.png
HOW IT SHOULD LOOK
menu_bg.png
Snippet of how i add the files to the list widget
// list the files in the list widget in the icon mode
for (int i=1; i<imgList.size(); ++i)
{
QString imgPath
= scaledDirPath.
absoluteFilePath(imgList
[i
]);
ui->FilesList->setWordWrap(true);
QString origImageName
= (imgList
[i
].
remove("_scaled", Qt
::CaseSensitive));
item->setTextAlignment(Qt::AlignBottom);
ui->FilesList->setGridSize(grid);
}
// list the files in the list widget in the icon mode
for (int i=1; i<imgList.size(); ++i)
{
QSize grid(150,150);
QString imgPath = scaledDirPath.absoluteFilePath(imgList[i]);
ui->FilesList->setMovement(QListWidget::Static);
ui->FilesList->setViewMode(QListWidget::IconMode);
ui->FilesList->setWordWrap(true);
QString origImageName = (imgList[i].remove("_scaled", Qt::CaseSensitive));
QListWidgetItem *item = new QListWidgetItem(QIcon(imgPath),origImageName);
item->setTextAlignment(Qt::AlignBottom);
ui->FilesList->setGridSize(grid);
ui->FilesList->addItem(new QListWidgetItem(QIcon(imgPath),origImageName));
}
To copy to clipboard, switch view to plain text mode
Any help is appreciated
Thanks
Gayathri
Bookmarks