hi friends,
i was trying to load the pixmapItem in a graphicsview using QLinearlayout . its like adding pixmap item with qfuturewatcher
imageScaling = new QFutureWatcher<QImage>(this);
connect(imageScaling, SIGNAL(resultReadyAt(int)), SLOT(showImage(int)));
imageScaling = new QFutureWatcher<QImage>(this);
connect(imageScaling, SIGNAL(resultReadyAt(int)), SLOT(showImage(int)));
To copy to clipboard, switch view to plain text mode
View::setSceneLayout()
{
m_scene->clear();
m_baseLayout = new QGraphicsLinearLayout(Qt::Vertical);
m_baseLayout->setSpacing(8);
m_container = new QGraphicsWidget;
m_container->setLayout(m_baseLayout);
}
View::setSceneLayout()
{
m_scene->clear();
m_baseLayout = new QGraphicsLinearLayout(Qt::Vertical);
m_baseLayout->setSpacing(8);
m_container = new QGraphicsWidget;
m_container->setLayout(m_baseLayout);
}
To copy to clipboard, switch view to plain text mode
void
View
::addItems( QStringList list
) //const QImage image, const QString &fileName){
if (imageScaling->isRunning()) {
imageScaling->cancel();
imageScaling->waitForFinished();
}
m_list = list;
imageScaling->setFuture(QtConcurrent::mapped(list, CheatScaled));
}
void
View::addItems( QStringList list ) //const QImage image, const QString &fileName)
{
if (imageScaling->isRunning()) {
imageScaling->cancel();
imageScaling->waitForFinished();
}
m_list = list;
imageScaling->setFuture(QtConcurrent::mapped(list, CheatScaled));
}
To copy to clipboard, switch view to plain text mode
CheatScaled
( const QString &imageFileName
){
//scaling image
return qimage;
}
QImage
CheatScaled( const QString &imageFileName)
{
//scaling image
return qimage;
}
To copy to clipboard, switch view to plain text mode
void
View::showImage(int num)
{
PixmapItem *pixItem = new PixmapItem(imageScaling->resultAt(num));
m_scene->addItem(pixItem);
m_baseLayout->addItem(pixItem);
}
void
View::showImage(int num)
{
PixmapItem *pixItem = new PixmapItem(imageScaling->resultAt(num));
m_scene->addItem(pixItem);
m_baseLayout->addItem(pixItem);
}
To copy to clipboard, switch view to plain text mode
the image is adding clearly to the graphicsview . but when the image added to the layout it shows a ghost image or a small portion of the loading image in the first item..but only at the loading time .. as it looks like flickering. for every item it adding. it is showing some kind of flickering but after it loads the item it looks normal ..
sorry i cant explain the problem clearly ..
please hep me in avoiding this effect ..
Bookmarks