I've been attempting a different solution for part of my problem. Perhaps the following can work? To display the same QGraphicsItemGroup on different views with a different background, can I reimplement:
QGraphicsView::drawBackground(QPainter *painter, const QRectF &rect)
I was able to get it to display a background on all the views:
{
painter->drawEllipse(10, 10, 10, 10);
}
void QGraphicsView::drawBackground(QPainter *painter, const QRectF &rect)
{
painter->drawEllipse(10, 10, 10, 10);
}
To copy to clipboard, switch view to plain text mode
However, I need to make it unique for each view. I want something like this:
{
if (this->ui.view1)
painter->drawEllipse(10, 10, 10, 10);
else if (this->ui.view2)
painter->drawEllipse(20, 20, 20, 20);
else if (this->ui.view3)
painter->drawEllipse(30, 30, 30, 30);
}
void QGraphicsView::drawBackground(QPainter *painter, const QRectF &rect)
{
if (this->ui.view1)
painter->drawEllipse(10, 10, 10, 10);
else if (this->ui.view2)
painter->drawEllipse(20, 20, 20, 20);
else if (this->ui.view3)
painter->drawEllipse(30, 30, 30, 30);
}
To copy to clipboard, switch view to plain text mode
However, I can't seem to figure out how to code the if statement to recognize a specific graphics view on my form...any tips? I've tried:
if (this->ui.view1)
if (this->TheForm::ui.view1)
if (this->ui.view1)
if (this->TheForm::ui.view1)
To copy to clipboard, switch view to plain text mode
Bookmarks