Allowing the users of your Qt application (regardless of whatever its purpose is) to use Drag & Drop is a very important aspect of writing easy to use apps and user interfaces. In this post I have described how to add Drag & Drop functionality in your Qt programs with just a few simple steps.
Continue reading “How to Add Drag & Drop Capability in Your Qt Application”How to set Android Screen Orientation in Qt
To be able to set your Android app orientation (to Portrait or Landscape mode) in Qt you have to modify AndroidManifest.XML manually. In this post I am going to describe where you can find this “AndroidManifest.XML”, because it does not exist in your project folder by default and how to modify it to set any desired Screen Orientation for your App.
Continue reading “How to set Android Screen Orientation in Qt”
How to use ODBC in Qt
ODBC (Open Database Connectivity) drivers allow connection to many databases out of the box. In Windows and Qt you can use ODBC Plugin (for Qt) to connect to those databases.
Continue reading “How to use ODBC in Qt”How to get screen size in Qt
Qt includes a very simple method to get the size of the screen (width and height). Here it is:
QSize size = qApp->screens()[0]->size();
Note that this function works perfectly in Android and iOS too.
Another thing to note is that if you replace [0] with 1, 2, 3, … you can access other monitors (if there are any) on desktop computers.
How to List All Running Programs and Windows in Qt
If you are learning how to use Windows API (specially Win32 API) in Qt you might have come across a lot of functions which require the usage of Callback Functions. A very well-known example is EnumWindows function. This function allows listing all open windows through a callback function.
Continue reading “How to List All Running Programs and Windows in Qt”How to correctly read Mat images with special characters in filename
You might have noticed that trying to read images that have special characters (such as Ü, Ö or other non-Ascii characters) with imread function in OpenCV will lead to crash. I noticed this while trying to open files with special Turkish characters (but I assume it is the same with Spanish, French, German or any other languages.) If you are using Qt, you are lucky because there is a workaround.
Continue reading “How to correctly read Mat images with special characters in filename”How to find Edges in a Qt QImage
Finding edges is crucial in many image processing applications because it gives a better understanding of the elements in a picture. This post contains download link to an example project (ready to build and run) in Qt that uses nothing but the existing Qt classes, namely QImage, to detect and display edges in a QImage.
How to read image orientation in Qt (Using stored EXIF)
Updated: QImageReader class in Qt has a new method (introduced in Qt 5.5) named transformation() which you can use for this purpose but this article still applies if you are not using 5.5 or having problems with QImageRaader. Also it is a useful example on how to use GDI in Qt.
You might have also noticed that Qt reads jpg, tif and other types of images that it supports without paying any attention to EXIF information stored in them. EXIF meta data contains highly valuable information about the characteristics of a photograph. Let’s say you want to read an image file into QImage and do some process over it. It is crucial to know what type of orientation the image needs to go through right after reading it.
Continue reading “How to read image orientation in Qt (Using stored EXIF)”How to display a Mat image in Qt
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.