Hi
i am bulding an application that needs to put image thumbnails in QHBoxLayout
i creant new widget and put image on it and add it to layout
this is OK
the Q? is i need to remove this widget from lay out in run time ..HOW?
i used
Layout->removeItem()
Layout->removeItem()
To copy to clipboard, switch view to plain text mode
but it dosent work
this is my code snippist to add layout RUN OK
m_thumbnailsWidgetHLayout
= new QHBoxLayout(ui.
thumbnailsScrollAreaWidgetContents);
ThumbnailWidget* thumb = new ThumbnailWidget;
QPixmap scaled
= pixmap.
scaled(ThumbnailWidget
::THUMBNAIL_SIZE,
ThumbnailWidget::THUMBNAIL_SIZE,
Qt::KeepAspectRatioByExpanding,
Qt::FastTransformation);
thumb->setPixmap(scaled);
thumb->setThumbnailIndex(key);
m_thumbnailsWidgetHLayout->addWidget(thumb);
m_thumbnailsWidgetHLayout = new QHBoxLayout(ui.thumbnailsScrollAreaWidgetContents);
ThumbnailWidget* thumb = new ThumbnailWidget;
QPixmap scaled = pixmap.scaled(ThumbnailWidget::THUMBNAIL_SIZE,
ThumbnailWidget::THUMBNAIL_SIZE,
Qt::KeepAspectRatioByExpanding,
Qt::FastTransformation);
thumb->setPixmap(scaled);
thumb->setThumbnailIndex(key);
m_thumbnailsWidgetHLayout->addWidget(thumb);
To copy to clipboard, switch view to plain text mode
and this is the code of removing widgets NOT RUN OK
for (int i = 0; i < m_thumbnailsWidgetHLayout->count(); i++) {
m_thumbnailsWidgetHLayout->removeItem(m_thumbnailsWidgetHLayout->itemAt(i));
}
for (int i = 0; i < m_thumbnailsWidgetHLayout->count(); i++) {
m_thumbnailsWidgetHLayout->removeItem(m_thumbnailsWidgetHLayout->itemAt(i));
}
To copy to clipboard, switch view to plain text mode
thanks
Bookmarks