How to call a frame in Qt - qt

I have included a frame in my ui and i'm trying to call it in my source code, and I'm guessing it should be something like this ui->frame; but while I'm typing it, it doesn't come along the suggestions...

compile the project and try again...
Qt creator call the Meta object compiler and will generate/update the moc files, after that you can get the suggestions when writing the code...
/****************************************************************************
** Meta object code from reading C++ file 'MyWindow.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0)
**
** WARNING! All changes made in this file will be lost!

Related

Qt creator: "Warning: The code model could not parse an included file..."

I have updated Qt Creator to the latest version (4.7.0) and now I have this warning when opening my projects:
Warning: The code model could not parse an included file, which might lead to slow or incorrect code completion and highlighting, for example
xmmintrin.h:818:1: error: definition of builtin function '_mm_getcsr'
emmintrin.h:1:1: note: in file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/emmintrin.h:1:
emmintrin.h:31:10: note: in file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/emmintrin.h:31:
Is this a bug and how to fix this please? I'm on Ubuntu 16.04.
Thank you very much in advance!
http://blog.qt.io/blog/2018/07/18/qt-creator-4-7-0-released/ states that clang code model is on by default. The warning is thrown by the Clang code model plugin. You can disable it or try earlier qt creators such as 4.6.2

Portaudio library not working with Qt

I have successfully installed and used the Portaudio library for real time sound output on Ubuntu, with some C++ code.
But my main project is on Windows under Qt Creator. I have tried to build Portaudio with MinGW which seems to have worked because when I run the example "bin/paex_sine" it outputs a sine, but I can't use it in Qt.
I have linked the library by adding
LIBS += -LC:/MinGW/lib/ -lportaudio.dll
as advised there, but I get errors of this type :
undefined reference to mingw_initcharmax crtexe.c
I also tried to use the flag "--enable-cxx" when running ./configure, but then the make returns the following error :
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\cwtype:89:11: error: '::iswblank' has not been declared
using ::iswblank;
^
I don't really know what I did wrong and how I should proceed...

How to load 3DS file using Qt3D

I successfully loaded the .OBJ model into Qt using Qt3D, but can not load the .3DS model. I just follow the tutorial from here.
My environment is: Windows7, Qt5.3.1, mingw32.
Show error: Asset importer error: Chunk is too large
Please, give some advice.
As it seems, problem is related to Open Asset Import Library (short name: Assimp) which is included to Qt3D.
Also, note that there is big probability that you'll have no such problem on Linux.
Here is similar problem solved: http://sourceforge.net/p/assimp/discussion/817654/thread/a246ba12/
As it seems, you need to rebuild Qt3D (according to Qt3D Installation, Windows (MinGW)) with parameter -mno-ms-bitfields. Try to add next line to qt3d.pro:
QMAKE_CXXFLAGS += -mno-ms-bitfields
Hope it helps!

about including QcontactObserver in my Qt project?

I want to run the example found here: http://doc.qt.nokia.com/qtmobility-1.2/samplephonebook.html
But I have an error in this line:
QContactObserver* m_observer;
The error is:
ISO C++ forbids declaration of 'QContactObserver' with no type
in the contacteditor.h file.
What's wrong ? What should I do for that to run?
This question may well have already been solved for the original OP, but for the sake of other users stumbling onto it:
QContactObserver is part of Qt Mobility. Although Qt Mobility is included with the QtSDK, it must be unpacked and built on the development system to ensure that it is configured properly to be used in a project on that system.
In addition, the .pro file requires additions to prompt it to include the required Qt Mobility headers. For example, QContactObserver is part of the QtContacts module, so the .pro file would require the follwing additional lines:
CONFIG += mobility
MOBILITY += contacts
The error mentioned in the comments above:
MBX: you sure have a #include <QContactObserver>, don't you?
Marwa Shams: when i include it .. I have an error "no such file or directory"
occurs because Qt does not know where to look for the <QContactObserver> headers. Following the steps above will remedy the problem.

Installing Qt SDK, cannot link to the C++ libraries

So I have installed the QtSDK on my Windows 7 64 bit machine. However, it seems like when I try to run a simple program like hello world such as:
#include <iostream>
int main(....) {
std::cout << "Hello World\n";
}
My program first gets the error:
CreateProcess: No Such file or directory.
So what I did was I went to this link here:
http://wiki.codeblocks.org/index.php?title=Installing_MinGW_with_Vista
And I first tried to add the directory to the
PATH: C:\MinGW\libexec\gcc\mingw32\MinGW-Version
(my directory is slightly different but follows same idea)
where MinGW-Version is the Version of MinGW you are using
So now that got rid of that error but now I get the error:
iostream: No such file or directory
So now I add the path where the iostream library is and that fixes that error but then I get all these other errors where it can't find other standard C++ libraries such as stddef.h or stdio.h etc. So it seems as if the C++ libraries cannot be linked to. I have tried various other things such as including C:\MinGW\bin in my path and have tried uninstalling and reinstalling Qt. Also I have checked that Qt is using the right gcc compiler by going to Tools->Options->Toolchains in Qt Creator.
It seems that the linking to C++ libraries is not correct for some reason. Could anyone help me or guide me as to why this may be happening and how to fix this?
I'm not sure why it's not working, so I'll just tell you how my environment is set up. I don't think you need to add any library paths to the system path. You should only need to add C:\MinGW\bin.
So get rid of everything except for that. Also, are you setting this through cmd or control panel? If doing it in the control panel, make sure you are putting it in the "Path" variable not "PATH" -> the former is in the lower box. I've had problems before using "PATH" in the upper box - not sure what the difference is to be honest.
The QtSDK installation usually install the mingw compiler for you in ...\QtSDK\mingw. The libraries and dlls in ...\QtSDK\Desktop\Qt\4.7.3\mingw were compiled with this compiler. The mingw compiler you installed to c:\MinGW may be a different version than that. If you want to use this compiler you would have to recompile the Qt libraries.
C++ librairies in Qt.
Go to this URL http://doc.qt.digia.com/qtcreator-2.4/creator-overview.html for how to.
It seems (I did not try it, yet) that other librairies can be easily linked to a Qt Project.
This could solve the problem.
Pythagooric

Resources