You can use this method to convert an OpenCV Mat image to a Qt QImage which then can be easily turned into a QPixmap and then displayed on a QLabel. It might sound a little bit confusing but I’ll explain all of its parts. Check the method and my descriptions below:
Continue reading “How to display a Mat image in Qt”How to blur an image in Qt
Today I want to share the source code of an example project that shows you how to blur (Gaussian blur) an image (QImage to be precise) without using any third party image processing libraries such as OpenCV. Sometimes it might be useful to avoid deploying OpenCV libs just for achieving a blur effect.
How to get position and size of another program’s window in Qt?
You can use Windows API functions to read the position (left and top, or x and y) of a window that does not belong to your program in Qt. GetWindowRect function allows you to read these values and also right and bottom which can then be used to extract width and height of that window. Note that you need to know the title of your target window or else it is not possible to achieve that. Follow th simple steps below to be able to do this.
Continue reading “How to get position and size of another program’s window in Qt?”Minimize All Windows Except Yours (in Qt)
You can use the little piece of magic in this post to minimize all programs and windows except yours in Qt (C++)
Continue reading “Minimize All Windows Except Yours (in Qt)”How to change Desktop background image in C++
In this post I am sharing a piece of code that I use to change Desktop Background image in Qt (C++) for Windows. This can be used in newer Windows versions (Windows 8 and later) and I have already tested it with Windows 10 64 bit. It involves using Windows interfaces in Qt.
Continue reading “How to change Desktop background image in C++”How To Mix C++ And Java Code (In Qt For Android)
Qt allows you to use Java code in your Android applications. This is the same code that Android Studio (or Eclipse etc.) users use when they are writing applications for Android. In Qt, by default, you are limited to C++ code and what the Qt modules have to offer (which in most cases are enough) but there are certain situations where you need to use something from Android API which is not provided in Qt. An obvious example for this can be using the default Android Galley to open a picture, or using Text-To-Speech engine or any other API that you can think of. If you don’t want to be limited to what is provided by Qt while writing Android apps then follow the steps below to be able to add Java code to your Qt project.
Continue reading “How To Mix C++ And Java Code (In Qt For Android)”How to build OpenCV from source for VC14
OpenCV 2.4.11 users may have noticed that it does not provide pre-built binaries (Libs and DLLs) for VC14 (Visual Studio 2015) Unfortunately it is also the case with Qt 5.5.1 (At least it’s true at the time of writing this article) so if you are going to use either one of them you have to build it yourself.
I was also faced with this obstacle so I decided to write a guide for anyone who wishes to built OpenCV for VC14.To do that, just follow the steps below:
How to enumerate installed Windows Media Codecs in Qt
To get a list of all available Windows Media Codecs in Qt you have no other choice but to use C++ interfaces from Windows Media Format SDK. In this post I am sharing an example source code which allows you to do that in Qt. If you are developing using Qt and MSVC compilers for Windows then you can definitely download this source code, build and run it for yourself.
Continue reading “How to enumerate installed Windows Media Codecs in Qt”How To Get Free Disk Space In C++ (Qt for Windows)
You can use the following Win32 API function to get the free disk space in C++. Note that this function can be used with Qt for Windows if you add the required dependencies described in this post.
Continue reading “How To Get Free Disk Space In C++ (Qt for Windows)”How to use VBScript in C++ (Using Qt)
In this article I’ll explain the process of combining C++ and VBScript codes together. There are many situations in which you find yourself in desperate need of some simple code that can handle what your program wants to do. An example that comes to my mind is using DDE Protocol in Windows. It can be heartbreaking to try and write a quick DDE handling program using C++. Well on the other hand it is extremely easy using VBScript. But I am not going to talk about DDE I this post. Search Google for “how to connect to DDE using VBScript” and combine that with what you learn from this post. So here it is:
Continue reading “How to use VBScript in C++ (Using Qt)”