Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Custom Widgets

In this example the widget we want to make usable for the designer is called RListView, which is derived from QListView. The plugin class we create will be named RListViewPlugin.

Adding the new Plugin Class to the custom Widgets

Create the new header file as shown below:

Create the new class. Be sure to include both, the Plugin header file just created, and the header file of the widget you want to map. It might be necessary to include the base class of your class as well, in this example QListView (RListView derives for QListView).

Adding the new Plugin Class to the custom Widgets

Every plugin must be initialized in RCustomWidgets:

// existing includes
// include the created header file
#include "RListViewPlugin.h"
QObject(parent) {
// existing plugins
// append the new plugin to the widgets
widgets.append(new RListViewPlugin(this));

That's it. Re-start the Designer and check if the plugin library is loaded correctly (Menu "About: Plugins"). The newly create custom widgets is now shown under the group "RCustomWidgets".