Hi
I am having problems displaying a text string in the top left hand corner of my QGraphicsView widget. When scrolling the text scrolls as well, I would like the text to stay in position at the top left hand corner of the widget.
UpdateDisplay is called when an image is ready for display, this forces the paint event for the QGraphicsView
My code is below, what am I doing wrong?
{
QGraphicsView::paintEvent(event
);
//pass the event to the graphic view ???
painter.
setPen(QColor(Qt
::yellow));
painter.drawText(10, 10, status);
}
o
void CScanWin::UpdateDisplay()
{
q++;
cscanScene->clear();
cscanScene->setSceneRect(img->rect());
cscanScene
->addPixmap
(QPixmap::fromImage(*img
));
viewport()->update();
}
void CScanWin::paintEvent(QPaintEvent *event)
{
QGraphicsView::paintEvent(event); //pass the event to the graphic view ???
QString status = "All Sources available..." + QString::number(q);
QPainter painter(viewport());
painter.setPen(QColor(Qt::yellow));
painter.drawText(10, 10, status);
}
o
void CScanWin::UpdateDisplay()
{
q++;
cscanScene->clear();
cscanScene->setSceneRect(img->rect());
cscanScene->addPixmap(QPixmap::fromImage(*img));
viewport()->update();
}
To copy to clipboard, switch view to plain text mode
Thanks
Bookmarks