Originally Posted by
eijnuhs
Update to what I did..
I added
scene()->update()
scene()->update()
To copy to clipboard, switch view to plain text mode
in my QGraphicsItem subclass's timer event method when the item updates its position.
It solves my repainting issue but felt its a crude way, and I will look for other means to do it.
On a side note,
Does anyone know how QGraphicsScene::changed(const QList (QRectf) rect) signal works ?
!
i reload scene by item on this way:
i need only by move elemenst or rotate , resize (paint outside from rect() item)
/* item */
void TextLayer::sceneReload()
{
GraphicsScene *sc;
if (sc = qobject_cast<GraphicsScene *>(scene())) {
sc->clearSelection();
}
}
/* scene */
void GraphicsScene::clearSelection()
{
/* actual rect sceneRect() or view port */
update(sceneRect());
}
/* item */
void TextLayer::sceneReload()
{
GraphicsScene *sc;
if (sc = qobject_cast<GraphicsScene *>(scene())) {
sc->clearSelection();
}
}
/* scene */
void GraphicsScene::clearSelection()
{
QGraphicsScene::clearSelection();
/* actual rect sceneRect() or view port */
update(sceneRect());
}
To copy to clipboard, switch view to plain text mode
or i send a setVisibleArea( const QRectF area ) to scene
void GraphicsScene
::setVisibleArea( const QRectF area
) {
emit MakeVisible(area); /* to GraphicsView */
}
void GraphicsView
::viewDisplay( const QRectF area
) {
/* if scale to big return text no readable */
qreal HHscaled = matx.m11();
if (HHscaled > 5.1) {
return;
}
}
void GraphicsScene::setVisibleArea( const QRectF area )
{
emit MakeVisible(area); /* to GraphicsView */
}
void GraphicsView::viewDisplay( const QRectF area )
{
/* if scale to big return text no readable */
QMatrix matx = matrix();
qreal HHscaled = matx.m11();
if (HHscaled > 5.1) {
return;
}
QGraphicsView::ensureVisible(area);
}
To copy to clipboard, switch view to plain text mode
Bookmarks