KGENDESIGNERPLUGI(1)
π KGENDESIGNERPLUGIN π
okay bestie, welcome to the manual for kgendesignerplugin β it lives in the KDE Frameworks KDesignerPlugin fam (section 1 of the manual, iykyk) and it's literally about to save you from writing the same boring boilerplate over and over. slay.
β¨ NAME β¨
kgendesignerplugin β Generates widget plugins for Qt(TM) Designer.
πΈ SYNOPSIS πΈ
kgendesignerplugin [OPTIONS...] file
π¦ DESCRIPTION π¦
so here's the tea. The custom widget plugins for Qt(TM) Designer usually follow a standard pattern, and the classes provided by the plugin mostly provide static information, along with function to create an instance that is normally just a simple constructor call.
and that's where our girl comes in π
kgendesignerplugin allows developers of libraries that provide new widgets to create such a plugin without creating all the associated boilerplate code β you just hand it a simple ini-style description file and it does the whole thing. iconic behaviour, honestly.
and the best part? kgendesignerplugin chooses sensible defaults for most settings, so minimal configuration is usually necessary. lowkey the laziest (affectionate) workflow ever π«Ά
π OPTIONS π
-ofile β The name for the generated C++ file. If not given, stdout will be used.-nplugin-name β Provided for compatibility. The default value for thePluginNameoption in the input file.-ggroup β Provided for compatibility. The default value for theDefaultGroupoption in the input file.--authorβ Show author information.--licenseβ Show license information.-h,--helpβ Show a brief help text.-v,--versionβ Show version information.
π FILE FORMAT π
The input file is an ini-style configuration file (specifically, it is in the format supported by the KConfig framework) that describes a set of widgets. It contains a [Global] section, providing general information about the plugin, and a section for each widget that should be included in the plugin.
π The [Global] section π
The [Global] section can have the following entries:
DefaultGroupβ The default value for theGroupentry in the class sections (default:"Custom", unless the-goption is given).Includesβ A (comma-separated) list of required includes (default: empty). Note that the header files for the widgets specified later in file should not be listed here; instead, this is for special headers for the plugin's own use, like those for classes providing previews.PluginNameβ The name of the main C++ class in the plugin (default:"WidgetsPlugin", unless the-noption is given).
π§ Class sections π§
Each class should have its own [ClassName] section, which can include the following entries:
CodeTemplateβ The value returned by thecodeTemplate()function of the plugin, which is marked for "future use" by Qt(TM) Designer (default: empty).ConstructorArgsβ The arguments to pass to the constructor of the class given byImplClass; these must be surrounded by parentheses (default:"(parent)"). The only variable guaranteed to be available isparent, which is the parentQWidgetpassed by Qt(TM) Designer.
This entry is ignored if CreateWidget is set.
CreateWidgetβ The code necessary to create an instance of the widget (default: usesnewto create an instance of the class given by theImplClassentry, passing the arguments specified byConstructorArgs). See the notes forImplClassandConstructorArgs.DomXMLβ An XML UI description of the widget (default: the default provided by the Qt(TM) Designer plugin headers).Groupβ The group to display the widget under in Qt(TM) Designer (default: the value of theDefaultGroupentry in the[Global]section).IconNameβ The image file or standard icon name to use as the icon for this widget in the Qt(TM) Designer widget list (default: a PNG file named with the section name, with any double colons removed, in the"pics"directory of a compiled-in resource file; for example,:/pics/Foo.pngin the section[Foo], or:/pics/FooBar.pngin the section[Foo::Bar]).ImplClassβ The class that should be used to create an instance of the widget for the use of Qt(TM) Designer (default: the section name). Note that this does not actually have to be the class that would be created for an end application: that is determined by theDomXML.
This entry is ignored if CreateWidget is set.
IncludeFileβ The header that needs to be included to use this widget (default: the lowercase version of the section name, with any colons removed and".h"appended; for example,foo.hin the section[Foo], orfoobar.hin the section[Foo::Bar]).IsContainerβ Whether this widget can contain other widgets (default: false).ToolTipβ The tooltip to display when hovering over the widget in the widget list of Qt(TM) Designer (default: the section name, with" Widget"appended; for example,Foo Widgetin the section[Foo]).WhatsThisβ The What's This text associated with the widget in Qt(TM) Designer (default: the section name, with" Widget"appended; for example,Foo Widgetin the section[Foo]).
π EXAMPLES π
The simplest description file might look like:
[Foo]
ToolTip=Displays foos
[Bar]
ToolTip=Bar editor
Note that each class must have at least one key set (ToolTip was used in this example), otherwise it will be ignored. π
Usually, you want to change at least the user-visible text, which means the ToolTip, WhatsThis and Group entries. Additionally, setting the plugin name can be a good idea to prevent possible symbol clashes and not confuse debuggers (both the debugger application and the person doing the debugging):
[Global]
PluginName=FooWidgets
DefaultGroup=Display
[Foo]
ToolTip=Displays bears
WhatsThis=An image widget that displays dancing bears
[Bar]
ToolTip=Bar editor
WhatsThis=An editor interface for bars for bears
Group=Editing
More complex files may be necessary if you have namespaced classes or extra options that need supplying to constructors, for example:
[Global]
PluginName=FooWidgets
DefaultGroup=Foo
[Foo::Bar]
ToolTip=Displays bars
WhatsThis=A widget that displays bars in a particular way
IncludeFile=foo/bar.h
IconName=:/previews/bar.png
[Foo::Baz]
IncludeFile=foo/baz.h
ConstructorArgs=(Foo::Baz::SomeOption, parent)
Group=Foo (Special)
IsContainer=true
IconName=:/previews/baz.png
Sometimes especially complex widgets might need a special "preview class" implementation for use in Qt(TM) Designer; this might be a subclass of the real widget that just does some extra setup, or it might be a completely different implementation.
[Global]
Includes=foopreviews.h
[FancyWidget]
ImplClass=FancyWidgetPreview
π₯ SEE ALSO π₯
- <https://doc.qt.io/qt-5/designer-creating-custom-widgets.html> β The Qt(TM) Designer documentation on creating plugins for custom widgets.
π BUGS π
Please use KDE's bugtracker[1] to report bugs, do not mail the authors directly. (fr fr, they're begging you, bestie π)
π AUTHORS π
- Richard Johnson
<rjohnson@kde.org>β Wrote the original documentation. - Alex Merry
<alexmerry@kde.org>β Updated the documentation for KDE Frameworks 5.
π NOTES π
- KDE's bugtracker β <https://bugs.kde.org>
and that's a wrap, bestie!! this little page came to you from KDE Frameworks, Frameworks 5.0, dated 2014-05-28 β so go forth, generate those widget plugins, and remember: minimal configuration is usually necessary, so don't overthink it π β¨ππ¦
π¦ where this page comes from
- debian bookworm: kgendesignerplugin-bin 5.103.0-1 Β· LGPL-2.1+3+KDEeV
- debian trixie: kgendesignerplugin-bin 5.116.0-1 Β· LGPL-2.1+3+KDEeV
- epel 9: kf5-kdesignerplugin 5.116.0-1.el9 Β· LGPLv2+
- fedora 43: kf5-kdesignerplugin 5.116.0-5.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: kf5-kdesignerplugin 5.116.0-6.fc44 Β· LicenseRef-Callaway-LGPLv2+
- opensuse-leap 16.0: kdesignerplugin 5.116.0-bp160.1.14 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: kdesignerplugin 5.116.0-bp160.1.14 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: kdesignerplugin 5.116.0-bp160.1.14 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: kdesignerplugin 5.116.0-bp160.1.14 Β· LGPL-2.1-or-later
- ubuntu jammy: kgendesignerplugin-bin 5.92.0-0ubuntu1 Β· LGPL-2.1+3+KDEeV
- ubuntu noble: kgendesignerplugin-bin 5.115.0-0ubuntu5 Β· LGPL-2.1+3+KDEeV
- ubuntu resolute: kgendesignerplugin-bin 5.116.0-1 Β· LGPL-2.1+3+KDEeV
- ubuntu stonking: kgendesignerplugin-bin 5.116.0-1 Β· LGPL-2.1+3+KDEeV
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms