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 Use OpenCV in Unity (Example Project)

This is a post that many people have requested recently. I’m going to describe how you can use OpenCV in Unity. Of course we’ll be using official OpenCV libraries and not any assets or existing plugins.  For those of you who aren’t familiar with the subject, Unity is a very popular game engine which allows building games, apps and so called experiences with much ease. Unity allows some modified form of JavaScript and also C# for its scripting. In this example project I’ll use C# since that’s the language I’m familiar with but it shouldn’t be hard to adapt this to JavaScript (but you’re gonna do it yourself if needed, sorry) so let’s start.

Continue reading “How to Use OpenCV in Unity (Example Project)”

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”

Full Featured VNC Client Widget for Qt

In this post I am going to share a Qt widget that allows full control (view and control) of VNC servers over TCP/IP. Using it is as simple as dropping a QWidget on your user interface and then promoting it to QVNCClientWidget. I needed this recently but was not able to find a Qt widget or any other Qt/C++ code for that matter, that supports VNC Authentication and can be used in a  real cross-platform way. So I had to gather and write this widget piece by piece and make sure it build on all platforms supported by Qt.

Continue reading “Full Featured VNC Client Widget for Qt”

Hello Qt, Hello OpenGL, Hello World

The example project that I am going to share in this post is the absolute beginner guide version of using OpenGL in Qt (Specially Qt5 and latest versions of OpenGL) which to my surprise I could not find anywhere. By checking the existing OpenGL examples in Qt I noticed they all make some assumptions about what you know about OpenGL and then go ahead and describe how to use in in Qt. [I hope, I really do] that is not what you’ll find here. So without further ado here is the most simple example.

Continue reading “Hello Qt, Hello OpenGL, Hello World”

How to Update Your Qt Application’s Taskbar Icon at Runtime

To update a Qt app’s taskbar icon you need to create a QIcon object and assign it using setWindowIcon of the QApplication. Here is very simple example:

qApp->setWindowIcon(QIcon("path-to-an-image-file"));

Notice that you are not required to provide an icon file (*.ico , *.icns etc.) for this function to work and you can use any (standard) image file type such as *.jpg or *.png etc. This function can be called anywhere in the program. You can use this same method along with a QTimer to ANIMATE TASKBAR ICON.