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
Forum Updated to NodeBB v4.3 + New Features

QT5 and QT6 projects issues with QWidget and QMainWindow

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
18 Posts 5 Posters 2.0k 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.
  • JoeCFDJ Offline
    JoeCFDJ Offline
    JoeCFD
    wrote on last edited by JoeCFD
    #4

    I guess the default installation dir is /opt/Qt for Qt5 on Ubuntu and therefore qmake path is not available automatically. You have to set qmake path in your shell. If you use qtcreator, it may be able to detect it.

    On 18.04 you might use installed qt which comes with ubuntu distribution.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Fikrat
      wrote on 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

      JoeCFDJ 1 Reply Last reply
      0
      • F Fikrat

        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

        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on 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 last edited by
          #7

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

          jsulmJ 1 Reply Last reply
          0
          • F Fikrat

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

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on 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
            0
            • jsulmJ jsulm

              @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 last edited by Fikrat
              #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.

              jsulmJ 1 Reply Last reply
              0
              • F Fikrat

                @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.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on 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 last edited by
                  #11

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

                  errors.png

                  jsulmJ 1 Reply Last reply
                  0
                  • F Fikrat

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

                    errors.png

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 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
                    1
                    • jsulmJ jsulm

                      @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 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.

                      JoeCFDJ JonBJ 2 Replies Last reply
                      0
                      • F Fikrat

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

                        JoeCFDJ Offline
                        JoeCFDJ Offline
                        JoeCFD
                        wrote on last edited by JoeCFD
                        #14

                        @Fikrat show output:
                        which qmake

                        Are you using qtcreator?

                        1 Reply Last reply
                        0
                        • F Fikrat

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

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on 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.

                          JoeCFDJ 1 Reply Last reply
                          0
                          • JonBJ JonB

                            @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.

                            JoeCFDJ Offline
                            JoeCFDJ Offline
                            JoeCFD
                            wrote on 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.

                            JonBJ 1 Reply Last reply
                            0
                            • Christian EhrlicherC Online
                              Christian EhrlicherC Online
                              Christian Ehrlicher
                              Lifetime Qt Champion
                              wrote on 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
                              • JoeCFDJ JoeCFD

                                @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.

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on 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

                                • Login

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