Hello Qt, Hello OpenGL, Hello World

The example project that I am going to share in this post is the absolute beginner guide version of using OpenGL in Qt (Specially Qt5 and latest versions of OpenGL) which to my surprise I could not find anywhere. By checking the existing OpenGL examples in Qt I noticed they all make some assumptions about what you know about OpenGL and then go ahead and describe how to use in in Qt. [I hope, I really do] that is not what you’ll find here. So without further ado here is the most simple example.

Continue reading “Hello Qt, Hello OpenGL, Hello World”

How to Access Android Camera Using Qt/C++

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 and Qt together. I strongly recommend that you should first read this article (which describes how to access Android Gallery from Qt) and also this article (which shows how to mix Java and C++ code in Qt) and then return here because I will be assuming that you are familiar with those processes. So if you can already access Android Gallery using Qt then continue reading the steps described below.

Continue reading “How to Access Android Camera Using Qt/C++”

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