Hi all! I'm still surprised by the amount of wise and generous people in these forums
I've got another problem which I could not figure out by myself. I'm using QList as an array of pointers, because I need it to be expansible and contractible and found it was the best way to do it. For what I wanted firstly, it's working just as it should. Got some problems now, though. Showing some code:
header:
...
private:
QList<QGraphicsEllipseItem*> point;
QList<QGraphicsTextItem*> pointLabel;
...
...
private:
QList<QGraphicsEllipseItem*> point;
QList<QGraphicsTextItem*> pointLabel;
...
To copy to clipboard, switch view to plain text mode
source (working part - notice I'm successfully using the list entries as pointers):
void WhiteSpaceView::insertPoint(...)
{
point.last()->setFlags(...);
pointLabel.append(...);
pointLabel.last()->moveBy(...);
insideScene->addItem(point.last());
insideScene->addItem(pointLabel.last());
}
void WhiteSpaceView::insertPoint(...)
{
point.append(new QGraphicsEllipseItem(...));
point.last()->setFlags(...);
pointLabel.append(...);
pointLabel.last()->moveBy(...);
insideScene->addItem(point.last());
insideScene->addItem(pointLabel.last());
}
To copy to clipboard, switch view to plain text mode
source (not working part)
void WhiteSpaceView::setShowLabels()
{
QList<QGraphicsTextItem*>::Iterator i;
for(i=pointLabel.begin();i!=pointLabel.end();++i)
{ i->setVisible(isShowLabels); }
}
void WhiteSpaceView::setShowLabels()
{
QList<QGraphicsTextItem*>::Iterator i;
for(i=pointLabel.begin();i!=pointLabel.end();++i)
{ i->setVisible(isShowLabels); }
}
To copy to clipboard, switch view to plain text mode
error: request for member ‘setVisible’ in ‘* i.QList<T>::iterator:
perator-> [with T = QGraphicsTextItem*]()’, which is of non-class type ‘QGraphicsTextItem*’
I didn't understand this error since I successfully used the entries as pointers in the other part of the code.
Any guesses?
Thank you all in advance!
Bookmarks