Icons from system theme
-
Is there any way to use icons from the system theme in a .ui file?
I know how to use QIcon::fromTheme() when I'm writing code in C++ but I need a way to do the same thing in a Qt Designer .ui file. I know I can manually edit the C++ header file that is generated from the .ui file but doing it that way means I'd have to edit the header file whenever I make a change to the .ui file in Qt Designer.
Anyone have any ideas how I can do this?
-
Modifying generated header files is usually not the best idea.
Include that generated header in your c++ file and then set a button's icon -- ui->button->setIcon(...) , would that work out for you?
-
That would work, although it would mean that I couldn't create a window that has any buttons with icons just be calling someDialog->show();
-
you could try to set the icons before calling dialog->show()
-
Why can't you do the necessary setup in the dialog's constructor, right after the UI was set up? @dialog->show()@ does work fine that way.
-
yes agreed! dialog constructor is better place to do this :)
-
Good idea, I'll try that
-
See "QTBUG-7777":http://bugreports.qt.nokia.com/browse/QTBUG-7777. It is planned for 4.8
[ Turned URL into a link, tobias ]