Unfortunately for Cross-Platform developers, there is no standard method or API that you can code once and use to have TTS (Text to Speech) in your programs. You may find some 3rd party libraries that allow a great deal of reusability in different Operating Systems but at some point they also prove to do less than what you require. Qt has promised to make this available for us in the near feature but it has been postponed all the time. The main reason is that there is a huge race between major Software companies (Microsoft, Google and Apple) in this field and it seems that they somehow make it work in totally different ways on purpose. So anyway that is why I decided to share the method to have TTS in Qt in all well known operating systems and I am going to start with the easiest one, which is Windows. Continue reading “How to Use Text to Speech in Qt for Windows”
How to Get the Position of a Widget in a Cell (QTableWidget)
In this article I describe how you can get the position (row and column) of a Widget in a Cell, or to be precise, how to get row and column of a QWidget in a QTableWidget. This is specially useful in case you have a button or any other widget and you want to perform a task specific to that widget when it is pressed or triggered in any way.
Continue reading “How to Get the Position of a Widget in a Cell (QTableWidget)”How to Set a QLabel color using QColor
Strange as it is, sometimes you need to go through some not-at-all-obvious procedures to solve simple problems such as this. QLabels allow writing and displaying HTML codes so one way of setting a QLabel’s color would be by setting the color as it is done in HTML but in Qt there is another way.
Continue reading “How to Set a QLabel color using QColor”How to Add Drag & Drop Capability in Your Qt Application
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.