Skip to content
Discussion options

You must be logged in to vote

At the moment there is no existing binding around QIcon, once that exists then QApplication and/or QGuiApplication could add setWindowIcon.

As a workaround you could write a C++ method like

void appSetWindowIcon(const QString& path) {
  Q_ASSERT(qGuiApp != nullptr);
  qGuiApp->setWindowIcon(QIcon(path));
}

Then use a normal CXX C++ bridge to use that

...
unsafe extern "C++" {
   include!("path/to/cpp/header.h");
   fn appSetWindowIcon(path: &QString);
}
...

A lot of the time if you are missing things, either it means writing bindings yourself, reusing extern C++Qt blocks where possible, or writing a C++ method that takes simpler types that already have bindings.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by andrej-urvantsev
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants