6

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.

1 Answer 1

10

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.

1
  • You're right. I was confused with the phrase "default window icon" in documentation. Thanks!
    – Michael
    Jun 11, 2009 at 18:21

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.