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. QT5 and QT6 projects issues with QWidget and QMainWindow
QtWS25 Last Chance

QT5 and QT6 projects issues with QWidget and QMainWindow

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
18 Posts 5 Posters 1.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.
  • F Offline
    F Offline
    Fikrat
    wrote on 1 Feb 2023, 17:30 last edited by
    #5

    Default installation is ~/Qt which is not located in root. I am using cmake in fact. As well as using qt creator, qt creator is not able to detect it.Actually in this case, should i again mention the path in cmake?

    I need to install qt5 on ubuntu 20.04, not on ubuntu 18.04

    J 1 Reply Last reply 1 Feb 2023, 17:38
    0
    • F Fikrat
      1 Feb 2023, 17:30

      Default installation is ~/Qt which is not located in root. I am using cmake in fact. As well as using qt creator, qt creator is not able to detect it.Actually in this case, should i again mention the path in cmake?

      I need to install qt5 on ubuntu 20.04, not on ubuntu 18.04

      J Offline
      J Offline
      JoeCFD
      wrote on 1 Feb 2023, 17:38 last edited by
      #6

      @Fikrat ~/Qt is user name dependent. It is better to install it under /opt/.
      https://github.com/KDAB/GammaRay/issues/213

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Fikrat
        wrote on 1 Feb 2023, 17:42 last edited by
        #7

        thanks so much i will do the same .In any case, I will let you know

        J 1 Reply Last reply 2 Feb 2023, 06:31
        0
        • F Fikrat
          1 Feb 2023, 17:42

          thanks so much i will do the same .In any case, I will let you know

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 2 Feb 2023, 06:31 last edited by
          #8

          @Fikrat Do you have

          find_package(Qt6 REQUIRED COMPONENTS Widgets)
          target_link_libraries(mytarget PRIVATE Qt6::Widgets)
          

          in your CMakeList.txt file as shown in https://doc.qt.io/qt-6/qwidget.html ?

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

          F 1 Reply Last reply 2 Feb 2023, 08:28
          0
          • J jsulm
            2 Feb 2023, 06:31

            @Fikrat Do you have

            find_package(Qt6 REQUIRED COMPONENTS Widgets)
            target_link_libraries(mytarget PRIVATE Qt6::Widgets)
            

            in your CMakeList.txt file as shown in https://doc.qt.io/qt-6/qwidget.html ?

            F Offline
            F Offline
            Fikrat
            wrote on 2 Feb 2023, 08:28 last edited by Fikrat 2 Feb 2023, 08:28
            #9

            @jsulm I installed qt5 on directory as the following: /opt/Qt

            Accordingly, I opened new widget and I controlled CMakeLists.txt which looks like as shown in the image!Qt Cmake.png

            As you can see, project and its files are highlighed as the white blank as well as include packages in the source files, provided compilation error.

            J 1 Reply Last reply 2 Feb 2023, 08:53
            0
            • F Fikrat
              2 Feb 2023, 08:28

              @jsulm I installed qt5 on directory as the following: /opt/Qt

              Accordingly, I opened new widget and I controlled CMakeLists.txt which looks like as shown in the image!Qt Cmake.png

              As you can see, project and its files are highlighed as the white blank as well as include packages in the source files, provided compilation error.

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 2 Feb 2023, 08:53 last edited by
              #10

              @Fikrat So, did you run CMake?

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

              1 Reply Last reply
              0
              • F Offline
                F Offline
                Fikrat
                wrote on 2 Feb 2023, 09:05 last edited by
                #11

                Dear @jsulm, when I actually build it, but it provided tons of compilation errors as following

                errors.png

                J 1 Reply Last reply 2 Feb 2023, 12:22
                0
                • F Fikrat
                  2 Feb 2023, 09:05

                  Dear @jsulm, when I actually build it, but it provided tons of compilation errors as following

                  errors.png

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 2 Feb 2023, 12:22 last edited by
                  #12

                  @Fikrat said in QT5 and QT6 projects issues with QWidget and QMainWindow:

                  compilation errors

                  It looks rather like errors from code modelling.
                  Did you actually try to build?

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

                  F 1 Reply Last reply 2 Feb 2023, 15:00
                  1
                  • J jsulm
                    2 Feb 2023, 12:22

                    @Fikrat said in QT5 and QT6 projects issues with QWidget and QMainWindow:

                    compilation errors

                    It looks rather like errors from code modelling.
                    Did you actually try to build?

                    F Offline
                    F Offline
                    Fikrat
                    wrote on 2 Feb 2023, 15:00 last edited by
                    #13

                    Dear @jsulm, I tried to build, though, did not provide any successful build operation. This is very strange. I am completely stacked.

                    J J 2 Replies Last reply 2 Feb 2023, 15:03
                    0
                    • F Fikrat
                      2 Feb 2023, 15:00

                      Dear @jsulm, I tried to build, though, did not provide any successful build operation. This is very strange. I am completely stacked.

                      J Offline
                      J Offline
                      JoeCFD
                      wrote on 2 Feb 2023, 15:03 last edited by JoeCFD 2 Feb 2023, 15:05
                      #14

                      @Fikrat show output:
                      which qmake

                      Are you using qtcreator?

                      1 Reply Last reply
                      0
                      • F Fikrat
                        2 Feb 2023, 15:00

                        Dear @jsulm, I tried to build, though, did not provide any successful build operation. This is very strange. I am completely stacked.

                        J Offline
                        J Offline
                        JonB
                        wrote on 2 Feb 2023, 15:06 last edited by
                        #15

                        @Fikrat
                        Show the Build Output errors. The only one that matters is the first one where it can't find <QObject>.

                        I need to install qt5 on ubuntu 20.04, not on ubuntu 18.04

                        You realize that Ubuntu release supplies a pre-built package for Qt5? But not sure why you want both Qt5 & Qt6. Plus Qt5 was designed for qmake rather than cmake.

                        J 1 Reply Last reply 2 Feb 2023, 15:09
                        0
                        • J JonB
                          2 Feb 2023, 15:06

                          @Fikrat
                          Show the Build Output errors. The only one that matters is the first one where it can't find <QObject>.

                          I need to install qt5 on ubuntu 20.04, not on ubuntu 18.04

                          You realize that Ubuntu release supplies a pre-built package for Qt5? But not sure why you want both Qt5 & Qt6. Plus Qt5 was designed for qmake rather than cmake.

                          J Offline
                          J Offline
                          JoeCFD
                          wrote on 2 Feb 2023, 15:09 last edited by
                          #16

                          @JonB I do not see any problem to use cmake for Qt5. I Have both cmake and qmake for Qt5. I guess cmake is preferred for Qt6. But I still test some Qt6 cases with qmake.

                          J 1 Reply Last reply 2 Feb 2023, 18:45
                          0
                          • C Offline
                            C Offline
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on 2 Feb 2023, 17:38 last edited by
                            #17

                            When QtCreator shows files grayed out then the cmake/qmake configure run did not work out and the error was written to the configure output panel - look at it, fix the errors and run again. QtCreator will not do any code model things when the project is not configured correctly.

                            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
                            0
                            • J JoeCFD
                              2 Feb 2023, 15:09

                              @JonB I do not see any problem to use cmake for Qt5. I Have both cmake and qmake for Qt5. I guess cmake is preferred for Qt6. But I still test some Qt6 cases with qmake.

                              J Offline
                              J Offline
                              JonB
                              wrote on 2 Feb 2023, 18:45 last edited by
                              #18

                              @JoeCFD
                              I meant for example all the sample code etc. I have seen out there for Qt5 is for qmake and .pro files. And the OP seems to be getting into some difficulty. But you know more than I in this area.

                              1 Reply Last reply
                              0

                              14/18

                              2 Feb 2023, 15:03

                              • Login

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