Export Visual Studio project to Qt Project - c++

I would like to export my Visual Studio Project to a Qt project.
How to generate a .pro file from a Visual Studio Project? I installed the Qt Add-In but I don't find such option.

With Visual Studio Qt plugin installed (officially named Qt VS Tools, can be downloaded from here), just:
Open your solution.
Select any Qt-based project from your solution (or any file within that project).
Go to menu Qt VS Tools > Create basic .pro File.... If you are using an old version of the plugin, menu may be named Qt5.
Select the projects you want to export. Project tags (.pro options, only in newest plugin versions) are automatically extract from your current project, you can modify them if needed or do it later when the .pro is created.
Run qmake or open it from Qt Creator.
PS: depending on your VS and Qt versions you may need an older version of the plugin. I'm assuming Qt 5 here.
Hope it helps.

Related

Visual Studio 2019 does not recognize Qt 6.1.2 package names

I'm new to both Visual Studio and Qt, and am trying to learn how to use them together. I installed Qt 6.1.2 and VS 2019 Professional, and then installed Qt VS Tools and set them up.
To learn, I attempted to recreate the notepad getting-started excercise (https://doc-snapshots.qt.io/qt6-dev/qtwidgets-tutorials-notepad-example.html), but I am having trouble with Visual Studio not being able to identify a lot of package names (or whatever it's called, like <QApplication>). I can recreate the excercise in Qt Creator just fine. I can also see and access the *.h files of Qt in Visual Studio just fine (e.g. #include <QtWidgets/qtextedit.h>).
Examples:
#include <QApplication> //Is accepted in Qt Creator, but not in VS
#include <QtCore/QCoreApplication>// Seems to work in Visual Studio, and roughly do the same thing?
#include <QMainWindow> //Is accepted in Qt Creator, but not VS (can't find src file) and I can't find what the suitable equivalent would be
I set up the project as a Qt Widgets Application, and I think Qt VS Tools automatically added the Qt installation include path, path to the .libs files, and names of the .lib files to my project settings (I can see something like $(Qt_INCLUDEPATH_) at the appropriate spots in my project properties).
Is there anything I can change in my project properties to make VS understand the Qt package names or does Qt VS Tools use other names for the packages?

Required to update Qt .pro and Visual Studio .vcxproj on new file additions

I'm developing using Qt Creator and Visual Studio. However, if I add a new file to the project through Visual Studio the Qt .pro file is out of sync and does not show the new file. Additionally, if I add a new file via Qt Creator the .vcxproj file doesn't get updated and therefore Visual Studio is out of sync.
I am using Visual Studio on Windows and Qt Creator on Linux.
Is there a proper way to manage this type of situation or is this something I just need to keep updated manually if I want the two project files?
There are a few options:
1) Use only Qt Creator, since it runs on both windows and linux it's an good option.
2) Only use the .pro to add files (options/etc), basically only use qmake build system to modify the anything build related and after each change re-create the VS files by using Open Qt project file (.pro) from Qt menu in Visual Studio.
3) Use a completely different build option that can be used on all the platforms you need, for example cmake is a good option and both Visual Studio and Qt Creator have support for it (i didn't used it, so i don't know how easy it's to setup, but i assume it should be relatively easy).

Building QT with Visual Studio

I know there have been a few questions before regarding this, but not too much up to date.
I am developing a project with Visual Studio 2015 express edition and I wish to add a GUI to my project via QT.
The latest version of QT (5.8.0) has a VS 2015 version, so I assume it is compiled using Visual Studio instead of MinGw.
Sorry if this is a very noob question. I have no experience with QT, but how do I then integrate my QT project into my VS project, do I build the GUI code first in QT?
If I will create a GUI using the .ui file in QT and then generate the source code for this, can I just copy the source code to my VS Project. I assume I have to configure the project file in VS as how will VS know where to find the dlls and header files for QT? Thanks in advance
You need the VS Tools for Qt. They work with >= Visual Studio 2013 Community Edition.
You can get them here and all information about how to use them.
Qt VS Tools integrate the Qt development tools into Microsoft Visual Studio 2013, and later. This enables developers to use the standard Windows development environment without having to worry about Qt-related build steps or tools.
The main features of Qt VS Tools are:
Wizards for creating new Qt projects and classes.
Automated build setup for the Meta-Object Compiler (moc), User Interface Compiler (uic), and Resource Compiler (rcc).
Import and export of Qt project files (.pro) and project include files (.pri).
*Automated conversion of a Qt VS Tools project to a qmake project, or the other way around.
Integrated Qt resource management.
Integrated Qt documentation.
Debugging extensions for Qt data types.

How to use Qt Creator with Visual C++ compiler on windows?

I installed Visual Studio 2008, Qt 4.8 libraries for vs2008 and Qt add in. I can build Qt projects in VS2008. But it's very inconvenient for me. When I open Qt project in Qt creator it can't compile because can't find qmake.
So, how to build projects using Qt Creator on windows.
Use CMake to build your software. With CMake you can:
-Build your project on a continuous integration server
Compile with different compilers (Microsoft, gcc, clang) to get additional static checking.
Open the top level CMakeLists.txt with creator as a project file.
Have CMake create Visual Studio project files.
If you want to fix Creator only:
Qt Creator needs to know where your Qt installation is. Choose the green Qt symbol in the settings menu, klick Qt Version and enter the path to qmake. Then Qt Creator should be ready to go.
hope this will help its having easy steps with some solution of errors that one may encounter during installation http://qtitkvtkhelp.blogspot.in/2012/11/qt-installation-prerequisite-1.html

Instruction for installing an environment with Qt and Qt integration with Visual Studio 2008

I want to use Qt lib but I don't know how to install Visual Studio 2008+Qt+Qtintegration. I have read some forums, that step by step tell what to download, where to download from, and then what to do. But that was for old versions of mentiond products.
I ask to Qt developers tell me the way to install these items on Windows. Any forum or site will be fine.
Thanks.
To get QT working with dev studio you need to install two things.
First, a copy of the QT Visual Studio Libraries.
And the QT Visual Studio Addin.
http://qt.nokia.com/downloads/windows-cpp-vs2008
http://qt.nokia.com/downloads/visual-studio-add-in
Download the QT sdk, and install it. It usually installs into a folder like
c:\qt\4.6.2
Then, install the visual studio addin. The addin should add (At least) two new things to Visual Sutdio. A new "Qt" project in the Create New Project Wizard, and a Qt menu.
Qt supports building your project against multiple builds of Qt, so the first thing you need to do is go to the Qt menu, and point it to the directory you installed the Qt SDK to. It all went well it should auto populate with c:\qt\4.6.2
Then, use the Wizard to create a new Qt project in Visual Studio.
If you are creating your first Qt project in Visual Studio this way, there is no need to fiddle with .pro files or doing any kind of "stuff" outside Visual Studio to get a project going. The Visual Studio addin sets up the workspace to do all the pre-compiles needed by the Qt build environment.
--
Note: The Qt SDK at this URL
http://qt.nokia.com/downloads/sdk-windows-cpp
comes with the MinGW runtine for GCC, and Qt Creator embedded. This is no good for Visual Studio. This build installs to a folder like
c:\Qt\2010.2