Al2O3
Al2O3

Reputation: 3203

Why isn't QToolButton's icon displayed?

I meet the problem, so I take a test at MainWindow, the problem remains the same. Here is the code in "MainWindow::MainWindow(QWidget *parent)..."

QToolButton* bt = new QToolButton(this);
bt->setIcon(QIcon(":/te.png"));
bt->setToolButtonStyle(Qt::ToolButtonIconOnly);
bt->show();

It looks like: enter image description here

My resource file is like this: enter image description here

Upvotes: 2

Views: 2958

Answers (1)

cmannett85
cmannett85

Reputation: 22346

You have given the icon an alias te but called the icon by it's full name te.png. Use :/te instead.

Upvotes: 4

Related Questions