Qt Custom Widget - Orientation Button

Опубликовано: 02 Октябрь 2024
на канале: vrfEducationEnglish
264
1

#qt #qtprogramming #qtplugin #qtwidget #customwidget #QDesignerCustomWidgetInterface #Q_PLUGIN_METADATA

Sometimes it happened to need align PushButton vertically on your .ui file. With QPushButton you can't do this. So I created a new widget for this purpose named OrientationButton. This button supports both vertical and horizontal alignment.
I also add a plugin for this widget, so you can add it to Qt Creator standard widgetbox. And the add it to your .ui file at design time.

Custom widgets is a way in Qt that we can add a new widget into our Qt creator standard widgetbox. Using this feature we need to create a new widget and then create a plugin for that. Using this plugin Qt creator will be able to load our widget at design time.
Most of developers just create new widgets and try to add those widgets at runtime to their UI. It's a little bit annoying and make other developers confused when they open .ui files.

source code also available on my github (vrfeducation)
There is also another widget name OrientationLabel that act the same for labels