Problem with displaying a QPixmap on a QImage
Hello everyone,
i've written the following code:
Code:
img
= new QImage("images/01_greyscale.png");
img_greyscale
->setPixmap
(QPixmap::fromImage(*img
));
img_greyscale->show();
leftLayout->addWidget(text1);
setLayout(leftLayout);
setWindowTitle(tr("Test"));
"img_greyscale" is defined in the header-file.
When starting the program with the "img_greyscale->setPixmap" line no Window pops up, nothing happens at all, not even an error is thrown. But i can't terminate the program so there must be a problem with this line.
What do i do wrong?
The "images" folder lies in the source-folder. The png-image weights only 8kb.
Thanks for your help.
Greetings,
moat
Re: Problem with displaying a QPixmap on a QImage
Where do you define img_greyscale? Are you sure img_greyscale is not 0 at this state?
Re: Problem with displaying a QPixmap on a QImage
When you say "defined in the header-file", do you mean it is declared? Is it initialized as well?
I am guessing img_greyscale has not been initialized (new QLabel) ?
Re: Problem with displaying a QPixmap on a QImage
Damn, thank you very much!
I just didn't initialized the QLabel. Stupid me.. :confused:
Thread can be closed.