How to use QT and GNU Autotools by using AutoTroll? - qt

I would like to use Autotools and QT4 together. For this i would like to use AutoTroll.
As the Website says, it should be very easy to use it. Unfortunately i was not able to do so.
I have a working Hello World example:
This is how my configure.ac looks like:
AC_INIT([Hello], [0.1], [bug-report#hello.example.com], [hello], [http://hello.example.com/])
AC_PREREQ([2.59])
AM_INIT_AUTOMAKE([1.10 no-define foreign])
AC_PROG_CXX
AC_PROG_CC
AT_WITH_QT
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
My Makefile.am:
AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
bin_PROGRAMS = hello
hello_SOURCES = src/*.cpp
My simple main.cpp with a QT include:
#include <iostream>
#include <QApplication> \\Added this to test if Autotools works correctly
int main()
{
std::cout << "Hello Worlasdasdsadd!" << std::endl;
return 0;
}
Can someone please help mit with this? An short Step by step would be very nice.
Thank you in advance.
Edit:
I don't know how to integrate this m4 makro (Autotroll) in my configuration. This is why i cannot provide any "Errors" or something else. The of the website does not help me to understand what to do.

I won't recommend you to mix QT and autotools. For QT projects is most recommended to use cmake/qmake. When you get any problems it would be easier to find answers, etc.
Furthermore, Autotroll seems unmaintained since 2008 and not tested with QT >= 4.4+, and it has rained a lot (really a lot, QML and QT 5.0 as examples) since then:
AutoTroll has been tested successfully with Qt 4.0+, Qt 4.1+, Qt 4.2+ and Qt 4.3+
If you just want to learn autotools, gtk/gnome, gnu-tools or just any c++/c/whatever-language project would make it easier for you. Find projects using autotools and learn what they need and what they use.
Another recommendation is that you look for presentations and talks explaining the autotools basis and tools flows.
All I can say is that Autotools is a big world, be patient.

Related

standard notation behind the QT reference documentation

I've searched extensively for an answer but to no avail. I am progressing well with self-tutoring of the basics of PyQT5. I am using http://pyqt.sourceforge.net to gain insight into how classes and functions link together but I am finding the QT reference documentation http://doc.qt.io/qt-5/ a useful means of gaining further insight.
I can pick up on the fact that there is a standard notation running through the documentation but I cannot follow what various symbols and reoccurring text refers to. There also appear to be many parameters and nested parameters applied. I paste a few samples below:
void setFocus(Qt::FocusReason reason)
render(QPainter *painter, const QPoint &targetOffset = QPoint(), const QRegion &sourceRegion = QRegion(), RenderFlags renderFlags = RenderFlags( DrawWindowBackground | DrawChildren ))
qmake: QT += widgets
enum RenderFlag { DrawWindowBackground, DrawChildren, IgnoreMask }
My question: is the documentation following an industry standard notation when it uses symbols such as "|" ? If so, is there a reference I can refer to to interpret the notation? I've combed through the QT website but can find nothing.
Qt is a C++ library and the snippets you are showing are excerpts from C++ code.
except for the qmake line which is qmake code.
| is the bitwise OR operator. The enum RenderFlag consists of flags (where usually one unique bit is set) which can be combined via this operator.

How can i fine-tune qt5 for an embedded system?

I am using yocto, and already have a build of qt5 in my image and it works. The issue is that it is HUGE.
So, I tried to use a .bbappend recipe in my layer for qt where I experimented with using
PACKAGECONFIG_remove = " qtnetworking qtdeclarative sql-mysql qtscript...etc";
and
EXTRA_OECONF = " -no-accessibility -no-feature-MDIAREA -no-feature-DRAGANDDROP ...etc";
I even removed all the feature disablement config params in EXTRA_OECONF and just added -qconfig minimal or -qconfig medium.
====> the result is always the same: compilation failure in the qt corelib or qtwidgets.
I want to disable networking, printing, and mdi support. How can I do that?
Much appreciated!

Compiling QtOpenCL with QT5

Anyone managed to compile library QtOpenCL using Qt5 (possibly under Window)?
edit: I managed to compile the code by porting it to QT5. I leave here in the question the dirty parts that I would like to replace in my method and describe what I did in the answer.
I was not able to provide the include path to my opencl installation so I
manually modified src/opencl/opencl.pro by adding the line
INCLUDEPATH += " *[absolute path to the openCL include folder]* "
QMAKE_LIBDIR_OPENCL = "*[absolute path to the opencl lib folder]*"
manually modified src/openclgl/openclgl.pro by adding the line
INCPATH += " *[absolute path to the openCL include folder]* "
QMAKE_LIBDIR_OPENCL = "*[absolute path to the opencl lib folder]*"
Anyone knows how to fix this in a cleaner way?
Here are the changes I had to introduce:
Modify the .pro files in order to add the OpenCL library. This is still an open problem for me. How to fix this in a cleaner way?
Link the projects (both opencl.pro and openclgl.pro) to the additional required Qt module QtConcurrent:
QT += concurrent
Fix the #include style by removing the packages, e.g. #include <qtconcurrentrun.h> instead of the old #include
<QtCore/qtconcurrentrun.h>
Fix qclvector.cpp by replacing qMalloc, qfree, qMemCopy with, respectively, std::malloc, std::free, std::memcpy
Moreover modify the initialization of ref in the constructor from ref = 1 to ref.store(1);
Removing all the macros QT_LICENSED_MODULE
This is enough to compile at least QtOpenCL and QtOpenCLGL using QT5

What API does Qt use for interacting with the Windows clipboard?

I've been browsing the Qt source code trying to find the actual system calls but it seems Qt doesn't use the Windows API documented on MSDN. For example grepping the source for "GetClipboardData" returns results in two files:
qclipboard_win.cpp:
#if defined(Q_OS_WINCE)
...
HANDLE clipData = GetClipboardData(CF_TEXT)
qaxserverbase.cpp:
STDMETHOD(GetClipboardData)(DWORD dwReserved, IDataObject** ppDataObject);
...
HRESULT WINAPI QAxServerBase::GetClipboardData(DWORD, IDataObject**)
{
return E_NOTIMPL;
}
and "SetClipboardData":
qclipboard_win.cpp:
#if defined(Q_OS_WINCE)
...
result = SetClipboardData(CF_UNICODETEXT, wcsdup(reinterpret_cast<const wchar_t *> (data->text().utf16()))) != NULL;
Neither of which seems useful, since they're being declared for Win CE/Mobile.
My Qt (4.8.1) uses OleSetClipboard and OleGetClipboard. The lines you got to are never reached in regular windows, as only in case of #if defined(Q_OS_WINCE) Qt uses #define OleSetClipboard QtCeSetClipboard and #define OleGetClipboard QtCeGetClipboard, and otherwise uses system-provided versions of those functions.
It was a little dificult to see this #if defined though, so you are excused ;)
It is so at least on my Qt version. If you are talking about qt, and especially about it's internals, you should menstion the version, right?

Qt auto software version?

Does Qt maintain any sort of versioning information about your program like .NET does? Like the build number? Or does it provide an easy way to access the SVN revision?
No.
But if you're using qmake then you can set compiler flags in the build system based on the results of arbitrary commands, which might be usable to do what you want.
For example, if you were using git, you could do something like this in your .pro file:
REVISION = $$system(git rev-parse HEAD)
DEFINES += APP_REVISION=$$REVISION
That would give you an APP_REVISION macro when compiling your program, which you could use like this:
// stringize macro
#define _STR(X) #X
#define STR(X) _STR(X)
QTextStream(cout) << "MyApp revision " STR(APP_REVISION) << endl;

Resources