How do i use Qt in my Visual Studio 2015 projects?

前端 未结 4 945
我寻月下人不归
我寻月下人不归 2020-11-29 03:12

We have large project that used .NET Framework for showing forms/windows. Recently i decided to deprecate CLR dependency and move to Qt.

While learning Qt, we\'ve m

相关标签:
4条回答
  • 2020-11-29 03:50

    Qt have finally added support for Visual Studio 2013 and 2015 although it's only in beta right now. See QTVSADDINBUG-404 for progress and read the blog post From Visual Studio Add-In To Qt VS Tools (Beta).

    0 讨论(0)
  • 2020-11-29 03:57

    The Qt Windows could be added to the current project by copying all relating necessary files from the Qt stand-alone project to the current project. Specifically, the following steps must be conducted carefully.

    1. Create an example project of Qt inside a Visual C++ project by using a Qt Plugin Program. The windows must be designed inside this project carefully before adding to the existing project.
    2. Inside the existing project, add carefully the file heloqt.cpp, helloqt.h, ui_helloqt.h, qrc_helloqt.cpp, moc_helloqt.cpp in case of the Qt Project having the name of helloqt.
    3. Add some configurations of Additional include directories and Additional library directories and Additional Dependencies into the existing project.
    4. Compile and add some required *.dll files for running the program.

    I have to do that because I want to use a graphic user interface in my big project, and this project is too big to be added into the Qt project inside the Visual C++ Studio.

    0 讨论(0)
  • 2020-11-29 04:01

    As of now, you can just download Qt for Visual Studio 2015. Here.

    0 讨论(0)
  • 2020-11-29 04:14

    Building

    You can use Qt in Visual Studio 2015 without any problems. As already stated in the comments, you have to build it from source but Qt is pretty straightforward to build. You can download the current (5.5) sources here and then follow this step by step example on building it.

    I would also suggest reading more about the configure options, this might save you a lot of time. It might possibly save you some external dependencies as well if you skip components you do not need. My configuration for instance contains -skip qtwebkit -skip qtwebchannel so I do not need ruby or python.

    I could totally omit step 3 from the link. Just be sure to open the Visual Studio Command Prompt (32/64 is important here) for configure and nmake.

    Usage

    For Visual Studio 2015, the Qt Add-In is not available anymore. But there is an Extension (Tools > Extensions & Updates) called Qt5Package or QtPackage which has the same functionality. After installing it, you have the Qt entry on your main toolbar where you have to specify a version and the path to the directory where you built it. This version will also be associated with the current project via the same menu.

    If you load an existing project, you also have to convert it so the whole Qt functionality is used automatically. You can do this by opening the solution and right click on it; there should be an entry for the conversion to a QtAddin generated project.

    I am using Qt 5.5 on Visual Studio 2015 with an old project and it is working without any issues.

    0 讨论(0)
提交回复
热议问题