How to Convert QBuffer to QString

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();



Fix ModSecurity Issues in Qt Network Module Download Functionality

You might have come across the following (Not Acceptable) error when trying to download files from some websites using Qt. This error message is generated by ModSecurity and it usually means that for some reason the web server does not allow downloading of the file using the method you are trying. In my case it was because of the User-Agent Header set to a value not allowed by the server. So here is how I fixed it:

Continue reading “Fix ModSecurity Issues in Qt Network Module Download Functionality”

How to Create an Empty QImage to Play Around With

You can create a QPixmap and convert it to QImage if you just want to have a QImage for modification and manipulation. Here, you can use the following code to achieve this:

int width = 100;
int height = 200;
QImage image = QPixmap(width, height).toImage();


How to Fix Facebook Share No Thumbnail/Description Issue

Sometimes when you share a URL in Facebook you notice that there is no description or thumbnail image in the shared link. This happens mostly because there is no image and/or description in the URL you are trying to share. In order to find out what is missing from the URL’s contents that causes this issue, you can use Facebook’s Sharing Debugger Tool.

Continue reading “How to Fix Facebook Share No Thumbnail/Description Issue”

How to Build OpenCV 2.4.13 Static/Dynamic with MSVC2010

OpenCV 2.4.13 was released just a few days ago and as a tradition I had to check if a static build with Microsoft Visual C++ 2010 (MSVC2010) 32-bit produced any errors or not. Fortunately, everything went quite smoothly (except a few common warnings here and there) and I was able to successfully build it so if you need to build the latest OpenCV release statically using MSVC2010 you can follow the steps below:

Continue reading “How to Build OpenCV 2.4.13 Static/Dynamic with MSVC2010”