Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Icon resource not registering

Icon resource not registering

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
3 Posts 2 Posters 485 Views 1 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.
  • E Offline
    E Offline
    EqiupmentConnected
    wrote on last edited by
    #1

    I'm trying to set the title bar icon for my program using an ico file registered in a qrc file but I can't get it to show up.

    I tried these calls, using the copied file path by right clicking the resource.

    1.PNG

    2.PNG

    In main function,
    app.setWindowIcon(QIcon(":/icon.ico"));
    or
    app.setWindowIcon(QIcon("qrc:/icon.ico"));

    It doesn't show up. This function works if I supply a direct filepath. Maybe I'm missing something in the makefile? It currently has

    qt_add_qml_module(RESOURCES resources.qrc)

    How can I set the window title bar icon using a resource file?

    Christian EhrlicherC 1 Reply Last reply
    0
    • E EqiupmentConnected

      I'm trying to set the title bar icon for my program using an ico file registered in a qrc file but I can't get it to show up.

      I tried these calls, using the copied file path by right clicking the resource.

      1.PNG

      2.PNG

      In main function,
      app.setWindowIcon(QIcon(":/icon.ico"));
      or
      app.setWindowIcon(QIcon("qrc:/icon.ico"));

      It doesn't show up. This function works if I supply a direct filepath. Maybe I'm missing something in the makefile? It currently has

      qt_add_qml_module(RESOURCES resources.qrc)

      How can I set the window title bar icon using a resource file?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @EqiupmentConnected said in Icon resource not registering:

      qt_add_qml_module(RESOURCES resources.qrc)

      Does your qml module really have the name 'RESOURCES' ?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      E 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        @EqiupmentConnected said in Icon resource not registering:

        qt_add_qml_module(RESOURCES resources.qrc)

        Does your qml module really have the name 'RESOURCES' ?

        E Offline
        E Offline
        EqiupmentConnected
        wrote on last edited by
        #3

        @Christian-Ehrlicher No, the full function is:

        qt_add_qml_module(appTM_QML
        URI TM_QML
        VERSION 1.0
        QML_FILES Main.qml
        SOURCES tm.h tm.cpp
        SOURCES database.h database.cpp
        QML_FILES SpreadGraph.qml
        QML_FILES Data_View.qml
        SOURCES serialporthandler.h serialporthandler.cpp
        QML_FILES
        QML_FILES SerialSettings.qml
        QML_FILES GlobalObject.qml
        RESOURCES resources.qrc
        )

        The resources part was auto added by QT creator when I created the qrc file.

        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