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. QML / QWidget & Window icons
Forum Updated to NodeBB v4.3 + New Features

QML / QWidget & Window icons

Scheduled Pinned Locked Moved Solved QML and Qt Quick
10 Posts 6 Posters 4.5k Views 2 Watching
  • 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.
  • J Offline
    J Offline
    J.Hilk
    Moderators
    wrote on 3 Jul 2018, 13:33 last edited by
    #1

    Hi everyone,

    I'm looking for the QML equivalent of QWidget::SetWindowIcon and I seem unable to find it in the docu:

    Theres the title property but, one for the icon seems to be missing.

    I can set an Icon by calling
    QApplication::setWindowIcon(); inside the main.cpp
    but, thats global and can't be changed, once exec() is called.

    My last Idea(untested so far) would be, to move from QQmlApplicationEngine to a QQuickView, because that one has a setIcon function, but I would rather not go the way over QWidgets.


    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.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 4 Jul 2018, 06:14 last edited by J.Hilk 7 Apr 2018, 06:18
      #4

      Thanks @SGaist and @GrecKo for your input on this issue.

      I ended up following the tip I found in the mailing list conversation SGaist posted.

      A QML Window is a QQuickWindow which is a subclass of QWindow, so the method you would want to call is QWindow::setIcon(QIcon &). Maybe you can create a subclass of QQuickWindow in C++ ...

      this is also basicaly what GrecKo suggested, I think.

      The fix was surprisingly easy, and I'm surpised that this hasn't been added to the official release yet, the Mailinglist conversation was on Jan 29, 2013 !

      the Custom QQuickWindow

      #ifndef QUICKWINDOW_H
      #define QUICKWINDOW_H
      
      #include <QQuickWindow>
      #include <QIcon>
      
      class QuickWindow : public QQuickWindow
      {
          Q_OBJECT
      
          Q_PROPERTY(QString windowIcon READ windowIcon WRITE setWindowIcon NOTIFY windowIconChanged)
      public:
          explicit QuickWindow(QQuickWindow *parent = nullptr) : QQuickWindow(parent)  {}
      
          const inline QString &windowIcon(){return str;}
          inline void setWindowIcon(const QString &str){
               if(str != m_str){
                   m_str = str;
                   setIcon(QIcon(m_str));
                   emit windowIconChanged();
               }
         }
      
      signals:
          void windowIconChanged();
      
      private:
          QString m_str;
      
      };
      
      #endif // QUICKWINDOW_H
      

      main.cpp

      #include "quickwindow.h"
      
      int main(int argc, char *argv[]){
         ....
         qmlRegisterType<QuickWindow>("QuickWindow",1,0, "QuickWindow");
          
         QQmlApplicationEngine engine;
         engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
         ....
      }
      

      main.qml

      import QuickWindow 1.0
      
      QuickWindow{
          ....
          title: qsTr("MyApp")
          windowIcon: ":/Path/to/image.png"
          ....
      }
      

      and done.

      Thanks for the help guys.


      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.

      N 1 Reply Last reply 16 May 2019, 10:35
      1
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 3 Jul 2018, 14:45 last edited by
        #2

        Hi,

        This interest mailing list thread might be of use.

        It looks like the Window type is missing some APIs.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • G Offline
          G Offline
          GrecKo
          Qt Champions 2018
          wrote on 3 Jul 2018, 16:14 last edited by
          #3

          What I would do:

          Create an attached type for the window with an icon property, effectively calling QWindow::setIcon.
          Usage would be like this:

          ApplicationWindow {
              // ...
              WindowHelper.icon: "qrc:/windowIconFile" 
            // ...
          }
          

          reference: http://doc.qt.io/qt-5/qtqml-cppintegration-definetypes.html#providing-attached-properties

          1 Reply Last reply
          2
          • J Offline
            J Offline
            J.Hilk
            Moderators
            wrote on 4 Jul 2018, 06:14 last edited by J.Hilk 7 Apr 2018, 06:18
            #4

            Thanks @SGaist and @GrecKo for your input on this issue.

            I ended up following the tip I found in the mailing list conversation SGaist posted.

            A QML Window is a QQuickWindow which is a subclass of QWindow, so the method you would want to call is QWindow::setIcon(QIcon &). Maybe you can create a subclass of QQuickWindow in C++ ...

            this is also basicaly what GrecKo suggested, I think.

            The fix was surprisingly easy, and I'm surpised that this hasn't been added to the official release yet, the Mailinglist conversation was on Jan 29, 2013 !

            the Custom QQuickWindow

            #ifndef QUICKWINDOW_H
            #define QUICKWINDOW_H
            
            #include <QQuickWindow>
            #include <QIcon>
            
            class QuickWindow : public QQuickWindow
            {
                Q_OBJECT
            
                Q_PROPERTY(QString windowIcon READ windowIcon WRITE setWindowIcon NOTIFY windowIconChanged)
            public:
                explicit QuickWindow(QQuickWindow *parent = nullptr) : QQuickWindow(parent)  {}
            
                const inline QString &windowIcon(){return str;}
                inline void setWindowIcon(const QString &str){
                     if(str != m_str){
                         m_str = str;
                         setIcon(QIcon(m_str));
                         emit windowIconChanged();
                     }
               }
            
            signals:
                void windowIconChanged();
            
            private:
                QString m_str;
            
            };
            
            #endif // QUICKWINDOW_H
            

            main.cpp

            #include "quickwindow.h"
            
            int main(int argc, char *argv[]){
               ....
               qmlRegisterType<QuickWindow>("QuickWindow",1,0, "QuickWindow");
                
               QQmlApplicationEngine engine;
               engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
               ....
            }
            

            main.qml

            import QuickWindow 1.0
            
            QuickWindow{
                ....
                title: qsTr("MyApp")
                windowIcon: ":/Path/to/image.png"
                ....
            }
            

            and done.

            Thanks for the help guys.


            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.

            N 1 Reply Last reply 16 May 2019, 10:35
            1
            • J J.Hilk
              4 Jul 2018, 06:14

              Thanks @SGaist and @GrecKo for your input on this issue.

              I ended up following the tip I found in the mailing list conversation SGaist posted.

              A QML Window is a QQuickWindow which is a subclass of QWindow, so the method you would want to call is QWindow::setIcon(QIcon &). Maybe you can create a subclass of QQuickWindow in C++ ...

              this is also basicaly what GrecKo suggested, I think.

              The fix was surprisingly easy, and I'm surpised that this hasn't been added to the official release yet, the Mailinglist conversation was on Jan 29, 2013 !

              the Custom QQuickWindow

              #ifndef QUICKWINDOW_H
              #define QUICKWINDOW_H
              
              #include <QQuickWindow>
              #include <QIcon>
              
              class QuickWindow : public QQuickWindow
              {
                  Q_OBJECT
              
                  Q_PROPERTY(QString windowIcon READ windowIcon WRITE setWindowIcon NOTIFY windowIconChanged)
              public:
                  explicit QuickWindow(QQuickWindow *parent = nullptr) : QQuickWindow(parent)  {}
              
                  const inline QString &windowIcon(){return str;}
                  inline void setWindowIcon(const QString &str){
                       if(str != m_str){
                           m_str = str;
                           setIcon(QIcon(m_str));
                           emit windowIconChanged();
                       }
                 }
              
              signals:
                  void windowIconChanged();
              
              private:
                  QString m_str;
              
              };
              
              #endif // QUICKWINDOW_H
              

              main.cpp

              #include "quickwindow.h"
              
              int main(int argc, char *argv[]){
                 ....
                 qmlRegisterType<QuickWindow>("QuickWindow",1,0, "QuickWindow");
                  
                 QQmlApplicationEngine engine;
                 engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
                 ....
              }
              

              main.qml

              import QuickWindow 1.0
              
              QuickWindow{
                  ....
                  title: qsTr("MyApp")
                  windowIcon: ":/Path/to/image.png"
                  ....
              }
              

              and done.

              Thanks for the help guys.

              N Offline
              N Offline
              nightshift
              wrote on 16 May 2019, 10:35 last edited by nightshift
              #5

              @J.Hilk said in QML / QWidget & Window icons:

              const inline QString &windowIcon(){return str;}

              Hi J.Hilk,

              I just wonder that your solution work..
              I got a "str was not declared in this scope for

              const inline QString &windowIcon(){return str;}
              

              May you can give your code a try with the recend Qt-Version and QtCreator 4.9.0?

              Kind regards,

              J-I W.

              Here for reference my system environment:

              {noformat}
              Qt 5.12.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.1 20160406 (Red Hat 5.3.1-6)) on "xcb" 
              OS: Debian GNU/Linux 9 (stretch) [linux version 4.9.0-9-amd64]
              
              Architecture: x86_64; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX
              
              Environment:
                QT_ACCESSIBILITY="1"
                QT_LINUX_ACCESSIBILITY_ALWAYS_ON="1"
                QT_QPA_PLATFORMTHEME="qgnomeplatform"
              
              Features: QT_NO_EXCEPTIONS
              
              Library info:
                PrefixPath: /home/emin/Qt/Tools/QtCreator/lib/Qt
                DocumentationPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/doc
                HeadersPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/include
                LibrariesPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/lib
                LibraryExecutablesPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/libexec
                BinariesPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/bin
                PluginsPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/plugins
                ImportsPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/imports
                Qml2ImportsPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/qml
                ArchDataPath: /home/emin/Qt/Tools/QtCreator/lib/Qt
                DataPath: /home/emin/Qt/Tools/QtCreator/lib/Qt
                TranslationsPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/translations
                ExamplesPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/examples
                TestsPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/tests
                SettingsPath: /home/emin/Qt/Tools/QtCreator/lib/Qt
              
              Standard paths [*...* denote writable entry]:
                DesktopLocation: "Desktop" */home/emin/Schreibtisch*
                DocumentsLocation: "Documents" */home/emin/Dokumente*
                FontsLocation: "Fonts" */home/emin/.local/share/fonts* /home/emin/.fonts
                ApplicationsLocation: "Applications" */home/emin/.local/share/applications* /usr/share/gnome/applications /usr/local/share/applications /usr/share/applications
                MusicLocation: "Music" */home/emin/Musik*
                MoviesLocation: "Movies" */home/emin/Videos*
                PicturesLocation: "Pictures" */home/emin/Bilder*
                TempLocation: "Temporary Directory" */tmp*
                HomeLocation: "Home" */home/emin*
                AppLocalDataLocation: "Application Data" */home/emin/.local/share/QtProject/qtdiag* /usr/share/gnome/QtProject/qtdiag /usr/local/share/QtProject/qtdiag /usr/share/QtProject/qtdiag
                CacheLocation: "Cache" */home/emin/.cache/QtProject/qtdiag*
                GenericDataLocation: "Shared Data" */home/emin/.local/share* /usr/share/gnome /usr/local/share /usr/share
                RuntimeLocation: "Runtime" */run/user/1000*
                ConfigLocation: "Configuration" */home/emin/.config* /etc/xdg
                DownloadLocation: "Download" */home/emin/Downloads*
                GenericCacheLocation: "Shared Cache" */home/emin/.cache*
                GenericConfigLocation: "Shared Configuration" */home/emin/.config* /etc/xdg
                AppDataLocation: "Application Data" */home/emin/.local/share/QtProject/qtdiag* /usr/share/gnome/QtProject/qtdiag /usr/local/share/QtProject/qtdiag /usr/share/QtProject/qtdiag
                AppConfigLocation: "Application Configuration" */home/emin/.config/QtProject/qtdiag* /etc/xdg/QtProject/qtdiag
              
              File selectors (increasing order of precedence):
                de_DE unix linux debian
              
              Network:
                Using "OpenSSL 1.0.1t  3 May 2016", version: 0x1000114f
              
              Platform capabilities: ThreadedPixmaps OpenGL WindowMasks MultipleWindows ForeignWindows NonFullScreenWindows NativeWidgets WindowManagement SyncState RasterGLSurface SwitchableWidgetComposition
              
              Style hints:
                mouseDoubleClickInterval: 400
                mousePressAndHoldInterval: 500
                startDragDistance: 8
                startDragTime: 500
                startDragVelocity: 0
                keyboardInputInterval: 400
                keyboardAutoRepeatRate: 30
                cursorFlashTime: 1200
                showIsFullScreen: 0
                showIsMaximized: 0
                passwordMaskDelay: 0
                passwordMaskCharacter: U+2022
                fontSmoothingGamma: 1.7
                useRtlExtensions: 0
                setFocusOnTouchRelease: 0
                tabFocusBehavior: Qt::TabFocusAllControls 
                singleClickActivation: 0
              
              Additional style hints (QPlatformIntegration):
                ReplayMousePressOutsidePopup: 0
              
              Theme:
                Platforms requested : gtk3,gnome,generic
                          available : gtk3,snap,flatpak,xdgdesktopportal
                Styles requested    : fusion,windows
                       available    : Windows,Fusion
                Icon theme          : hicolor,  from /usr/share/icons
                System font         : "Cantarell" 11
                Native file dialog
                Native color dialog
                Native font dialog
              
              Fonts:
                General font : "Cantarell" 11
                Fixed font   : "monospace" 11
                Title font   : "DejaVu Sans" 12
                Smallest font: "DejaVu Sans" 12
              
              Palette:
                QPalette::WindowText: #ff000000
                QPalette::Button: #ffefefef
                QPalette::Light: #ffffffff
                QPalette::Midlight: #ffcbcbcb
                QPalette::Dark: #ff9f9f9f
                QPalette::Mid: #ffb8b8b8
                QPalette::Text: #ff000000
                QPalette::BrightText: #ffffffff
                QPalette::ButtonText: #ff000000
                QPalette::Base: #ffffffff
                QPalette::Window: #ffefefef
                QPalette::Shadow: #ff767676
                QPalette::Highlight: #ff308cc6
                QPalette::HighlightedText: #ffffffff
                QPalette::Link: #ff0000ff
                QPalette::LinkVisited: #ffff00ff
                QPalette::AlternateBase: #fff7f7f7
                QPalette::NoRole: #ff000000
                QPalette::ToolTipBase: #ffffffdc
                QPalette::ToolTipText: #ff000000
                QPalette::PlaceholderText: #80000000
              
              Screens: 1, High DPI scaling: inactive
              # 0 "VGA-1" Depth: 24 Primary: yes
                Manufacturer: Dell Inc.
                Model: DELL 1908FP-
                Serial number: G316H86A3U1L-
                Geometry: 1280x1024+0+0 Available: 1280x997+0+27
                Physical size: 376x301 mm  Refresh: 60 Hz Power state: 0
                Physical DPI: 86.4681,86.4106 Logical DPI: 96,96 Subpixel_None
                DevicePixelRatio: 1 Pixel density: 1
                Primary orientation: 2 Orientation: 2 Native orientation: 0 OrientationUpdateMask: 0
              
              LibGL Vendor: Intel Open Source Technology Center
              Renderer: Mesa DRI Intel(R) Sandybridge Desktop 
              Version: 3.0 Mesa 13.0.6
              Shading language: 1.30
              Format: Version: 3.0 Profile: 0 Swap behavior: 0 Buffer size (RGB): 8,8,8
              Profile: None (QOpenGLFunctions_3_0)
              
              
              qt.network.ssl: QSslSocket: cannot resolve DTLSv1_2_server_method
              qt.network.ssl: QSslSocket: cannot resolve DTLSv1_2_client_method
              qt.network.ssl: QSslSocket: cannot resolve SSL_CONF_CTX_new
              qt.network.ssl: QSslSocket: cannot resolve SSL_CONF_CTX_free
              qt.network.ssl: QSslSocket: cannot resolve SSL_CONF_CTX_set_ssl_ctx
              qt.network.ssl: QSslSocket: cannot resolve SSL_CONF_CTX_set_flags
              qt.network.ssl: QSslSocket: cannot resolve SSL_CONF_CTX_finish
              qt.network.ssl: QSslSocket: cannot resolve SSL_CONF_cmd
              qt.network.ssl: QSslSocket: cannot resolve SSL_set_alpn_protos
              qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_alpn_select_cb
              qt.network.ssl: QSslSocket: cannot resolve SSL_get0_alpn_selected
              qt.network.ssl: QSslSocket: cannot resolve DTLS_server_method
              qt.network.ssl: QSslSocket: cannot resolve DTLS_client_method
              
              Plugin information:
              
              + Android                           4.9.0
              + AutoTest                          4.9.0
                AutotoolsProjectManager           4.9.0
                BareMetal                         4.9.0
              + Bazaar                            4.9.0
              + Beautifier                        4.9.0
              + BinEditor                         4.9.0
              + Bookmarks                         4.9.0
              + CMakeProjectManager               4.9.0
              + CVS                               4.9.0
              + ClangCodeModel                    4.9.0
                ClangFormat                       4.9.0
              + ClangTools                        4.9.0
              + ClassView                         4.9.0
                ClearCase                         4.9.0
              + CodePaster                        4.9.0
                CompilationDatabaseProjectManager 4.9.0
              + Core                              4.9.0
              + CppEditor                         4.9.0
              + CppTools                          4.9.0
                Cppcheck                          4.9.0
              + Debugger                          4.9.0
              + Designer                          4.9.0
              + DiffEditor                        4.9.0
                EmacsKeys                         4.9.0
              + FakeVim                           4.9.0
              + GLSLEditor                        4.9.0
              + GenericProjectManager             4.9.0
              + Git                               4.9.0
                HelloWorld                        4.9.0
              + Help                              4.9.0
              + ImageViewer                       4.9.0
                Ios                               4.9.0
                LanguageClient                    4.9.0
              + Macros                            4.9.0
              + Mercurial                         4.9.0
              + ModelEditor                       4.9.0
                Nim                               4.9.0
              + PerfProfiler                      4.9.0
                Perforce                          4.9.0
              + ProjectExplorer                   4.9.0
              + PythonEditor                      4.9.0
              + QbsProjectManager                 4.9.0
              + QmakeProjectManager               4.9.0
              + QmlDesigner                       4.9.0
              + QmlJSEditor                       4.9.0
              + QmlJSTools                        4.9.0
              + QmlPreview                        4.9.0
              + QmlProfiler                       4.9.0
              + QmlProjectManager                 4.9.0
              + Qnx                               4.9.0
              + QtSupport                         4.9.0
              + RemoteLinux                       4.9.0
              + ResourceEditor                    4.9.0
              + ScxmlEditor                       4.9.0
                SilverSearcher                    4.9.0
              + Subversion                        4.9.0
              + TaskList                          4.9.0
              + TextEditor                        4.9.0
                Todo                              4.9.0
              + UpdateInfo                        4.9.0
              + Valgrind                          4.9.0
              + VcsBase                           4.9.0
              + Welcome                           4.9.0
                WinRt                             4.9.0
              
              Qt Creator 4.9.0
              Based on Qt 5.12.2 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)
              From revision 7885bc899f
              Built on Apr 12 2019 00:20:28
              
              {noformat}
              
              J 1 Reply Last reply 16 May 2019, 10:39
              0
              • N nightshift
                16 May 2019, 10:35

                @J.Hilk said in QML / QWidget & Window icons:

                const inline QString &windowIcon(){return str;}

                Hi J.Hilk,

                I just wonder that your solution work..
                I got a "str was not declared in this scope for

                const inline QString &windowIcon(){return str;}
                

                May you can give your code a try with the recend Qt-Version and QtCreator 4.9.0?

                Kind regards,

                J-I W.

                Here for reference my system environment:

                {noformat}
                Qt 5.12.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.1 20160406 (Red Hat 5.3.1-6)) on "xcb" 
                OS: Debian GNU/Linux 9 (stretch) [linux version 4.9.0-9-amd64]
                
                Architecture: x86_64; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX
                
                Environment:
                  QT_ACCESSIBILITY="1"
                  QT_LINUX_ACCESSIBILITY_ALWAYS_ON="1"
                  QT_QPA_PLATFORMTHEME="qgnomeplatform"
                
                Features: QT_NO_EXCEPTIONS
                
                Library info:
                  PrefixPath: /home/emin/Qt/Tools/QtCreator/lib/Qt
                  DocumentationPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/doc
                  HeadersPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/include
                  LibrariesPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/lib
                  LibraryExecutablesPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/libexec
                  BinariesPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/bin
                  PluginsPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/plugins
                  ImportsPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/imports
                  Qml2ImportsPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/qml
                  ArchDataPath: /home/emin/Qt/Tools/QtCreator/lib/Qt
                  DataPath: /home/emin/Qt/Tools/QtCreator/lib/Qt
                  TranslationsPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/translations
                  ExamplesPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/examples
                  TestsPath: /home/emin/Qt/Tools/QtCreator/lib/Qt/tests
                  SettingsPath: /home/emin/Qt/Tools/QtCreator/lib/Qt
                
                Standard paths [*...* denote writable entry]:
                  DesktopLocation: "Desktop" */home/emin/Schreibtisch*
                  DocumentsLocation: "Documents" */home/emin/Dokumente*
                  FontsLocation: "Fonts" */home/emin/.local/share/fonts* /home/emin/.fonts
                  ApplicationsLocation: "Applications" */home/emin/.local/share/applications* /usr/share/gnome/applications /usr/local/share/applications /usr/share/applications
                  MusicLocation: "Music" */home/emin/Musik*
                  MoviesLocation: "Movies" */home/emin/Videos*
                  PicturesLocation: "Pictures" */home/emin/Bilder*
                  TempLocation: "Temporary Directory" */tmp*
                  HomeLocation: "Home" */home/emin*
                  AppLocalDataLocation: "Application Data" */home/emin/.local/share/QtProject/qtdiag* /usr/share/gnome/QtProject/qtdiag /usr/local/share/QtProject/qtdiag /usr/share/QtProject/qtdiag
                  CacheLocation: "Cache" */home/emin/.cache/QtProject/qtdiag*
                  GenericDataLocation: "Shared Data" */home/emin/.local/share* /usr/share/gnome /usr/local/share /usr/share
                  RuntimeLocation: "Runtime" */run/user/1000*
                  ConfigLocation: "Configuration" */home/emin/.config* /etc/xdg
                  DownloadLocation: "Download" */home/emin/Downloads*
                  GenericCacheLocation: "Shared Cache" */home/emin/.cache*
                  GenericConfigLocation: "Shared Configuration" */home/emin/.config* /etc/xdg
                  AppDataLocation: "Application Data" */home/emin/.local/share/QtProject/qtdiag* /usr/share/gnome/QtProject/qtdiag /usr/local/share/QtProject/qtdiag /usr/share/QtProject/qtdiag
                  AppConfigLocation: "Application Configuration" */home/emin/.config/QtProject/qtdiag* /etc/xdg/QtProject/qtdiag
                
                File selectors (increasing order of precedence):
                  de_DE unix linux debian
                
                Network:
                  Using "OpenSSL 1.0.1t  3 May 2016", version: 0x1000114f
                
                Platform capabilities: ThreadedPixmaps OpenGL WindowMasks MultipleWindows ForeignWindows NonFullScreenWindows NativeWidgets WindowManagement SyncState RasterGLSurface SwitchableWidgetComposition
                
                Style hints:
                  mouseDoubleClickInterval: 400
                  mousePressAndHoldInterval: 500
                  startDragDistance: 8
                  startDragTime: 500
                  startDragVelocity: 0
                  keyboardInputInterval: 400
                  keyboardAutoRepeatRate: 30
                  cursorFlashTime: 1200
                  showIsFullScreen: 0
                  showIsMaximized: 0
                  passwordMaskDelay: 0
                  passwordMaskCharacter: U+2022
                  fontSmoothingGamma: 1.7
                  useRtlExtensions: 0
                  setFocusOnTouchRelease: 0
                  tabFocusBehavior: Qt::TabFocusAllControls 
                  singleClickActivation: 0
                
                Additional style hints (QPlatformIntegration):
                  ReplayMousePressOutsidePopup: 0
                
                Theme:
                  Platforms requested : gtk3,gnome,generic
                            available : gtk3,snap,flatpak,xdgdesktopportal
                  Styles requested    : fusion,windows
                         available    : Windows,Fusion
                  Icon theme          : hicolor,  from /usr/share/icons
                  System font         : "Cantarell" 11
                  Native file dialog
                  Native color dialog
                  Native font dialog
                
                Fonts:
                  General font : "Cantarell" 11
                  Fixed font   : "monospace" 11
                  Title font   : "DejaVu Sans" 12
                  Smallest font: "DejaVu Sans" 12
                
                Palette:
                  QPalette::WindowText: #ff000000
                  QPalette::Button: #ffefefef
                  QPalette::Light: #ffffffff
                  QPalette::Midlight: #ffcbcbcb
                  QPalette::Dark: #ff9f9f9f
                  QPalette::Mid: #ffb8b8b8
                  QPalette::Text: #ff000000
                  QPalette::BrightText: #ffffffff
                  QPalette::ButtonText: #ff000000
                  QPalette::Base: #ffffffff
                  QPalette::Window: #ffefefef
                  QPalette::Shadow: #ff767676
                  QPalette::Highlight: #ff308cc6
                  QPalette::HighlightedText: #ffffffff
                  QPalette::Link: #ff0000ff
                  QPalette::LinkVisited: #ffff00ff
                  QPalette::AlternateBase: #fff7f7f7
                  QPalette::NoRole: #ff000000
                  QPalette::ToolTipBase: #ffffffdc
                  QPalette::ToolTipText: #ff000000
                  QPalette::PlaceholderText: #80000000
                
                Screens: 1, High DPI scaling: inactive
                # 0 "VGA-1" Depth: 24 Primary: yes
                  Manufacturer: Dell Inc.
                  Model: DELL 1908FP-
                  Serial number: G316H86A3U1L-
                  Geometry: 1280x1024+0+0 Available: 1280x997+0+27
                  Physical size: 376x301 mm  Refresh: 60 Hz Power state: 0
                  Physical DPI: 86.4681,86.4106 Logical DPI: 96,96 Subpixel_None
                  DevicePixelRatio: 1 Pixel density: 1
                  Primary orientation: 2 Orientation: 2 Native orientation: 0 OrientationUpdateMask: 0
                
                LibGL Vendor: Intel Open Source Technology Center
                Renderer: Mesa DRI Intel(R) Sandybridge Desktop 
                Version: 3.0 Mesa 13.0.6
                Shading language: 1.30
                Format: Version: 3.0 Profile: 0 Swap behavior: 0 Buffer size (RGB): 8,8,8
                Profile: None (QOpenGLFunctions_3_0)
                
                
                qt.network.ssl: QSslSocket: cannot resolve DTLSv1_2_server_method
                qt.network.ssl: QSslSocket: cannot resolve DTLSv1_2_client_method
                qt.network.ssl: QSslSocket: cannot resolve SSL_CONF_CTX_new
                qt.network.ssl: QSslSocket: cannot resolve SSL_CONF_CTX_free
                qt.network.ssl: QSslSocket: cannot resolve SSL_CONF_CTX_set_ssl_ctx
                qt.network.ssl: QSslSocket: cannot resolve SSL_CONF_CTX_set_flags
                qt.network.ssl: QSslSocket: cannot resolve SSL_CONF_CTX_finish
                qt.network.ssl: QSslSocket: cannot resolve SSL_CONF_cmd
                qt.network.ssl: QSslSocket: cannot resolve SSL_set_alpn_protos
                qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_alpn_select_cb
                qt.network.ssl: QSslSocket: cannot resolve SSL_get0_alpn_selected
                qt.network.ssl: QSslSocket: cannot resolve DTLS_server_method
                qt.network.ssl: QSslSocket: cannot resolve DTLS_client_method
                
                Plugin information:
                
                + Android                           4.9.0
                + AutoTest                          4.9.0
                  AutotoolsProjectManager           4.9.0
                  BareMetal                         4.9.0
                + Bazaar                            4.9.0
                + Beautifier                        4.9.0
                + BinEditor                         4.9.0
                + Bookmarks                         4.9.0
                + CMakeProjectManager               4.9.0
                + CVS                               4.9.0
                + ClangCodeModel                    4.9.0
                  ClangFormat                       4.9.0
                + ClangTools                        4.9.0
                + ClassView                         4.9.0
                  ClearCase                         4.9.0
                + CodePaster                        4.9.0
                  CompilationDatabaseProjectManager 4.9.0
                + Core                              4.9.0
                + CppEditor                         4.9.0
                + CppTools                          4.9.0
                  Cppcheck                          4.9.0
                + Debugger                          4.9.0
                + Designer                          4.9.0
                + DiffEditor                        4.9.0
                  EmacsKeys                         4.9.0
                + FakeVim                           4.9.0
                + GLSLEditor                        4.9.0
                + GenericProjectManager             4.9.0
                + Git                               4.9.0
                  HelloWorld                        4.9.0
                + Help                              4.9.0
                + ImageViewer                       4.9.0
                  Ios                               4.9.0
                  LanguageClient                    4.9.0
                + Macros                            4.9.0
                + Mercurial                         4.9.0
                + ModelEditor                       4.9.0
                  Nim                               4.9.0
                + PerfProfiler                      4.9.0
                  Perforce                          4.9.0
                + ProjectExplorer                   4.9.0
                + PythonEditor                      4.9.0
                + QbsProjectManager                 4.9.0
                + QmakeProjectManager               4.9.0
                + QmlDesigner                       4.9.0
                + QmlJSEditor                       4.9.0
                + QmlJSTools                        4.9.0
                + QmlPreview                        4.9.0
                + QmlProfiler                       4.9.0
                + QmlProjectManager                 4.9.0
                + Qnx                               4.9.0
                + QtSupport                         4.9.0
                + RemoteLinux                       4.9.0
                + ResourceEditor                    4.9.0
                + ScxmlEditor                       4.9.0
                  SilverSearcher                    4.9.0
                + Subversion                        4.9.0
                + TaskList                          4.9.0
                + TextEditor                        4.9.0
                  Todo                              4.9.0
                + UpdateInfo                        4.9.0
                + Valgrind                          4.9.0
                + VcsBase                           4.9.0
                + Welcome                           4.9.0
                  WinRt                             4.9.0
                
                Qt Creator 4.9.0
                Based on Qt 5.12.2 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)
                From revision 7885bc899f
                Built on Apr 12 2019 00:20:28
                
                {noformat}
                
                J Offline
                J Offline
                J.Hilk
                Moderators
                wrote on 16 May 2019, 10:39 last edited by J.Hilk
                #6

                hi @nightshift and welcome
                that must have been a copy and past error on my side, as windowIcon() should return the member variable m_str
                can't believe, I missed that x)


                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.

                N 1 Reply Last reply 16 May 2019, 10:46
                2
                • G Offline
                  G Offline
                  GrecKo
                  Qt Champions 2018
                  wrote on 16 May 2019, 10:42 last edited by
                  #7

                  This must be a typo. return m_str will work.

                  Note that by using QQuickWindow as a base class, you will lose some of the functionnality of QML Window, and even more of ApplicationWindow.

                  That's why I suggested using an attached object so that it could attach to any arbitrary window without having to subclass one.

                  1 Reply Last reply
                  2
                  • J J.Hilk
                    16 May 2019, 10:39

                    hi @nightshift and welcome
                    that must have been a copy and past error on my side, as windowIcon() should return the member variable m_str
                    can't believe, I missed that x)

                    N Offline
                    N Offline
                    nightshift
                    wrote on 16 May 2019, 10:46 last edited by
                    #8

                    @J.Hilk thanks you for the quick answer. :)
                    It's just the simple things which break the biggest inventions.
                    @GrecKo:
                    Thanks for the Note, if I'am a pure Newbie and currently stumbling around Qt and C++, I don't think it will make a big issue for me, losing some funcionality. :D

                    Have all a nice day!

                    1 Reply Last reply
                    1
                    • JoeCFDJ Offline
                      JoeCFDJ Offline
                      JoeCFD
                      wrote on 29 Sept 2022, 19:59 last edited by JoeCFD
                      #9

                      Today I came cross the same issue as well. Is it a better solution without QuickWindow?
                      After main.qml is loaded:

                          auto root_window = qobject_cast< QQuickWindow * >( m_qmlAppEngine->rootObjects()[ 0 ] );
                          if ( nullptr != root_window ) {
                              root_window->setIcon( QIcon( "***" ) );
                          }
                      

                      this works for me.

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        pourjour
                        wrote on 6 Mar 2023, 22:43 last edited by
                        #10

                        @GrecKo for more information about what @GrecKo mentioned refer to this example:

                        https://doc.qt.io/qt-6/qtqml-referenceexamples-extended-example.html

                        1 Reply Last reply
                        0
                        • A ankou29666 referenced this topic on 21 Sept 2024, 21:43

                        • Login

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