How to Use Text to Speech in Qt for Windows

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 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 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”