You are not logged in.

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