add module in qt(QML module) [duplicate] - qt

So when I create a new Qt project inside Qt Creator I'm only asked for some simple details like location of the project, build targets, the main window class name (along with header, source and form file) and at the enda choice to add it to version control.
After I create the project I'm only given the qt core and gui modules. My question is how do I add other modules (such as network or opengl). I've looked and looked, yet I cannot find anything on how to add other Qt modules easily. I know I can edit the .pro file, but unfortunately I don't know all the modules in Qt, nevermind the name I'm supposed to put there. Adding external libraries is easy, but how come there's no (obvious) option to add Qt libraries?
Help would be much appreciated ^_^ Thanks!
Oh yeah... I'm running Arch Linux if that's any help.

Edit your .pro file. It should has one line like this:
QT += core gui
Append the desired modules in this line. To get the module's names, just remove the "Qt" part in this list. (e.g. QtSql turns "sql")

I can't find that either.
It seems that in older versions of the "New project" wizard you used to be able to specify which modules you wanted to use, but even then you were not able to alter your choice later. And this seems gone now, so your only choice is to manually edit the .pro file.

As others have pointed out, you simply #include the module you want in the source and add the name of the module in the .pro file to the QT variable.
However the actual documentation you need which no one else has mentioned is the qmake Project Files page. qmake is very powerful and it's well worth getting familiar with how it works and I think that's why they don't provide a complete GUI for it, as it can handle some very complex scenarios.

You have to read the documentation to add the modules.
Frankly speaking, I never really felt like that there needs to be a GUI for that.

Related

How do I remove a library from the arduino environment?

In the Arduino GUI on windows, if I click on Sketch --> Import Library, at the bottom of the menu there is a section called "Contributed".
Unfortunately, I had misclicked and added a library I did not want to that list.
How can I remove it from that list?
The help page only mentions that "If a sketch no longer needs a library, simply delete its #include statements from the top of your code" but it does not mention how to remove the library from the list of contributed libraries.
Go to your Arduino documents directory; inside you will find a directory named "Libraries". The imported library directory will be there. Just delete it and restart the Arduino app.
Your Arduino library folder should look like this (on Windows):
My Documents\Arduino\libraries\ArduinoParty\ArduinoParty.cpp
My Documents\Arduino\libraries\ArduinoParty\ArduinoParty.h
My Documents\Arduino\libraries\ArduinoParty\examples
....
or like this (on Mac and Linux):
Documents/Arduino/libraries/ArduinoParty/ArduinoParty.cpp
Documents/Arduino/libraries/ArduinoParty/ArduinoParty.h
Documents/Arduino/libraries/ArduinoParty/examples
The only issue with unused libraries is the trivial amount of disk space they use. They aren't loaded automatically so don't take up any application memory of the Arduino IDE.
Quote from official documentation as of August 2013:
User-created libraries as of version 0017 go in a subdirectory of your default sketch directory. For example, on OSX, the new directory would be ~/Documents/Arduino/libraries/. On Windows, it would be My Documents\Arduino\libraries\. To add your own library, create a new directory in the libraries directory with the name of your library. The folder should contain a C or C++ file with your code and a header file with your function and variable declarations. It will then appear in the Sketch | Import Library menu in the Arduino IDE.
To remove a library, stop the Arduino IDE and remove the library directory from the aforementioned location.
The answer is only valid if you have not changed the "Sketchbook Location" field in Preferences. So, first, you need to open the Arduino IDE and go to the menu
"File -> Preferences"
In the dialog, look at the field "Sketchbook Location" and open the corresponding folder.
The "libraries" folder in inside.
I have found that from version 1.8.4 on, the libraries can be found in ~/Arduino/Libraries. Hope this helps anyone else.
I had to look for them in C:\Users\Dell\AppData\Local\Arduino15\
I had to take help from the "date created" and "date modified" attributes to identify which libraries to delete.
But the names still show in the IDE... But it is something I can live with for now.
For others who are looking to remove a built-in library, the route is to get into PackageContents -> Java -> libraries.
BUT : IT MAKES NO SENSE TO ELIMINATE LIBRARIES inside the app, they don't take space, don't have any influence on performance, and if you don't know what you are doing, you can harm the program.
I did it because Arduino told me about libraries to update, showing then a board I don't have, and when saying ok it wanted to install a lot of new dependencies - I just felt forced to something I don't want, so I deinstalled that board.
In Elegoo Super Starter Kit, Part 2, Lesson 2.12, IR Receiver Module, I hit the problem that the lesson's IRremote library has a hard conflict with the built-in Arduino RobotIRremote library. I am using the Win10 IDE App, and it was non-trivial to "move the RobotIRremote" folder like the pre-Win10 instructions said. The built-in Libraries are saved at a path like: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries
You won't be able to see WindowsApps unless you show hidden files, and you can't do anything in that folder structure until you are the owner. Carefully follow these directions to make that happen: https://www.youtube.com/watch?v=PmrOzBDZTzw
After hours of frustration, the process above finally resulted in success for me. Elegoo gets an F+ for modern instructions on this lesson.
as of 1.8.X IDE
C:\Users***\Documents\Arduino\Libraries\
My solution is low-tech but effective so I want to share:
create a folder for disabled libraries next to libraries
move libraries here to disable, swap back in to re-enable

