I have a project with so many files and all the files are either CPP or Java. I want to add this project to QTCreator for code navigation and code completion while editing. I don't need QTCreator for compilation. Can anyone please help me how to add this code to QTCreator.
You can just start a new project, selecting "Project without Qt".
In the new project right click the project folder and select adding an existing directory to it.
Related
My Qt project uses shadow build.
When I change in MainWindow form ( .ui file), I build the project but my program doesn't update GUI.
If I rebuild all, GUI will be updated. But rebuild is very very slow.
I try creating a new project (an empty QMainWindow with some labels), I modify some texts. I build and GUI is updated.
How can I use shadow build correctly, without a rebuild of all my project?
The same issue occurs if the *.ui file name is changed.
For example, Changing yourUi.ui to myUi.ui.
If that is the scenario, then the ui_*.h should also be changed, that is, yourUi.ui to ui_myUi.h.
close Qt creator, go to your project directory and delete the .pro.user file, open the project again and this time Qt creator will ask you to configure your project by choosing the kit you use to build your project. Select the appropriate kit and press the "configure project" button. Apply your shadow build. I hope it will work.
Have you tried to just run qmake (Build -> Run qmake) ?
Edit
As suggested by a comment, I copied the comment to preserve it.
It seems that QtCreator correctly rebuild the .h file of the ui in the shadow build directory, and then include the ones in the source directory, which is not regenerated. I don't know if this is a bug or an intended behaviour, but a quick workaround can be to build the project in the shadow build directory, copy the generated .h files back in the source directory and rebuild again. This work with my simple project, don't know if can be workable also for bigger and more complex project. Or do not use shadow builds
I'm using qt 5.3 under windows 7. Every time I edit the .pro file I need to clean up Makefile file under output/building folder to make it re-parse the changed pro file. I want it automatically detect the change when I hit build or run.
Is there some config I miss-set?
Three ways to re-parse the .pro file:
Right-click the project name in the Project pane (the topmost item) and select Run qmake
Click the Build/Run qmake menu option
Edit the .pro file, press Ctrl-S, and let Qt Creator automatically reparse it
It sounds like the third option is what you want and it's not working for you. It has traditionally been flakey and I never rely on it -- I use the first technique, right-clicking the Project and choosing Run qmake.
I'm trying to use some script files between different projects. I have one solution with four projects. In the project "A" I have some scripts like Jquery, Javascript Plugins, etc, and i want to use them on the project "B", by adding a scriptmanager, or anything that works. What can i do this?
I'm using Visual Studio 2010.
Here is a printscreen with my environment.
[EDIT]
Hello, after doing what #CStick says, a have now the scripts in my other project, so a can't add them to a ScriptManager. The problem is path not found on Asp.net code. It cant find the script cause they're placed in the other project. What can i do to solve it?
I know this is old, but for future reader i post an answer.
You will have to use "Link project file" for this.
From the target project, right click on the folder you what the file to be
Select add -> Existing file
Browse to the file you need then click on the arrow at the right of the add button and select add as a link
After this you can modify the file in booth project, but the fille will be only in the source physical location until you publish the project.
This can cause problem for client side file, like script file, on debug because you cant view the file because it's not physically in the target project.
You can use MsBuild to copy the source file on the target directory on build.
(See this answer)
In short, you will create a .targets file then add a reference in your project file.
I've created qt project called calculator so the file path on my disc is:
C:\excercizes\QT_projects\calculator
but qt created another extra directory next to it, which looks like:
C:\excercizes\QT_projects\Calculator-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug
What for is this directory? I see inside it two folders called debug and release but even when I build this project in release mode nothing is placed there, instead folders debug and release inside the first directory mentioned are used.
Anyone knows?
It's shadow building. You can desactivate that if you want.
http://doc.qt.io/qtcreator/creator-glossary.html#glossary-shadow-build
I've added a QAction to my QToolBar in my MainWindow in Qt Designer (using the Qt Creator IDE) and given that Action an icon (done by "Choose File" and selecting my .png located in the same directory as my project and source code). The icon shows up fine in the toolbar in Qt Designer, but does not show when the project is running. I've had similar trouble when choosing the title bar icon on windows. I've never used graphics in Qt before, is there something special I need to do?
Screenshot:
I found myself doing all the right stuff, adding a qrc file and placing my icons there. When I run the program no deal.
Turn out I was forgetting to run qmake:
Right click your project's name and select "Run qmake". Or go to Build>Run qmake.
Everytime you change something in the .pro file you need to run qmake again. Creating a resource file implicitly adds argunments to the .pro file, so you need to do it.
Hope it helps other people out there.
Did you make a QRC file (that is, Qt's equivalent of a resource file?)
If not, that would explain what you're seeing. The icons will show up in the creator, but not in the final compiled executable. Have a look at this:
http://doc.qt.io/qt-5/resources.html
Also in case of shadow build don't forget to use windeployqt.exe on your application executable file. After that several folders will be added to your build directory. Particulary two important folders: iconengines and imageformats which contain several dlls needed to load and draw the icon.
Have you tried opening up the Project file. For example, my project file is named menu.pro and it contains the following:
TEMPLATE = app
QT = gui core
CONFIG += qt debug warn_on console
DESTDIR = bin
OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build
FORMS = ui/mainwindow.ui
HEADERS = src/mainwindowimpl.h
SOURCES = src/mainwindowimpl.cpp src/main.cpp
RESOURCES = Images.qrc
The last line (RESOURCES = Images.qrc) is what you need to put in your project file: of course, use the name that you used for your resources file, in my case, it is Images.qrc.
While adding icons use "Choose Resource" option instead of "Choose
File" option.
Right click your project's name and click "Run
qmake".
Also make sure you don't forget to include the qrc file in the code (e.g. in main(...)) with Q_INIT_RESOURCE(MyIconResource);
This can also lead to missing icons in the final exe.
I also faced such a problem. In my case, I closed qt creator and deleted the build folder (something like build-projectname.. ). Then restarted qt creator. Then magically my icon showed up on running application.
I often use this trick when qt doesn't behave well.