Qt Creator search in project only - qt-creator

In Qt Creator 4.15.0 when I right-click on a symbol and choose Refactor > Rename symbol under cursor, it shows me all occurrences of said symbol in all open projects. What I want is for Qt Creator to restrict its search and replace to the active project. Is this possible ?

Related

Cannot add my user control to the toolbox from DLL file

I created a custom WinForms control. When I added reference to the control's project for any project in the same solution, the control appeared in a WinForms designer toolbox and I can use it.
But I have problem to use it as an external library.
I built it and got a DLL file. When I add reference to the DLL file for a project, the control doesn't show in the toolbox. I tried also add it by "right click toolbox => choose items...", but I have an error: "'path to dll' targets a platform whose toolbox items cannot be enumerated dynamically".
Visual Studio 2022 Community .Net 6
I found the "answer" here: link
The only solution is workaround: Putting your controls in a NuGet package and referencing that

CMake to Qt Creator .pro file; Build specific CMake project from Qt Creator

Qt Creator does an excellent job with with parsing and building a CMake project. The problem is that when the CMake is too big and has sub-projects, it takes a long time to build.
CMake does have the ability to convert a CMake project to a Visual Studio solution. But since I am using Qt Creator, I'd also like to be able to convert a CMake project to a Qt Creator project.
Is there a straightforward way of accomplishing this task? I have googled, but haven't found anything.
P.S. Or, alternatively, I want the ability to just a build a specific CMake project from Qt Creator, and not the whole "solution". Visual Studio allows you to do it, Qt Creator does not. Unless it does and I don't know how.
Did some digging in Qt Creator and it turns out that it is indeed possible to set which particular CMake sub-project to build.
On the right hand-side where you see the column Welcome/Edit/Design/Projects/Help, go to Projects and select Build on the configuration that you're building:
Then on the right hand-side you'll see on the top a CMake dialog and right below it Build Steps dialog with all the CMake sub-projects loaded. By default all is checked. You can change that selection to whatever sub-project you want to. Obviously if you have a number of sub-projects that are libraries and you're modifying most of the time your executable project and running, then the choice would be the very first one, titled Current Executable:

netbeans not found Qt Designer

When i want to open a .ui file in netbeans, its alert that: Failed to start Qt Designer. Make sure it is installed and added to PATH
I use win vista and opensource Qt 4.8.4 and Qt creator 2.6.1 in Addr. C:\Qt\qtcreator-2.6.1\bin\qtcreator.exe
and i have Qt designer in Addr. C:\Qt\4.8.4o\bin\designer.exe
my netbeans build tools options qmake set on C:\Qt\4.8.4o\bin\qmake.exe
thanx
PATH is a Windows environment variable. It is a list of paths that the OS uses to look for executables and libraries.
You need to add the path to Qt Designer to that list. Right-click on 'My Computer', hit 'Properties', go to 'Advanced system settings', and click on the 'Environment Variables' button. Find 'Path' (or 'PATH') in the System Variables group, and click edit. The paths are delimited by a semi-colon, add the Qt Designer path to the end.

Qt SDK on Windows: how to use Assistant

After installing Qt SDK on Windows, I don't see any Help item in the Qt SDK menu. QtCreator\bin directory contains assistant.exe, and Documentation directory contains *.qch files. Is it possible to create a shortcut showing Qt Assistant with Qt SDK reference?
You can add these .qch files by going to the menu Edit > Preferences > Documentation > Add...
You should only need to do that once.

How to convert a regular win32 (VC++ vcproj) project to a Qt project?

