How to Access Windows Event Log Using C++ with Qt and Win32 API

In this post I’ll share a method you can use to access and read events in Windows operating system, using C++. Note that this method is modified to be used with Qt, but you can easily replace the few Qt classes used in this example and remove the dependency on Qt if you are using any other frameworks. In any case, this method relies on Win32 APIs and will work only on Windows operating system.

Continue reading “How to Access Windows Event Log Using C++ with Qt and Win32 API”

How to Build Qt 5.9.2 Static Using MinGW

You can follow the instructions below to build Qt 5.9.2 from sources using MinGW, and statically. To be able to proceed further, you need to make sure you have all the prerequisites on your PC, which are mentioned in this post, then return here.Assuming that you have taken care of all the requirements, you can start by downloading MinGW and Qt 5.9.2 source codes, or take the better and “recommended” route and simply download both of them using the Qt 5.9.2 all-in-one installer for Windows.

Continue reading “How to Build Qt 5.9.2 Static Using MinGW”

Computer Vision with OpenCV 3 and Qt5, Now Available for Preorder

It is one thing to become an author, but it is totally another level of joy, to be published by my most favorite publisher in the computer science industry. So, it is with great pleasure that today I can announce that my upcoming book about OpenCV and Qt is available for preordering on Amazon, and also from PacktPub. It’s titled “Computer Vision with OpenCV 3 and Qt5”, and it aims to teach both computer vision and application development for developers who are familiar with C++ (on an intermediate level), but want to learn about powerful cross-platform frameworks such as Qt and OpenCV with hands-on examples and clear instructions. The book is in its final stages of completion, so I’m also excited to announce that our goal is to make it available by the beginning of 2018 and we are working hard to make it happen. Here are the links to preorder:

https://www.packtpub.com/application-development/computer-vision-opencv-3-and-qt5



How to Use C++/Qt/QML/OpenCV to Write Mobile Applications

I have avoided using QML for long time and always wrote even the most simple applications using Qt Widgets and C++ code but the release of Qt’s Quick Controls 2 and Material Style just made it very irresistible and I had to go for it. Well it didn’t take too long to get a hold of things (for a newcomer) since I had enough programming experience and QML is just too well-structured and easy to learn and use. In this post I’m going to share a project that demonstrates using OpenCV in QML to write beautiful and powerful Android (and other platforms) apps.

Continue reading “How to Use C++/Qt/QML/OpenCV to Write Mobile Applications”

Diffuse Shading in OpenGL Using Qt

This one is taken from one of my favourite books (OpenGL 4.0 Shading Language Cookbook) and the relevant chapter’s title for this tutorial in the book is called “Implementing diffuse, per-vertex shading with a single point light source”. Of course it’s modified to use OpenGL ES in Qt which is more cross-platform and creates less issues with building and running on different operating systems (including Android and iOS)

Continue reading “Diffuse Shading in OpenGL Using Qt”

How to Read Wavefront OBJ Files Using C++/Qt

First of all let’s briefly go through what’s an OBJ File. Here’s a very brief description from Wikipedia: “OBJ (or .OBJ) is a geometry definition file format first developed by Wavefront Technologies for its Advanced Visualizer animation package. The file format is open and has been adopted by other 3D graphics application vendors.” Anyway, I’ll assume that now that since you’re here you already know what an OBJ File is and How and Where to use it.

Continue reading “How to Read Wavefront OBJ Files Using C++/Qt”

How to Show a Toast Message in Qt for Android

If you’re a regular Qt user (like me) and have tried writing Android applications with Qt then you must have come across situations where you’ve needed some very simple capabilities of Android API but it wasn’t present in the Qt library. Displaying a Toast message in Qt for Android is one of those situations. In this post I’m going to describe how to display Toast messages in Qt for Android, and it’s also a very good example of showing how to use JNI (QAndroidJniObject class in Qt, along with Java code) to access Java code from within C++/Qt code.

Continue reading “How to Show a Toast Message in Qt for Android”

How to Get Current App Version in Qt

I have tried numerous methods to get an application’s own version number and believe me this is the best way to get it. First of all if we consider the fact that setting a Qt application version is done in PRO file (qmake) using the following simple command:

VERSION = 1.2.3.4

Then getting this same value should be the easiest possible method.

Just add the following line to your PRO file after defining version as seen above and you can use the same version string wherever you like in the code:

DEFINES += APP_VERSION=\\\"$$VERSION\\\"

APP_VERSION will contain the string “1.2.3.4” and can be used in the C++ code.