You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Saturday, August 12th 2017, 11:27am

qicon not showing on qpushbutton

this is a very simple example that doesn't work. any guesses why? i have an image called 1.png in the same directory as the source file.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <QApplication>
#include <QPushButton>
#include <QIcon>

int main(int argc, char **argv) {

    QApplication app(argc, argv);

    QPushButton button;

    QIcon icon("1.png");
    button.setIcon(icon);

    button.show();

    return app.exec();
}

Similar threads

Used tags

qicon, QPushButton