I've got still issue with it
my code looks like this:
first there is a main function where I create ImageViewer instance:
int main(int argc, char *argv[])
{
ImageViewer imageViewer;
imageViewer.show();
return app.exec();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
ImageViewer imageViewer;
imageViewer.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
later on there is a class, where is an QImage object created as public:
class ImageViewer
{
public:
ImageViewer();
....
}
class ImageViewer
{
public:
ImageViewer();
QImage image;
....
}
To copy to clipboard, switch view to plain text mode
and then I've got other class which constructor look like this:
SceneWindow::SceneWindow()
{
...
SceneWindow::SceneWindow()
{
QPixmap pixmap=QPixmap::fromImage(imageViewer->image);
...
To copy to clipboard, switch view to plain text mode
and compiler output is:
scenewindow.cpp: In constructor `SceneWindow::SceneWindow()':
scenewindow.cpp:10: error: `imageViewer' was not declared in this scope
So shortly:
we create instance of object in main(), this object contains an image and we need to use this image in method from another class.
Bookmarks