Warning, /frameworks/kdesignerplugin/README.md is written in an unsupported language. File is not indexed.

0001 # KDesignerPlugin
0002 
0003 Integrating custom widgets with Qt Designer
0004 
0005 This tool is deprecated. In your CMake-based build system use [ECMAddQtDesignerPlugin](https://api.kde.org/ecm/module/ECMAddQtDesignerPlugin.html) from "Extra CMake Modules" instead.
0006 
0007 ## Introduction
0008 
0009 This framework provides a utility (kgendesignerplugin) that can be used to
0010 generate plugins for Qt Designer from ini-style description files.
0011 
0012 ## kgendesignerplugin
0013 
0014 To use kgendesignerplugin in your own project, add
0015 
0016     find_package(KF5DesignerPlugin)
0017 
0018 to your CMakeLists.txt file, and use the
0019 kf5designerplugin\_add\_widget\_files macro.  For example, you might do
0020 
0021     find_package(Qt5Designer)
0022     find_package(KF5DesignerPlugin NO_MODULE)
0023     include_directories(${Qt5Designer_INCLUDE_DIRS})
0024     if(Qt5Designer_FOUND AND KF5DesignerPlugin_FOUND)
0025        set(foowidgets_SRCS)
0026        kf5designerplugin_add_widget_files(foowidgets_SRCS
0027           foo.widgets
0028        )
0029        qt5_add_resources(foowidgets_SRCS
0030           foowidgets.qrc # preview images
0031        )
0032        add_library(foowidgets MODULE ${foowidgets_SRCS})
0033        target_link_libraries(foowidgets
0034           foo # library containing the actual widget classes
0035        )
0036        install(TARGETS foowidgets DESTINATION ${QT_PLUGIN_INSTALL_DIR}/designer)
0037     endif()
0038 
0039 foo.widgets is an ini-style configuration file (see the KConfig
0040 framework for format details) describing the widgets exported by the
0041 plugin.  It must include a [Global] section providing a PluginName entry
0042 (the value of which must be a valid C++ class name).  For example,
0043 
0044     [Global]
0045     PluginName=FooWidgets
0046 
0047 This section can also list additional headers that should be included
0048 for the plugin code to work, for example preview classes (see ImplClass
0049 documentation below), with the Includes entry.  It can also specify a
0050 default value for the Group option (see below) with the DefaultGroup
0051 entry.
0052 
0053     [Global]
0054     PluginName=FooWidgets
0055     Includes=classpreviews.h,otherinclude.h
0056     DefaultGroup=Foo Widgets
0057 
0058 In addition, it should have a section for each widget you wish to
0059 include in the plugin.  For example, if you have a class FooView (that
0060 inherits QWidget), whose header file is fooview.h, you could have the
0061 section
0062 
0063     [FooView]
0064     IncludeFile=fooviewwidget.h
0065     ImplClass=FooViewPreview
0066     Group=Views (Foo)
0067 
0068 The implementation of every method of QDesignerCustomWidgetInterface can
0069 be controlled using options similar to the Group entry in the above
0070 example, which causes the group() method to return "Views (Foo)".
0071 
0072 kgendesignerplugin attempts to pick sensible defaults for these values:
0073 
0074 - IncludeFile: would default to "fooview.h" if it were omitted from the
0075   example
0076 - Group: defaults to the value of DefaultGroup in the [Global] section,
0077   which itself defaults to "Custom"
0078 - ToolTip: defaults to "FooView Widget" in the example
0079 - WhatsThis: defaults to "FooView Widget" in the example
0080 - IsContainer: defaults to false
0081 - CreateWidget: defaults to `return new ImplClass ConstructorArgs` where
0082   ImplClass and ConstructorArgs are entries (see below)
0083 - DomXml: defaults to the value of
0084   QDesignerCustomWidgetInterface::domXml()
0085 - Initialize: the default simply sets the mInitialized variable to true
0086   if it is not already
0087 
0088 Note that no Icon entry is given above, instead you should provide an
0089 icon name with IconName; this defaults to ":/pics/fooview.png" in the
0090 above example.  You should include this image in a resource file.
0091 
0092 If your class requires arguments other than the parent widget, or you
0093 need to use a different class for previewing the widget in Qt Designer
0094 (FooViewPreview in the above example), rather than setting CreateWidget
0095 you can use some combination of ImplClass and ConstructorArgs:
0096 
0097 - ImplClass: would default to FooView if it were omitted from the
0098   example
0099 - ConstructorArgs: defaults to (parent) - note that the parentheses
0100   are required
0101 
0102