I am trying to display an image on a Push button using the icon property.
Here is the compiled ui file:
pushButton_3
->setObjectName
(QString::fromUtf8("pushButton_3"));
pushButton_3
->setGeometry
(QRect(500,
30,
211,
131));
pushButton_3->setIcon(icon2);
pushButton_3
->setIconSize
(QSize(100,
100));
pushButton_3 = new QPushButton(tab);
pushButton_3->setObjectName(QString::fromUtf8("pushButton_3"));
pushButton_3->setGeometry(QRect(500, 30, 211, 131));
QIcon icon2;
icon2.addFile(QString::fromUtf8("resource/image.jpg"), QSize(), QIcon::Normal, QIcon::Off);
pushButton_3->setIcon(icon2);
pushButton_3->setIconSize(QSize(100, 100));
To copy to clipboard, switch view to plain text mode
The image is displayed inside Qt creator, but the compiled executable does not have the image in the button.
I have also tried creating a resource file and including images to the resource file.
Some help would be great!
Bookmarks