decouple custom widget classes from designer component

this opens up possibilities for writing a new designer tool or
unexporting the designer and designer components classes and making
them part of the designer tool for example

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-10-28 19:51:19 +03:00
parent b821713bad
commit 49f0becf27
36 changed files with 217 additions and 323 deletions

View file

@ -112,11 +112,11 @@ endif()
set(KATIE_TYPE SHARED CACHE STRING "Build type")
# components and tools that will be build, changed depending on the requirements availability
# NOTE: excluding DesignerComponents as it was never used as public component, currently only
# used by the the designer tool. if it is ever needed for something it can just be added here,
# Q_DESIGNER_COMPONENTS_EXPORT must be introduced and genmap.py adjusted - the rest of the
# build system has everything in place.
set(KATIE_COMPONENTS "Core Gui Declarative Designer Network Svg Xml Script ScriptTools Test UiTools")
# NOTE: excluding Designer and DesignerComponents as they were never used as public components,
# currently only used by the designer tool. if needed for something they can just be added here,
# Q_<component>_EXPORT must be introduced and genmap.py adjusted - the rest of the build system
# has everything in place.
set(KATIE_COMPONENTS "Core Gui Declarative Network Svg Xml Script ScriptTools Test UiTools")
set(KATIE_TOOLS "moc uic rcc designer qscript qtconfig")
set(KATIE_HEADERS_PATH "${CMAKE_INSTALL_FULL_INCLUDEDIR}/katie" CACHE PATH "Headers installation path")
@ -506,14 +506,16 @@ katie_generate_obsolete(QCloseEvent QtGui qevent.h)
katie_generate_obsolete(QContextMenuEvent QtGui qevent.h)
katie_generate_obsolete(QContiguousCacheData QtCore qcontiguouscache.h)
katie_generate_obsolete(QContiguousCacheTypedData QtCore qcontiguouscache.h)
katie_generate_obsolete(QCustomWidget QtUiTools customwidget.h)
katie_generate_obsolete(QCustomWidgetPlugin QtUiTools customwidget.h)
katie_generate_obsolete(QDateEdit QtGui qdatetimeedit.h)
katie_generate_obsolete(QDate QtCore qdatetime.h)
katie_generate_obsolete(QDBusAbstractInterfaceBase QtDBus qdbusabstractinterface.h)
katie_generate_obsolete(QDBusObjectPath QtDBus qdbusextratypes.h)
katie_generate_obsolete(QDBusPendingCallWatcher QtDBus qdbuspendingcall.h)
katie_generate_obsolete(QDBusPendingReplyData QtDBus qdbuspendingreply.h)
katie_generate_obsolete(QDBusSignature QtDBus qdbusextratypes.h)
katie_generate_obsolete(QDBusVariant QtDBus qdbusextratypes.h)
katie_generate_obsolete(QDate QtCore qdatetime.h)
katie_generate_obsolete(QDateEdit QtGui qdatetimeedit.h)
katie_generate_obsolete(QDeclarativeAttachedPropertiesFunc QtDeclarative qdeclarativeprivate.h)
katie_generate_obsolete(QDeclarativeListProperty QtDeclarative qdeclarativelist.h)
katie_generate_obsolete(QDeclarativeListReference QtDeclarative qdeclarativelist.h)
@ -522,8 +524,6 @@ katie_generate_obsolete(QDeclarativeTypeInfo QtDeclarative qdeclarativeprivate.h
katie_generate_obsolete(QDesignerActionEditorInterface QtDesigner abstractactioneditor.h)
katie_generate_obsolete(QDesignerComponents QtDesigner qdesigner_components.h)
katie_generate_obsolete(QDesignerContainerExtension QtDesigner container.h)
katie_generate_obsolete(QDesignerCustomWidgetCollectionInterface QtDesigner customwidget.h)
katie_generate_obsolete(QDesignerCustomWidgetInterface QtDesigner customwidget.h)
katie_generate_obsolete(QDesignerDnDItemInterface QtDesigner abstractdnditem.h)
katie_generate_obsolete(QDesignerDynamicPropertySheetExtension QtDesigner dynamicpropertysheet.h)
katie_generate_obsolete(QDesignerExtraInfoExtension QtDesigner extrainfo.h)
@ -552,16 +552,16 @@ katie_generate_obsolete(QDomAttr QtXml qdom.h)
katie_generate_obsolete(QDomCDATASection QtXml qdom.h)
katie_generate_obsolete(QDomCharacterData QtXml qdom.h)
katie_generate_obsolete(QDomComment QtXml qdom.h)
katie_generate_obsolete(QDomDocument QtXml qdom.h)
katie_generate_obsolete(QDomDocumentFragment QtXml qdom.h)
katie_generate_obsolete(QDomDocument QtXml qdom.h)
katie_generate_obsolete(QDomDocumentType QtXml qdom.h)
katie_generate_obsolete(QDomElement QtXml qdom.h)
katie_generate_obsolete(QDomEntity QtXml qdom.h)
katie_generate_obsolete(QDomEntityReference QtXml qdom.h)
katie_generate_obsolete(QDomImplementation QtXml qdom.h)
katie_generate_obsolete(QDomNamedNodeMap QtXml qdom.h)
katie_generate_obsolete(QDomNode QtXml qdom.h)
katie_generate_obsolete(QDomNodeList QtXml qdom.h)
katie_generate_obsolete(QDomNode QtXml qdom.h)
katie_generate_obsolete(QDomNotation QtXml qdom.h)
katie_generate_obsolete(QDomProcessingInstruction QtXml qdom.h)
katie_generate_obsolete(QDomText QtXml qdom.h)
@ -612,30 +612,31 @@ katie_generate_obsolete(QGraphicsSceneResizeEvent QtGui qgraphicssceneevent.h)
katie_generate_obsolete(QGraphicsSceneWheelEvent QtGui qgraphicssceneevent.h)
katie_generate_obsolete(QGraphicsSimpleTextItem QtGui qgraphicsitem.h)
katie_generate_obsolete(QGraphicsTextItem QtGui qgraphicsitem.h)
katie_generate_obsolete(QHBoxLayout QtGui qboxlayout.h)
katie_generate_obsolete(QHashData QtCore qhash.h)
katie_generate_obsolete(QHashIterator QtCore qhash.h)
katie_generate_obsolete(QHashNode QtCore qhash.h)
katie_generate_obsolete(QHBoxLayout QtGui qboxlayout.h)
katie_generate_obsolete(QHelpEvent QtGui qevent.h)
katie_generate_obsolete(QHideEvent QtGui qevent.h)
katie_generate_obsolete(QHoverEvent QtGui qevent.h)
katie_generate_obsolete(QIPv6Address QtNetwork qhostaddress.h)
katie_generate_obsolete(QIconEnginePluginV2 QtGui qiconengineplugin.h)
katie_generate_obsolete(QIconEngineV2 QtGui qiconengine.h)
katie_generate_obsolete(QImageIOPlugin QtGui qimageiohandler.h)
katie_generate_obsolete(QIncompatibleFlag QtCore qglobal.h)
katie_generate_obsolete(QInputEvent QtGui qevent.h)
katie_generate_obsolete(QIntValidator QtGui qvalidator.h)
katie_generate_obsolete(QInternal QtCore qnamespace.h)
katie_generate_obsolete(QItemEditorCreator QtGui qitemeditorfactory.h)
katie_generate_obsolete(QIntValidator QtGui qvalidator.h)
katie_generate_obsolete(QIPv6Address QtNetwork qhostaddress.h)
katie_generate_obsolete(Q_IPV6ADDR QtNetwork qhostaddress.h)
katie_generate_obsolete(QItemEditorCreatorBase QtGui qitemeditorfactory.h)
katie_generate_obsolete(QItemEditorCreator QtGui qitemeditorfactory.h)
katie_generate_obsolete(QItemSelection QtGui qitemselectionmodel.h)
katie_generate_obsolete(QItemSelectionRange QtGui qitemselectionmodel.h)
katie_generate_obsolete(QKeyEvent QtGui qevent.h)
katie_generate_obsolete(QLatin1Char QtCore qchar.h)
katie_generate_obsolete(QLatin1String QtCore qstring.h)
katie_generate_obsolete(QLineF QtCore qline.h)
katie_generate_obsolete(QLinearGradient QtGui qbrush.h)
katie_generate_obsolete(QLineF QtCore qline.h)
katie_generate_obsolete(QListData QtCore qlist.h)
katie_generate_obsolete(QListIterator QtCore qlist.h)
katie_generate_obsolete(QListWidgetItem QtGui qlistwidget.h)
@ -656,10 +657,10 @@ katie_generate_obsolete(QMetaEnum QtCore qmetaobject.h)
katie_generate_obsolete(QMetaMethod QtCore qmetaobject.h)
katie_generate_obsolete(QMetaObjectAccessor QtCore qobjectdefs.h)
katie_generate_obsolete(QMetaProperty QtCore qmetaobject.h)
katie_generate_obsolete(QMetaTypeId QtCore qmetatype.h)
katie_generate_obsolete(QMetaTypeId2 QtCore qmetatype.h)
katie_generate_obsolete(QModelIndex QtCore qabstractitemmodel.h)
katie_generate_obsolete(QMetaTypeId QtCore qmetatype.h)
katie_generate_obsolete(QModelIndexList QtCore qabstractitemmodel.h)
katie_generate_obsolete(QModelIndex QtCore qabstractitemmodel.h)
katie_generate_obsolete(QMouseEvent QtGui qevent.h)
katie_generate_obsolete(QMoveEvent QtGui qevent.h)
katie_generate_obsolete(QMultiHash QtCore qhash.h)
@ -676,10 +677,11 @@ katie_generate_obsolete(QNoDebug QtCore qdebug.h)
katie_generate_obsolete(QObjectData QtCore qobject.h)
katie_generate_obsolete(QObjectList QtCore qobject.h)
katie_generate_obsolete(QPaintEngineState QtGui qpaintengine.h)
katie_generate_obsolete(QPaintEvent QtGui qevent.h)
katie_generate_obsolete(QPainterPathPrivate QtGui qpainterpath.h)
katie_generate_obsolete(QPainterPathStroker QtGui qpainterpath.h)
katie_generate_obsolete(QPaintEvent QtGui qevent.h)
katie_generate_obsolete(QPersistentModelIndex QtCore qabstractitemmodel.h)
katie_generate_obsolete(Q_PID QtCore qprocess.h)
katie_generate_obsolete(QPlainTextDocumentLayout QtGui qplaintextedit.h)
katie_generate_obsolete(QPointF QtCore qpoint.h)
katie_generate_obsolete(QPolygonF QtGui qpolygon.h)
@ -698,13 +700,13 @@ katie_generate_obsolete(QSizeF QtCore qsize.h)
katie_generate_obsolete(QSpacerItem QtGui qlayoutitem.h)
katie_generate_obsolete(QSplitterHandle QtGui qsplitter.h)
katie_generate_obsolete(QSpontaneKeyEvent QtTest qtestspontaneevent.h)
katie_generate_obsolete(QStandardItem QtGui qstandarditemmodel.h)
katie_generate_obsolete(QStandardItemEditorCreator QtGui qitemeditorfactory.h)
katie_generate_obsolete(QStandardItem QtGui qstandarditemmodel.h)
katie_generate_obsolete(QStatusTipEvent QtGui qevent.h)
katie_generate_obsolete(QStringListIterator QtCore qstringlist.h)
katie_generate_obsolete(QStringRef QtCore qstring.h)
katie_generate_obsolete(QStyleHintReturn QtGui qstyleoption.h)
katie_generate_obsolete(QStyleHintReturnMask QtGui qstyleoption.h)
katie_generate_obsolete(QStyleHintReturn QtGui qstyleoption.h)
katie_generate_obsolete(QStyleHintReturnVariant QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionButton QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionComboBox QtGui qstyleoption.h)
@ -725,9 +727,9 @@ katie_generate_obsolete(QStyleOptionRubberBand QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionSizeGrip QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionSlider QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionSpinBox QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionTab QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionTabBarBase QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionTabBarBaseV2 QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionTab QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionTabV2 QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionTabV3 QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionTabWidgetFrame QtGui qstyleoption.h)
@ -743,23 +745,30 @@ katie_generate_obsolete(QStyleOptionViewItemV3 QtGui qstyleoption.h)
katie_generate_obsolete(QStyleOptionViewItemV4 QtGui qstyleoption.h)
katie_generate_obsolete(QTableWidgetItem QtGui qtablewidget.h)
katie_generate_obsolete(QTableWidgetSelectionRange QtGui qtablewidget.h)
katie_generate_obsolete(QtAlgorithms QtCore qalgorithms.h)
katie_generate_obsolete(QtCleanUpFunction QtCore qcoreapplication.h)
katie_generate_obsolete(QtConfig QtCore qconfig.h)
katie_generate_obsolete(QtContainerFwd QtCore qcontainerfwd.h)
katie_generate_obsolete(QtDebug QtCore qdebug.h)
katie_generate_obsolete(QtEndian QtCore qendian.h)
katie_generate_obsolete(QTestDelayEvent QtTest qtestevent.h)
katie_generate_obsolete(QTestEventList QtTest qtestevent.h)
katie_generate_obsolete(QTestKeyClicksEvent QtTest qtestevent.h)
katie_generate_obsolete(QTestKeyEvent QtTest qtestevent.h)
katie_generate_obsolete(QTestMouseEvent QtTest qtestevent.h)
katie_generate_obsolete(QTextBlock QtGui qtextobject.h)
katie_generate_obsolete(QtEvents QtGui qevent.h)
katie_generate_obsolete(QTextBlockFormat QtGui qtextformat.h)
katie_generate_obsolete(QTextBlockGroup QtGui qtextobject.h)
katie_generate_obsolete(QTextBlock QtGui qtextobject.h)
katie_generate_obsolete(QTextBlockUserData QtGui qtextobject.h)
katie_generate_obsolete(QTextCharFormat QtGui qtextformat.h)
katie_generate_obsolete(QTextConverter QtCore qtextcodec.h)
katie_generate_obsolete(QTextDecoder QtCore qtextcodec.h)
katie_generate_obsolete(QTextEncoder QtCore qtextcodec.h)
katie_generate_obsolete(QTextFragment QtGui qtextobject.h)
katie_generate_obsolete(QTextFrame QtGui qtextobject.h)
katie_generate_obsolete(QTextFrameFormat QtGui qtextformat.h)
katie_generate_obsolete(QTextFrameLayoutData QtGui qtextobject.h)
katie_generate_obsolete(QTextFrame QtGui qtextobject.h)
katie_generate_obsolete(QTextImageFormat QtGui qtextformat.h)
katie_generate_obsolete(QTextInlineObject QtGui qtextlayout.h)
katie_generate_obsolete(QTextItem QtGui qpaintengine.h)
@ -769,22 +778,28 @@ katie_generate_obsolete(QTextListFormat QtGui qtextformat.h)
katie_generate_obsolete(QTextObjectInterface QtGui qabstracttextdocumentlayout.h)
katie_generate_obsolete(QTextStreamFunction QtCore qtextstream.h)
katie_generate_obsolete(QTextStreamManipulator QtCore qtextstream.h)
katie_generate_obsolete(QTextTableCell QtGui qtexttable.h)
katie_generate_obsolete(QTextTableCellFormat QtGui qtextformat.h)
katie_generate_obsolete(QTextTableCell QtGui qtexttable.h)
katie_generate_obsolete(QTextTableFormat QtGui qtextformat.h)
katie_generate_obsolete(QtGlobal QtCore qglobal.h)
katie_generate_obsolete(QTileRules QtGui qdrawutil.h)
katie_generate_obsolete(QTime QtCore qdatetime.h)
katie_generate_obsolete(QTimeEdit QtGui qdatetimeedit.h)
katie_generate_obsolete(QTime QtCore qdatetime.h)
katie_generate_obsolete(QTimerEvent QtCore qcoreevent.h)
katie_generate_obsolete(QtMsgHandler QtCore qglobal.h)
katie_generate_obsolete(QtPluginInstanceFunction QtCore qplugin.h)
katie_generate_obsolete(QtPlugin QtCore qplugin.h)
katie_generate_obsolete(Qt QtCore qnamespace.h)
katie_generate_obsolete(QTreeWidgetItem QtGui qtreewidget.h)
katie_generate_obsolete(QtTestGui QtTest qtest_gui.h)
katie_generate_obsolete(QTypeInfo QtCore qglobal.h)
katie_generate_obsolete(QUndoCommand QtGui qundostack.h)
katie_generate_obsolete(QUnixPrintWidget QtGui qprintdialog.h)
katie_generate_obsolete(QUpdateLaterEvent QtGui qevent.h)
katie_generate_obsolete(QVBoxLayout QtGui qboxlayout.h)
katie_generate_obsolete(QVariantHash QtCore qvariant.h)
katie_generate_obsolete(QVariantList QtCore qvariant.h)
katie_generate_obsolete(QVariantMap QtCore qvariant.h)
katie_generate_obsolete(QVBoxLayout QtGui qboxlayout.h)
katie_generate_obsolete(QVectorData QtCore qvector.h)
katie_generate_obsolete(QVectorIterator QtCore qvector.h)
katie_generate_obsolete(QVectorTypedData QtCore qvector.h)
@ -804,9 +819,9 @@ katie_generate_obsolete(QX11EmbedWidget QtGui qx11embed_x11.h)
katie_generate_obsolete(QX11Info QtGui qx11info_x11.h)
katie_generate_obsolete(QXmlAttributes QtXml qxml.h)
katie_generate_obsolete(QXmlContentHandler QtXml qxml.h)
katie_generate_obsolete(QXmlDTDHandler QtXml qxml.h)
katie_generate_obsolete(QXmlDeclHandler QtXml qxml.h)
katie_generate_obsolete(QXmlDefaultHandler QtXml qxml.h)
katie_generate_obsolete(QXmlDTDHandler QtXml qxml.h)
katie_generate_obsolete(QXmlEntityResolver QtXml qxml.h)
katie_generate_obsolete(QXmlErrorHandler QtXml qxml.h)
katie_generate_obsolete(QXmlInputSource QtXml qxml.h)
@ -827,25 +842,6 @@ katie_generate_obsolete(QXmlStreamNotationDeclaration QtXml qxmlstream.h)
katie_generate_obsolete(QXmlStreamNotationDeclarations QtXml qxmlstream.h)
katie_generate_obsolete(QXmlStreamReader QtXml qxmlstream.h)
katie_generate_obsolete(QXmlStreamWriter QtXml qxmlstream.h)
katie_generate_obsolete(Q_IPV6ADDR QtNetwork qhostaddress.h)
katie_generate_obsolete(Q_PID QtCore qprocess.h)
katie_generate_obsolete(Qt QtCore qnamespace.h)
katie_generate_obsolete(QtAlgorithms QtCore qalgorithms.h)
katie_generate_obsolete(QtCleanUpFunction QtCore qcoreapplication.h)
katie_generate_obsolete(QtConfig QtCore qconfig.h)
katie_generate_obsolete(QtContainerFwd QtCore qcontainerfwd.h)
katie_generate_obsolete(QtDebug QtCore qdebug.h)
katie_generate_obsolete(QtEndian QtCore qendian.h)
katie_generate_obsolete(QtEvents QtGui qevent.h)
katie_generate_obsolete(QtGlobal QtCore qglobal.h)
katie_generate_obsolete(QtMsgHandler QtCore qglobal.h)
katie_generate_obsolete(QtPlugin QtCore qplugin.h)
katie_generate_obsolete(QtPluginInstanceFunction QtCore qplugin.h)
katie_generate_obsolete(QtTestGui QtTest qtest_gui.h)
# those have shuffled from QtDesigner to QtUiTools
katie_generate_obsolete(formbuilder.h QtDesigner ../QtUiTools/formbuilder.h)
katie_generate_obsolete(customwidget.h QtDesigner ../QtUiTools/customwidget.h)
katie_generate_obsolete(qdesignercustomwidgetinterface.h QtDesigner ../QtUiTools/customwidget.h)
katie_string_wrap("${KATIE_DEFINITIONS}" KATIE_DEFINITIONS)

View file

@ -365,8 +365,6 @@ include/katie/QtDesigner/QAbstractFormBuilder
include/katie/QtDesigner/QDesignerActionEditorInterface
include/katie/QtDesigner/QDesignerComponents
include/katie/QtDesigner/QDesignerContainerExtension
include/katie/QtDesigner/QDesignerCustomWidgetCollectionInterface
include/katie/QtDesigner/QDesignerCustomWidgetInterface
include/katie/QtDesigner/QDesignerDnDItemInterface
include/katie/QtDesigner/QDesignerDynamicPropertySheetExtension
include/katie/QtDesigner/QDesignerExtraInfoExtension
@ -1169,6 +1167,8 @@ include/katie/QtTest/qtestspontaneevent.h
include/katie/QtTest/qtestsystem.h
include/katie/QtTest/qtestxmlstreamer.h
include/katie/QtTest/qtestxunitstreamer.h
include/katie/QtUiTools/QCustomWidget
include/katie/QtUiTools/QCustomWidgetPlugin
include/katie/QtUiTools/QUiLoader
include/katie/QtUiTools/QtUiTools
include/katie/QtUiTools/abstractformbuilder.h

View file

@ -121,8 +121,6 @@ incmap = {
'QDesignerActionEditorInterface': 'abstractactioneditor.h',
'QDesignerComponents': 'qdesigner_components.h',
'QDesignerContainerExtension': 'container.h',
'QDesignerCustomWidgetCollectionInterface': 'customwidget.h',
'QDesignerCustomWidgetInterface': 'customwidget.h',
'QDesignerDnDItemInterface': 'abstractdnditem.h',
'QDesignerDynamicPropertySheetExtension': 'dynamicpropertysheet.h',
'QDesignerExtraInfoExtension': 'extrainfo.h',
@ -333,6 +331,10 @@ incmap = {
'QTestMouseEvent': 'qtestevent.h',
'QtTestGui': 'qtest_gui.h',
},
'QtUiTools': {
'QCustomWidget': 'customwidget.h',
'QCustomWidgetPlugin': 'customwidget.h',
},
'QtXml': {
'QDomAttr': 'qdom.h',
'QDomCDATASection': 'qdom.h',

View file

@ -71,6 +71,8 @@ classlist = [
"QCoreApplication",
"QCryptographicHash",
"QCursor",
"QCustomWidget",
"QCustomWidgetPlugin",
"QDataStream",
"QDataWidgetMapper",
"QDate",
@ -125,8 +127,6 @@ classlist = [
"QDesignerActionEditorInterface",
"QDesignerComponents",
"QDesignerContainerExtension",
"QDesignerCustomWidgetCollectionInterface",
"QDesignerCustomWidgetInterface",
"QDesignerDnDItemInterface",
"QDesignerDynamicPropertySheetExtension",
"QDesignerExtraInfoExtension",

View file

@ -133,7 +133,6 @@ set(DESIGNER_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/shared/filterwidget_p.h
${CMAKE_CURRENT_SOURCE_DIR}/shared/plugindialog_p.h
${CMAKE_CURRENT_SOURCE_DIR}/container.h
${CMAKE_CURRENT_SOURCE_DIR}/qdesignerexportwidget.h
${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_components_global.h
${CMAKE_CURRENT_SOURCE_DIR}/qdesigner_components.h
${CMAKE_CURRENT_SOURCE_DIR}/qdesignercommon_p.h

View file

@ -37,7 +37,6 @@ class DomResource;
class QDesignerContainerExtension;
class QDesignerFormEditorInterface;
class QDesignerCustomWidgetInterface;
class QDesignerWidgetDataBaseItemInterface;
class QTabWidget;

View file

@ -597,7 +597,7 @@ WidgetBoxTreeWidget::CategoryList WidgetBoxTreeWidget::loadCustomCategoryList()
const QString invisible = QLatin1String(invisibleNameC);
const QString iconPrefix = QLatin1String(iconPrefixC);
foreach(QDesignerCustomWidgetInterface *c, customWidgets) {
foreach(QCustomWidget *c, customWidgets) {
const QString dom_xml = c->domXml();
if (dom_xml.isEmpty())
continue;

View file

@ -129,11 +129,6 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/code/tools_designer_src_lib_extension_extension.cpp 0
When implementing a custom widget plugin, a pointer to \QD's
current QDesignerFormEditorInterface object (\c formEditor) is
provided by the QDesignerCustomWidgetInterface::initialize()
function's parameter.
If the widget in the example above doesn't have a defined
QDesignerPropertySheetExtension, \c propertySheet will be a null
pointer.

View file

@ -36,20 +36,12 @@ QT_BEGIN_NAMESPACE
a QExtensionFactory, i.e a class that is able to make an instance
of your extension, and register it using \QD's extension manager.
The registration of an extension factory is typically made in the
QDesignerCustomWidgetInterface::initialize() function:
\snippet doc/src/snippets/code/tools_designer_src_lib_extension_qextensionmanager.cpp 0
The QExtensionManager is not intended to be instantiated
directly. You can retrieve an interface to \QD's extension manager
using the QDesignerFormEditorInterface::extensionManager()
function. A pointer to \QD's current QDesignerFormEditorInterface
object (\c formEditor in the example above) is provided by the
QDesignerCustomWidgetInterface::initialize() function's
parameter. When implementing a custom widget plugin, you must
subclass the QDesignerCustomWidgetInterface to expose your plugin
to \QD.
function.
Then, when an extension is required, \QD's extension manager will
run through all its registered factories calling

View file

@ -1,39 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2016 Ivailo Monev
**
** This file is part of the Katie Designer of the Katie Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
**
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QDESIGNEREXPORTWIDGET_H
#define QDESIGNEREXPORTWIDGET_H
#include <QtCore/QtGlobal>
QT_BEGIN_NAMESPACE
#if defined(QDESIGNER_EXPORT_WIDGETS)
# define QDESIGNER_WIDGET_EXPORT Q_DECL_EXPORT
#else
# define QDESIGNER_WIDGET_EXPORT Q_DECL_IMPORT
#endif
QT_END_NAMESPACE
#endif //QDESIGNEREXPORTWIDGET_H

View file

@ -114,14 +114,6 @@ QDesignerFormEditorInterfacePrivate::~QDesignerFormEditorInterfacePrivate()
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformeditor.cpp 0
QDesignerFormEditorInterface is not intended to be instantiated
directly. A pointer to \QD's current QDesignerFormEditorInterface
object (\c formEditor in the example above) is provided by the
QDesignerCustomWidgetInterface::initialize() function's
parameter. When implementing a custom widget plugin, you must
subclass the QDesignerCustomWidgetInterface to expose your plugin
to \QD.
QDesignerFormEditorInterface also provides functions that can set
the action editor, property editor, object inspector and widget
box. These are only useful if you want to provide your own custom
@ -135,7 +127,7 @@ QDesignerFormEditorInterfacePrivate::~QDesignerFormEditorInterfacePrivate()
Finally, QDesignerFormEditorInterface provides the topLevel()
function that returns \QD's top-level widget.
\sa QDesignerCustomWidgetInterface
\sa QCustomWidget
*/
/*!

View file

@ -67,13 +67,6 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformwindow.cpp 1
The pointer to \QD's current QDesignerFormEditorInterface object
(\c formEditor in the example above) is provided by the
QDesignerCustomWidgetInterface::initialize() function's
parameter. When implementing a custom widget plugin, you must
subclass the QDesignerCustomWidgetInterface class to expose your
plugin to \QD.
Once you have the form window, you can query its properties. For
example, a plain custom widget plugin is managed by \QD only at
its top level, i.e. none of its child widgets can be resized in

View file

@ -43,13 +43,6 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformwindowmanager.cpp 0
When implementing a custom widget plugin, a pointer to \QD's
current QDesignerFormEditorInterface object (\c formEditor in the
example above) is provided by the
QDesignerCustomWidgetInterface::initialize() function's parameter.
You must subclass the QDesignerCustomWidgetInterface to expose
your plugin to Katie Designer.
The form window manager interface provides the createFormWindow()
function that enables you to create a new form window which you
can add to the collection of form windows that the manager

View file

@ -40,13 +40,7 @@ QT_BEGIN_NAMESPACE
The QDesignerObjectInspectorInterface class is not intended to be
instantiated directly. You can retrieve an interface to \QD's
object inspector using the
QDesignerFormEditorInterface::objectInspector() function. A
pointer to \QD's current QDesignerFormEditorInterface object (\c
formEditor in the example above) is provided by the
QDesignerCustomWidgetInterface::initialize() function's
parameter. When implementing a custom widget plugin, you must
subclass the QDesignerCustomWidgetInterface to expose your plugin
to \QD.
QDesignerFormEditorInterface::objectInspector() function.
The interface provides the core() function that you can use to
retrieve a pointer to \QD's current QDesignerFormEditorInterface

View file

@ -54,13 +54,7 @@ QT_BEGIN_NAMESPACE
The QDesignerPropertyEditorInterface class is not intended to be
instantiated directly. You can retrieve an interface to \QD's
property editor using the
QDesignerFormEditorInterface::propertyEditor() function. A pointer
to \QD's current QDesignerFormEditorInterface object (\c
formEditor in the examples above) is provided by the
QDesignerCustomWidgetInterface::initialize() function's
parameter. When implementing a custom widget plugin, you must
subclass the QDesignerCustomWidgetInterface to expose your plugin
to \QD.
QDesignerFormEditorInterface::propertyEditor() function.
The functions accessing the property editor are the core()
function that you can use to retrieve an interface to the form

View file

@ -51,13 +51,7 @@ QT_BEGIN_NAMESPACE
The QDesignerWidgetBoxInterface class is not intended to be
instantiated directly. You can retrieve an interface to Qt
Designer's widget box using the
QDesignerFormEditorInterface::widgetBox() function. A pointer to
\QD's current QDesignerFormEditorInterface object (\c formEditor
in the example above) is provided by the
QDesignerCustomWidgetInterface::initialize() function's
parameter. When implementing a custom widget plugin, you must
subclass the QDesignerCustomWidgetInterface to expose your plugin
to \QD.
QDesignerFormEditorInterface::widgetBox() function.
If you want to save your changes, and at the same time preserve
the original contents, you can use the save() function combined

View file

@ -34,11 +34,6 @@
\snippet doc/src/snippets/code/doc_src_qtdesigner.cpp 2
When implementing a custom widget plugin, a pointer to \QD's
current QDesignerFormEditorInterface object (\c formEditor in the
example above) is provided by the
QDesignerCustomWidgetInterface::initialize() function's parameter.
The member sheet (and any other extension), can be retrieved by
querying \QD's extension manager using the qt_extension()
function. When you want to release the extension, you only need to

View file

@ -44,11 +44,6 @@
{QDesignerFormWindowCursorInterface::setWidgetProperty()}{setWidgetProperty()},
instead.
When implementing a custom widget plugin, a pointer to \QD's
current QDesignerFormEditorInterface object (\c formEditor in the
example above) is provided by the
QDesignerCustomWidgetInterface::initialize() function's parameter.
The property sheet, or any other extension, can be retrieved by
querying \QD's extension manager using the qt_extension()
function. When you want to release the extension, you only need to

View file

@ -91,11 +91,8 @@ void PluginDialog::populateTreeWidget()
QTreeWidgetItem *pluginItem = setPluginItem(topLevelItem, fileInfo.fileName(), boldFont);
if (QObject *plugin = loader.instance()) {
if (const QDesignerCustomWidgetCollectionInterface *c = qobject_cast<QDesignerCustomWidgetCollectionInterface*>(plugin)) {
foreach (const QDesignerCustomWidgetInterface *p, c->customWidgets())
setItem(pluginItem, p->name(), p->toolTip(), p->whatsThis(), p->icon());
} else {
if (const QDesignerCustomWidgetInterface *p = qobject_cast<QDesignerCustomWidgetInterface*>(plugin))
if (const QCustomWidgetPlugin *c = qobject_cast<QCustomWidgetPlugin*>(plugin)) {
foreach (const QCustomWidget *p, c->customWidgets())
setItem(pluginItem, p->name(), p->toolTip(), p->whatsThis(), p->icon());
}
}

View file

@ -426,7 +426,7 @@ class QDesignerPluginManagerPrivate {
QDesignerPluginManagerPrivate(QDesignerFormEditorInterface *core);
void clearCustomWidgets();
bool addCustomWidget(QDesignerCustomWidgetInterface *c,
bool addCustomWidget(QCustomWidget *c,
const QString &pluginPath,
const QString &designerLanguage);
void addCustomWidgets(const QObject *o,
@ -444,7 +444,7 @@ class QDesignerPluginManagerPrivate {
// Synced lists of custom widgets and their data. Note that the list
// must be ordered for collections to appear in order.
QList<QDesignerCustomWidgetInterface *> m_customWidgets;
QList<QCustomWidget *> m_customWidgets;
QList<QDesignerCustomWidgetData> m_customWidgetData;
QStringList defaultPluginPaths() const;
@ -466,7 +466,7 @@ void QDesignerPluginManagerPrivate::clearCustomWidgets()
// Add a custom widget to the list if it parses correctly
// and is of the right language
bool QDesignerPluginManagerPrivate::addCustomWidget(QDesignerCustomWidgetInterface *c,
bool QDesignerPluginManagerPrivate::addCustomWidget(QCustomWidget *c,
const QString &pluginPath,
const QString &designerLanguage)
{
@ -474,7 +474,7 @@ bool QDesignerPluginManagerPrivate::addCustomWidget(QDesignerCustomWidgetInterfa
qDebug() << Q_FUNC_INFO << c->name();
if (!c->isInitialized())
c->initialize(m_core);
c->initialize();
// Parse the XML even if the plugin is initialized as Jambi might play tricks here
QDesignerCustomWidgetData data(pluginPath);
const QString domXml = c->domXml();
@ -501,18 +501,14 @@ bool QDesignerPluginManagerPrivate::addCustomWidget(QDesignerCustomWidgetInterfa
return true;
}
// Check the plugin interface for either a custom widget or a collection and
// Check the plugin interface for a custom widget plugin and
// add all contained custom widgets.
void QDesignerPluginManagerPrivate::addCustomWidgets(const QObject *o,
const QString &pluginPath,
const QString &designerLanguage)
{
if (QDesignerCustomWidgetInterface *c = qobject_cast<QDesignerCustomWidgetInterface*>(o)) {
addCustomWidget(c, pluginPath, designerLanguage);
return;
}
if (const QDesignerCustomWidgetCollectionInterface *coll = qobject_cast<QDesignerCustomWidgetCollectionInterface*>(o)) {
foreach(QDesignerCustomWidgetInterface *c, coll->customWidgets())
if (const QCustomWidgetPlugin *coll = qobject_cast<const QCustomWidgetPlugin*>(o)) {
foreach(QCustomWidget *c, coll->customWidgets())
addCustomWidget(c, pluginPath, designerLanguage);
}
}
@ -739,7 +735,7 @@ QDesignerPluginManager::CustomWidgetList QDesignerPluginManager::registeredCusto
return m_d->m_customWidgets;
}
QDesignerCustomWidgetData QDesignerPluginManager::customWidgetData(QDesignerCustomWidgetInterface *w) const
QDesignerCustomWidgetData QDesignerPluginManager::customWidgetData(QCustomWidget *w) const
{
const int index = m_d->m_customWidgets.indexOf(w);
if (index == -1)

View file

@ -43,7 +43,7 @@
QT_BEGIN_NAMESPACE
class QDesignerFormEditorInterface;
class QDesignerCustomWidgetInterface;
class QCustomWidget;
class QDesignerPluginManagerPrivate;
class QDesignerCustomWidgetSharedData;
@ -88,7 +88,7 @@ class Q_DESIGNER_EXPORT QDesignerPluginManager: public QObject
{
Q_OBJECT
public:
typedef QList<QDesignerCustomWidgetInterface*> CustomWidgetList;
typedef QList<QCustomWidget*> CustomWidgetList;
explicit QDesignerPluginManager(QDesignerFormEditorInterface *core);
virtual ~QDesignerPluginManager();
@ -113,7 +113,7 @@ public:
QObjectList instances() const;
CustomWidgetList registeredCustomWidgets() const;
QDesignerCustomWidgetData customWidgetData(QDesignerCustomWidgetInterface *w) const;
QDesignerCustomWidgetData customWidgetData(QCustomWidget *w) const;
QDesignerCustomWidgetData customWidgetData(const QString &className) const;
bool registerNewPlugins();

View file

@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
namespace {
typedef QList<DomWidgetData*> DomWidgetDataList;
typedef QList<DomProperty*> DomPropertyList;
typedef QList<QDesignerCustomWidgetInterface *> CustomWidgetInterfaces;
typedef QList<QCustomWidget *> CustomWidgetInterfaces;
}
namespace qdesigner_internal {

View file

@ -307,7 +307,7 @@ int WidgetDataBase::indexOfObject(QObject *object, bool /*resolveName*/) const
return QDesignerWidgetDataBaseInterface::indexOfClassName(id);
}
static WidgetDataBaseItem *createCustomWidgetItem(const QDesignerCustomWidgetInterface *c,
static WidgetDataBaseItem *createCustomWidgetItem(const QCustomWidget *c,
const QDesignerCustomWidgetData &data)
{
WidgetDataBaseItem *item = new WidgetDataBaseItem(c->name(), c->group());
@ -342,7 +342,7 @@ void WidgetDataBase::loadPlugins()
// 2) create a list plugins
ItemList pluginList;
const QDesignerPluginManager *pm = m_core->pluginManager();
foreach(QDesignerCustomWidgetInterface* c, pm->registeredCustomWidgets())
foreach(QCustomWidget* c, pm->registeredCustomWidgets())
pluginList += createCustomWidgetItem(c, pm->customWidgetData(c));
// 3) replace custom classes or add new ones, remove them from existingCustomClasses,

View file

@ -45,7 +45,6 @@
QT_BEGIN_NAMESPACE
class QObject;
class QDesignerCustomWidgetInterface;
namespace qdesigner_internal {

View file

@ -194,8 +194,8 @@ void WidgetFactory::loadPlugins()
QDesignerPluginManager *pluginManager = m_core->pluginManager();
QList<QDesignerCustomWidgetInterface*> lst = pluginManager->registeredCustomWidgets();
foreach (QDesignerCustomWidgetInterface *c, lst) {
QList<QCustomWidget*> lst = pluginManager->registeredCustomWidgets();
foreach (QCustomWidget *c, lst) {
m_customFactory.insert(c->name(), c);
}
}
@ -221,7 +221,7 @@ QWidget* WidgetFactory::createCustomWidget(const QString &className, QWidget *p
if (it == m_customFactory.constEnd())
return 0;
QDesignerCustomWidgetInterface *factory = it.value();
QCustomWidget *factory = it.value();
QWidget *rc = factory->createWidget(parentWidget);
// shouldn't happen
if (!rc) {

View file

@ -49,7 +49,7 @@ class QObject;
class QWidget;
class QLayout;
class QDesignerFormEditorInterface;
class QDesignerCustomWidgetInterface;
class QCustomWidget;
class QDesignerFormWindowInterface;
class QStyle;
@ -144,7 +144,7 @@ private:
const Strings m_strings;
QDesignerFormEditorInterface *m_core;
typedef QMap<QString, QDesignerCustomWidgetInterface*> CustomWidgetFactoryMap;
typedef QMap<QString, QCustomWidget*> CustomWidgetFactoryMap;
CustomWidgetFactoryMap m_customFactory;
QDesignerFormWindowInterface *m_formWindow;

View file

@ -9,7 +9,7 @@ set(QDECLARATIVEVIEWPLUGIN_SOURCES
katie_setup_target(qdeclarativeviewplugin ${QDECLARATIVEVIEWPLUGIN_SOURCES} ${QDECLARATIVEVIEWPLUGIN_HEADERS})
add_library(qdeclarativeviewplugin MODULE ${qdeclarativeviewplugin_SOURCES})
target_link_libraries(qdeclarativeviewplugin KtCore KtDeclarative KtDesigner)
target_link_libraries(qdeclarativeviewplugin KtCore KtDeclarative KtUiTools)
set_target_properties(qdeclarativeviewplugin PROPERTIES
OUTPUT_NAME qdeclarativeview
PREFIX ""

View file

@ -21,9 +21,6 @@
#include "qdeclarativeview_plugin.h"
#include <QtDesigner/default_extensionfactory.h>
#include <QtDesigner/QExtensionManager>
#include <QtCore/qplugin.h>
#include <QtDeclarative/QDeclarativeView>
@ -31,58 +28,58 @@ static const char toolTipC[] = "QtDeclarative view widget";
QT_BEGIN_NAMESPACE
QDeclarativeViewPlugin::QDeclarativeViewPlugin(QObject *parent) :
QObject(parent),
QDeclarativeViewWidget::QDeclarativeViewWidget(QObject *parent)
: QCustomWidget(parent),
m_initialized(false)
{
}
QString QDeclarativeViewPlugin::name() const
QString QDeclarativeViewWidget::name() const
{
return QLatin1String("QDeclarativeView");
}
QString QDeclarativeViewPlugin::group() const
QString QDeclarativeViewWidget::group() const
{
return QLatin1String("Display Widgets");
}
QString QDeclarativeViewPlugin::toolTip() const
QString QDeclarativeViewWidget::toolTip() const
{
return tr(toolTipC);
}
QString QDeclarativeViewPlugin::whatsThis() const
QString QDeclarativeViewWidget::whatsThis() const
{
return tr(toolTipC);
}
QString QDeclarativeViewPlugin::includeFile() const
QString QDeclarativeViewWidget::includeFile() const
{
return QLatin1String("QtDeclarative/QDeclarativeView");
}
QIcon QDeclarativeViewPlugin::icon() const
QIcon QDeclarativeViewWidget::icon() const
{
return QIcon();
}
bool QDeclarativeViewPlugin::isContainer() const
bool QDeclarativeViewWidget::isContainer() const
{
return false;
}
QWidget *QDeclarativeViewPlugin::createWidget(QWidget *parent)
QWidget *QDeclarativeViewWidget::createWidget(QWidget *parent)
{
return new QDeclarativeView(parent);
}
bool QDeclarativeViewPlugin::isInitialized() const
bool QDeclarativeViewWidget::isInitialized() const
{
return m_initialized;
}
void QDeclarativeViewPlugin::initialize(QDesignerFormEditorInterface * /*core*/)
void QDeclarativeViewWidget::initialize()
{
if (m_initialized)
return;
@ -90,7 +87,7 @@ void QDeclarativeViewPlugin::initialize(QDesignerFormEditorInterface * /*core*/)
m_initialized = true;
}
QString QDeclarativeViewPlugin::domXml() const
QString QDeclarativeViewWidget::domXml() const
{
return QLatin1String("\
<ui language=\"c++\">\
@ -107,6 +104,22 @@ QString QDeclarativeViewPlugin::domXml() const
</ui>");
}
QDeclarativeViewPlugin::QDeclarativeViewPlugin(QObject *parent)
: QCustomWidgetPlugin(parent)
{
m_plugins.append(new QDeclarativeViewWidget(this));
}
QDeclarativeViewPlugin::~QDeclarativeViewPlugin()
{
}
QList<QCustomWidget*> QDeclarativeViewPlugin::customWidgets() const
{
return m_plugins;
}
Q_EXPORT_PLUGIN2(customwidgetplugin, QDeclarativeViewPlugin)
QT_END_NAMESPACE

View file

@ -26,12 +26,11 @@
QT_BEGIN_NAMESPACE
class QDeclarativeViewPlugin: public QObject, public QDesignerCustomWidgetInterface
class QDeclarativeViewWidget: public QCustomWidget
{
Q_OBJECT
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
QDeclarativeViewPlugin(QObject *parent = nullptr);
QDeclarativeViewWidget(QObject *parent = nullptr);
virtual QString name() const;
virtual QString group() const;
@ -42,13 +41,26 @@ public:
virtual bool isContainer() const;
virtual QWidget *createWidget(QWidget *parent);
virtual bool isInitialized() const;
virtual void initialize(QDesignerFormEditorInterface *core);
virtual void initialize();
virtual QString domXml() const;
private:
bool m_initialized;
};
class QDeclarativeViewPlugin: public QCustomWidgetPlugin
{
Q_OBJECT
public:
QDeclarativeViewPlugin(QObject *parent = nullptr);
virtual ~QDeclarativeViewPlugin();
virtual QList<QCustomWidget*> customWidgets() const;
private:
QList<QCustomWidget*> m_plugins;
};
QT_END_NAMESPACE
#endif // QDECLARATIVEVIEW_PLUGIN_H

View file

@ -118,6 +118,8 @@ static const struct ClassTblData {
{ QLatin1String("QCoreApplication"), QLatin1String("QtCore/qcoreapplication.h") },
{ QLatin1String("QCryptographicHash"), QLatin1String("QtNetwork/qcryptographichash.h") },
{ QLatin1String("QCursor"), QLatin1String("QtGui/qcursor.h") },
{ QLatin1String("QCustomWidget"), QLatin1String("QtUiTools/customwidget.h") },
{ QLatin1String("QCustomWidgetPlugin"), QLatin1String("QtUiTools/customwidget.h") },
{ QLatin1String("QDBusAbstractAdaptor"), QLatin1String("QtDBus/qdbusabstractadaptor.h") },
{ QLatin1String("QDBusAbstractInterface"), QLatin1String("QtDBus/qdbusabstractinterface.h") },
{ QLatin1String("QDBusAbstractInterfaceBase"), QLatin1String("QtDBus/qdbusabstractinterface.h") },

View file

@ -33,6 +33,7 @@ set(UITOOLS_HEADERS
set(UITOOLS_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/quiloader.cpp
${CMAKE_CURRENT_SOURCE_DIR}/abstractformbuilder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/customwidget.cpp
${CMAKE_CURRENT_SOURCE_DIR}/formbuilder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/formbuilderextra.cpp
${CMAKE_CURRENT_SOURCE_DIR}/textbuilder.cpp

View file

@ -17,23 +17,26 @@
**
****************************************************************************/
/*!
\class QDesignerCustomWidgetInterface
#include "customwidget.h"
\brief The QDesignerCustomWidgetInterface class enables Katie Designer
QT_BEGIN_NAMESPACE
/*!
\class QCustomWidget
\brief The QCustomWidget class enables Katie Designer
to access and construct custom widgets.
\inmodule QtDesigner
\inmodule QtUiTools
QDesignerCustomWidgetInterface provides a custom widget with an
interface. The class contains a set of functions that must be subclassed
to return basic information about the widget, such as its class name and
the name of its header file. Other functions must be implemented to
initialize the plugin when it is loaded, and to construct instances of
the custom widget for \QD to use.
QCustomWidget provides a interface for custom widget. The class contains
a set of functions that must be subclassed to return basic information
about the widget, such as its class name and the name of its header file.
Other functions must be implemented to initialize the plugin when it is
loaded, and to construct instances of the custom widget for \QD to use.
When implementing a custom widget you must subclass
QDesignerCustomWidgetInterface to expose your widget to \QD. For
QCustomWidget to expose your widget to \QD. For
example, this is the declaration for the plugin used in the
\l{Custom Widget Plugin Example}{Custom Widget Plugin example} that
enables an analog clock custom widget to be used by \QD:
@ -50,8 +53,7 @@
After \QD loads a custom widget plugin, it calls the interface's
initialize() function to enable it to set up any resources that it
may need. This function is called with a QDesignerFormEditorInterface
parameter that provides the plugin with a gateway to all of \QD's API.
may need.
\QD constructs instances of the custom widget by calling the plugin's
createWidget() function with a suitable parent widget. Plugins must
@ -73,7 +75,7 @@
When implementing a custom widget plugin, you build it as a
separate library. If you want to include several custom widget
plugins in the same library, you must in addition subclass
QDesignerCustomWidgetCollectionInterface.
QCustomWidgetPlugin.
\warning If your custom widget plugin contains QVariant
properties, be aware that only the following \l
@ -97,23 +99,28 @@
\o QVariant::UInt
\endlist
For a complete example using the QDesignerCustomWidgetInterface
class, see the \l {designer/customwidgetplugin}{Custom Widget
Example}. The example shows how to create a custom widget plugin
for \QD.
\sa QDesignerCustomWidgetCollectionInterface {Creating Custom
\sa QCustomWidgetPlugin {Creating Custom
Widgets for Katie Designer}
*/
/*!
\fn QDesignerCustomWidgetInterface::~QDesignerCustomWidgetInterface()
Destroys the custom widget interface.
Constructs an custom widget plugin with the given \a parent. This
is invoked automatically by the Q_EXPORT_PLUGIN2() macro.
*/
QCustomWidget::QCustomWidget(QObject *parent)
: QObject(parent)
{
}
/*!
\fn QString QDesignerCustomWidgetInterface::name() const
Destroys the custom widget interface.
*/
QCustomWidget::~QCustomWidget()
{
}
/*!
\fn QString QCustomWidget::name() const
Returns the class name of the custom widget supplied by the interface.
@ -122,41 +129,41 @@
*/
/*!
\fn QString QDesignerCustomWidgetInterface::group() const
\fn QString QCustomWidget::group() const
Returns the name of the group to which the custom widget belongs.
*/
/*!
\fn QString QDesignerCustomWidgetInterface::toolTip() const
\fn QString QCustomWidget::toolTip() const
Returns a short description of the widget that can be used by \QD
in a tool tip.
*/
/*!
\fn QString QDesignerCustomWidgetInterface::whatsThis() const
\fn QString QCustomWidget::whatsThis() const
Returns a description of the widget that can be used by \QD in
"What's This?" help for the widget.
*/
/*!
\fn QString QDesignerCustomWidgetInterface::includeFile() const
\fn QString QCustomWidget::includeFile() const
Returns the path to the include file that \l uic uses when
creating code for the custom widget.
*/
/*!
\fn QIcon QDesignerCustomWidgetInterface::icon() const
\fn QIcon QCustomWidget::icon() const
Returns the icon used to represent the custom widget in \QD's
widget box.
*/
/*!
\fn bool QDesignerCustomWidgetInterface::isContainer() const
\fn bool QCustomWidget::isContainer() const
Returns true if the custom widget is intended to be used as a
container; otherwise returns false.
@ -168,14 +175,14 @@
*/
/*!
\fn QWidget *QDesignerCustomWidgetInterface::createWidget(QWidget *parent)
\fn QWidget *QCustomWidget::createWidget(QWidget *parent)
Returns a new instance of the custom widget, with the given \a
parent.
*/
/*!
\fn bool QDesignerCustomWidgetInterface::isInitialized() const
\fn bool QCustomWidget::isInitialized() const
Returns true if the widget has been initialized; otherwise returns
false.
@ -184,23 +191,22 @@
*/
/*!
\fn void QDesignerCustomWidgetInterface::initialize(QDesignerFormEditorInterface *formEditor)
\fn void QCustomWidget::initialize()
Initializes the widget for use with the specified \a formEditor
interface.
Initializes the widget.
\sa isInitialized()
*/
/*!
\fn QString QDesignerCustomWidgetInterface::domXml() const
\fn QString QCustomWidget::domXml() const
Returns the XML that is used to describe the custom widget's
properties to \QD.
*/
/*!
\fn QString QDesignerCustomWidgetInterface::codeTemplate() const
\fn QString QCustomWidget::codeTemplate() const
This function is reserved for future use by \QD.
@ -211,48 +217,21 @@
*/
/*!
\macro QDESIGNER_WIDGET_EXPORT
\relates QDesignerCustomWidgetInterface
\since 4.1
\class QCustomWidgetPlugin
This macro is used when defining custom widgets to ensure that they are
correctly exported from plugins for use with \QD.
\brief The QCustomWidgetPlugin class allows you to include
several custom widgets in one single library.
On some platforms, the symbols required by \QD to create new widgets
are removed from plugins by the build system, making them unusable.
Using this macro ensures that the symbols are retained on those platforms,
and has no side effects on other platforms.
For example, the \l{designer/worldtimeclockplugin}{World Time Clock Plugin}
example exports a custom widget class with the following declaration:
\snippet examples/designer/worldtimeclockplugin/worldtimeclock.h 0
\dots
\snippet examples/designer/worldtimeclockplugin/worldtimeclock.h 2
\sa {Creating Custom Widgets for Katie Designer}
*/
/*!
\class QDesignerCustomWidgetCollectionInterface
\brief The QDesignerCustomWidgetCollectionInterface class allows
you to include several custom widgets in one single library.
\inmodule QtDesigner
\inmodule QtUiTools
When implementing a custom widget plugin, you build it as a
separate library. If you want to include several custom widget
plugins in the same library, you must in addition subclass
QDesignerCustomWidgetCollectionInterface.
QCustomWidgetPlugin.
QDesignerCustomWidgetCollectionInterface contains one single
QCustomWidgetPlugin contains one single
function returning a list of the collection's
QDesignerCustomWidgetInterface objects. For example, if you have
QCustomWidget objects. For example, if you have
several custom widgets \c CustomWidgetOne, \c CustomWidgetTwo and
\c CustomWidgetThree, the class definition may look like this:
@ -270,18 +249,33 @@
the custom widgets. Without this macro, there is no way for \QD to
use them.
\sa QDesignerCustomWidgetInterface, {Creating Custom Widgets for
\sa QCustomWidget, {Creating Custom Widgets for
Katie Designer}
*/
/*!
\fn QDesignerCustomWidgetCollectionInterface::~QDesignerCustomWidgetCollectionInterface() {
Destroys the custom widget collection interface.
Constructs an custom widget collection plugin with the given
\a parent. This is invoked automatically by the Q_EXPORT_PLUGIN2()
macro.
*/
QCustomWidgetPlugin::QCustomWidgetPlugin(QObject *parent)
: QObject(parent)
{
}
/*!
\fn QList<QDesignerCustomWidgetInterface*> QDesignerCustomWidgetCollectionInterface::customWidgets() const
Destroys the custom widget collection interface.
*/
QCustomWidgetPlugin::~QCustomWidgetPlugin()
{
}
/*!
\fn QList<QCustomWidget*> QCustomWidgetPlugin::customWidgets() const
Returns a list of interfaces to the collection's custom widgets.
*/
QT_END_NAMESPACE
#include "moc_customwidget.h"

View file

@ -26,16 +26,16 @@
#include <QtCore/QString>
#include <QtGui/QIcon>
QT_BEGIN_NAMESPACE
class QWidget;
class QDesignerFormEditorInterface;
class QDesignerCustomWidgetInterface
class Q_UITOOLS_EXPORT QCustomWidget : public QObject
{
Q_OBJECT
public:
virtual ~QDesignerCustomWidgetInterface() {}
explicit QCustomWidget(QObject *parent = nullptr);
virtual ~QCustomWidget();
virtual QString name() const = 0;
virtual QString group() const = 0;
@ -49,7 +49,7 @@ public:
virtual QWidget *createWidget(QWidget *parent) = 0;
virtual bool isInitialized() const { return false; }
virtual void initialize(QDesignerFormEditorInterface *core) { Q_UNUSED(core); }
virtual void initialize() { }
virtual QString domXml() const
{
@ -60,24 +60,16 @@ public:
virtual QString codeTemplate() const { return QString(); }
};
QT_END_NAMESPACE
Q_DECLARE_INTERFACE(QDesignerCustomWidgetInterface, "Katie.Designer.CustomWidget")
QT_BEGIN_NAMESPACE
class QDesignerCustomWidgetCollectionInterface
class Q_UITOOLS_EXPORT QCustomWidgetPlugin : public QObject
{
Q_OBJECT
public:
virtual ~QDesignerCustomWidgetCollectionInterface() {}
explicit QCustomWidgetPlugin(QObject *parent = nullptr);
virtual ~QCustomWidgetPlugin();
virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const = 0;
virtual QList<QCustomWidget*> customWidgets() const = 0;
};
QT_END_NAMESPACE
Q_DECLARE_INTERFACE(QDesignerCustomWidgetCollectionInterface,
"Katie.Designer.CustomWidgetCollection")
#endif // CUSTOMWIDGET_H

View file

@ -192,7 +192,7 @@ QWidget *QFormBuilder::createWidget(const QString &widgetName, QWidget *parentWi
break;
// try with a registered custom widget
QDesignerCustomWidgetInterface *factory = m_customWidgets.value(widgetName);
QCustomWidget *factory = m_customWidgets.value(widgetName);
if (factory != 0)
w = factory->createWidget(parentWidget);
} while(false);
@ -433,16 +433,10 @@ void QFormBuilder::setPluginPath(const QStringList &pluginPaths)
updateCustomWidgets();
}
static void insertPlugins(QObject *o, QMap<QString, QDesignerCustomWidgetInterface*> *customWidgets)
static void insertPlugins(QObject *o, QMap<QString, QCustomWidget*> *customWidgets)
{
// step 1) try with a normal plugin
if (QDesignerCustomWidgetInterface *iface = qobject_cast<QDesignerCustomWidgetInterface *>(o)) {
customWidgets->insert(iface->name(), iface);
return;
}
// step 2) try with a collection of plugins
if (QDesignerCustomWidgetCollectionInterface *c = qobject_cast<QDesignerCustomWidgetCollectionInterface *>(o)) {
foreach (QDesignerCustomWidgetInterface *iface, c->customWidgets())
if (QCustomWidgetPlugin *c = qobject_cast<QCustomWidgetPlugin *>(o)) {
foreach (QCustomWidget *iface, c->customWidgets())
customWidgets->insert(iface->name(), iface);
}
}
@ -476,11 +470,11 @@ void QFormBuilder::updateCustomWidgets()
}
/*!
\fn QList<QDesignerCustomWidgetInterface*> QFormBuilder::customWidgets() const
\fn QList<QCustomWidget*> QFormBuilder::customWidgets() const
Returns a list of the available plugins.
*/
QList<QDesignerCustomWidgetInterface*> QFormBuilder::customWidgets() const
QList<QCustomWidget*> QFormBuilder::customWidgets() const
{
return m_customWidgets.values();
}

View file

@ -30,7 +30,7 @@
QT_BEGIN_NAMESPACE
class QDesignerCustomWidgetInterface;
class QCustomWidget;
#ifdef QFORMINTERNAL_NAMESPACE
namespace QFormInternal
@ -49,7 +49,7 @@ public:
void addPluginPath(const QString &pluginPath);
void setPluginPath(const QStringList &pluginPaths);
QList<QDesignerCustomWidgetInterface*> customWidgets() const;
QList<QCustomWidget*> customWidgets() const;
protected:
virtual QWidget *create(DomUI *ui, QWidget *parentWidget);
@ -74,7 +74,7 @@ protected:
private:
QStringList m_pluginPaths;
QMap<QString, QDesignerCustomWidgetInterface*> m_customWidgets;
QMap<QString, QCustomWidget*> m_customWidgets;
};
#ifdef QFORMINTERNAL_NAMESPACE

View file

@ -757,7 +757,7 @@ QStringList QUiLoader::availableWidgets() const
d->setupWidgetMap();
foreach (QDesignerCustomWidgetInterface *plugin, d->builder.customWidgets()) {
foreach (QCustomWidget *plugin, d->builder.customWidgets()) {
g_widgets()->append(plugin->name());
}