Qt Creator: add Qt module to project - linux

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

Configuring VC++ for WxWidgets

I am trying to follow this guide
to configure VC++ for WxWidgets. I got stuck here.
So for Core wxWidgets libraries to include, I did include wxmsw31u[d]_core.lib and wxbase31u[d].lib under Linker>>Input>>Additional Depenedencies. That is all to it right?
As for Linking with correct runtime library, can someone tell me how that is done? I manage to get here but don't know how to set the indicated settings.
Please help. I really appreciate it.
When you want to debug your app the debugger must know where in the compiled code is each function used. In jargon, the "debugging symbols". Windows puts these symbols in the compiled executable, while Linux uses another, .devfile.
When you compile code (your app or wxWidgets library) you must tell the compiler whether you want a "Debug" version or a "Release" one.
If you want the debugger to be able to step into wxWidgets code, then you must compile wxWidgets in "debug" mode, which will add the character d to the library files built. So, you must add, for example, wxmsw31ud_core.lib to your app dependencies. Notice the d between u and _. Use the file explorer to see all files generated by wxWidgets compilation process.
Perhaps you don't want all this wxWidgets "debug". Then use another wxWidgets compilation route and add wxmsw31u_core.lib instead of the d'd version. Still you can compile your own app in debug mode, but not being able to step through wxWidgets internals.
Now for your app, a) do you want a single executable file also containing wxWidgets code? or b) let your app in a .exe file which uses as needed external .dll files?
a) is called "static linkage" while b) is called "dynamic linkage"
As you can see, there are four combinations of debug/release & static/dynamic. You must choose one "runtime library" to link to your app.
The table in the wiki shows the switch and MSVC lib (select the desired combination in the 'properties' page) to use in your app; and macro definition required to build wxWidgets if you use nmake instead of the already provided configurations in VS.
Take a look at docs\msw\install.txt for more info.
The best advice I give is that you look into "minimal" sample project. Load it into VS and read every option. You can even make a copy, change some file names and use it for your own app.
I recommend using the official instructions instead of the wiki, they're simpler and, if you look at the last paragraph, you can see that you don't even have to link the libraries manually with MSVC.
You also don't need to do anything special to link with the correct version of the CRT, the defaults are just fine.

Disable the interactive-search - user side

I got accustomed to then I write file name in Save dialog in Windows PC, it writes into file name label. In linux I must focus on label, and then write. It's annoying, but I can't find how to disable quick search. I see source, GTK documentation, asking questions to developers, but no help. There is this mice hidden? GTK2-3, no matter.
In the answers on this site I see recomendations for developers, not users. I want recompile GTK, or write the key in .gtkrc-2.0/3.0 to disable this functionality.
I found, that GTK developers is very hard of hearing, and don't like adding configurable options.
This "feature" is called typeahead and hardcoded in GTK libs, so no config or build options, just fixing code needed. It's a pity...
https://www.reddit.com/r/archlinux/comments/33x4wk/gnomegtk_316_file_chooser_typeahead/
But I find filename and strings to modify:
/gtk+-3.22.7/gtk/gtkfilechooserwidget.c b/gtk+-3.22.7/gtk/gtkfilechooserwidget.c
gtk_tree_view_set_search_column (GTK_TREE_VIEW (priv->browse_files_tree_view), -1);
/gtk+-3.22.7/gtk/ui/gtkfilechooserwidget.ui b/gtk+-3.22.7/gtk/ui/gtkfilechooserwidget.ui
0
Now need find source of GTK, because there is no option to disable this behavior...

How to use two Qt5 versions on KDE Plasma to avoid conflict?

I am using Opensuse Leap 42.3, with KDE Plasma 5.8.7 which uses Qt 5.6.2.
I would like to use the latest Qt version (5.10 as of asking this question) for development, and I've installed it in /usr/local/Qt5.10/.
I added Qt5.10 library path (/usr/local/Qt5.10/5.10.0/gcc_64/lib/) to my /etc/ld.so.conf but it caused a conflict with system's Qt version, which as a result anything using Qt libs (Dolphin, Kate, etc) won't work, and if logged out, cannot login, complaining about qdbus.
I tried to create symlinks in /usr/lib64 like this:
for f in /usr/local/Qt5.10/5.10.0/gcc_64/lib/libQt5*.so.5.10; do
ln -s $f /usr/lib;
done
But this too, made the same problem. I have also added a LD_LIBRARY_PATH entry in ~/.profile but with the same problem.
I can do export LD_LIBRARY_PATH="/usr/local/Qt5.10/5.10.0/gcc_64/lib/" in a terminal and run my Qt5.10 application, but this is not convenient.
What is the correct way of doing this?
It may not be convenient, but setting the path up as you launch seems to be the only way to avoid the issues you mention.
I also use KDE, and am playing with Qt 5.10 visualisation stuff on a system using Qt 5.9 and have experienced the hell of mashed library dependencies you mention.
Qt Creator seems to take care of that and in other environments (eg: KDevelop) you can add it to the path in the run/debug launch settings. And although not portable, you could also add it to the path for your desktop file...
The qtchooser utility might be useful although I admit I don't really understand how it's supposed to work.
Yes, I realise this is a low quality answer but I am interested in seeing a better solution too.

How can a Linux source package be opened as a project in an IDE?

I am makeing a small mod to SMPlayer; the Linux version...
The make, sudo make install from the command line works, but I would like to have the project in an IDE.
I want to use CodeBlocks IDE, only because I've used it before, but if some other IDE is required, I can use that instead... (I use Codeblocks because it is simple, and that suits my current ability to handle an IDE)..
Is there some way to use SMPlayer's Makefile, or some such thing?
This depends on the IDE and has little to nothing to do with Linux.
Does your program come with something like cmake or another setup tool? That normally makes it much easier. For example in KDevelop you can import straight from CMakeLists.txt and Makefiles.
If all else fails it might be quite easy to do something like this (not knowing your specific IDE):
Add new Project
Set build directory and other necessary settings (like compiler and compiler flags)
Add the already existing files to it.
Press "Compile"-button.
This is obviously depending on the project structure, setup and size.
Code::Blocks has builtin support for Makefile projects. See the FAQ.
Also you could just use vim or emacs ;)

How do I backup my C++ Builder component installation?

I finally have my C++ Builder 2010 installation the way I want it, with all my components upgraded and installed. (touch wood)
I have been working with C++builder since version 1 and I know from countless previous traumatic experiences that this state of affairs could change in an instant. I would like to backup the installation and component set.
Is there a way to do this? A tool perhaps? A menu command that I have maybe missed all these years? I don't want to have to reinstall all the components from the bpl source again.
I make nightly backup images of my entire drive, I would like to do this for c++builder only if possible.
If it's a matter of simply copying files, which files would I need to copy? Are there entries in the registry that would need to be restored?
Thanks in advance for any thoughts and suggestions
The HKCU\Software\CodeGear\BDS\7.0\ registry section contains the "known packages" subtree that contains which components you have installed. reg export/import should save you some trouble.
You'll also want to backup/restore the actual files referenced there as well.
It has been a while since I used C++ Builder, but I will make two suggestions...
1) run regedit and looks for "builder". You will probably find a hive like hk_local_machine/software/codegear or such. Export that and you can import it later
2) have a look at GExperts - is they don't have the exact solution, they still have some pretty useful (and free) tools

Resources