File and data compression using Qt is extremely easy. There are many cases where you’d possibly like your data to be compressed (for example before sending it over network to a remote host) and in such cases you can use the approach below:
Continue reading “How to Compress Files/Data Using Qt”Use QGraphicsSepiaEffect to Add Sepia Effect Widgets
In this post I’m sharing a class called QGraphicsSepiaEffect that you can use to add Sepia effect to your Qt Widgets. It inherits QGraphicsEffect, which means you can easily add it to your project and use a single line of code to have Sepia effect on any widget or image (i.e. on a QLabel).
Continue reading “Use QGraphicsSepiaEffect to Add Sepia Effect Widgets”How to Get the List of COM / ActiveX Controls
You can use ActiveX Control List application to get a complete list of currently installed and registered ActiveX (and COM of course) components that are available on the system.
Continue reading “How to Get the List of COM / ActiveX Controls”
How to Find a Website’s IP Address Using Qt/C++
QHostInfo class provides an static function (lookupHost) that you can use to get any host’s (including a website’s) IP address quickly and efficiently.
Here is an example of how you can get Google’s IP Address using Qt/C++:
Continue reading “How to Find a Website’s IP Address Using Qt/C++”How to Find Local IP Addresses in Qt
Below is the approach I use to get all of the IP addresses for the local computer. Note that this method also gives you all Subnet Masks which you can then use to find all IP addresses in a subnet, say for scanning a Home Network or any similar purpose.
Continue reading “How to Find Local IP Addresses in Qt”How to Read PDF Files Using ActiveX in Qt
To be able read PDF files in your Qt applications you can use any 3rd party libraries but my choice is to use Adobe Acrobat Reader ActiveX in a QAxWidget object. The approach is quite simple as long as you have Acrobat Reader ActiveX installed on your computer.
Continue reading “How to Read PDF Files Using ActiveX in Qt”How to Add a Splash Screen for Your Qt Application
Qt provides QSplashScreen class in case you want to have a splash screen for your application without any efforts. You can use the approach below to add an splash screen image of your choice using QSplashScreen and QPixmap classes that stays for 1 second and then disappears.
Continue reading “How to Add a Splash Screen for Your Qt Application”How to Get Window Handle (HWND) in Qt
You can use the following approach to get a Window‘s Handle in Qt. This can be useful in case you need to call a Windows API (Win32 API) function that is not implemented in Qt or for any other purposes.
Continue reading “How to Get Window Handle (HWND) in Qt”What you need to know about LPCTSTR in Windows API (Specially for Qt users)
This question comes up a lot and is sometimes very confusing but if you just pay attention for a few seconds you’ll get past this forever, I promise you.
Continue reading “What you need to know about LPCTSTR in Windows API (Specially for Qt users)”How to Convert QString to Wide C String (wchar_t *)
The same as standard C String, for this also you can go through standard C++ as shown below:
Let’s say you have a QString, like this:
QString s = "www.amin-ahmadi.com";
First convert it to std::wstring and then use its c_str method, like this:
s.toStdWString().c_str()