Qt

Fixing ~crappy~ no-good Qt-includes

Written by  on January 29, 2019

How to locate all includes of that style:

with proper

Fired up https://regex101.com/ and set it to PHP and created an expression, which matches:
starting with slash, then a q, then characters, then . then h

(Replace & check has to be done by YOU ;))

Qt5: connect: How to use ‘connect’ in case the slot has less parameters than the signal

Written by  on September 18, 2018

Task is to connect from one signal with one parameter to a slot with zero parameters. With the “old” Qt4-way of connect it works like this

But what if I want to use the type-safe Qt5-connects?

The documentation just mentions the cases with:
* connect to default parameters in slot
* and (for example) using the above-mentioned way of the string-based connect.

My idea was to use a lambda to fix this:

But it turned out in in this thread that

is possible! 🙂

First pull-request on github, yay!

Written by  on August 5, 2018

Searched for a usable NTP-library, which assorts well with Qt and stumbled over qntp. While fiddling around I noticed in their source some opportunities to improve the code. So I cloned the repo, did them and created my very first pull-request for open-source 🙂
(Side-note: currently mostly Python-code is pushed due to the daily coding-challenge. But C++/Qt is still my carthorse.)

MPC: adding additional DEFINES

Written by  on May 25, 2018

Some weeks ago I noticed how the qDebug()-output could be enriched, so that in bigger solutions with a lot of different “unknown” components a reported error could be immediately pinned. And you save writing always __FILE__ and __LINE__. Referres to this post.
But the problem was that with the mpc-buildsystem it was unknown to me how to force it to put this DEFINE into the vcxproj-files.

It can be done via the “macros”-statement!

So I worked on my Python-skills and wrote a short script which iterates the given path recursively and fixes all mpc-files by checking for the position of the line with the last closingbrace “}” and then it adds before that position the line. Of course, the experts know several thousand ways to improve that script – but I am currently happy with it. It works, it is debug-able (.sh, I look at you!) and I will use the skeleton also for some other tasks.
It can be found (like most Python-snippets) at: https://github.com/marcelpetrick/pythonCollection

QT_MESSAGELOGCONTEXT: more detailed qDebug()

Written by  on April 19, 2018

Add to your environment:

Windows: set either via “set” or via RapidEnvironmentEditor.
In case of a no-debug-build, add QT_MESSAGELOGCONTEXT to DEFINES in the pro-file.

(Open question: if there are just mpc/vcxproj-files, then how to trigger?)

related sources:
* https://woboq.com/blog/nice-debug-output-with-qt.html
* https://fecub.wordpress.com/2015/11/04/better-debug-output-using-qt_message_pattern/
* http://doc.qt.io/qt-5/qmessagelogcontext.html#details

Convert *.pro to *.vcxproj (qmake to Visual Studio-project)

Written by  on April 5, 2018

0. Change this particualar line inside the *.pro:

1. run qmake against that pro-file
2. load the vcxproj with Visual Studio

edit: or do it with the original pro-file just like the wiki.qt.io suggests:

Cullendula

Written by  on April 3, 2018

Small program to pick out the best shots of the vast amount of taken pictures per session (excursion). The name itself is a wordplay of the plant Calendula and the activity “to cull” (slang for sorting the photos).

url for the repository: https://github.com/marcelpetrick/Cullendula/
development time for fully usable version 0.1: one day
used technologies: C++ and Qt – my favorite ones <3

VisualStudio-Addin for Qt

Written by  on March 22, 2018

The source for the current downloads: https://download.qt.io/official_releases/vsaddin/ (for MSVC 2013, 2015 and 2017), because I had to (again) search for the installation-files.

proper rename-scheme for digiKam

Written by  on October 28, 2017

The Olympus-cam has no nice way to set an immediate scheme for the filename, so I transfer the files to the PC and fire up digiKam:

Fun fact: since it is based on KDE –> Qt, it also uses the same formatting for DateTime like Qt. Horay 🙂

Addendum: to fix the annoying “no klauncher found”-message and the invisible thumbnails after some certain apt-get-upgrades, just run

again.

proCreator version 0.1 is ready!

Written by  on October 22, 2017

url: https://github.com/marcelpetrick/proCreator

Clone, build (preferrably with QtCreator 4.x and Qt 5.9), run. A short howto in the readme describes how to use it.
After applying some restructuring, I got rid of some classes, simplified the code for reading the directory-content and for filtering. Kudos to the Qt-library!*

* Three slogans I like to stick to:
– Keep it simple (and stupid).
– Don’t re-invent the wheel.
– Functionality first.

Addendum: the proCreator was used now to revive two projects for which only source-code, but no “make-files” (pro, qbs, mpc, cmake ..) existed. It did its job 🙂