Tomasz
21st July 2010, 11:55
Hello!
I've got problem with showing icons. I've read code from program where icons were used (on buttons or just somewhere on window). I've wrote code (based on that program):
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
logoLabel = new QLabel(this);
logoLabel->setPixmap(QPixmap(":/images/icon1.png"));
ui->layout->addWidget(logoLabel);
button = new QPushButton;
button->setIcon(QIcon(":/images/icon2.png"));
button->setIconSize(QSize(48, 48));
button->setFixedSize(150, 60);
ui->layout->addWidget(button);
}
but nothing shows. No icons (button is 'empty'). Images are in directory images/ where my source code is. What I'm doing wrong?
thanks in advance
best regards
Tomasz
I've got problem with showing icons. I've read code from program where icons were used (on buttons or just somewhere on window). I've wrote code (based on that program):
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
logoLabel = new QLabel(this);
logoLabel->setPixmap(QPixmap(":/images/icon1.png"));
ui->layout->addWidget(logoLabel);
button = new QPushButton;
button->setIcon(QIcon(":/images/icon2.png"));
button->setIconSize(QSize(48, 48));
button->setFixedSize(150, 60);
ui->layout->addWidget(button);
}
but nothing shows. No icons (button is 'empty'). Images are in directory images/ where my source code is. What I'm doing wrong?
thanks in advance
best regards
Tomasz