I have a QGraphicsItem element (subclassesed from QGraphicsItem) that has as child a QGraphicsTextItem.
The problem is that the paint(...) method of the QGraphicsItem is called infinitely.
Here is the paint method from my QGraphicsItem element with the QGraphicsTextItem:
void rectangle_element::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget )
{
painter->drawRoundedRect( -10, -10, 80, 40, 5, 5 );
painter->drawStaticText( -10, -10, QStaticText( "some text" ) );
text_item->setPlainText( "more text" );
}
I cannot use setCacheMode with other flag than QGraphicsItem::CacheMode::NoCache.
I'm using Qt 5.6.
UPDATE:
The text_item is a member of the class and it is initialized in the initialization list.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)