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. A Simple Question About Icons Of Window
Qt 6.11 is out! See what's new in the release blog

A Simple Question About Icons Of Window

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 474 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.
  • K Offline
    K Offline
    Kansas
    wrote last edited by Kansas
    #1

    I got a simple question about icons of window. I have asked for AI for several times, but however it didn't give me a proper answer.

    import QtQuick 2.15
    import QtQuick.Window 2.15
    import QtQuick.Controls 2.12
    import QtQuick.Window
    import Qt.labs.platform 1.1 as Platform
    
    
    ApplicationWindow {
        id: mainWindow
        width: Screen.width
        height: Screen.height
        visible: true
        visibility: "FullScreen"
    
        icon: "qrc:/images/msRain.png"
        title: qsTr("NaciroManchurianMsRain")
        flags: Qt.FramelessWindowHint
        color: "transparent"
    
        Component.onCompleted: {
            PetHelper.setWindow(mainWindow);
        }
    
    
    
        Image {
            id: msRain0_1
            source: "qrc:/images/msRain.png"
            Component.onCompleted: {
                var id = PetHelper.autoCreateNewRegion(msRain0_1.source);
                PetHelper.updatePosition(msRain0_1.x, msRain0_1.y, id);
                PetHelper.updateMask();
            }
        }
    
        Platform.SystemTrayIcon {
                id: trayIcon
                visible: true
                icon.source: "qrc:/images/msRain.png"
                tooltip: "我的透明窗口应用"
                menu: Platform.Menu {
                    Platform.MenuItem {
                        text: qsTr("关闭")
                        onTriggered: Qt.quit()
                    }
                }
        }
    }
    

    It says that "Cannot assign to non-existent property 'icon'". But I think ApplicationWindow does have the property "icon" right?

    If you need more files about cpp files or cmake files et cetera, I will instantly offer it.

    There's a few Chinese words, but it won't make a influence on your conprehension. And my English is really bad, hope all of you can forgive me, pardon me.

    jsulmJ 1 Reply Last reply
    0
    • K Kansas

      I got a simple question about icons of window. I have asked for AI for several times, but however it didn't give me a proper answer.

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.12
      import QtQuick.Window
      import Qt.labs.platform 1.1 as Platform
      
      
      ApplicationWindow {
          id: mainWindow
          width: Screen.width
          height: Screen.height
          visible: true
          visibility: "FullScreen"
      
          icon: "qrc:/images/msRain.png"
          title: qsTr("NaciroManchurianMsRain")
          flags: Qt.FramelessWindowHint
          color: "transparent"
      
          Component.onCompleted: {
              PetHelper.setWindow(mainWindow);
          }
      
      
      
          Image {
              id: msRain0_1
              source: "qrc:/images/msRain.png"
              Component.onCompleted: {
                  var id = PetHelper.autoCreateNewRegion(msRain0_1.source);
                  PetHelper.updatePosition(msRain0_1.x, msRain0_1.y, id);
                  PetHelper.updateMask();
              }
          }
      
          Platform.SystemTrayIcon {
                  id: trayIcon
                  visible: true
                  icon.source: "qrc:/images/msRain.png"
                  tooltip: "我的透明窗口应用"
                  menu: Platform.Menu {
                      Platform.MenuItem {
                          text: qsTr("关闭")
                          onTriggered: Qt.quit()
                      }
                  }
          }
      }
      

      It says that "Cannot assign to non-existent property 'icon'". But I think ApplicationWindow does have the property "icon" right?

      If you need more files about cpp files or cmake files et cetera, I will instantly offer it.

      There's a few Chinese words, but it won't make a influence on your conprehension. And my English is really bad, hope all of you can forgive me, pardon me.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote last edited by
      #2

      @Kansas said in A Simple Question About Icons Of Window:

      But I think ApplicationWindow does have the property "icon" right?

      Wrong. See https://doc.qt.io/qt-6/qml-qtquick-controls-applicationwindow.html
      What icons do you mean? The icons in the title bar of the window (close/minimize/maximize)?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Kansas said in A Simple Question About Icons Of Window:

        But I think ApplicationWindow does have the property "icon" right?

        Wrong. See https://doc.qt.io/qt-6/qml-qtquick-controls-applicationwindow.html
        What icons do you mean? The icons in the title bar of the window (close/minimize/maximize)?

        K Offline
        K Offline
        Kansas
        wrote last edited by Kansas
        #3

        @jsulm said in A Simple Question About Icons Of Window:

        @Kansas said in A Simple Question About Icons Of Window:

        But I think ApplicationWindow does have the property "icon" right?

        Wrong. See https://doc.qt.io/qt-6/qml-qtquick-controls-applicationwindow.html
        What icons do you mean? The icons in the title bar of the window (close/minimize/maximize)?

        Oh, I see. Thanks a lot. I specifically mean the icons in the title bar of the window, but I also want to set the icon of the exe.
        I'll search it again carefully. Thank you again.

        1 Reply Last reply
        0
        • K Kansas has marked this topic as solved

        • Login

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