Hi!

Thanks for your replies.

But my Problem is still not solved.

I have changed my strategy a bit:
I am extensively working on a QGraphicsView and Scene, so the idea is to hide all QGraphicsItems in my scene once the computation starts, and to show a Progressbar which is a subclass of QGraphicsItem.

the code looks like that:
Qt Code:
  1. //MainView is derived from QGraphicsView
  2. void MainView::loadBackgroundImage(const QString& filename)
  3. {
  4. // the background item shall always be newly created.
  5. if(this->scene()->items().contains(this->m_background))
  6. this->scene()->removeItem(this->m_background);
  7. delete m_background;
  8.  
  9. //hide all scene items
  10. this->m_scalable_item->setVisible(false);
  11.  
  12. //get the progressbar (derived from QGraphicsItem)
  13. GraphicsProgressBar * g = new GraphicsProgressBar;
  14. this->scene()->addItem(g);
  15. g->setPos(this->sceneRect().center());
  16.  
  17. this->scene()->update();
  18.  
  19. QTimer * timer = new QTimer(this);
  20. connect(timer, SIGNAL(timeout()), g, SLOT(updateProgress()));
  21. timer->start(100);
  22.  
  23. //BackgroundImageItem is derived from QObject, QThread and QGraphicsItem
  24. // start() starts the computation is background-thread
  25. m_background = new BackgroundImageItem(filename);
  26. m_background->start();
  27. qDebug() << "work started";
  28. //the gui thread should wait here until the worker has finished
  29. m_background->wait();
  30. qDebug() << QThread::currentThreadId() << "Waiting done.";
  31.  
  32. // I just add the background item here
  33. this->scene()->addItem(this->m_background);
  34. if(!this->scene()->items().contains(m_scalable_item))
  35. this->scene()->addItem(m_scalable_item);
  36. this->m_scalable_item->setVisible(true);
  37.  
  38. //free all timer resoureces and the progressbar
  39. timer->stop();
  40. timer->disconnect();
  41. g->disconnect();
  42. this->scene()->removeItem(g);
  43. delete g;
  44. delete timer;
  45. }
To copy to clipboard, switch view to plain text mode 
The Progressbar code looks like:
Qt Code:
  1. class GraphicsProgressBar : public QObject, public QGraphicsItem
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6.  
  7. GraphicsProgressBar()
  8. {
  9. setZValue(5);
  10. status = 1;
  11. };
  12.  
  13. inline QRectF boundingRect() const { return QRectF(-66,-21,132,42); };
  14.  
  15. void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
  16. {
  17. qDebug() << "paint";
  18. painter->drawRect(-66,-21,132,42);
  19. if(status >=1)
  20. painter->drawRect(-65,-20,40,40);
  21. if(status >=2)
  22. painter->drawRect(-20,-20,40,40);
  23. if(status >=3)
  24. painter->drawRect(25,-20,40,40);
  25. };
  26.  
  27. public slots:
  28.  
  29. void updateProgress()
  30. {
  31. status = (status+1)%4;
  32. qDebug() << QThread::currentThreadId() << status;
  33. //this->update();
  34. };
  35.  
  36.  
  37. private:
  38. int status;
  39. };
To copy to clipboard, switch view to plain text mode 
The progressbar does not show up.
Also, the hiding
The paint method gets never called!
Also the debugmsg from updateProgress never appears.
It seems that nothing I try to change at the graphicsScene or view has an effect.
Its not even possible to hide all elements.

HELP appreciated!