I'm new to qt so this may be a basic question. I want to create multipul ui pages but I don't really know how to do it. I've gone Add New -> C++ Class -> include QWidget. Although this creates new source and header files, it does not create and additional .ui file. I've tried building and running QMake but that hasn't helped. I've also tried adding temperature.ui to the forms section of the .pro files but that just gives me the
":-1: error: No rule to make target 'temperature.ui', needed by 'ui_temperature.h'. Stop." error. Any suggestions? Many thanks
One thing is a C++ Class and another thing is a Qt class. The first one has a *.cpp and a *.h and the second one has, in addition, a *.ui file which contains the ui made with Qt designer.
So that, you need to Add a Designer Form Class instead of a C++ class
Related
I'm working with a C++ Unreal Engine project and made my own custom module called MyActor, Unreal Engine automatically created the .cpp and .h files for me. That much appears to be working.
So now I want to include classes or methods from the AppleARKit plugin then override and call them from my custom MyActor module.
First I tried using #include AppleARKitLiveLinkSourceFactory.h because it has theIARKitBlendShapePublisher::PublishBlendshapes method which I want to modify and use.
It didn't work at first with this error: E1696 Cannot open source file AppleARKitLiveLinkSourceFactory.h but I found out I could include them in Visual Studio using the "Include Directories" under Properties like this:
The AppleARKitLiveLinkSourceFactory.h lives in the Public folder but I included the Private folder as well, I don't know if I need to do that. This appeared to work at first but then I got the same error as before for every dependency inside the AppleARKitLiveLinkSourceFactory.h file.
Do I have to include the individual directories for every dependency down the entire chain? Is there an easier way?
When I ran into the issue of including files from a plugin, in my case LidarPointCloud, the following steps worked for me:
1) In my <project-name>.Build.cs file, I added the module name I wished to use (LidarPointCloudRuntime) to the public dependency list
PublicDependencyModuleNames.AddRange(new string[] { "LidarPointCloudRuntime", "Core", "CoreUObject", "Engine", "InputCore" });
I determined the module name by opening the .uplugin file in the plugin's folder, and looked at the Modules section. If multiple module names are listed, you should pick the one that contains the source for the classes you care about.
2) I then rebuilt the project, closed my editor, then right clicked my <project-name>.uproject file and regenerated project files.
After that, I was able to access the .h files in my code.
-Update-
It seems that AppleARKitFaceSupport has dependencies on other plugins that may need to be included. For example, ARSystems.h lives in AugmentedReality. When I add that to PublicDependencyModuleNames and perform the same steps, it can find ARSystem.h.
i have created a UI with the Qt Designer, i want to integrate it into my cpp program now.
I have to convert the main_window.ui to a header file?
Supposedly it should be a possibility via the Designer Form->View Code to give a cpp code to this class which I can copy directly into a header file?
Unfortunately I get the error message : Unable to launch C:/Program Files(x86)/Qt Designer/bin/uic.
Under my path exesterit no folder structure /bin ?
I can't find a download for the user interface compiler either ?
Is there a simple solution? Or where is my mistake?
Most of the time you don't need to call uic manually: just add the .ui files to your .pro files as "FORMS", and qmake will take care of the rest. See for example: https://doc.qt.io/qt-5/qmake-variable-reference.html#forms and https://doc.qt.io/qt-5/designer-using-a-ui-file.html
I wish to try this qt example. I created a qwidgets project, copied all headers and sources from the following example to my project.
http://doc.qt.io/archives/qt-5.5/qtmultimedia-audiorecorder-example.html
What is the way to copy the .ui file of that project to my project?
What should be the extention of that file in my project?
The *.ui files are GUI designer files and define the actual GUI.
Copy it as-is. You'll need to invoke the uic (User Interface Compiler) on it to produce the ui_audiorecorder.h header file, which is included in the audiorecorder.cpp file.
Read more on the uic toolchain in the docs: Using a Designer UI File in Your Application.
You copy the .ui file into your project's folder using your favorite file manager or terminal or what have you. Suppose that the file is named foo.ui.
Then you add the file to the project by either:
Adding the following line to the .pro file:
FORMS += foo.ui
Right-clicking the root project node, selecting "Add Existing Files...", and navigating to the foo.ui file in the file dialog.
The two procedures are equivalent, the result is the same: a new FORMS item in the project file.
That's all. As soon as you save the .pro file, Qt Creator will parse it and show the foo.ui under a Forms project tree node.
In my Qt Project, I want to create some subfolders like Audio or Video.
Something like this:
Project\Media
Project\Media\Audio
Project\Media\Audio\Video
How I can do this?
Is there an way to add a new folder in Qt Creator? Or do I need to create this manually via the explorer?
Currently the only way is to add or create file that is inside of the directory - then the directory will be also created in Projects view of the QtCreator. This is not really that bad, since you can create directory while adding a new class file to the project. When the file is added to the project, also all its parent directories will be reflected in the Projects view.
In qt you use mkdir
bool QDir::mkdir ( const QString & dirName ) const
which will create a subdirectory called (variable dirName)
You could also use cmake which allows you to generate makefiles for every platform you need, itsteand of writing them manually. See code examples here
Everything was fine until I decided to add another combobox (which I did not rename and is indeed called comboBox) into my .ui when I realized that ui->comboBox was not recognized. All my other widgets etc that I added awhile ago still work though. When I debug I get http://i.stack.imgur.com/xVs8X.png but i know for a fact that I created it. Usually bugs like these I could just close my Qt and start it up again and all would be well but not this time. Does anyone know how to possibly fix this issue? I'm using Qt5.1.0.
I noticed this problem after I built Qt statically. Could that be the issue?
Example:
detail.ui
trying to access the button in detail.cpp
As you can see, i can still access all of the previous widgets etc before I made Qt Statically. But now, when I make a new pushbutton, cpp file does not recognize this.
I had to run Qt5.1.0 for Desktop (MinGW4.8 32bit) prompt. cd C:\path\to\project.pro and then type mingw32-make clean
In my case there was a copy of the auto generated "ui_xyz" file in my working directory(source files) so the compiler wasn't referring to new one in the build directory.