wagmare
11th October 2013, 05:48
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)));
View::setSceneLayout()
{
m_scene->clear();
m_baseLayout = new QGraphicsLinearLayout(Qt::Vertical);
m_baseLayout->setSpacing(8);
m_container = new QGraphicsWidget;
m_container->setLayout(m_baseLayout);
}
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));
}
QImage
CheatScaled( const QString &imageFileName)
{
//scaling image
return qimage;
}
void
View::showImage(int num)
{
PixmapItem *pixItem = new PixmapItem(imageScaling->resultAt(num));
m_scene->addItem(pixItem);
m_baseLayout->addItem(pixItem);
}
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 ..
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)));
View::setSceneLayout()
{
m_scene->clear();
m_baseLayout = new QGraphicsLinearLayout(Qt::Vertical);
m_baseLayout->setSpacing(8);
m_container = new QGraphicsWidget;
m_container->setLayout(m_baseLayout);
}
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));
}
QImage
CheatScaled( const QString &imageFileName)
{
//scaling image
return qimage;
}
void
View::showImage(int num)
{
PixmapItem *pixItem = new PixmapItem(imageScaling->resultAt(num));
m_scene->addItem(pixItem);
m_baseLayout->addItem(pixItem);
}
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 ..