Hello,
I'm developing an application that displays a default image in a QGraphicsiew (named viewer) when it's executed and displays other image when a button it's clicked but my code doesn't work:
main.cpp
int main(int argc, char *argv[])
{
catiz w;
w.showFullScreen();
return a.exec();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
catiz w;
w.showFullScreen();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
catiz.cpp
...
{
ui->setupUi(this);
scene.addPixmap(pixmap);
ui->viewer->setScene(&scene);
}
...
...
catiz::catiz(QWidget *parent) : QWidget(parent),ui(new Ui::catiz)
{
ui->setupUi(this);
QGraphicsScene scene;
QPixmap pixmap(":/init.jpg");
scene.addPixmap(pixmap);
ui->viewer->setScene(&scene);
}
...
To copy to clipboard, switch view to plain text mode
What could be wrong? I'm using QtCreator.
Best regards.
Bookmarks