There are many cases in every cross-platform development framework that you want your source code to be built differently under different operating systems. For example you might want a method to to use platform specific functions in Windows, Linux and Mac OS X but you don’t want to have different projects for each one of […]
Frame in a window is the part of window that is crated and managed by the OS. It contains usually contains all borders and title bar of the window. To remove the frame of any window using Qt you need to use the following piece of code: setWindowFlags(Qt::Window | Qt::FramelessWindowHint); Note that this will also […]
Below I have described the method to get active (focused) windows title using Qt in Linux systems (Such as Ubuntu, CentOS etc.) Basically you use xdotool with two parameters mentioned below to get the title of current window which has the focus.
You can use the following function to get current user name is Linux. I have tested this on Ubuntu and CentOS flavors but it should also work with other flavors without any issues.
In this article I am going to describe how to get the title of the window which has the focus, or in other word is currently active. To be able to achieve this in Qt/C++ you need to use the operating system API functions, in this case Win32 API.
You can use the following snippet to make your MainWindow or any other window always on top: setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); Just insert it in your window’s constructor function.
In this article I am going to describe the required steps needed for accessing Android Camera (or Default Camera Interface) using Qt. Unfortunately OpenCV does not provide a reliable way of connecting to Camera in Android so you have go for a method like this if you intend to write an Android application which uses OpenCV […]
There are scenarios where you would need to find the sum or the average of all values in a QByteArray. This can specially happen if you are trying to send data using COM ports to devices that require the average or sum (or a similar combination) of all elements in order to check the integrity […]
Qt Framework implements many convenience functions inside QByteArray for quickly handling of raw data. One of the widely used encoding methods is Base64 and if you’re with Qt, you can easily convert any string (QString) to/from Base64.
You can convert QBuffer to QString using buffer function of the QBuffer. Here is how you can do it. QBuffer b; b.open(QBuffer::ReadWrite); b.write(“http://amin-ahmadi.com”); QString str = b.buffer(); qDebug() << str; // “http://amin-ahmadi.com” b.close();