The problem is in lines:
page2->setPixmap(QPixmap("1.png"));
page2->setText("Alpha version 1.0");
QLabel can't have both text and Pixmap options, so, when you setText, QPixmap is removed. To avoid this, you can create new QWidget for second tab of your QTabWidget, add there 2 QLabels, with 1, that have text and second - pixmap.
UPDATE:
if after removing page2->setText("Alpha version 1.0");
QPixmap still is not present, try to find out, if there even exist file "1.png". Try this out, to determine, if file exists and it where you expect it to be
qDebug()<<"File exists -"<<QFileInfo("1.png").exists()<<" "<<QFileInfo("1.png").absoluteFilePath();
UPDATE2:
When you launch it from QtCreator (compile it), your file should be in your project directory (near *.pro file), when you launch it from executable, it should be near it, if you invoke it like "1.png". By the way, if you change your currentWorkingDirectory
- then next problems will arise. The solution is to add qt recource file to project and add this image to recource and call it like QPixmap(:/1.png");
. But for now, you can find the required directory with QDir::currentPath()
, put your file there.