c++ - custom painting over QGraphicsView -
i want put text information scene on qgraphicsview
.
so i've inherited qgraphicsview
i've overrided paintevent
, drawings there.
it seemd fine i've realized drawings being updated when there item moving near them. comes mind there clipping, cannot find set , how can obey it.
my painting routine:
void objectsview::paintevent(qpaintevent* event) { qgraphicsview::paintevent(event); const int fps = m_controller->fps(); const qstring info = qstring(tr("information simulation: fps: %1")) .arg(fps); qpainter painter(viewport()); const qrect inforect = painter.boundingrect(qrect(), 0, info); painter.setpen(qt::black); painter.drawtext(inforect.bottomleft(), info); painter.drawline(qpoint(), viewport()->rect().bottomright()); }