Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QGuiApplication window icon
Forum Updated to NodeBB v4.3 + New Features

QGuiApplication window icon

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 4.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ODБOïO Offline
    ODБOïO Offline
    ODБOï
    wrote on last edited by
    #1

    I'm trying to change my application icon, i did :

    QGuiApplication::setWindowIcon(QIcon(":/GUI/img/Radiation.png"));
    

    but icon is not changing.
    I also tryed the solution posted by @J-Hilk
    https://forum.qt.io/topic/92233/qml-qwidget-window-icons

    class QuickWindow : public QQuickWindow
    {
    ....
    //mains.cpp
    qmlRegisterType<QuickWindow>("QuickWindow",1,0, "QuickWindow");
    ...
    //main.qml
    QuickWindow {
     ...
        windowIcon: "GUI/img/Radiation.png"
    

    but i still have the default icon.

    Does anyone know hos to fix this ?

    Qt 5.11 Mingw
    Win 7 x64

    Googled : it looks like there is a probleme with w7.

    One solution in Srackoverflow is : https://stackoverflow.com/questions/19587359/qapplicationsetwindowicon-works-on-windows-xp-but-does-not-work-on-windows-7

    • lcreate directory imageformats in application dir,

    • copy qico.dll in it. // Where is this dll ?

    Thx in advance

    J.HilkJ 1 Reply Last reply
    0
    • J.HilkJ J.Hilk

      @LeLev
      Hi,

      let us check some points to remove the most common errors :)

      • Radiation.png is part of your QtRessource file?
      • Did you add Radiation.png later to your ressource file
        • If yes, make sure you run qmake again, or delete the buildfolder, so that the image is compiled into your binary correctly.
      • Did you include QIcon #include <QIcon> in your main.cpp ?
      • the qml ressource path should also start with :/GUI in your example it starts with GUI, typo?
      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #3

      @J.Hilk hi, thanks for reply

      finnaly deleting the buildfolder and using setWindowIcon() worked

       QGuiApplication::setWindowIcon(QIcon(":/GUI/img/Radiation.png"));
      

      thx

      1 Reply Last reply
      0
      • ODБOïO ODБOï

        I'm trying to change my application icon, i did :

        QGuiApplication::setWindowIcon(QIcon(":/GUI/img/Radiation.png"));
        

        but icon is not changing.
        I also tryed the solution posted by @J-Hilk
        https://forum.qt.io/topic/92233/qml-qwidget-window-icons

        class QuickWindow : public QQuickWindow
        {
        ....
        //mains.cpp
        qmlRegisterType<QuickWindow>("QuickWindow",1,0, "QuickWindow");
        ...
        //main.qml
        QuickWindow {
         ...
            windowIcon: "GUI/img/Radiation.png"
        

        but i still have the default icon.

        Does anyone know hos to fix this ?

        Qt 5.11 Mingw
        Win 7 x64

        Googled : it looks like there is a probleme with w7.

        One solution in Srackoverflow is : https://stackoverflow.com/questions/19587359/qapplicationsetwindowicon-works-on-windows-xp-but-does-not-work-on-windows-7

        • lcreate directory imageformats in application dir,

        • copy qico.dll in it. // Where is this dll ?

        Thx in advance

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by J.Hilk
        #2

        @LeLev
        Hi,

        let us check some points to remove the most common errors :)

        • Radiation.png is part of your QtRessource file?
        • Did you add Radiation.png later to your ressource file
          • If yes, make sure you run qmake again, or delete the buildfolder, so that the image is compiled into your binary correctly.
        • Did you include QIcon #include <QIcon> in your main.cpp ?
        • the qml ressource path should also start with :/GUI in your example it starts with GUI, typo?

        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        ODБOïO 1 Reply Last reply
        3
        • J.HilkJ J.Hilk

          @LeLev
          Hi,

          let us check some points to remove the most common errors :)

          • Radiation.png is part of your QtRessource file?
          • Did you add Radiation.png later to your ressource file
            • If yes, make sure you run qmake again, or delete the buildfolder, so that the image is compiled into your binary correctly.
          • Did you include QIcon #include <QIcon> in your main.cpp ?
          • the qml ressource path should also start with :/GUI in your example it starts with GUI, typo?
          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by
          #3

          @J.Hilk hi, thanks for reply

          finnaly deleting the buildfolder and using setWindowIcon() worked

           QGuiApplication::setWindowIcon(QIcon(":/GUI/img/Radiation.png"));
          

          thx

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved