Qt Project in Visual Studio 2022
-
@Furkan said in Qt Project in Visual Studio 2022:
I want to move my project written in qt to visual studio
What do you mean exactly?
You want to use Qt in Visual Studio?
If so then see https://doc.qt.io/qtvstools/index.html and https://www.qt.io/blog/qt-vs-tools-for-visual-studio-2022 -
I highly dislike the Qt plugin for Visual Studio. For QMake-based project I just run
qmake -tp vc myproject.pro
on the command line which yields a much better VS project (dependencies are better resolved). CMake is a lot easier because you can just open it in either VS or QtCreator. -
@SimonSchroeder said in Qt Project in Visual Studio 2022:
I highly dislike the Qt plugin for Visual Studio. For QMake-based project I just run
qmake -tp vc myproject.pro
on the command line which yields a much better VS project (dependencies are better resolved). CMake is a lot easier because you can just open it in either VS or QtCreator.Also in Clion
-
@Furkan said in Qt Project in Visual Studio 2022:
I want to change my compiler from Qt to Visual Studio
Qt is not a compiler.
You can use Qt in Visual Studio just fine as pointed out in this thread. -
Qt does not come with its own compiler. It uses the one you install yourself. If you only have Visual Studio installed, you're good to go. During installation you have to pick the precompiled version of Qt for a specific compiler, either MSVC or mingw. It is not possible to switch the compiler for the same compiled Qt library.
Within QtCreator you can select different "Kits". A kit consists of a compiled Qt library with Qt tools and a compiler. If you want to change the compiler, select a different kit. Sometimes you have to create your own kits. It would be different, though, when your compiling from the command line.
-
@SimonSchroeder I'm sorry for using the wrong term. My English is not well. By the way, I create my project with qt 6.6.0 mingw64 kit, but I can't transfer this project to visual studio. Also, I should change the language from Qml to C++. How can I do this?
-
@Furkan said in Qt Project in Visual Studio 2022:
but I can't transfer this project to visual studio
Why? What is the problem?
" I should change the language from Qml to C++. How can I do this?" - you will need to rewrite what you're doing with QML to use QtWidgets instead of QML. -
@jsulm You're right, I'll have to rewrite for that. I learned that in order to import from the qt environment to visual studio, it can only be done by introducing the pro file to visual studio. For this, I added qt vs tools to visual studio and I select the pro file with the help of these tools, but I cannot access the other .qml, .cpp and .h files in the pro file. The main.qml and main.cpp files created by visual studio are automatically created and when I run them, only these files work. I can explain my problem in detail this way. I apologize for explaining the problem less clearly before.
-
@Furkan said in Qt Project in Visual Studio 2022:
it can only be done by introducing the pro file to visual studi
More future proof would be to switch from QMake to CMake. Because Qt6 uses CMake by default and Visual Studio supports CMake directly.
-
@jsulm I have solved this problem. Firstly, I use Qt vs tools to import my project but I have taken another error. It says "msvc-version.conf loaded but QMAKE_MSC_VER isn't set". Than I open msvc_version.conf file in wordpad to give a version. In this file, it says which version you should use for your visual studio version. I have done this to. After that, I just add my lib files and other environments.
-
-