QT5 and QT6 projects issues with QWidget and QMainWindow
-
wrote on 1 Feb 2023, 17:30 last edited by
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
-
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
wrote on 1 Feb 2023, 17:38 last edited by@Fikrat ~/Qt is user name dependent. It is better to install it under /opt/.
https://github.com/KDAB/GammaRay/issues/213 -
wrote on 1 Feb 2023, 17:42 last edited by
thanks so much i will do the same .In any case, I will let you know
-
@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 ?
-
@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 ?
wrote on 2 Feb 2023, 08:28 last edited by 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!
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.
-
@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!
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.
@Fikrat So, did you run CMake?
-
Dear @jsulm, when I actually build it, but it provided tons of compilation errors as following
@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? -
@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? -
Dear @jsulm, I tried to build, though, did not provide any successful build operation. This is very strange. I am completely stacked.
-
Dear @jsulm, I tried to build, though, did not provide any successful build operation. This is very strange. I am completely stacked.
wrote on 2 Feb 2023, 15:06 last edited by@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.
-
@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.
-
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.
-
@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.
14/18