1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the designer application of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#include "abstractwidgetdatabase.h"
30
#include <QtCore/qdebug.h>
31
#include <qalgorithms.h>
34
\class QDesignerWidgetDataBaseInterface
39
Constructs an interface to the widget database with the given \a parent.
41
QDesignerWidgetDataBaseInterface::QDesignerWidgetDataBaseInterface(QObject *parent)
47
Destroys the interface to the widget database.
49
QDesignerWidgetDataBaseInterface::~QDesignerWidgetDataBaseInterface()
57
int QDesignerWidgetDataBaseInterface::count() const
59
return m_items.count();
64
QDesignerWidgetDataBaseItemInterface *QDesignerWidgetDataBaseInterface::item(int index) const
66
return index != -1 ? m_items.at(index) : 0;
71
int QDesignerWidgetDataBaseInterface::indexOf(QDesignerWidgetDataBaseItemInterface *item) const
73
return m_items.indexOf(item);
78
void QDesignerWidgetDataBaseInterface::insert(int index, QDesignerWidgetDataBaseItemInterface *item)
80
m_items.insert(index, item);
85
void QDesignerWidgetDataBaseInterface::append(QDesignerWidgetDataBaseItemInterface *item)
92
QDesignerFormEditorInterface *QDesignerWidgetDataBaseInterface::core() const
99
int QDesignerWidgetDataBaseInterface::indexOfClassName(const QString &name, bool) const
101
for (int i=0; i<count(); ++i) {
102
QDesignerWidgetDataBaseItemInterface *entry = item(i);
103
if (entry->name() == name)
112
int QDesignerWidgetDataBaseInterface::indexOfObject(QObject *object, bool) const
117
QString className = QString::fromUtf8(object->metaObject()->className());
118
return indexOfClassName(className);
123
bool QDesignerWidgetDataBaseInterface::isContainer(QObject *object, bool resolveName) const
125
if (QDesignerWidgetDataBaseItemInterface *i = item(indexOfObject(object, resolveName)))
126
return i->isContainer();
132
bool QDesignerWidgetDataBaseInterface::isCustom(QObject *object, bool resolveName) const
134
if (QDesignerWidgetDataBaseItemInterface *i = item(indexOfObject(object, resolveName)))
135
return i->isCustom();
140
\fn void QDesignerWidgetDataBaseInterface::changed()
142
This signal is emitted ...
146
// Doc: No implementation - an abstract class
149
\class QDesignerWidgetDataBaseItemInterface
150
\brief The QDesignerWidgetDataBaseItemInterface class provides an interface that is used to
151
access individual items in \QD's widget database.
154
This class enables individual items in the widget database to be accessed and modified.
155
Changes to the widget database itself are made through the QDesignerWidgetDataBaseInterface
160
\fn virtual QDesignerWidgetDataBaseItemInterface::~QDesignerWidgetDataBaseItemInterface()
162
Destroys the interface.
166
\fn virtual QString QDesignerWidgetDataBaseItemInterface::name() const = 0
168
Returns the name of the widget.
172
\fn virtual void QDesignerWidgetDataBaseItemInterface::setName(const QString &name) = 0
176
\fn virtual QString QDesignerWidgetDataBaseItemInterface::group() const = 0
178
Returns the name of the group that the widget belongs to.
182
\fn virtual void QDesignerWidgetDataBaseItemInterface::setGroup(const QString &group) = 0
186
\fn virtual QString QDesignerWidgetDataBaseItemInterface::toolTip() const = 0
188
Returns the tool tip to be used by the widget.
192
\fn virtual void QDesignerWidgetDataBaseItemInterface::setToolTip(const QString &toolTip) = 0
196
\fn virtual QString QDesignerWidgetDataBaseItemInterface::whatsThis() const = 0
198
Returns the "What's This?" help for the widget.
202
\fn virtual void QDesignerWidgetDataBaseItemInterface::setWhatsThis(const QString &whatsThis) = 0
206
\fn virtual QString QDesignerWidgetDataBaseItemInterface::includeFile() const = 0
208
Returns the name of the include file that the widget needs when being built from source.
212
\fn virtual void QDesignerWidgetDataBaseItemInterface::setIncludeFile(const QString &includeFile) = 0
216
\fn virtual QIcon QDesignerWidgetDataBaseItemInterface::icon() const = 0
218
Returns the icon used to represent the item.
222
\fn virtual void QDesignerWidgetDataBaseItemInterface::setIcon(const QIcon &icon) = 0
226
\fn virtual bool QDesignerWidgetDataBaseItemInterface::isCompat() const = 0
228
Returns true if this type of widget is provided for compatibility purposes (e.g. Qt3Support
229
widgets); otherwise returns false.
235
\fn virtual void QDesignerWidgetDataBaseItemInterface::setCompat(bool compat) = 0
237
If \a compat is true, the widget is handled as a compatibility widget; otherwise it is
238
handled normally by \QD.
244
\fn virtual bool QDesignerWidgetDataBaseItemInterface::isContainer() const = 0
246
Returns true if this widget is intended to be used to hold other widgets; otherwise returns
253
\fn virtual void QDesignerWidgetDataBaseItemInterface::setContainer(bool container) = 0
255
If \a container is true, the widget can be used to hold other widgets in \QD; otherwise
256
\QD will refuse to let the user place other widgets inside it.
262
\fn virtual bool QDesignerWidgetDataBaseItemInterface::isCustom() const = 0
264
Returns true if the widget is a custom widget; otherwise return false if it is a standard
271
\fn virtual void QDesignerWidgetDataBaseItemInterface::setCustom(bool custom) = 0
273
If \a custom is true, the widget is handled specially by \QD; otherwise it is handled as
274
a standard Qt widget.
280
\fn virtual QString QDesignerWidgetDataBaseItemInterface::pluginPath() const = 0
282
Returns the path to use for the widget plugin.
286
\fn virtual void QDesignerWidgetDataBaseItemInterface::setPluginPath(const QString &path) = 0
290
\fn virtual bool QDesignerWidgetDataBaseItemInterface::isPromoted() const = 0
292
Returns true if the widget is promoted; otherwise returns false.
294
Promoted widgets are those that represent custom widgets, but which are represented in
295
\QD by either standard Qt widgets or readily-available custom widgets.
301
\fn virtual void QDesignerWidgetDataBaseItemInterface::setPromoted(bool promoted) = 0
303
If \a promoted is true, the widget is handled as a promoted widget by \QD and will use
304
a placeholder widget to represent it; otherwise it is handled as a standard widget.
310
\fn virtual QString QDesignerWidgetDataBaseItemInterface::extends() const = 0
312
Returns the name of the widget that the item extends.
316
\fn virtual void QDesignerWidgetDataBaseItemInterface::setExtends(const QString &s) = 0
320
\fn virtual void QDesignerWidgetDataBaseItemInterface::setDefaultPropertyValues(const QList<QVariant> &list) = 0
322
Sets the default property values for the widget to the given \a list.
326
\fn virtual QList<QVariant> QDesignerWidgetDataBaseItemInterface::defaultPropertyValues() const = 0
328
Returns a list of default values to be used as properties for the item.