Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using QT .qrc File with Visual Studio Proj…?
Forum Updated to NodeBB v4.3 + New Features

Using QT .qrc File with Visual Studio Proj…?

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 3 Posters 2.5k 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.
  • A Offline
    A Offline
    AlexanderAlexander
    wrote on last edited by AlexanderAlexander
    #3

    @Christian-Ehrlicher Do I also need to add this to my add_executable in my CMake file (Note: I have Auto RCC on)?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #4

      If you've autorcc on then you don't need the macro: https://cmake.org/cmake/help/latest/manual/cmake-qt.7.html#autorcc

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

      1 Reply Last reply
      2
      • A Offline
        A Offline
        AlexanderAlexander
        wrote on last edited by AlexanderAlexander
        #5

        @Christian-Ehrlicher I have built my proj with my new CMake file, and have added my icons images to the qrc file. Within MSCV2017, my QT Addin seems to be working, and I used it to add the resources to the file. Upon building the proj and opening up the solution, I see a qrc_.cpp file generated, and that my images are "in" it (its very complex to me). The only problem is that when I open my UI file with QT Designer, and go to change button icons, nothing is in the resource browser.

        Christian EhrlicherC 1 Reply Last reply
        0
        • A AlexanderAlexander

          @Christian-Ehrlicher I have built my proj with my new CMake file, and have added my icons images to the qrc file. Within MSCV2017, my QT Addin seems to be working, and I used it to add the resources to the file. Upon building the proj and opening up the solution, I see a qrc_.cpp file generated, and that my images are "in" it (its very complex to me). The only problem is that when I open my UI file with QT Designer, and go to change button icons, nothing is in the resource browser.

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

          You have to add the resource file to your ui file in the designer - the designer and cmake are two completely different things which don't know of each other so the designer also can't know that you added a qrc file to CMakeLists.txt

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

          mrjjM 1 Reply Last reply
          3
          • Christian EhrlicherC Christian Ehrlicher

            You have to add the resource file to your ui file in the designer - the designer and cmake are two completely different things which don't know of each other so the designer also can't know that you added a qrc file to CMakeLists.txt

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #7

            @Christian-Ehrlicher
            Hi
            like this
            https://doc.qt.io/qt-5/designer-resources.html
            `?
            Or is it different when from Visual Studio IDE ?

            A 1 Reply Last reply
            0
            • mrjjM mrjj

              @Christian-Ehrlicher
              Hi
              like this
              https://doc.qt.io/qt-5/designer-resources.html
              `?
              Or is it different when from Visual Studio IDE ?

              A Offline
              A Offline
              AlexanderAlexander
              wrote on last edited by AlexanderAlexander
              #8

              @Christian-Ehrlicher To clarify, I am in QT Creator's embedded Design mode. How would I add the resource file from there, the only thing to do with resources that I can open is when I edit the icon property of an item. It just opens up the "Choose Resource" Window, and there is just <resource root>. I cant edit a pathway or add a file...?

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #9

                @AlexanderAlexander said in Using QT .qrc File with Visual Studio Proj…?:

                I am in QT Creator's embedded Design mode

                Previously your said you're using MSVC2017 + Qt Vs Addin and using Qt designer

                Within MSCV2017, my QT Addin seems to be working ... I open my UI file with QT Designer

                In Qt designer you can add a resource file in the resource editor dock widget.

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

                A 1 Reply Last reply
                2
                • Christian EhrlicherC Christian Ehrlicher

                  @AlexanderAlexander said in Using QT .qrc File with Visual Studio Proj…?:

                  I am in QT Creator's embedded Design mode

                  Previously your said you're using MSVC2017 + Qt Vs Addin and using Qt designer

                  Within MSCV2017, my QT Addin seems to be working ... I open my UI file with QT Designer

                  In Qt designer you can add a resource file in the resource editor dock widget.

                  A Offline
                  A Offline
                  AlexanderAlexander
                  wrote on last edited by
                  #10

                  @Christian-Ehrlicher My apologies for the confusion, I always call it that by accident. Do you know how to add a resource file in QT Creator's Designer. I can't find any documentation on how to do so...

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    @AlexanderAlexander said in Using QT .qrc File with Visual Studio Proj…?:

                    Do you know how to add a resource file in QT Creator's Designer

                    No, simply use Qt-Designer, add it there and then it's also available in QtCreator

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

                    A 1 Reply Last reply
                    2
                    • Christian EhrlicherC Christian Ehrlicher

                      @AlexanderAlexander said in Using QT .qrc File with Visual Studio Proj…?:

                      Do you know how to add a resource file in QT Creator's Designer

                      No, simply use Qt-Designer, add it there and then it's also available in QtCreator

                      A Offline
                      A Offline
                      AlexanderAlexander
                      wrote on last edited by
                      #12

                      @Christian-Ehrlicher I can't believe I never thought of doing that. It's finally working now. Thank you so much for the help and sorry about all of my confusion.

                      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