Does Qt Resources system support having files just for testing?

I already used the Resources from Qt to add a couple of icons to the menu and works great, but now I was wondering if it would be possible to add a file that I need to use as a reference for testing purposes.
Therefore, I would like this file to be accesible just when I´m running the tests, not that it gets added to the binary of the application. Is there any way to set that differentiation?
I did not find something like that in Qt´s documentation.
You can do it programmatically using QResource.
Or maybe writing on the .pro file (i have not tried it!! ) :
Debug:RESOURCES += resources_only_debug_mode.qrc
more information here : Qt .pro Docs

How to use QtCopyDialog?

I include this library:
#include <QtCopyDialog>
When i compile, i see this error
"QtCopyDialog: No such file or directory"
How to solve this problem?
Thanks.
QtCopyDialog is not part of the core Qt library, but was released as part of Qt Solutions, a now discontinued add-on. The official Qt site links to a newish Git repository containing a few of the original Qt Solutions classes. This appears to be the most (only?) maintained location for the Qt Solutions source, but QtCopyDialog appears not to have made the grade. The only place I can find the source for QtCopyDialog is here. Judging from the docs, the last time it was maintained was pre Qt 4.5. You might need to make some changes in order to get it to work with whatever version of the Qt libs you're using.

Debug into Qt sources

Is it possible to step into Qt sources, e.g. qmainwindow.cpp, in Qt Creator? At the moment I'm seeing the disassembly, but it would be nice to see the sources instead.
Of course! But you might have to first:
go to $QT_HOME/qt
run ./configure with the -debug or -debug-and-release flag (many other flags here)
run "make"
wait a couple of hours while things build
Download the Source code itself.
Create your application with including all the required files (for e.g qmainwindow.h,qmainwindow.cpp,...) directly. Run your application. Step into the desired files while debugging.. I haven't tried this way but this should work.
Also you have to include all the desired files. For e.g QMainWindow is derived from QWidget. QWidget is derived from QObject. So you need to include the qwidget.cpp, qwidget.h for QWidget and qobject.cpp, qobject.h for QObject. Similarly you have to include all the necessary files that might be required.
What you are actually doing is, instead of linking the Qt libraries (*.dll and *.lib), you are including the required files directly. That's all.
Remember with the Qt libraries linked, you will not able to step into the files that are all built into the libraries.. So, inclusion of the desired files will help you.
Hope it helps.
You don't say what paltform, but on windows you also have to tell Visual Studio where the sources are. See options->vs projects and directoriers->source code

how to change the look and feel for Qt form?

i need to change my form look and feel and i dont know :
what i need to download and install ?
is there any ready to use look and feel installed into qt library ?
i am using windows and qt 4.4.3
Take a look at Widget Styles and Stylesheets (both linked to Qt 4.4 since that's your version).
Edit: In other words, you don't need to install anything else. Styles are built into Qt.
Look-and-feel is pretty vague -- you can change the GUI application style by adding the -style STYLENAME command line argument when you run the program. You can change to the application to run under motif, windows, platinum, or any other custom styles that you might have compiled (such as plastique).
Here is more information about it in the Qt Docs: http://doc.trolltech.com/4.6/qapplication.html#QApplication

Resources