tags:

views:

964

answers:

2

I need to change my Qt application's dock icon (in MacOS X) in run-time according to some conditions.

I've found several recipes on trolltech.com:

  1. QApplication::setIcon()
  2. setApplicationIcon()
  3. qt_mac_set_app_icon()

but none of it works: there is no such methods/functions in Qt 4.5.

How can I change my application's dock icon and what icon formats can I use?

Thank you.

+6  A: 

In Qt 4.5 the methods you are searching for are called

QApplication::setWindowIcon(const QIcon &)

or

QWidget::setWindowIcon(const QIcon &).

You can use every image format for icons that Qt supports (e.g. BMP, GIF, JPG, PNG, TIFF, XPM, ...).

Maybe you want to have a look at Qt's documentation at http://doc.qtsoftware.com/4.5/index.html or use the Qt Assistant.

Hope that helps you.

Elrohir
You're right. I was confused with the phrase "default window icon" in documentation. Thanks!
Michael
A: 

I noticed in my application (using Qt 4.3) that

QApplication::setWindowIcon(const QIcon &)

worked and

QWidget::setWindowIcon(const QIcon &)

didn't work for me.

kyue
Elrohir