How can I convert existing vcproj files to project files that the QT add-in to Visual Studio recognizes and treats as valid Qt projects?
Should I just bite the bullet and create new projects to replace the old ones, and then add existing code?
I am using QT 4.6 and VS 2008 with Qt Add-in 1.1.2.
Original vcproj files have NOT been generated with QMake.
Using Visual Studio 2010+ it is now possible to convert a project to a Qt Addin project, using the "Convert project to Qt Add-in project" feature of the Qt Addin.
The following steps are from the work around in bug QTVSADDINBUG-27. This was tested with Visual Studio 2010, but should work similarly with new versions:
Right click on your project in "Solution Explorer", click on "Unload Project"
Right click on your project in "Solution Explorer", click on "Edit .vcxproj"
Add line <Keyword>Qt4VSv1.0</Keyword> between the tags <PropertyGroup Label="Globals"> and </PropertyGroup>.
Right click on your project in "Solution Explorer", click on "Reload Project"
Right click on your project in "Solution Explorer", click on "Convert project to Qt Add-in project"
If you have header files in your project you are going to have to follow the instructions in this answer to trigger the generation of moc_* files in the "Generated Files" folder.
For editions of Visual Studio older than 2010 see this work around.
Here's the response from Nokia support engineer, name removed for privacy protection:
Hi,
Thanks for the suggestion. I have
passed it on to our developers who
will consider implementing it for a
future release. You can track it using
the following link:
https://bugreports.qt.io/browse/QTVSADDINBUG-27
Regards,
Support Engineer, Qt Development Frameworks, Nokia
>
Original question
We have quite a few legacy vcproj projects that we wish to add Qt to it.
Currently, we don't have an easy way to convert these legacy vcproj
files into a Qt-enabled vcproj.
What do I mean by Qt-enabled?
On a non-Qt-enabled vcproj, when I right click on the project name
under Solution Explorer, all options related to Qt are all grayed-out.
It would be really useful if Nokia adds this capability to VSTD Add-in.
Stackoverflow fellows, if you would like to see this feature implemented by Nokia, please help vote for it at the link above! =)
I use Qt VS Tools instead of Qt VS Add-in.
Instructions
In the .vcxproj file, make the following modifications:
Add <Keyword>Qt4VSv1.0</Keyword> into <Project><PropertyGroup Label="Globals"> (in accord with Benjamin's answer).
Add the following element into <Project> (the root element):
<ProjectExtensions>
<VisualStudio>
<UserProperties MocDir=".\GeneratedFiles\$(ConfigurationName)" UicDir=".\GeneratedFiles" RccDir=".\GeneratedFiles" lupdateOptions="" lupdateOnBuild="0" lreleaseOptions="" Qt5Version_x0020_x64="5.6-msvc2013_64" MocOptions="" />
</VisualStudio>
</ProjectExtensions>
Note that the value of the attribute Qt5Version_x0020_x64 should match the name of a Qt version in Qt VS Tools. You may set an arbitrary value and then fix it in Qt Project Settings in Visual Studio.
My setup
Visual Studio 2013
Qt VS Tools 2.0.0 Beta (apparently a rebranding of Qt VS Add-in)
Qt 5.6 msvc2013_64
Notes
When I follow Benjamin's answer and try to "Convert project to Qt VS Tools project", Visual Studio gets stuck.
The only Qt specific functionality I've tried with the project is exporting a .pri file.
I have reverse engineered the necessary modifications from a fresh VS project created using the template Qt GUI Application.
Converting a regular VC project to a QT project should be easier and the error message displayed by the Qt plug-in when attempting to add a Qt class to a non-QT project is exceedingly unhelpful especially when considering the actual differences between a Qt .vcprojfile and a non-Qt one are minimal. It is often the case that you have existing legacy code built into libraries and Dll's. During migration to Qt you may wish to add a Qt class to an existing module which was previously a non-Qt project. If the module has relatively few source files you may find it easier to re-create the project as a Qt project. If it has hundreds of source files or is complex in other ways it is often be easier to simply hand edit the .vcproj file. By comparing a regular .vcproj with a Qt one it is easy to see what the differences are:
A Qt project has a Keyword="Qt4VS1.0" immediately before
TargetFrameWorkVersion line near the top of the file.
At the bottom of the file you need to add the required Globals (in
particular QtVersion.Win32)
You will need to add the locations of the Qt header files to the
include paths (for all build configurations). You can do this later
via the visual studio user interface
For an exe or dll you will also need to add the Qt library locations
and library files to the linker options.
You actually only need to do 1 and 2 in a text editor and then you can reload the project in Visual Studio.
After setting up include paths and libraries you should be able to build the project as usual. Next you can add a new Qt class or convert an existing class into a Qt class. To do the latter first remove the source files for the existing class from the project otherwise the Qt add class wizard is likely to complain.
The above steps are intended for experienced users and you should always back up existing projects .vcproj files bfore hand editing. Simple mistakes here can render the file unusable.
More answer from Qt support engineer; I think the first pargraph is helpful as I didn't know that before:
i think this is a misunderstanding
really. If you have a Qt project
generated with the Add-in, then you
can change this project into a qmake
generated Qt project - and vice versa;
If you have a .vcproj that has been
generated by doing qmake -tp vc, then
you can convert this to a Qt Add-in
project.
There is no functionality to convert a
regular win32 project into a Qt
enabled project, so the suggestion
created is still valid, see:
https://bugreports.qt.io/browse/QTVSADDINBUG-27
I can see from the history of this
report that it has been closed and
re-opened again, so I assume there was
a misunderstanding regarding what you
were looking for in the first place.
If you create a .pro for you project
using qmake, then you should be able
to create a .vcproj file using 'qmake
-tp vc' on that .pro file. The qmake manual is available here:
http://doc.qt.io/qt-5/qmake-manual.html
I hope this helps.
Regards,
--
Support Engineer, Qt Development
Frameworks, Nokia

Resources