Can I use Qt visual studio tools for comercial projects? - c++

I understand that I can work on closed source projects using Qt as long as I link dynamically the Qt libraries and don't include them in the release version of my app.
My question is, if I use Qt visual studio tools, would it compile it including the Qt libraries on my release? if so, how could I make use of Qt libraries in visual studio?
Also I guess another question would be, if I use the Qt IDE's like Qt Design studio can I compile my app so that it links the Qt framework dynamically?

This dialog in the installer has the answers to all your questions. So, with these limitations in this wizard, you can use the open source version of Qt in your project.
And yes, you can of course link against Qt dynamically either in qmake or cmake.
All these common and popular IDEs support cmake, like Visual Studio or QtCreator, so you should not worry about using Qt in these IDEs.

Related

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.

Integrating separate Qt and Visual studio 2008 projects together

I have a Qt project(.pro) which essentially uses Qt libraries and OpenGL and i need to integrate this project with an existing VS2008 project(.vcproj) which uses a 3rd party API on another system.
The VS project interfaces with a hardware(along with many other functions) through a serial port and i intend to use its event handler to trigger the actions in Qt( since a serial port cannot be opened by two programs simultaneously? )
I use Qt v4.8.1 with mingw complier. i did come across a VS plugin for Qt. but i'm not sure as to how the above task of integration can be done.
I'll be thankful if you can kindly shed some light on this.
My advice would be to completely integrate the source of the Qt project into the VS project. It's possible to compile Qt code in visual studio. Of course, this requires to configure your VS project to make it "qt-ready". In detail:
Integrate the source code of the qt project into the VS solution. This means, the header files, the cpp files and the ui files you might have.
You still need the Qt libraries on your system in order to compile QT source with visual studio. I recommend to install "qt-win-opensource-4.8.1-vs2008.exe". These are the special Qt 4.8.1 libaries for VS 2008 (pre-compiled). Can be found here: http://download.qt-project.org/archive/qt/4.8/4.8.1/
You have to tell visual studio how to "pre-compile" the Qt source with the installed Qt binaries. This can be down in two ways:
I. You can configure the project properties of your VS project. Unfortunatelly I have never used this way, so I don't know exactly how to do this.
II. You can use CMake to setup your VS project. CMake allows the simple integration of Qt libaries and compilers. Using CMake means to write a CMakeLists.txt, which generates the VS project for you. Here you can find a sample, explaining how to write a CMakeLists.txt with Qt support: http://www.cmake.org/Wiki/CMake/Tutorials/Qt
Also, the Qt plugin for visual studio you mentioned is optional. You do not need it to build a Qt project with visual studio, but it makes some issues easier, e.g. debugging or calling the Qt designer from visual studio.
Hope this helps,
Michael

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

How do I configure Qt to work with Visual Studio 2010?

I downloaded open-source version of Qt from the site and have compiled it with nmake, but I'm having trouble using it in my projects. It seems that Visual Studio can't find the Qt headers, even though I added the paths to my PATH, INCLUDE, and LIB variables. I tried installing the Qt Visual Studio add-in but it only supports Visual Studio 2008.
Has anyone gotten Qt to work with Visual Studio 2010? Or do I have to wait until Qt 4.7 is officially released for Visual Studio 2010 support?
Either download the pre-built vs2008 package or build it using cmake's vs2008 profile and then open the resulting .sln file in vs2010 and let it do the conversion.
edit - annoying feature so far is that the vs plugin doesn't support vs2010 which makes it essentially impossible to use for desktop app development.
Traditionally VS support was part of the paid licences, with the OS package you only get mingw support. Things are changing, but might have some rough edges for a while.
OTOH, mingw has a HUGE advantage: deployment. You don't have to chase around the vcredist_x86 files and all the associated voodoo. Just be sure to include all the .DLLs you use and that's it.
Also, there's QtCreator. It's not as featureful or omniscient as VS; but it does feel a lot nicer and easier to use. It takes off all the tedious work of nmake, and embeds the UI editors. And it's cross platform!
honestly, for me VS can drop dead this minute and i won't miss it.
Qt V4.8.0 contains prebuilt binaries for Visual Studio 2010 so you don't need to build manually anymore:
http://qt.nokia.com/downloads/windows-cpp-vs2010

Simultaneous development in Visual Studio and Qt Creator

I'm going to develop a bunch of projects with Qt that should compile both under Visual Studio with Qt integration (commercial) and Qt Creator with LGPL SDK. My primary IDE is VS but I've grown to like Qt Creator too. It would be nice to be able to work in both of them simultaneously. I need to do it in some extent anyway.
The most annoying problem is project management. Should I create .pro file first and then import it to VS? Or should I create VS project first and create .pro file by Qt integration utilities? What's the best way to do it?
I would like to hear your ideas on the subject.
I use the .pro files as a basis and create VS projects from them. Using scoping rules I can set options that are specific for the VC++ compiler or the MinGW compiler. I haven't encountered any VS option yet I couldn't specify in a .pro file. OK, make that one: trying to set the warning level to 4 (win32:QMAKE_CXXFLAGS_DEBUG += /W4) didn't work because /W3 was still present.
For adding new files to the project I sometimes just add them to the .pro files and setup the VS project again. That way I don't have to worry about keeping both in sync.
Using this approach makes it easy to do automatic builds under a variety of compilers (Microsoft, Intel, MinGW, 64bit cross compilers)
Do you mean Qt Designer or Qt Creator? Qt Designer is the form builder, Qt Creator is the IDE.
I would recommend delegating your project management to CMake. Qt Creator now has support for cmake. cmake generates you project files based on a simple set of description files. I now use cmake even if I am just using visual studio because it is much easier to manage common settings between related projects than updating loads of settings in different dialog boxes. It also is also a multi platform build and is very clever at discovering the build tools and libraries installed on the developer system and creating the appropriate build output, make files, and ide project files.
I am glad you were able to solve you current issue QT Creator is a great tool. As much I like QT Creator and dislike Visual Studio, if you need to work with other developers on windows skipping support for visual studio in the future may not be an option.
I have had good luck using CMake ( http://cmake.org/ ) to generate my project files. I am working on a Linux/windows project where the developers can use just about any IDE and compiler. Learning to use CMake is easy, learning to make good cmake scripts takes a little time though. However, QT Creator has the ability to create the CMake projects for you, and you can customize and learn just as much of the CMake build script language as you need to.
Like this I have worked with visual studio, Code::blocks, QT Creator, clang, gcc/mingw and the vc++ compiler.
My approach was to create the project in VC++ and then export it to pro. I then tweaked all the pro files by hand and I keep them in sync by hand.
It's better to start with VC++, because VC++ has many more options that Qt's pro files.
Once you start changing more advanced options you will want to sync by hand
Make sure that both toolchains output the files in the same directories, or you might encounter issues such as moc files in your project dir that are updated only by QtCreator, while VC++ only updates the ones in GenratedFiles which the compiler can't see due to the former.
I have dropped Visual Studio for C++ development. Now I use only Qt Creator. All the troubles with parallel ways just do not worth it.