What is qobject_cast?

Before you start learning what qobject_cast is, you would need to know what C++’s dynamic_cast is. Dynamic cast is all about polymorphism. C++’s dynamic cast uses RTTI (Run Time Type Information) to cast an object. But qobject_cast does this without RTTI. What is dynamic cast? For example suppose we’ve got a car factory function. Like … Read more

How do I use Qt in Visual Studio Code?

You should give a chance for this extension: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools With this, you can configure include paths for better IntelliSense results. Configuring includePath One way to configure e.g the QtCore module. Ctrl + Shift + p to open command palette Search for: C/Cpp: Edit Configurations You should have a new tab called: c_cpp_properties.json In configurations array … Read more

Inserting an image in a GUI using Qt Designer

You can start inserting a label. Next, you right click on it an then click “change rich text…”. A new window will pop-up. Click on the figure Icon “Insert figure”. Now, you have to create a resource file. Click on the Pencil button. Next, click on the “New resource file” button. Choose a name and … Read more

qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” even though it was found.

For the Qt 6.5.0 release, the missing library was libxcb-cursor.so.0, resolved with sudo apt install libxcb-cursor0 With that, the sample widget and gui projects from QtCreator run correctly built with Qt 6.5.0. libxcb-cursor.so.0 wasn’t previously needed for Qt 6.4.0. I identified the missing library with this shell code for l in /path/to/Qt/6.5.0/gcc_64/lib/*.so; do echo $l; … Read more