Using QList<QGraphicsItem*>
I am using a developer defined QGraphicsScene pointer from the "dialog/mainwindow" class called wavesScene to return a QList of QGraphicsItem*'s using QGraphicsScene::items. Something seems to be wrong with my syntax, it says that the list "graphicsItemList" is never used/declared.
Here is my code, any ideas as to how I would properly implement this methodology
relevant code inside mainwindow/segyView.h
Code:
Constructor code *I think, may be called something different
SEGYView
::SEGYView(QWidget *parent
) ui(new Ui::SEGYView)
{
ui->setupUi(this);
ui->PixmapView->setScene(wavesScene);
}
Code inside slider_value_changed() slot
Code:
QList<QGraphicsItem*> graphicsItemList(wavesScene->items());
QPixmap wavesPixmap
= pixmapItem.
pixmap();
QPixmap wavesPixmapScaled
= wavesPixmap.
scaled((newSliderValue
*INITIAL_WAVES_PIXMAP_X_SIZE
),
1250);
pixmapItem.setPixmap((wavesPixmapScaled));
wavesScene->addItem(&pixmapItem);
relevant code inside actionOpen on triggered() slot
wavesScene->addItem(pixmapGraphicsItem);
ui->PixmapView->setScene(wavesScene);
Error is "graphicsItemList" was not declared in this scope QGraphicsPixmapItem* pixmapItem = graphicsItemList.at(0);
^
Re: Using QList<QGraphicsItem*>
You need to show us your real code, not "relevant" lines you've copied and pasted from who knows where. Copy and paste the full methods where you are getting the errors. Code without context is useless for helping you solve the problem.