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.
Related
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.
NB: I have tried asking this question here (on the Qt Project forums), but to no avail for the moment, so I'm trying my luck here.
I’m using Qt 5.0.1 (on a laptop with Ubuntu 13.04), the compiler is gcc 4.7.3 (and I'm working with Qt Creator 2.7.0).
In order to have C++11 working, it seems that simply adding the following line to the .pro file of the project does the trick (or at least it's supposed to):
CONFIG += c++11
However, when I do that, I get a ton of errors in the file qobjectdefs_impl.h upon compilation.
Anyone know how to fix this problem? Thanks in advance!
Edit: Here is a screenshot so that you can see what the errors look like (apparently the errors happen when I do #include <QColor>):
NB: link to the image if it shows too small here.
Edit: I still have the errors after having upgraded to gcc 4.8.1 and Qt 5.1.2, which I compiled from the sources.
Yay, someone (JKSH) found what the problem was on Qt Project forums (here).
In short:
The problem was that I had written somewhere #define I complex(0.0, 1.0), which created a name clash in qobjectdefs_impl.h (where complex was a typedef for std::complex<double>). For some (weird) reason that didn’t cause any problems as long as I didn’t write CONFIG = c+11 in the pro file, but not it did after writing it.
Many thanks to JKSH, and also Greenflow for helping!
Edit: The credit for finding the issue should go to Thiago Macieira from the Qt Project Interest mailing list, see comment.
I am currently using QtCreator 2.4.1 with Qt 4.7.4 development libraries (in Ubuntu) and am trying to track down a bug which after profiling with valgrind seems to occur internally within QGraphicsView::paintEvent(…) method
To help isolate this problem I would like to step into the Qt sources. Having done some searching through both the Qt forums and stack overflow and have not being able to find a way to integrate the sources with my version of QtCreator.
I have currently tried downloading the sources via the QtSDK manager and adding a “Source Path Mapping” within Tools->Options->Debugger. I am sure that this step is where I am making a mistake as I am unable to even switch to source when viewing internal Qt header files i.e. from QGraphicsView.h
I have so far tried adding the following Source Path Mappings
Source Path=/var/tmp/qt-src
TargetPath=/home/paul/QtSDK/QtSources/4.7.4
and
Source Path=/var/tmp/qt-src
TargetPath=/home/paul/QtSDK/QtSources/4.7.4/src
Neither works.
I have also tried building Qt directly from source, adding this to my "Qt versions" list within Qt Creator and creating a new project configuration using this version. This also did not work.
Likewise I have tried adding the src folders to my gdbinit file. This also fails to work.
I am completely lost with this.
Paul
Someone asked a similar question here: Need to step into Qt sources (my IDE is Qt Creator).
Someone else asked about Valgrind errors with Qt here: Suppression files for Qt memory leaks with Valgrind
And here is a little more info about Using Valgrind with Qt Creator along with some explanation about how to read the results. Its a little dated from late 2010.
Related Suggestions
I wouldn't debug the QGraphicsView class just because of all the effort to make it work or find the problem might be for nothing... Qt is moving to using the SceneGraph as the backend for QML and the rendering engine for QGraphicsView might become obsolete.
Updating to the latest stable build of the Qt libraries may make a big difference for QGraphicsView.
If you post the valgrind error you are getting to the Qt Trolls, someone might be able to explain what is going on for you.
There are other debugging techniques besides the traditional debugger. I've been programming in Qt in Windows (without valgrind) and with a large multi-threaded application, that loads a bunch of Dll's. I've had to put some faith into the Object Tree Model clean up and work on all the new calls I put in. Most of the time I just use QDebug to find errors. Then I am also using a combination of qInstallMessageHandler() with QDebug to implement decent logging for the hard to track bugs.
See also Qt Debugging Techniques.
I had a problem while I'm compiling the existing example in Qt-mobility. It's a code example shows how to use messaging API in Qt for symbian. After run the program there was an error occured:
Cannot open include file :
'qtmessaging.h': no such file or
directory
So what to do for use the qtmessaging library?
Thanks in advance.
This seems to be a bug in Qt Mobility. qtmessaging.h is not listed as a public header file.
In later releases of Qt Mobility such as the most recent 1.0.2, qtmessaging.h seems to be removed completely and the examples updated to not use it. So the solution is simple: update your Qt Mobility to the most recent version.
your pro file seems to be correct.
just look at the example provided here, do cross check your profile with example one here
http://doc.qt.nokia.com/qtmobility-1.0-beta/quickstart.html
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