diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2009-03-23 09:18:55 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-03-23 09:18:55 (GMT) |
commit | e5fcad302d86d316390c6b0f62759a067313e8a9 (patch) | |
tree | c2afbf6f1066b6ce261f14341cf6d310e5595bc1 /tools/designer/src/lib/sdk | |
download | Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2 |
Long live Qt 4.5!
Diffstat (limited to 'tools/designer/src/lib/sdk')
55 files changed, 8323 insertions, 0 deletions
diff --git a/tools/designer/src/lib/sdk/abstractactioneditor.cpp b/tools/designer/src/lib/sdk/abstractactioneditor.cpp new file mode 100644 index 0000000..e3b870a --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractactioneditor.cpp @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractactioneditor.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerActionEditorInterface + + \brief The QDesignerActionEditorInterface class allows you to + change the focus of Qt Designer's action editor. + + \inmodule QtDesigner + + The QDesignerActionEditorInterface class is not intended to be + instantiated directly. You can retrieve an interface to \QD's + action editor using the + QDesignerFormEditorInterface::actionEditor() function. + + You can control which actions that are available in the action + editor's window using the manageAction() and unmanageAction() + functions. An action that is managed by \QD is available in the + action editor while an unmanaged action is ignored. + + QDesignerActionEditorInterface also provides the core() function + that you can use to retrieve a pointer to \QD's current + QDesignerFormEditorInterface object, and the setFormWindow() + function that enables you to change the currently selected form + window. + + \sa QDesignerFormEditorInterface, QDesignerFormWindowInterface +*/ + +/*! + Constructs an action editor interface with the given \a parent and + the specified window \a flags. +*/ +QDesignerActionEditorInterface::QDesignerActionEditorInterface(QWidget *parent, Qt::WindowFlags flags) + : QWidget(parent, flags) +{ +} + +/*! + Destroys the action editor interface. +*/ +QDesignerActionEditorInterface::~QDesignerActionEditorInterface() +{ +} + +/*! + Returns a pointer to \QD's current QDesignerFormEditorInterface + object. +*/ +QDesignerFormEditorInterface *QDesignerActionEditorInterface::core() const +{ + return 0; +} + +/*! + \fn void QDesignerActionEditorInterface::setFormWindow(QDesignerFormWindowInterface *formWindow) + + Sets the currently selected form window to \a formWindow. + +*/ + +/*! + \fn void QDesignerActionEditorInterface::manageAction(QAction *action) + + Instructs \QD to manage the specified \a action. An action that is + managed by \QD is available in the action editor. + + \sa unmanageAction() +*/ + +/*! + \fn void QDesignerActionEditorInterface::unmanageAction(QAction *action) + + Instructs \QD to ignore the specified \a action. An unmanaged + action is not available in the action editor. + + \sa manageAction() +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractactioneditor.h b/tools/designer/src/lib/sdk/abstractactioneditor.h new file mode 100644 index 0000000..7408a52 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractactioneditor.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTACTIONEDITOR_H +#define ABSTRACTACTIONEDITOR_H + +#include <QtDesigner/sdk_global.h> + +#include <QtGui/QWidget> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDesignerFormEditorInterface; +class QDesignerFormWindowInterface; + +class QDESIGNER_SDK_EXPORT QDesignerActionEditorInterface: public QWidget +{ + Q_OBJECT +public: + QDesignerActionEditorInterface(QWidget *parent, Qt::WindowFlags flags = 0); + virtual ~QDesignerActionEditorInterface(); + + virtual QDesignerFormEditorInterface *core() const; + + virtual void manageAction(QAction *action) = 0; + virtual void unmanageAction(QAction *action) = 0; + +public Q_SLOTS: + virtual void setFormWindow(QDesignerFormWindowInterface *formWindow) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTACTIONEDITOR_H diff --git a/tools/designer/src/lib/sdk/abstractbrushmanager.h b/tools/designer/src/lib/sdk/abstractbrushmanager.h new file mode 100644 index 0000000..493ca25 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractbrushmanager.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTBRUSHMANAGER_H +#define ABSTRACTBRUSHMANAGER_H + +#include <QtDesigner/sdk_global.h> + +#include <QtCore/qobject.h> +#include <QtCore/qmap.h> +#include <QtGui/qbrush.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QObject; + +class QDESIGNER_SDK_EXPORT QDesignerBrushManagerInterface : public QObject +{ + Q_OBJECT +public: + QDesignerBrushManagerInterface(QObject *parentObject = 0) : QObject(parentObject) {} + + virtual QBrush brush(const QString &name) const = 0; + virtual QMap<QString, QBrush> brushes() const = 0; + virtual QString currentBrush() const = 0; + + virtual QString addBrush(const QString &name, const QBrush &brush) = 0; + virtual void removeBrush(const QString &name) = 0; + virtual void setCurrentBrush(const QString &name) = 0; + + virtual QPixmap brushPixmap(const QBrush &brush) const = 0; +Q_SIGNALS: + void brushAdded(const QString &name, const QBrush &brush); + void brushRemoved(const QString &name); + void currentBrushChanged(const QString &name, const QBrush &brush); + +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif diff --git a/tools/designer/src/lib/sdk/abstractdialoggui.cpp b/tools/designer/src/lib/sdk/abstractdialoggui.cpp new file mode 100644 index 0000000..690fb51 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractdialoggui.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractdialoggui_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerDialogGuiInterface + \since 4.4 + \internal + + \brief The QDesignerDialogGuiInterface allows integrations of \QD to replace the + message boxes displayed by \QD by custom dialogs. + + \inmodule QtDesigner + + QDesignerDialogGuiInterface provides virtual functions that can be overwritten + to display message boxes and file dialogs. + \sa QMessageBox, QFileDialog +*/ + +/*! + \enum QDesignerDialogGuiInterface::Message + + This enum specifies the context from within the message box is called. + + \value FormLoadFailureMessage Loading of a form failed + \value UiVersionMismatchMessage Attempt to load a file created with an old version of Designer + \value ResourceLoadFailureMessage Resources specified in a file could not be found + \value TopLevelSpacerMessage Spacer items detected on a container without layout + \value PropertyEditorMessage Messages of the propert yeditor + \value SignalSlotEditorMessage Messages of the signal / slot editor + \value FormEditorMessage Messages of the form editor + \value PreviewFailureMessage A preview could not be created + \value PromotionErrorMessage Messages related to promotion of a widget + \value ResourceEditorMessage Messages of the resource editor + \value ScriptDialogMessage Messages of the script dialog + \value SignalSlotDialogMessage Messages of the signal slot dialog + \value OtherMessage Unspecified context +*/ + +/*! + Constructs a QDesignerDialogGuiInterface object. +*/ + +QDesignerDialogGuiInterface::QDesignerDialogGuiInterface() +{ +} + +/*! + Destroys the QDesignerDialogGuiInterface object. +*/ +QDesignerDialogGuiInterface::~QDesignerDialogGuiInterface() +{ +} + +/*! + \fn QMessageBox::StandardButton QDesignerDialogGuiInterface::message(QWidget *parent, Message context, QMessageBox::Icon icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) + + Opens a message box as child of \a parent within the context \a context, using \a icon, \a title, \a text, \a buttons and \a defaultButton + and returns the button chosen by the user. +*/ + +/*! + \fn QString QDesignerDialogGuiInterface::getExistingDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options) + + Opens a file dialog as child of \a parent using the parameters \a caption, \a dir and \a options that prompts the + user for an existing directory. Returns a directory selected by the user. +*/ + +/*! + \fn QString QDesignerDialogGuiInterface::getOpenFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options) + + Opens a file dialog as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options + that prompts the user for an existing file. Returns a file selected by the user. +*/ + +/*! + \fn QStringList QDesignerDialogGuiInterface::getOpenFileNames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options) + + Opens a file dialog as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options + that prompts the user for a set of existing files. Returns one or more existing files selected by the user. +*/ + +/*! + Opens a file dialog with image browsing capabilities as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options + that prompts the user for an existing file. Returns a file selected by the user. + + The default implementation simply calls getOpenFileName(). On platforms that do not support an image preview in the QFileDialog, + the function can be reimplemented to provide an image browser. + + \since 4.5 +*/ + +QString QDesignerDialogGuiInterface::getOpenImageFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options) +{ + return getOpenFileName(parent, caption, dir, filter, selectedFilter, options); +} + +/*! + Opens a file dialog with image browsing capabilities as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options + that prompts the user for a set of existing files. Returns one or more existing files selected by the user. + + The default implementation simply calls getOpenFileNames(). On platforms that do not support an image preview in the QFileDialog, + the function can be reimplemented to provide an image browser. + + \since 4.5 +*/ + +QStringList QDesignerDialogGuiInterface::getOpenImageFileNames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options options) +{ + return getOpenImageFileNames(parent, caption, dir, filter, selectedFilter, options); +} + +/*! + \fn QString QDesignerDialogGuiInterface::getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options) + + Opens a file dialog as child of \a parent using the parameters \a caption, \a dir, \a filter, \a selectedFilter and \a options + that prompts the user for a file. Returns a file selected by the user. The file does not have to exist. +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractdialoggui_p.h b/tools/designer/src/lib/sdk/abstractdialoggui_p.h new file mode 100644 index 0000000..faaa7e5 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractdialoggui_p.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt Designer. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#ifndef ABSTRACTDIALOGGUI_H +#define ABSTRACTDIALOGGUI_H + +#include <QtDesigner/sdk_global.h> +#include <QtGui/QMessageBox> +#include <QtGui/QFileDialog> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QWidget; + +class QDESIGNER_SDK_EXPORT QDesignerDialogGuiInterface +{ + Q_DISABLE_COPY(QDesignerDialogGuiInterface) +public: + QDesignerDialogGuiInterface(); + virtual ~QDesignerDialogGuiInterface(); + + enum Message { FormLoadFailureMessage, UiVersionMismatchMessage, ResourceLoadFailureMessage, + TopLevelSpacerMessage, PropertyEditorMessage, SignalSlotEditorMessage, FormEditorMessage, + PreviewFailureMessage, PromotionErrorMessage, ResourceEditorMessage, + ScriptDialogMessage, SignalSlotDialogMessage, OtherMessage, FileChangedMessage }; + + virtual QMessageBox::StandardButton + message(QWidget *parent, Message context, QMessageBox::Icon icon, + const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, + QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) = 0; + + virtual QMessageBox::StandardButton + message(QWidget *parent, Message context, QMessageBox::Icon icon, + const QString &title, const QString &text, const QString &informativeText, + QMessageBox::StandardButtons buttons = QMessageBox::Ok, + QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) = 0; + + virtual QMessageBox::StandardButton + message(QWidget *parent, Message context, QMessageBox::Icon icon, + const QString &title, const QString &text, const QString &informativeText, const QString &detailedText, + QMessageBox::StandardButtons buttons = QMessageBox::Ok, + QMessageBox::StandardButton defaultButton = QMessageBox::NoButton) = 0; + + virtual QString getExistingDirectory(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly)= 0; + virtual QString getOpenFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0)= 0; + virtual QString getOpenImageFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0); + virtual QStringList getOpenFileNames(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0)= 0; + virtual QStringList getOpenImageFileNames(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0); + virtual QString getSaveFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = 0, QFileDialog::Options options = 0)= 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTDIALOGGUI_H diff --git a/tools/designer/src/lib/sdk/abstractdnditem.h b/tools/designer/src/lib/sdk/abstractdnditem.h new file mode 100644 index 0000000..fca1295 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractdnditem.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTDNDITEM_H +#define ABSTRACTDNDITEM_H + +#include <QtDesigner/sdk_global.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class DomUI; +class QWidget; +class QPoint; + +class QDESIGNER_SDK_EXPORT QDesignerDnDItemInterface +{ +public: + enum DropType { MoveDrop, CopyDrop }; + + QDesignerDnDItemInterface() {} + virtual ~QDesignerDnDItemInterface() {} + + virtual DomUI *domUi() const = 0; + virtual QWidget *widget() const = 0; + virtual QWidget *decoration() const = 0; + virtual QPoint hotSpot() const = 0; + virtual DropType type() const = 0; + virtual QWidget *source() const = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTDNDITEM_H diff --git a/tools/designer/src/lib/sdk/abstractformeditor.cpp b/tools/designer/src/lib/sdk/abstractformeditor.cpp new file mode 100644 index 0000000..17e93e7 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractformeditor.cpp @@ -0,0 +1,621 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractformeditor.h" +#include "abstractdialoggui_p.h" +#include "abstractintrospection_p.h" +#include "abstractsettings_p.h" +#include "abstractoptionspage_p.h" + +#include <QtDesigner/QDesignerWidgetBoxInterface> +#include <QtDesigner/QDesignerPropertyEditorInterface> +#include <QtDesigner/QDesignerFormWindowManagerInterface> +#include <QtDesigner/QExtensionManager> +#include <QtDesigner/QDesignerMetaDataBaseInterface> +#include <QtDesigner/QDesignerWidgetDataBaseInterface> +#include <QtDesigner/QDesignerWidgetFactoryInterface> +#include <QtDesigner/QDesignerObjectInspectorInterface> +#include <QtDesigner/QDesignerBrushManagerInterface> +#include <QtDesigner/QDesignerIntegrationInterface> +#include <QtDesigner/QDesignerIconCacheInterface> +#include <QtDesigner/QDesignerActionEditorInterface> +#include <pluginmanager_p.h> +#include <qtresourcemodel_p.h> +#include <qtgradientmanager.h> +#include <widgetfactory_p.h> +#include <shared_settings_p.h> +#include <formwindowbase_p.h> +#include <grid_p.h> +#include <QtDesigner/QDesignerPromotionInterface> + +static void initResources() +{ + Q_INIT_RESOURCE(shared); +} + +QT_BEGIN_NAMESPACE + +class QDesignerFormEditorInterfacePrivate { +public: + QDesignerFormEditorInterfacePrivate(); + ~QDesignerFormEditorInterfacePrivate(); + + + QPointer<QWidget> m_topLevel; + QPointer<QDesignerWidgetBoxInterface> m_widgetBox; + QPointer<QDesignerPropertyEditorInterface> m_propertyEditor; + QPointer<QDesignerFormWindowManagerInterface> m_formWindowManager; + QPointer<QExtensionManager> m_extensionManager; + QPointer<QDesignerMetaDataBaseInterface> m_metaDataBase; + QPointer<QDesignerWidgetDataBaseInterface> m_widgetDataBase; + QPointer<QDesignerWidgetFactoryInterface> m_widgetFactory; + QPointer<QDesignerObjectInspectorInterface> m_objectInspector; + QPointer<QDesignerBrushManagerInterface> m_brushManager; + QPointer<QDesignerIntegrationInterface> m_integration; + QPointer<QDesignerIconCacheInterface> m_iconCache; + QPointer<QDesignerActionEditorInterface> m_actionEditor; + QDesignerSettingsInterface *m_settingsManager; + QDesignerPluginManager *m_pluginManager; + QDesignerPromotionInterface *m_promotion; + QDesignerIntrospectionInterface *m_introspection; + QDesignerDialogGuiInterface *m_dialogGui; + QPointer<QtResourceModel> m_resourceModel; + QPointer<QtGradientManager> m_gradientManager; // instantiated and deleted by designer_integration + QList<QDesignerOptionsPageInterface*> m_optionsPages; +}; + +QDesignerFormEditorInterfacePrivate::QDesignerFormEditorInterfacePrivate() : + m_settingsManager(0), + m_pluginManager(0), + m_promotion(0), + m_introspection(0), + m_dialogGui(0), + m_resourceModel(0), + m_gradientManager(0) +{ +} + +QDesignerFormEditorInterfacePrivate::~QDesignerFormEditorInterfacePrivate() +{ + delete m_settingsManager; + delete m_formWindowManager; + delete m_promotion; + delete m_introspection; + delete m_dialogGui; + delete m_resourceModel; + qDeleteAll(m_optionsPages); +} + +/*! + \class QDesignerFormEditorInterface + + \brief The QDesignerFormEditorInterface class allows you to access + Qt Designer's various components. + + \inmodule QtDesigner + + \QD's current QDesignerFormEditorInterface object holds + information about all \QD's components: The action editor, the + object inspector, the property editor, the widget box, and the + extension and form window managers. QDesignerFormEditorInterface + contains a collection of functions that provides interfaces to all + these components. They are typically used to query (and + manipulate) the respective component. For example: + + \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 + components. + + If designer is embedded in another program, one could to provide its + own settings manager. The manager is used by the components of \QD + to store/retrieve persistent configuration settings. The default + manager uses QSettings as the backend. + + Finally, QDesignerFormEditorInterface provides the topLevel() + function that returns \QD's top-level widget. + + \sa QDesignerCustomWidgetInterface +*/ + +/*! + Constructs a QDesignerFormEditorInterface object with the given \a + parent. +*/ + +QDesignerFormEditorInterface::QDesignerFormEditorInterface(QObject *parent) + : QObject(parent), + d(new QDesignerFormEditorInterfacePrivate()) +{ + initResources(); +} + +/*! + Destroys the QDesignerFormEditorInterface object. +*/ +QDesignerFormEditorInterface::~QDesignerFormEditorInterface() +{ + delete d; +} + +/*! + Returns an interface to \QD's widget box. + + \sa setWidgetBox() +*/ +QDesignerWidgetBoxInterface *QDesignerFormEditorInterface::widgetBox() const +{ + return d->m_widgetBox; +} + +/*! + Sets \QD's widget box to be the specified \a widgetBox. + + \sa widgetBox() +*/ +void QDesignerFormEditorInterface::setWidgetBox(QDesignerWidgetBoxInterface *widgetBox) +{ + d->m_widgetBox = widgetBox; +} + +/*! + Returns an interface to \QD's property editor. + + \sa setPropertyEditor() +*/ +QDesignerPropertyEditorInterface *QDesignerFormEditorInterface::propertyEditor() const +{ + return d->m_propertyEditor; +} + +/*! + Sets \QD's property editor to be the specified \a propertyEditor. + + \sa propertyEditor() +*/ +void QDesignerFormEditorInterface::setPropertyEditor(QDesignerPropertyEditorInterface *propertyEditor) +{ + d->m_propertyEditor = propertyEditor; +} + +/*! + Returns an interface to \QD's action editor. + + \sa setActionEditor() +*/ +QDesignerActionEditorInterface *QDesignerFormEditorInterface::actionEditor() const +{ + return d->m_actionEditor; +} + +/*! + Sets \QD's action editor to be the specified \a actionEditor. + + \sa actionEditor() +*/ +void QDesignerFormEditorInterface::setActionEditor(QDesignerActionEditorInterface *actionEditor) +{ + d->m_actionEditor = actionEditor; +} + +/*! + Returns \QD's top-level widget. +*/ +QWidget *QDesignerFormEditorInterface::topLevel() const +{ + return d->m_topLevel; +} + +/*! + \internal +*/ +void QDesignerFormEditorInterface::setTopLevel(QWidget *topLevel) +{ + d->m_topLevel = topLevel; +} + +/*! + Returns an interface to \QD's form window manager. +*/ +QDesignerFormWindowManagerInterface *QDesignerFormEditorInterface::formWindowManager() const +{ + return d->m_formWindowManager; +} + +/*! + \internal +*/ +void QDesignerFormEditorInterface::setFormManager(QDesignerFormWindowManagerInterface *formWindowManager) +{ + d->m_formWindowManager = formWindowManager; +} + +/*! + Returns an interface to \QD's extension manager. +*/ +QExtensionManager *QDesignerFormEditorInterface::extensionManager() const +{ + return d->m_extensionManager; +} + +/*! + \internal +*/ +void QDesignerFormEditorInterface::setExtensionManager(QExtensionManager *extensionManager) +{ + d->m_extensionManager = extensionManager; +} + +/*! + \internal + + Returns an interface to the meta database used by the form editor. +*/ +QDesignerMetaDataBaseInterface *QDesignerFormEditorInterface::metaDataBase() const +{ + return d->m_metaDataBase; +} + +/*! + \internal +*/ +void QDesignerFormEditorInterface::setMetaDataBase(QDesignerMetaDataBaseInterface *metaDataBase) +{ + d->m_metaDataBase = metaDataBase; +} + +/*! + \internal + + Returns an interface to the widget database used by the form editor. +*/ +QDesignerWidgetDataBaseInterface *QDesignerFormEditorInterface::widgetDataBase() const +{ + return d->m_widgetDataBase; +} + +/*! + \internal +*/ +void QDesignerFormEditorInterface::setWidgetDataBase(QDesignerWidgetDataBaseInterface *widgetDataBase) +{ + d->m_widgetDataBase = widgetDataBase; +} + +/*! + \internal + + Returns an interface to the designer promotion handler. +*/ + +QDesignerPromotionInterface *QDesignerFormEditorInterface::promotion() const +{ + return d->m_promotion; +} + +/*! + \internal + + Sets the designer promotion handler. +*/ + +void QDesignerFormEditorInterface::setPromotion(QDesignerPromotionInterface *promotion) +{ + if (d->m_promotion) + delete d->m_promotion; + d->m_promotion = promotion; +} + +/*! + \internal + + Returns an interface to the widget factory used by the form editor + to create widgets for the form. +*/ +QDesignerWidgetFactoryInterface *QDesignerFormEditorInterface::widgetFactory() const +{ + return d->m_widgetFactory; +} + +/*! + \internal +*/ +void QDesignerFormEditorInterface::setWidgetFactory(QDesignerWidgetFactoryInterface *widgetFactory) +{ + d->m_widgetFactory = widgetFactory; +} + +/*! + Returns an interface to \QD's object inspector. +*/ +QDesignerObjectInspectorInterface *QDesignerFormEditorInterface::objectInspector() const +{ + return d->m_objectInspector; +} + +/*! + Sets \QD's object inspector to be the specified \a + objectInspector. + + \sa objectInspector() +*/ +void QDesignerFormEditorInterface::setObjectInspector(QDesignerObjectInspectorInterface *objectInspector) +{ + d->m_objectInspector = objectInspector; +} + +/*! + \internal + + Returns an interface to the brush manager used by the palette editor. +*/ +QDesignerBrushManagerInterface *QDesignerFormEditorInterface::brushManager() const +{ + return d->m_brushManager; +} + +/*! + \internal +*/ +void QDesignerFormEditorInterface::setBrushManager(QDesignerBrushManagerInterface *brushManager) +{ + d->m_brushManager = brushManager; +} + +/*! + \internal + + Returns an interface to the integration. +*/ +QDesignerIntegrationInterface *QDesignerFormEditorInterface::integration() const +{ + return d->m_integration; +} + +/*! + \internal +*/ +void QDesignerFormEditorInterface::setIntegration(QDesignerIntegrationInterface *integration) +{ + d->m_integration = integration; +} + +/*! + \internal + + Returns an interface to the icon cache used by the form editor to + manage icons. +*/ +QDesignerIconCacheInterface *QDesignerFormEditorInterface::iconCache() const +{ + return d->m_iconCache; +} + +/*! + \internal +*/ +void QDesignerFormEditorInterface::setIconCache(QDesignerIconCacheInterface *cache) +{ + d->m_iconCache = cache; +} + +/*! + \internal + \since 4.5 + Returns the list of options pages that allow the user to configure \QD components. +*/ +QList<QDesignerOptionsPageInterface*> QDesignerFormEditorInterface::optionsPages() const +{ + return d->m_optionsPages; +} + +/*! + \internal + \since 4.5 + Sets the list of options pages that allow the user to configure \QD components. +*/ +void QDesignerFormEditorInterface::setOptionsPages(const QList<QDesignerOptionsPageInterface*> &optionsPages) +{ + d->m_optionsPages = optionsPages; +} + + +/*! + \internal + + Returns the plugin manager used by the form editor. +*/ +QDesignerPluginManager *QDesignerFormEditorInterface::pluginManager() const +{ + return d->m_pluginManager; +} + +/*! + \internal + + Sets the plugin manager used by the form editor to the specified + \a pluginManager. +*/ +void QDesignerFormEditorInterface::setPluginManager(QDesignerPluginManager *pluginManager) +{ + d->m_pluginManager = pluginManager; +} + +/*! + \internal + \since 4.4 + Returns the resource model used by the form editor. +*/ +QtResourceModel *QDesignerFormEditorInterface::resourceModel() const +{ + return d->m_resourceModel; +} + +/*! + \internal + + Sets the resource model used by the form editor to the specified + \a resourceModel. +*/ +void QDesignerFormEditorInterface::setResourceModel(QtResourceModel *resourceModel) +{ + d->m_resourceModel = resourceModel; +} + +/*! + \internal + \since 4.4 + Returns the gradient manager used by the style sheet editor. +*/ +QtGradientManager *QDesignerFormEditorInterface::gradientManager() const +{ + return d->m_gradientManager; +} + +/*! + \internal + + Sets the gradient manager used by the style sheet editor to the specified + \a gradientManager. +*/ +void QDesignerFormEditorInterface::setGradientManager(QtGradientManager *gradientManager) +{ + d->m_gradientManager = gradientManager; +} + +/*! + \internal + \since 4.5 + Returns the settings manager used by the components to store persistent settings. +*/ +QDesignerSettingsInterface *QDesignerFormEditorInterface::settingsManager() const +{ + return d->m_settingsManager; +} + +/*! + \internal + \since 4.5 + Sets the settings manager used to store/retrieve the persistent settings of the components. +*/ +void QDesignerFormEditorInterface::setSettingsManager(QDesignerSettingsInterface *settingsManager) +{ + if (d->m_settingsManager) + delete d->m_settingsManager; + d->m_settingsManager = settingsManager; + + // This is a (hopefully) safe place to perform settings-dependent + // initializations. + const qdesigner_internal::QDesignerSharedSettings settings(this); + qdesigner_internal::FormWindowBase::setDefaultDesignerGrid(settings.defaultGrid()); +} + +/*! + \internal + \since 4.4 + Returns the introspection used by the form editor. +*/ +QDesignerIntrospectionInterface *QDesignerFormEditorInterface::introspection() const +{ + return d->m_introspection; +} + +/*! + \internal + \since 4.4 + + Sets the introspection used by the form editor to the specified \a introspection. +*/ +void QDesignerFormEditorInterface::setIntrospection(QDesignerIntrospectionInterface *introspection) +{ + if (d->m_introspection) + delete d->m_introspection; + d->m_introspection = introspection; +} + +/*! + \internal + + Returns the path to the resources used by the form editor. +*/ +QString QDesignerFormEditorInterface::resourceLocation() const +{ +#ifdef Q_WS_MAC + return QLatin1String(":/trolltech/formeditor/images/mac"); +#else + return QLatin1String(":/trolltech/formeditor/images/win"); +#endif +} + +/*! + \internal + + Returns the dialog GUI used by the form editor. +*/ + +QDesignerDialogGuiInterface *QDesignerFormEditorInterface::dialogGui() const +{ + return d->m_dialogGui; +} + +/*! + \internal + + Sets the dialog GUI used by the form editor to the specified \a dialogGui. +*/ + +void QDesignerFormEditorInterface::setDialogGui(QDesignerDialogGuiInterface *dialogGui) +{ + delete d->m_dialogGui; + d->m_dialogGui = dialogGui; +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractformeditor.h b/tools/designer/src/lib/sdk/abstractformeditor.h new file mode 100644 index 0000000..0625ce6 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractformeditor.h @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTFORMEDITOR_H +#define ABSTRACTFORMEDITOR_H + +#include <QtDesigner/sdk_global.h> + +#include <QtCore/QObject> +#include <QtCore/QPointer> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDesignerWidgetBoxInterface; +class QDesignerPropertyEditorInterface; +class QDesignerFormWindowManagerInterface; +class QDesignerWidgetDataBaseInterface; +class QDesignerMetaDataBaseInterface; +class QDesignerWidgetFactoryInterface; +class QDesignerObjectInspectorInterface; +class QDesignerPromotionInterface; +class QDesignerBrushManagerInterface; +class QDesignerIconCacheInterface; +class QDesignerActionEditorInterface; +class QDesignerIntegrationInterface; +class QDesignerPluginManager; +class QDesignerIntrospectionInterface; +class QDesignerDialogGuiInterface; +class QDesignerSettingsInterface; +class QDesignerOptionsPageInterface; +class QtResourceModel; +class QtGradientManager; + +class QWidget; + +class QExtensionManager; + +class QDesignerFormEditorInterfacePrivate; + +class QDESIGNER_SDK_EXPORT QDesignerFormEditorInterface : public QObject +{ + Q_OBJECT +public: + QDesignerFormEditorInterface(QObject *parent = 0); + virtual ~QDesignerFormEditorInterface(); + + QExtensionManager *extensionManager() const; + + QWidget *topLevel() const; + QDesignerWidgetBoxInterface *widgetBox() const; + QDesignerPropertyEditorInterface *propertyEditor() const; + QDesignerObjectInspectorInterface *objectInspector() const; + QDesignerFormWindowManagerInterface *formWindowManager() const; + QDesignerWidgetDataBaseInterface *widgetDataBase() const; + QDesignerMetaDataBaseInterface *metaDataBase() const; + QDesignerPromotionInterface *promotion() const; + QDesignerWidgetFactoryInterface *widgetFactory() const; + QDesignerBrushManagerInterface *brushManager() const; + QDesignerIconCacheInterface *iconCache() const; + QDesignerActionEditorInterface *actionEditor() const; + QDesignerIntegrationInterface *integration() const; + QDesignerPluginManager *pluginManager() const; + QDesignerIntrospectionInterface *introspection() const; + QDesignerDialogGuiInterface *dialogGui() const; + QDesignerSettingsInterface *settingsManager() const; + QString resourceLocation() const; + QtResourceModel *resourceModel() const; + QtGradientManager *gradientManager() const; + QList<QDesignerOptionsPageInterface*> optionsPages() const; + + void setTopLevel(QWidget *topLevel); + void setWidgetBox(QDesignerWidgetBoxInterface *widgetBox); + void setPropertyEditor(QDesignerPropertyEditorInterface *propertyEditor); + void setObjectInspector(QDesignerObjectInspectorInterface *objectInspector); + void setPluginManager(QDesignerPluginManager *pluginManager); + void setActionEditor(QDesignerActionEditorInterface *actionEditor); + void setIntegration(QDesignerIntegrationInterface *integration); + void setIntrospection(QDesignerIntrospectionInterface *introspection); + void setDialogGui(QDesignerDialogGuiInterface *dialogGui); + void setSettingsManager(QDesignerSettingsInterface *settingsManager); + void setResourceModel(QtResourceModel *model); + void setGradientManager(QtGradientManager *manager); + void setOptionsPages(const QList<QDesignerOptionsPageInterface*> &optionsPages); + +protected: + void setFormManager(QDesignerFormWindowManagerInterface *formWindowManager); + void setMetaDataBase(QDesignerMetaDataBaseInterface *metaDataBase); + void setWidgetDataBase(QDesignerWidgetDataBaseInterface *widgetDataBase); + void setPromotion(QDesignerPromotionInterface *promotion); + void setWidgetFactory(QDesignerWidgetFactoryInterface *widgetFactory); + void setExtensionManager(QExtensionManager *extensionManager); + void setBrushManager(QDesignerBrushManagerInterface *brushManager); + void setIconCache(QDesignerIconCacheInterface *cache); + +private: + QPointer<QWidget> m_pad1; + QPointer<QDesignerWidgetBoxInterface> m_pad2; + QPointer<QDesignerPropertyEditorInterface> m_pad3; + QPointer<QDesignerFormWindowManagerInterface> m_pad4; + QPointer<QExtensionManager> m_pad5; + QPointer<QDesignerMetaDataBaseInterface> m_pad6; + QPointer<QDesignerWidgetDataBaseInterface> m_pad7; + QPointer<QDesignerWidgetFactoryInterface> m_pad8; + QPointer<QDesignerObjectInspectorInterface> m_pad9; + QPointer<QDesignerBrushManagerInterface> m_pad10; + QPointer<QDesignerIconCacheInterface> m_pad11; + QPointer<QDesignerActionEditorInterface> m_pad12; + QDesignerFormEditorInterfacePrivate *d; + +private: + QDesignerFormEditorInterface(const QDesignerFormEditorInterface &other); + void operator = (const QDesignerFormEditorInterface &other); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTFORMEDITOR_H diff --git a/tools/designer/src/lib/sdk/abstractformeditorplugin.cpp b/tools/designer/src/lib/sdk/abstractformeditorplugin.cpp new file mode 100644 index 0000000..f4ee895 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractformeditorplugin.cpp @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtDesigner/abstractformeditorplugin.h> + +QT_BEGIN_NAMESPACE + +/*! + \internal + \class QDesignerFormEditorPluginInterface + \brief The QDesignerFormEditorPluginInterface class provides an interface that is used to + manage plugins for Qt Designer's form editor component. + \inmodule QtDesigner + + \sa QDesignerFormEditorInterface +*/ + +/*! + \fn virtual QDesignerFormEditorPluginInterface::~QDesignerFormEditorPluginInterface() + + Destroys the plugin interface. +*/ + +/*! + \fn virtual bool QDesignerFormEditorPluginInterface::isInitialized() const = 0 + + Returns true if the plugin interface is initialized; otherwise returns false. +*/ + +/*! + \fn virtual void QDesignerFormEditorPluginInterface::initialize(QDesignerFormEditorInterface *core) = 0 + + Initializes the plugin interface for the specified \a core interface. +*/ + +/*! + \fn virtual QAction *QDesignerFormEditorPluginInterface::action() const = 0 + + Returns the action associated with this interface. +*/ + +/*! + \fn virtual QDesignerFormEditorInterface *QDesignerFormEditorPluginInterface::core() const = 0 + + Returns the core form editor interface associated with this component. +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractformeditorplugin.h b/tools/designer/src/lib/sdk/abstractformeditorplugin.h new file mode 100644 index 0000000..6288602 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractformeditorplugin.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTFORMEDITORPLUGIN_H +#define ABSTRACTFORMEDITORPLUGIN_H + +#include <QtDesigner/sdk_global.h> + +#include <QtCore/QObject> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDesignerFormEditorInterface; +class QAction; + +class QDESIGNER_SDK_EXPORT QDesignerFormEditorPluginInterface +{ +public: + virtual ~QDesignerFormEditorPluginInterface() {} + + virtual bool isInitialized() const = 0; + virtual void initialize(QDesignerFormEditorInterface *core) = 0; + virtual QAction *action() const = 0; + + virtual QDesignerFormEditorInterface *core() const = 0; +}; +Q_DECLARE_INTERFACE(QDesignerFormEditorPluginInterface, "com.trolltech.Qt.Designer.QDesignerFormEditorPluginInterface") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTFORMEDITORPLUGIN_H diff --git a/tools/designer/src/lib/sdk/abstractformwindow.cpp b/tools/designer/src/lib/sdk/abstractformwindow.cpp new file mode 100644 index 0000000..3c05ff7 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractformwindow.cpp @@ -0,0 +1,814 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractformwindow.h" + +#include <widgetfactory_p.h> + +#include <QtGui/QTabBar> +#include <QtGui/QSizeGrip> +#include <QtGui/QAbstractButton> +#include <QtGui/QToolBox> +#include <QtGui/QMenuBar> +#include <QtGui/QMainWindow> +#include <QtGui/QDockWidget> +#include <QtGui/QToolBar> + +#include <QtCore/qdebug.h> + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerFormWindowInterface + + \brief The QDesignerFormWindowInterface class allows you to query + and manipulate form windows appearing in Qt Designer's workspace. + + \inmodule QtDesigner + + QDesignerFormWindowInterface provides information about + the associated form window as well as allowing its properties to be + altered. The interface is not intended to be instantiated + directly, but to provide access to \QD's current form windows + controlled by \QD's \l {QDesignerFormWindowManagerInterface}{form + window manager}. + + If you are looking for the form window containing a specific + widget, you can use the static + QDesignerFormWindowInterface::findFormWindow() function: + + \snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformwindow.cpp 0 + + But in addition, you can access any of the current form windows + through \QD's form window manager: Use the + QDesignerFormEditorInterface::formWindowManager() function to + retrieve an interface to the manager. Once you have this + interface, you have access to all of \QD's current form windows + through the QDesignerFormWindowManagerInterface::formWindow() + function. For example: + + \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 + \QD's workspace. But QDesignerFormWindowInterface provides you + with functions that enables you to control whether a widget should + be managed by \QD, or not: + + \snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformwindow.cpp 2 + + The complete list of functions concerning widget management is: + isManaged(), manageWidget() and unmanageWidget(). There is also + several associated signals: widgetManaged(), widgetRemoved(), + aboutToUnmanageWidget() and widgetUnmanaged(). + + In addition to controlling the management of widgets, you can + control the current selection in the form window using the + selectWidget(), clearSelection() and emitSelectionChanged() + functions, and the selectionChanged() signal. + + You can also retrieve information about where the form is stored + using absoluteDir(), its include files using includeHints(), and + its layout and pixmap functions using layoutDefault(), + layoutFunction() and pixmapFunction(). You can find out whether + the form window has been modified (but not saved) or not, using + the isDirty() function. You can retrieve its author(), its + contents(), its fileName(), associated comment() and + exportMacro(), its mainContainer(), its features(), its grid() and + its resourceFiles(). + + The interface provides you with functions and slots allowing you + to alter most of this information as well. The exception is the + directory storing the form window. Finally, there is several + signals associated with changes to the information mentioned above + and to the form window in general. + + \sa QDesignerFormWindowCursorInterface, + QDesignerFormEditorInterface, QDesignerFormWindowManagerInterface +*/ + +/*! + \enum QDesignerFormWindowInterface::FeatureFlag + + This enum describes the features that are available and can be + controlled by the form window interface. These values are used + when querying the form window to determine which features it + supports: + + \value EditFeature Form editing + \value GridFeature Grid display and snap-to-grid facilities for editing + \value TabOrderFeature Tab order management + \value DefaultFeature Support for default features (form editing and grid) + + \sa hasFeature(), features() +*/ + +/*! + Constructs a form window interface with the given \a parent and + the specified window \a flags. +*/ +QDesignerFormWindowInterface::QDesignerFormWindowInterface(QWidget *parent, Qt::WindowFlags flags) + : QWidget(parent, flags) +{ +} + +/*! + Destroys the form window interface. +*/ +QDesignerFormWindowInterface::~QDesignerFormWindowInterface() +{ +} + +/*! + Returns a pointer to \QD's current QDesignerFormEditorInterface + object. +*/ +QDesignerFormEditorInterface *QDesignerFormWindowInterface::core() const +{ + return 0; +} + +/*! + \fn QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QWidget *widget) + + Returns the form window interface for the given \a widget. +*/ + +static inline bool stopFindAtTopLevel(const QObject *w, bool stopAtMenu) +{ + // Do we need to go beyond top levels when looking for the form window? + // 1) A dialog has a window attribute at the moment it is created + // before it is properly embedded into a form window. The property + // sheet queries the layout attributes precisely at this moment. + // 2) In the case of floating docks and toolbars, we also need to go beyond the top level window. + // 3) In the case of menu editing, we don't want to block events from the + // Designer menu, so, we say stop. + // Note that there must be no false positives for dialogs parented on + // the form (for example, the "change object name" dialog), else, its + // events will be blocked. + + if (stopAtMenu && w->inherits("QDesignerMenu")) + return true; + return !qdesigner_internal::WidgetFactory::isFormEditorObject(w); +} + +QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QWidget *w) +{ + while (w != 0) { + if (QDesignerFormWindowInterface *fw = qobject_cast<QDesignerFormWindowInterface*>(w)) { + return fw; + } else { + if (w->isWindow() && stopFindAtTopLevel(w, true)) + break; + } + + w = w->parentWidget(); + } + + return 0; +} + +/*! + \fn QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObject *object) + + Returns the form window interface for the given \a object. + + \since 4.4 +*/ + +QDesignerFormWindowInterface *QDesignerFormWindowInterface::findFormWindow(QObject *object) +{ + while (object != 0) { + if (QDesignerFormWindowInterface *fw = qobject_cast<QDesignerFormWindowInterface*>(object)) { + return fw; + } else { + QWidget *w = qobject_cast<QWidget *>(object); + // QDesignerMenu is a window, so stopFindAtTopLevel(w) returns 0. + // However, we want to find the form window for QActions of a menu. + // If this check is inside stopFindAtTopLevel(w), it will break designer + // menu editing (e.g. when clicking on items inside an opened menu) + if (w && w->isWindow() && stopFindAtTopLevel(w, false)) + break; + + } + + object = object->parent(); + } + + return 0; +} + +/*! + \fn virtual QString QDesignerFormWindowInterface::fileName() const + + Returns the file name of the .ui file that describes the form + currently being shown. + + \sa setFileName() +*/ + +/*! + \fn virtual QDir QDesignerFormWindowInterface::absoluteDir() const + + Returns the absolute location of the directory containing the form + shown in the form window. +*/ + +/*! + \fn virtual QString QDesignerFormWindowInterface::contents() const + + Returns details of the contents of the form currently being + displayed in the window. +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setContents(QIODevice *device) + + Sets the form's contents using data obtained from the given \a device. + + Data can be read from QFile objects or any other subclass of QIODevice. +*/ + +/*! + \fn virtual Feature QDesignerFormWindowInterface::features() const + + Returns a combination of the features provided by the form window + associated with the interface. The value returned can be tested + against the \l Feature enum values to determine which features are + supported by the window. + + \sa setFeatures(), hasFeature() +*/ + +/*! + \fn virtual bool QDesignerFormWindowInterface::hasFeature(Feature feature) const + + Returns true if the form window offers the specified \a feature; + otherwise returns false. + + \sa features() +*/ + +/*! + \fn virtual QString QDesignerFormWindowInterface::author() const + + Returns details of the author or creator of the form currently + being displayed in the window. +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setAuthor(const QString &author) + + Sets the details for the author or creator of the form to the \a + author specified. +*/ + +/*! + \fn virtual QString QDesignerFormWindowInterface::comment() const + + Returns comments about the form currently being displayed in the window. +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setComment(const QString &comment) + + Sets the information about the form to the \a comment + specified. This information should be a human-readable comment + about the form. +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::layoutDefault(int *margin, int *spacing) + + Fills in the default margin and spacing for the form's default + layout in the \a margin and \a spacing variables specified. +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setLayoutDefault(int margin, int spacing) + + Sets the default \a margin and \a spacing for the form's layout. + + \sa layoutDefault() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::layoutFunction(QString *margin, QString *spacing) + + Fills in the current margin and spacing for the form's layout in + the \a margin and \a spacing variables specified. +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setLayoutFunction(const QString &margin, const QString &spacing) + + Sets the \a margin and \a spacing for the form's layout. + + The default layout properties will be replaced by the + corresponding layout functions when \c uic generates code for the + form, that is, if the functions are specified. This is useful when + different environments requires different layouts for the same + form. + + \sa layoutFunction() +*/ + +/*! + \fn virtual QString QDesignerFormWindowInterface::pixmapFunction() const + + Returns the name of the function used to load pixmaps into the + form window. + + \sa setPixmapFunction() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setPixmapFunction(const QString &pixmapFunction) + + Sets the function used to load pixmaps into the form window + to the given \a pixmapFunction. + + \sa pixmapFunction() +*/ + +/*! + \fn virtual QString QDesignerFormWindowInterface::exportMacro() const + + Returns the export macro associated with the form currently being + displayed in the window. The export macro is used when the form + is compiled to create a widget plugin. + + \sa {Creating Custom Widgets for Qt Designer} +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setExportMacro(const QString &exportMacro) + + Sets the form window's export macro to \a exportMacro. The export + macro is used when building a widget plugin to export the form's + interface to other components. +*/ + +/*! + \fn virtual QStringList QDesignerFormWindowInterface::includeHints() const + + Returns a list of the header files that will be included in the + form window's associated \c .ui file. + + Header files may be local, i.e. relative to the project's + directory,\c "mywidget.h", or global, i.e. part of Qt or the + compilers standard libraries:\c <QtGui/QWidget>. + + \sa setIncludeHints() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setIncludeHints(const QStringList &includeHints) + + Sets the header files that will be included in the form window's + associated \c .ui file to the specified \a includeHints. + + Header files may be local, i.e. relative to the project's + directory,\c "mywidget.h", or global, i.e. part of Qt or the + compilers standard libraries:\c <QtGui/QWidget>. + + \sa includeHints() +*/ + +/*! + \fn virtual QDesignerFormWindowCursorInterface *QDesignerFormWindowInterface::cursor() const + + Returns the cursor interface used by the form window. +*/ + +/*! + \fn virtual int QDesignerFormWindowInterface::toolCount() const + + Returns the number of tools available. + + \internal +*/ + +/*! + \fn virtual int QDesignerFormWindowInterface::currentTool() const + + Returns the index of the current tool in use. + + \sa setCurrentTool() + + \internal +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setCurrentTool(int index) + + Sets the current tool to be the one with the given \a index. + + \sa currentTool() + + \internal +*/ + +/*! + \fn virtual QDesignerFormWindowToolInterface *QDesignerFormWindowInterface::tool(int index) const + + Returns an interface to the tool with the given \a index. + + \internal +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::registerTool(QDesignerFormWindowToolInterface *tool) + + Registers the given \a tool with the form window. + + \internal +*/ + +/*! + \fn virtual QPoint QDesignerFormWindowInterface::grid() const = 0 + + Returns the grid spacing used by the form window. + + \sa setGrid() +*/ + +/*! + \fn virtual QWidget *QDesignerFormWindowInterface::mainContainer() const + + Returns the main container widget for the form window. + + \sa setMainContainer() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setMainContainer(QWidget *mainContainer) + + Sets the main container widget on the form to the specified \a + mainContainer. + + \sa mainContainer(), mainContainerChanged() +*/ + +/*! + \fn virtual bool QDesignerFormWindowInterface::isManaged(QWidget *widget) const + + Returns true if the specified \a widget is managed by the form + window; otherwise returns false. + + \sa manageWidget() +*/ + +/*! + \fn virtual bool QDesignerFormWindowInterface::isDirty() const + + Returns true if the form window is "dirty" (modified but not + saved); otherwise returns false. + + \sa setDirty() +*/ + +/*! + \fn virtual QUndoStack *QDesignerFormWindowInterface::commandHistory() const + + Returns an object that can be used to obtain the commands used so + far in the construction of the form. + + \internal +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::beginCommand(const QString &description) + + Begins execution of a command with the given \a + description. Commands are executed between beginCommand() and + endCommand() function calls to ensure that they are recorded on + the undo stack. + + \sa endCommand() + + \internal +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::endCommand() + + Ends execution of the current command. + + \sa beginCommand() + + \internal +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::simplifySelection(QList<QWidget*> *widgets) const + + Simplifies the selection of widgets specified by \a widgets. + + \sa selectionChanged() + \internal +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::emitSelectionChanged() + + Emits the selectionChanged() signal. + + \sa selectWidget(), clearSelection() +*/ + +/*! + \fn virtual QStringList QDesignerFormWindowInterface::resourceFiles() const + + Returns a list of paths to resource files that are currently being + used by the form window. + + \sa addResourceFile(), removeResourceFile() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::addResourceFile(const QString &path) + + Adds the resource file at the given \a path to those used by the form. + + \sa resourceFiles(), resourceFilesChanged() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::removeResourceFile(const QString &path) + + Removes the resource file at the specified \a path from the list + of those used by the form. + + \sa resourceFiles(), resourceFilesChanged() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::ensureUniqueObjectName(QObject *object) + + Ensures that the specified \a object has a unique name amongst the + other objects on the form. + + \internal +*/ + +// Slots + +/*! + \fn virtual void QDesignerFormWindowInterface::manageWidget(QWidget *widget) + + Instructs the form window to manage the specified \a widget. + + \sa isManaged(), unmanageWidget(), widgetManaged() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::unmanageWidget(QWidget *widget) + + Instructs the form window not to manage the specified \a widget. + + \sa aboutToUnmanageWidget(), widgetUnmanaged() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setFeatures(Feature features) + + Enables the specified \a features for the form window. + + \sa features(), featureChanged() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setDirty(bool dirty) + + If \a dirty is true, the form window is marked as dirty, meaning + that it is modified but not saved. If \a dirty is false, the form + window is considered to be unmodified. + + \sa isDirty() +*/ + +/*! +\fn virtual void QDesignerFormWindowInterface::clearSelection(bool update) + + Clears the current selection in the form window. If \a update is + true, the emitSelectionChanged() function is called, emitting the + selectionChanged() signal. + + \sa selectWidget() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::selectWidget(QWidget *widget, bool select) + + If \a select is true, the given \a widget is selected; otherwise + the \a widget is deselected. + + \sa clearSelection(), selectionChanged() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setGrid(const QPoint &grid) + + Sets the grid size for the form window to the point specified by + \a grid. In this function, the coordinates in the QPoint are used + to specify the dimensions of a rectangle in the grid. + + \sa grid() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setFileName(const QString &fileName) + + Sets the file name for the form to the given \a fileName. + + \sa fileName(), fileNameChanged() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::setContents(const QString &contents) + + Sets the contents of the form using data read from the specified + \a contents string. + + \sa contents() +*/ + +/*! + \fn virtual void QDesignerFormWindowInterface::editWidgets() + + Switches the form window into editing mode. + + \sa \l {Qt Designer's Form Editing Mode} + + \internal +*/ + +// Signals + +/*! + \fn void QDesignerFormWindowInterface::mainContainerChanged(QWidget *mainContainer) + + This signal is emitted whenever the main container changes. + The new container is specified by \a mainContainer. + + \sa setMainContainer() +*/ + +/*! + \fn void QDesignerFormWindowInterface::toolChanged(int toolIndex) + + This signal is emitted whenever the current tool changes. + The specified \a toolIndex is the index of the new tool in the list of + tools in the widget box. + + \internal +*/ + +/*! + \fn void QDesignerFormWindowInterface::fileNameChanged(const QString &fileName) + + This signal is emitted whenever the file name of the form changes. + The new file name is specified by \a fileName. + + \sa setFileName() +*/ + +/*! + \fn void QDesignerFormWindowInterface::featureChanged(Feature feature) + + This signal is emitted whenever a feature changes in the form. + The new feature is specified by \a feature. + + \sa setFeatures() +*/ + +/*! + \fn void QDesignerFormWindowInterface::selectionChanged() + + This signal is emitted whenever the selection in the form changes. + + \sa selectWidget(), clearSelection() +*/ + +/*! + \fn void QDesignerFormWindowInterface::geometryChanged() + + This signal is emitted whenever the form's geometry changes. +*/ + +/*! + \fn void QDesignerFormWindowInterface::resourceFilesChanged() + + This signal is emitted whenever the list of resource files used by the + form changes. + + \sa resourceFiles() +*/ + +/*! + \fn void QDesignerFormWindowInterface::widgetManaged(QWidget *widget) + + This signal is emitted whenever a widget on the form becomes managed. + The newly managed widget is specified by \a widget. + + \sa manageWidget() +*/ + +/*! + \fn void QDesignerFormWindowInterface::widgetUnmanaged(QWidget *widget) + + This signal is emitted whenever a widget on the form becomes unmanaged. + The newly released widget is specified by \a widget. + + \sa unmanageWidget(), aboutToUnmanageWidget() +*/ + +/*! + \fn void QDesignerFormWindowInterface::aboutToUnmanageWidget(QWidget *widget) + + This signal is emitted whenever a widget on the form is about to + become unmanaged. When this signal is emitted, the specified \a + widget is still managed, and a widgetUnmanaged() signal will + follow, indicating when it is no longer managed. + + \sa unmanageWidget(), isManaged() +*/ + +/*! + \fn void QDesignerFormWindowInterface::activated(QWidget *widget) + + This signal is emitted whenever a widget is activated on the form. + The activated widget is specified by \a widget. +*/ + +/*! + \fn void QDesignerFormWindowInterface::changed() + + This signal is emitted whenever a form is changed. +*/ + +/*! + \fn void QDesignerFormWindowInterface::widgetRemoved(QWidget *widget) + + This signal is emitted whenever a widget is removed from the form. + The widget that was removed is specified by \a widget. +*/ + +/*! + \fn void QDesignerFormWindowInterface::objectRemoved(QObject *object) + + This signal is emitted whenever an object (such as + an action or a QButtonGroup) is removed from the form. + The object that was removed is specified by \a object. + + \since 4.5 +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractformwindow.h b/tools/designer/src/lib/sdk/abstractformwindow.h new file mode 100644 index 0000000..1fc3702 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractformwindow.h @@ -0,0 +1,183 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTFORMWINDOW_H +#define ABSTRACTFORMWINDOW_H + +#include <QtDesigner/sdk_global.h> + +#include <QtGui/QWidget> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDesignerFormEditorInterface; +class QDesignerFormWindowCursorInterface; +class QDesignerFormWindowToolInterface; +class DomUI; +class QUndoStack; +class QDir; + +class QDESIGNER_SDK_EXPORT QDesignerFormWindowInterface: public QWidget +{ + Q_OBJECT +public: + enum FeatureFlag + { + EditFeature = 0x01, + GridFeature = 0x02, + TabOrderFeature = 0x04, + DefaultFeature = EditFeature | GridFeature + }; + Q_DECLARE_FLAGS(Feature, FeatureFlag) + +public: + QDesignerFormWindowInterface(QWidget *parent = 0, Qt::WindowFlags flags = 0); + virtual ~QDesignerFormWindowInterface(); + + virtual QString fileName() const = 0; + virtual QDir absoluteDir() const = 0; + + virtual QString contents() const = 0; + virtual void setContents(QIODevice *dev) = 0; + + virtual Feature features() const = 0; + virtual bool hasFeature(Feature f) const = 0; + + virtual QString author() const = 0; + virtual void setAuthor(const QString &author) = 0; + + virtual QString comment() const = 0; + virtual void setComment(const QString &comment) = 0; + + virtual void layoutDefault(int *margin, int *spacing) = 0; + virtual void setLayoutDefault(int margin, int spacing) = 0; + + virtual void layoutFunction(QString *margin, QString *spacing) = 0; + virtual void setLayoutFunction(const QString &margin, const QString &spacing) = 0; + + virtual QString pixmapFunction() const = 0; + virtual void setPixmapFunction(const QString &pixmapFunction) = 0; + + virtual QString exportMacro() const = 0; + virtual void setExportMacro(const QString &exportMacro) = 0; + + virtual QStringList includeHints() const = 0; + virtual void setIncludeHints(const QStringList &includeHints) = 0; + + virtual QDesignerFormEditorInterface *core() const; + virtual QDesignerFormWindowCursorInterface *cursor() const = 0; + + virtual int toolCount() const = 0; + + virtual int currentTool() const = 0; + virtual void setCurrentTool(int index) = 0; + + virtual QDesignerFormWindowToolInterface *tool(int index) const = 0; + virtual void registerTool(QDesignerFormWindowToolInterface *tool) = 0; + + virtual QPoint grid() const = 0; + + virtual QWidget *mainContainer() const = 0; + virtual void setMainContainer(QWidget *mainContainer) = 0; + + virtual bool isManaged(QWidget *widget) const = 0; + + virtual bool isDirty() const = 0; + + static QDesignerFormWindowInterface *findFormWindow(QWidget *w); + static QDesignerFormWindowInterface *findFormWindow(QObject *obj); + + virtual QUndoStack *commandHistory() const = 0; + virtual void beginCommand(const QString &description) = 0; + virtual void endCommand() = 0; + + virtual void simplifySelection(QList<QWidget*> *widgets) const = 0; + + // notifications + virtual void emitSelectionChanged() = 0; + + virtual QStringList resourceFiles() const = 0; + virtual void addResourceFile(const QString &path) = 0; + virtual void removeResourceFile(const QString &path) = 0; + + virtual void ensureUniqueObjectName(QObject *object) = 0; + +public Q_SLOTS: + virtual void manageWidget(QWidget *widget) = 0; + virtual void unmanageWidget(QWidget *widget) = 0; + + virtual void setFeatures(Feature f) = 0; + virtual void setDirty(bool dirty) = 0; + virtual void clearSelection(bool changePropertyDisplay = true) = 0; + virtual void selectWidget(QWidget *w, bool select = true) = 0; + virtual void setGrid(const QPoint &grid) = 0; + virtual void setFileName(const QString &fileName) = 0; + virtual void setContents(const QString &contents) = 0; + + virtual void editWidgets() = 0; + +Q_SIGNALS: + void mainContainerChanged(QWidget *mainContainer); + void toolChanged(int toolIndex); + void fileNameChanged(const QString &fileName); + void featureChanged(Feature f); + void selectionChanged(); + void geometryChanged(); + + void resourceFilesChanged(); + + void widgetManaged(QWidget *widget); + void widgetUnmanaged(QWidget *widget); + void aboutToUnmanageWidget(QWidget *widget); + void activated(QWidget *widget); + + void changed(); + void widgetRemoved(QWidget *w); + void objectRemoved(QObject *o); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTFORMWINDOW_H diff --git a/tools/designer/src/lib/sdk/abstractformwindowcursor.cpp b/tools/designer/src/lib/sdk/abstractformwindowcursor.cpp new file mode 100644 index 0000000..2d27133 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractformwindowcursor.cpp @@ -0,0 +1,252 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractformwindowcursor.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerFormWindowCursorInterface + + \brief The QDesignerFormWindowCursorInterface class allows you to + query and modify a form window's widget selection, and in addition + modify the properties of all the form's widgets. + + \inmodule QtDesigner + + QDesignerFormWindowCursorInterface is a convenience class that + provides an interface to the associated form window's text cursor; + it provides a collection of functions that enables you to query a + given form window's selection and change the selection's focus + according to defined modes (MoveMode) and movements + (MoveOperation). You can also use the interface to query the + form's widgets and change their properties. + + The interface is not intended to be instantiated directly, but to + provide access to the selections and widgets of \QD's current form + windows. QDesignerFormWindowInterface always provides an + associated cursor interface. The form window for a given widget + can be retrieved using the static + QDesignerFormWindowInterface::findFormWindow() functions. For + example: + + \snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformwindowcursor.cpp 0 + + You can retrieve any of \QD's current form windows through + \QD's \l {QDesignerFormWindowManagerInterface}{form window + manager}. + + Once you have a form window's cursor interface, you can check if + the form window has a selection at all using the hasSelection() + function. You can query the form window for its total + widgetCount() and selectedWidgetCount(). You can retrieve the + currently selected widget (or widgets) using the current() or + selectedWidget() functions. + + You can retrieve any of the form window's widgets using the + widget() function, and check if a widget is selected using the + isWidgetSelected() function. You can use the setProperty() + function to set the selected widget's properties, and the + setWidgetProperty() or resetWidgetProperty() functions to modify + the properties of any given widget. + + Finally, you can change the selection by changing the text + cursor's position() using the setPosition() and movePosition() + functions. + + \sa QDesignerFormWindowInterface, QDesignerFormWindowManagerInterface +*/ + +/*! + \enum QDesignerFormWindowCursorInterface::MoveOperation + + This enum describes the types of text cursor operation that can occur in a form window. + + \value NoMove The cursor does not move. + \value Start Moves the cursor to the start of the focus chain. + \value End Moves the cursor to the end of the focus chain. + \value Next Moves the cursor to the next widget in the focus chain. + \value Prev Moves the cursor to the previous widget in the focus chain. + \value Left The cursor moves to the left. + \value Right The cursor moves to the right. + \value Up The cursor moves upwards. + \value Down The cursor moves downwards. +*/ + +/*! + \enum QDesignerFormWindowCursorInterface::MoveMode + + This enum describes the different modes that are used when the text cursor moves. + + \value MoveAnchor The anchor moves with the cursor to its new location. + \value KeepAnchor The anchor remains at the cursor's old location. +*/ + +/*! + Returns true if the specified \a widget is selected; otherwise + returns false. +*/ +bool QDesignerFormWindowCursorInterface::isWidgetSelected(QWidget *widget) const +{ + for (int index=0; index<selectedWidgetCount(); ++index) { + if (selectedWidget(index) == widget) + return true; + } + + return false; +} + +/*! + \fn virtual QDesignerFormWindowCursorInterface::~QDesignerFormWindowCursorInterface() + + Destroys the cursor interface. +*/ + +/*! + \fn virtual QDesignerFormWindowInterface *QDesignerFormWindowCursorInterface::formWindow() const + + Returns the form window interface associated with this cursor interface. +*/ + +/*! + \fn virtual bool QDesignerFormWindowCursorInterface::movePosition(MoveOperation operation, MoveMode mode) + + Performs the given \a operation on the cursor using the specified + \a mode, and returns true if it completed successfully; otherwise + returns false. + + \sa position(), setPosition() +*/ + +/*! + \fn virtual int QDesignerFormWindowCursorInterface::position() const + + Returns the cursor position. + + \sa setPosition(), movePosition() +*/ + +/*! + \fn virtual void QDesignerFormWindowCursorInterface::setPosition(int position, MoveMode mode = MoveAnchor) + + Sets the position of the cursor to the given \a position using the + \a mode to specify how it is moved there. + + \sa position(), movePosition() +*/ + +/*! + \fn virtual QWidget *QDesignerFormWindowCursorInterface::current() const + + Returns the currently selected widget in the form window. + + \sa selectedWidget() +*/ + +/*! + \fn virtual int QDesignerFormWindowCursorInterface::widgetCount() const + + Returns the number of widgets in the form window. + + \sa selectedWidgetCount() +*/ + +/*! + \fn virtual QWidget *QDesignerFormWindowCursorInterface::widget(int index) const + + Returns the widget with the given \a index in the list of widgets + in the form window. + + \sa selectedWidget() +*/ + +/*! + \fn virtual bool QDesignerFormWindowCursorInterface::hasSelection() const + + Returns true if the form window contains a selection; otherwise + returns false. +*/ + +/*! + \fn virtual int QDesignerFormWindowCursorInterface::selectedWidgetCount() const + + Returns the number of selected widgets in the form window. + + \sa widgetCount() +*/ + +/*! + \fn virtual QWidget *QDesignerFormWindowCursorInterface::selectedWidget(int index) const + + Returns the widget with the given \a index in the list of selected + widgets. + + \sa current(), widget() +*/ + +/*! + \fn virtual void QDesignerFormWindowCursorInterface::setProperty(const QString &name, const QVariant &value) + + Sets the property with the given \a name for the currently + selected widget to the specified \a value. + + \sa setWidgetProperty(), resetWidgetProperty() +*/ + +/*! + \fn virtual void QDesignerFormWindowCursorInterface::setWidgetProperty(QWidget *widget, const QString &name, const QVariant &value) + + Sets the property with the given \a name for the given \a widget + to the specified \a value. + + \sa resetWidgetProperty(), setProperty() +*/ + +/*! + \fn virtual void QDesignerFormWindowCursorInterface::resetWidgetProperty(QWidget *widget, const QString &name) + + Resets the property with the given \a name for the specified \a + widget to its default value. + + \sa setProperty(), setWidgetProperty() +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractformwindowcursor.h b/tools/designer/src/lib/sdk/abstractformwindowcursor.h new file mode 100644 index 0000000..117bcac --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractformwindowcursor.h @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTFORMWINDOWCURSOR_H +#define ABSTRACTFORMWINDOWCURSOR_H + +#include <QtDesigner/sdk_global.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDesignerFormWindowInterface; +class QWidget; +class QVariant; +class QString; + +class QDESIGNER_SDK_EXPORT QDesignerFormWindowCursorInterface +{ +public: + enum MoveOperation + { + NoMove, + + Start, + End, + Next, + Prev, + Left, + Right, + Up, + Down + }; + + enum MoveMode + { + MoveAnchor, + KeepAnchor + }; + +public: + virtual ~QDesignerFormWindowCursorInterface() {} + + virtual QDesignerFormWindowInterface *formWindow() const = 0; + + virtual bool movePosition(MoveOperation op, MoveMode mode = MoveAnchor) = 0; + + virtual int position() const = 0; + virtual void setPosition(int pos, MoveMode mode = MoveAnchor) = 0; + + virtual QWidget *current() const = 0; + + virtual int widgetCount() const = 0; + virtual QWidget *widget(int index) const = 0; + + virtual bool hasSelection() const = 0; + virtual int selectedWidgetCount() const = 0; + virtual QWidget *selectedWidget(int index) const = 0; + + virtual void setProperty(const QString &name, const QVariant &value) = 0; + virtual void setWidgetProperty(QWidget *widget, const QString &name, const QVariant &value) = 0; + virtual void resetWidgetProperty(QWidget *widget, const QString &name) = 0; + + bool isWidgetSelected(QWidget *widget) const; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTFORMWINDOWCURSOR_H diff --git a/tools/designer/src/lib/sdk/abstractformwindowmanager.cpp b/tools/designer/src/lib/sdk/abstractformwindowmanager.cpp new file mode 100644 index 0000000..5265552 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractformwindowmanager.cpp @@ -0,0 +1,502 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractformwindowmanager.h" + +#include <QtCore/QMap> + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerFormWindowManagerInterface + + \brief The QDesignerFormWindowManagerInterface class allows you to + manipulate the collection of form windows in Qt Designer, and + control Qt Designer's form editing actions. + + \inmodule QtDesigner + + QDesignerFormWindowManagerInterface is not intended to be + instantiated directly. \QD uses the form window manager to + control the various form windows in its workspace. You can + retrieve an interface to \QD's form window manager using + the QDesignerFormEditorInterface::formWindowManager() + function. For example: + + \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 Qt 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 + maintains, using the addFormWindow() slot. It also provides the + formWindowCount() function returning the number of form windows + currently under the manager's control, the formWindow() function + returning the form window associated with a given index, and the + activeFormWindow() function returning the currently selected form + window. The removeFormWindow() slot allows you to reduce the + number of form windows the manager must maintain, and the + setActiveFormWindow() slot allows you to change the form window + focus in \QD's workspace. + + In addition, QDesignerFormWindowManagerInterface contains a + collection of functions that enables you to intervene and control + \QD's form editing actions. All these functions return the + original action, making it possible to propagate the function + further after intervention. + + Finally, the interface provides three signals which are emitted + when a form window is added, when the currently selected form + window changes, or when a form window is removed, respectively. All + the signals carry the form window in question as their parameter. + + \sa QDesignerFormEditorInterface, QDesignerFormWindowInterface +*/ + +// ------------- QDesignerFormWindowManagerInterfacePrivate + +struct QDesignerFormWindowManagerInterfacePrivate { + QDesignerFormWindowManagerInterfacePrivate(); + QAction *m_simplifyLayoutAction; + QAction *m_formLayoutAction; +}; + +QDesignerFormWindowManagerInterfacePrivate::QDesignerFormWindowManagerInterfacePrivate() : + m_simplifyLayoutAction(0), + m_formLayoutAction(0) +{ +} + +typedef QMap<const QDesignerFormWindowManagerInterface *, QDesignerFormWindowManagerInterfacePrivate *> FormWindowManagerPrivateMap; + +Q_GLOBAL_STATIC(FormWindowManagerPrivateMap, g_FormWindowManagerPrivateMap) + +/*! + Constructs an interface with the given \a parent for the form window + manager. +*/ +QDesignerFormWindowManagerInterface::QDesignerFormWindowManagerInterface(QObject *parent) + : QObject(parent) +{ + g_FormWindowManagerPrivateMap()->insert(this, new QDesignerFormWindowManagerInterfacePrivate); +} + +/*! + Destroys the interface for the form window manager. +*/ +QDesignerFormWindowManagerInterface::~QDesignerFormWindowManagerInterface() +{ + FormWindowManagerPrivateMap *fwmpm = g_FormWindowManagerPrivateMap(); + const FormWindowManagerPrivateMap::iterator it = fwmpm->find(this); + Q_ASSERT(it != fwmpm->end()); + delete it.value(); + fwmpm->erase(it); +} + +/*! + Allows you to intervene and control \QD's "cut" action. The function + returns the original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionCut() const +{ + return 0; +} + +/*! + Allows you to intervene and control \QD's "copy" action. The + function returns the original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionCopy() const +{ + return 0; +} + +/*! + Allows you to intervene and control \QD's "paste" action. The + function returns the original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionPaste() const +{ + return 0; +} + +/*! + Allows you to intervene and control \QD's "delete" action. The function + returns the original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionDelete() const +{ + return 0; +} + +/*! + Allows you to intervene and control \QD's "select all" action. The + function returns the original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionSelectAll() const +{ + return 0; +} + +/*! + Allows you to intervene and control the action of lowering a form + window in \QD's workspace. The function returns the original + action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionLower() const +{ + return 0; +} + +/*! + Allows you to intervene and control the action of raising of a + form window in \QD's workspace. The function returns the original + action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionRaise() const +{ + return 0; +} + +/*! + Allows you to intervene and control a request for horizontal + layout for a form window in \QD's workspace. The function returns + the original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionHorizontalLayout() const +{ + return 0; +} + +/*! + Allows you to intervene and control a request for vertical layout + for a form window in \QD's workspace. The function returns the + original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionVerticalLayout() const +{ + return 0; +} + +/*! + Allows you to intervene and control \QD's "split horizontal" + action. The function returns the original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionSplitHorizontal() const +{ + return 0; +} + +/*! + Allows you to intervene and control \QD's "split vertical" + action. The function returns the original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionSplitVertical() const +{ + return 0; +} + +/*! + Allows you to intervene and control a request for grid layout for + a form window in \QD's workspace. The function returns the + original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionGridLayout() const +{ + return 0; +} + +/*! + Allows you to intervene and control \QD's "form layout" action. The + function returns the original action. + +FormWindowManagerPrivateMap *fwmpm = g_FormWindowManagerPrivateMap(); \sa QAction + \since 4.4 +*/ + +QAction *QDesignerFormWindowManagerInterface::actionFormLayout() const +{ + const QDesignerFormWindowManagerInterfacePrivate *d = g_FormWindowManagerPrivateMap()->value(this); + Q_ASSERT(d); + return d->m_formLayoutAction; +} + +/*! + Sets the "form layout" action to \a action. + + \internal + \since 4.4 +*/ + +void QDesignerFormWindowManagerInterface::setActionFormLayout(QAction *action) +{ + QDesignerFormWindowManagerInterfacePrivate *d = g_FormWindowManagerPrivateMap()->value(this); + Q_ASSERT(d); + d->m_formLayoutAction = action; +} + +/*! + Allows you to intervene and control \QD's "break layout" action. The + function returns the original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionBreakLayout() const +{ + return 0; +} + +/*! + Allows you to intervene and control \QD's "adjust size" action. The + function returns the original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionAdjustSize() const +{ + return 0; +} + +/*! + Allows you to intervene and control \QD's "simplify layout" action. The + function returns the original action. + + \sa QAction + \since 4.4 +*/ + +QAction *QDesignerFormWindowManagerInterface::actionSimplifyLayout() const +{ + const QDesignerFormWindowManagerInterfacePrivate *d = g_FormWindowManagerPrivateMap()->value(this); + Q_ASSERT(d); + return d->m_simplifyLayoutAction; +} + +/*! + Sets the "simplify layout" action to \a action. + + \internal + \since 4.4 +*/ + +void QDesignerFormWindowManagerInterface::setActionSimplifyLayout(QAction *action) +{ + QDesignerFormWindowManagerInterfacePrivate *d = g_FormWindowManagerPrivateMap()->value(this); + Q_ASSERT(d); + d->m_simplifyLayoutAction = action; +} + +/*! + Returns the currently active form window in \QD's workspace. + + \sa setActiveFormWindow(), removeFormWindow() +*/ +QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::activeFormWindow() const +{ + return 0; +} + +/*! + Returns a pointer to \QD's current QDesignerFormEditorInterface + object. +*/ +QDesignerFormEditorInterface *QDesignerFormWindowManagerInterface::core() const +{ + return 0; +} + +/*! + Adds the given \a formWindow to the collection of windows that + \QD's form window manager maintains. + + \sa formWindowAdded() +*/ +void QDesignerFormWindowManagerInterface::addFormWindow(QDesignerFormWindowInterface *formWindow) +{ + Q_UNUSED(formWindow); +} + +/*! + Removes the given \a formWindow from the collection of windows that + \QD's form window manager maintains. + + \sa formWindow(), formWindowRemoved() +*/ +void QDesignerFormWindowManagerInterface::removeFormWindow(QDesignerFormWindowInterface *formWindow) +{ + Q_UNUSED(formWindow); +} + +/*! + Sets the given \a formWindow to be the currently active form window in + \QD's workspace. + + \sa activeFormWindow(), activeFormWindowChanged() +*/ +void QDesignerFormWindowManagerInterface::setActiveFormWindow(QDesignerFormWindowInterface *formWindow) +{ + Q_UNUSED(formWindow); +} + +/*! + Returns the number of form windows maintained by \QD's form window + manager. +*/ +int QDesignerFormWindowManagerInterface::formWindowCount() const +{ + return 0; +} + +/*! + Returns the form window at the given \a index. + + \sa setActiveFormWindow(), removeFormWindow() +*/ +QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::formWindow(int index) const +{ + Q_UNUSED(index); + return 0; +} + +/*! + \fn QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::createFormWindow(QWidget *parent, Qt::WindowFlags flags) + + Creates a form window with the given \a parent and the given window + \a flags. + + \sa addFormWindow() +*/ +QDesignerFormWindowInterface *QDesignerFormWindowManagerInterface::createFormWindow(QWidget *parentWidget, Qt::WindowFlags flags) +{ + Q_UNUSED(parentWidget); + Q_UNUSED(flags); + return 0; +} + +/*! + Allows you to intervene and control \QD's "undo" action. The + function returns the original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionUndo() const +{ + return 0; +} + +/*! + Allows you to intervene and control \QD's "redo" action. The + function returns the original action. + + \sa QAction +*/ +QAction *QDesignerFormWindowManagerInterface::actionRedo() const +{ + return 0; +} + +/*! + \fn void QDesignerFormWindowManagerInterface::formWindowAdded(QDesignerFormWindowInterface *formWindow) + + This signal is emitted when a new form window is added to the + collection of windows that \QD's form window manager maintains. A + pointer to the new \a formWindow is passed as an argument. + + \sa addFormWindow(), setActiveFormWindow() +*/ + +/*! + \fn void QDesignerFormWindowManagerInterface::formWindowRemoved(QDesignerFormWindowInterface *formWindow) + + This signal is emitted when a form window is removed from the + collection of windows that \QD's form window manager maintains. A + pointer to the removed \a formWindow is passed as an argument. + + \sa removeFormWindow() +*/ + +/*! + \fn void QDesignerFormWindowManagerInterface::activeFormWindowChanged(QDesignerFormWindowInterface *formWindow) + + This signal is emitted when the contents of the currently active + form window in \QD's workspace changed. A pointer to the currently + active \a formWindow is passed as an argument. + + \sa activeFormWindow() +*/ + +/*! + \fn void QDesignerFormWindowManagerInterface::dragItems(const QList<QDesignerDnDItemInterface*> &item_list) + + \internal +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractformwindowmanager.h b/tools/designer/src/lib/sdk/abstractformwindowmanager.h new file mode 100644 index 0000000..e3ac3dc --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractformwindowmanager.h @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTFORMWINDOWMANAGER_H +#define ABSTRACTFORMWINDOWMANAGER_H + +#include <QtDesigner/sdk_global.h> +#include <QtDesigner/abstractformwindow.h> + +#include <QtCore/QObject> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QAction; +class QActionGroup; +class QDesignerFormEditorInterface; +class DomUI; +class QWidget; +class QDesignerDnDItemInterface; + +class QDESIGNER_SDK_EXPORT QDesignerFormWindowManagerInterface: public QObject +{ + Q_OBJECT +public: + QDesignerFormWindowManagerInterface(QObject *parent = 0); + virtual ~QDesignerFormWindowManagerInterface(); + + virtual QAction *actionCut() const; + virtual QAction *actionCopy() const; + virtual QAction *actionPaste() const; + virtual QAction *actionDelete() const; + virtual QAction *actionSelectAll() const; + virtual QAction *actionLower() const; + virtual QAction *actionRaise() const; + virtual QAction *actionUndo() const; + virtual QAction *actionRedo() const; + + virtual QAction *actionHorizontalLayout() const; + virtual QAction *actionVerticalLayout() const; + virtual QAction *actionSplitHorizontal() const; + virtual QAction *actionSplitVertical() const; + virtual QAction *actionGridLayout() const; + QAction *actionFormLayout() const; + virtual QAction *actionBreakLayout() const; + virtual QAction *actionAdjustSize() const; + QAction *actionSimplifyLayout() const; + + virtual QDesignerFormWindowInterface *activeFormWindow() const; + + virtual int formWindowCount() const; + virtual QDesignerFormWindowInterface *formWindow(int index) const; + + virtual QDesignerFormWindowInterface *createFormWindow(QWidget *parentWidget = 0, Qt::WindowFlags flags = 0); + + virtual QDesignerFormEditorInterface *core() const; + + virtual void dragItems(const QList<QDesignerDnDItemInterface*> &item_list) = 0; + +Q_SIGNALS: + void formWindowAdded(QDesignerFormWindowInterface *formWindow); + void formWindowRemoved(QDesignerFormWindowInterface *formWindow); + void activeFormWindowChanged(QDesignerFormWindowInterface *formWindow); + +public Q_SLOTS: + virtual void addFormWindow(QDesignerFormWindowInterface *formWindow); + virtual void removeFormWindow(QDesignerFormWindowInterface *formWindow); + virtual void setActiveFormWindow(QDesignerFormWindowInterface *formWindow); + +protected: + void setActionFormLayout(QAction *action); + void setActionSimplifyLayout(QAction *action); + +private: + QDesignerFormWindowManagerInterface(const QDesignerFormWindowManagerInterface &other); + QDesignerFormWindowManagerInterface &operator = (const QDesignerFormWindowManagerInterface &other); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTFORMWINDOWMANAGER_H diff --git a/tools/designer/src/lib/sdk/abstractformwindowtool.cpp b/tools/designer/src/lib/sdk/abstractformwindowtool.cpp new file mode 100644 index 0000000..9ef2e86 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractformwindowtool.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractformwindowtool.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerFormWindowToolInterface + + \brief The QDesignerFormWindowToolInterface class provides an + interface that enables tools to be used on items in a form window. + + \inmodule QtDesigner + + \internal +*/ + +/*! +*/ +QDesignerFormWindowToolInterface::QDesignerFormWindowToolInterface(QObject *parent) + : QObject(parent) +{ +} + +/*! +*/ +QDesignerFormWindowToolInterface::~QDesignerFormWindowToolInterface() +{ +} + +/*! + \fn virtual QDesignerFormEditorInterface *QDesignerFormWindowToolInterface::core() const = 0 +*/ + +/*! + \fn virtual QDesignerFormWindowInterface *QDesignerFormWindowToolInterface::formWindow() const = 0 +*/ + +/*! + \fn virtual QWidget *QDesignerFormWindowToolInterface::editor() const = 0 +*/ + +/*! + \fn virtual QAction *QDesignerFormWindowToolInterface::action() const = 0 +*/ + +/*! + \fn virtual void QDesignerFormWindowToolInterface::activated() = 0 +*/ + +/*! + \fn virtual void QDesignerFormWindowToolInterface::deactivated() = 0 +*/ + +/*! + \fn virtual void QDesignerFormWindowToolInterface::saveToDom(DomUI*, QWidget*) { +*/ + +/*! + \fn virtual void QDesignerFormWindowToolInterface::loadFromDom(DomUI*, QWidget*) { +*/ + +/*! + \fn virtual bool QDesignerFormWindowToolInterface::handleEvent(QWidget *widget, QWidget *managedWidget, QEvent *event) = 0 +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractformwindowtool.h b/tools/designer/src/lib/sdk/abstractformwindowtool.h new file mode 100644 index 0000000..a797311 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractformwindowtool.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTFORMWINDOWTOOL_H +#define ABSTRACTFORMWINDOWTOOL_H + +#include <QtDesigner/sdk_global.h> + +#include <QtCore/QObject> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDesignerFormEditorInterface; +class QDesignerFormWindowInterface; +class QWidget; +class QAction; +class DomUI; + +class QDESIGNER_SDK_EXPORT QDesignerFormWindowToolInterface: public QObject +{ + Q_OBJECT +public: + QDesignerFormWindowToolInterface(QObject *parent = 0); + virtual ~QDesignerFormWindowToolInterface(); + + virtual QDesignerFormEditorInterface *core() const = 0; + virtual QDesignerFormWindowInterface *formWindow() const = 0; + virtual QWidget *editor() const = 0; + + virtual QAction *action() const = 0; + + virtual void activated() = 0; + virtual void deactivated() = 0; + + virtual void saveToDom(DomUI*, QWidget*) {} + virtual void loadFromDom(DomUI*, QWidget*) {} + + virtual bool handleEvent(QWidget *widget, QWidget *managedWidget, QEvent *event) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTFORMWINDOWTOOL_H diff --git a/tools/designer/src/lib/sdk/abstracticoncache.h b/tools/designer/src/lib/sdk/abstracticoncache.h new file mode 100644 index 0000000..b0c827f --- /dev/null +++ b/tools/designer/src/lib/sdk/abstracticoncache.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTICONCACHE_H +#define ABSTRACTICONCACHE_H + +#include <QtDesigner/sdk_global.h> + +#include <QtCore/QObject> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QIcon; +class QPixmap; +class QString; + +class QDESIGNER_SDK_EXPORT QDesignerIconCacheInterface : public QObject +{ + Q_OBJECT +public: + QDesignerIconCacheInterface(QObject *parent_) + : QObject(parent_) {} + + virtual QIcon nameToIcon(const QString &filePath, const QString &qrcPath = QString()) = 0; + virtual QPixmap nameToPixmap(const QString &filePath, const QString &qrcPath = QString()) = 0; + + virtual QString iconToFilePath(const QIcon &pm) const = 0; + virtual QString iconToQrcPath(const QIcon &pm) const = 0; + + virtual QString pixmapToFilePath(const QPixmap &pm) const = 0; + virtual QString pixmapToQrcPath(const QPixmap &pm) const = 0; + + virtual QList<QPixmap> pixmapList() const = 0; + virtual QList<QIcon> iconList() const = 0; + + virtual QString resolveQrcPath(const QString &filePath, const QString &qrcPath, const QString &workingDirectory = QString()) const = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTICONCACHE_H diff --git a/tools/designer/src/lib/sdk/abstractintegration.cpp b/tools/designer/src/lib/sdk/abstractintegration.cpp new file mode 100644 index 0000000..3ef1810 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractintegration.cpp @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractintegration.h" +#include "abstractformeditor.h" + +QT_BEGIN_NAMESPACE + +QDesignerIntegrationInterface::QDesignerIntegrationInterface(QDesignerFormEditorInterface *core, QObject *parent) + : QObject(parent), + m_core(core) +{ + core->setIntegration(this); +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractintegration.h b/tools/designer/src/lib/sdk/abstractintegration.h new file mode 100644 index 0000000..8af5bfb --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractintegration.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTINTEGRATION_H +#define ABSTRACTINTEGRATION_H + +#include <QtDesigner/sdk_global.h> + +#include <QtCore/QObject> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDesignerFormEditorInterface; + +class QDESIGNER_SDK_EXPORT QDesignerIntegrationInterface: public QObject +{ + Q_OBJECT +public: + QDesignerIntegrationInterface(QDesignerFormEditorInterface *core, QObject *parent = 0); + + inline QDesignerFormEditorInterface *core() const; + + virtual QWidget *containerWindow(QWidget *widget) const = 0; + +private: + QDesignerFormEditorInterface *m_core; +}; + +inline QDesignerFormEditorInterface *QDesignerIntegrationInterface::core() const +{ return m_core; } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTINTEGRATION_H diff --git a/tools/designer/src/lib/sdk/abstractintrospection.cpp b/tools/designer/src/lib/sdk/abstractintrospection.cpp new file mode 100644 index 0000000..70ff723 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractintrospection.cpp @@ -0,0 +1,548 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractintrospection_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerMetaEnumInterface + \internal + \since 4.4 + + \brief QDesignerMetaEnumInterface is part of \QD's introspection interface and represents an enumeration. + + \inmodule QtDesigner + + The QDesignerMetaEnumInterface class provides meta-data about an enumerator. + + \sa QDesignerMetaObjectInterface +*/ + +/*! + Constructs a QDesignerMetaEnumInterface object. +*/ + +QDesignerMetaEnumInterface::QDesignerMetaEnumInterface() +{ +} + +/*! + Destroys the QDesignerMetaEnumInterface object. +*/ +QDesignerMetaEnumInterface::~QDesignerMetaEnumInterface() +{ +} + +/*! + \fn bool QDesignerMetaEnumInterface::isFlag() const + + Returns true if this enumerator is used as a flag. +*/ + +/*! + \fn QString QDesignerMetaEnumInterface::key(int index) const + + Returns the key with the given \a index. +*/ + +/*! + \fn int QDesignerMetaEnumInterface::keyCount() const + + Returns the number of keys. +*/ + +/*! + \fn int QDesignerMetaEnumInterface::keyToValue(const QString &key) const + + Returns the integer value of the given enumeration \a key, or -1 if \a key is not defined. +*/ + +/*! + \fn int QDesignerMetaEnumInterface::keysToValue(const QString &keys) const + + Returns the value derived from combining together the values of the \a keys using the OR operator, or -1 if keys is not defined. Note that the strings in \a keys must be '|'-separated. +*/ + +/*! + \fn QString QDesignerMetaEnumInterface::name() const + + Returns the name of the enumerator (without the scope). +*/ + +/*! + \fn QString QDesignerMetaEnumInterface::scope() const + + Returns the scope this enumerator was declared in. +*/ + +/*! + \fn QString QDesignerMetaEnumInterface::separator() const + + Returns the separator to be used when building enumeration names. +*/ + +/*! + \fn int QDesignerMetaEnumInterface::value(int index) const + + Returns the value with the given \a index; or returns -1 if there is no such value. +*/ + +/*! + \fn QString QDesignerMetaEnumInterface::valueToKey(int value) const + + Returns the string that is used as the name of the given enumeration \a value, or QString::null if value is not defined. +*/ + +/*! + \fn QString QDesignerMetaEnumInterface::valueToKeys(int value) const + + Returns a byte array of '|'-separated keys that represents the given \a value. +*/ + +/*! + \class QDesignerMetaPropertyInterface + \internal + \since 4.4 + + \brief QDesignerMetaPropertyInterface is part of \QD's introspection interface and represents a property. + + \inmodule QtDesigner + + The QDesignerMetaPropertyInterface class provides meta-data about a property. + + \sa QDesignerMetaObjectInterface +*/ + +/*! + Constructs a QDesignerMetaPropertyInterface object. +*/ + +QDesignerMetaPropertyInterface::QDesignerMetaPropertyInterface() +{ +} + +/*! + Destroys the QDesignerMetaPropertyInterface object. +*/ + +QDesignerMetaPropertyInterface::~QDesignerMetaPropertyInterface() +{ +} + +/*! + \enum QDesignerMetaPropertyInterface::Kind + + This enum indicates whether the property is of a special type. + + \value EnumKind The property is of an enumeration type + \value FlagKind The property is of an flag type + \value OtherKind The property is of another type + */ + +/*! + \enum QDesignerMetaPropertyInterface::AccessFlag + + These flags specify the access the property provides. + + \value ReadAccess Property can be read + \value WriteAccess Property can be written + \value ResetAccess Property can be reset to a default value + */ + +/*! + \enum QDesignerMetaPropertyInterface::Attribute + + Various attributes of the property. + + \value DesignableAttribute Property is designable (visible in \QD) + \value ScriptableAttribute Property is scriptable + \value StoredAttribute Property is stored, that is, not calculated + \value UserAttribute Property is the property that the user can edit for the QObject + */ + +/*! + \fn const QDesignerMetaEnumInterface *QDesignerMetaPropertyInterface::enumerator() const + + Returns the enumerator if this property's type is an enumerator type; +*/ + +/*! + \fn Kind QDesignerMetaPropertyInterface::kind() const + + Returns the type of the property. +*/ + +/*! + \fn AccessFlags QDesignerMetaPropertyInterface::accessFlags() const + + Returns a combination of access flags. +*/ + +/*! + \fn Attributes QDesignerMetaPropertyInterface::attributes(const QObject *object) const + + Returns the attributes of the property for the gives \a object. +*/ + +/*! + \fn QVariant::Type QDesignerMetaPropertyInterface::type() const + + Returns the type of the property. +*/ + +/*! + \fn QString QDesignerMetaPropertyInterface::name() const + + Returns the name of the property. +*/ + +/*! + \fn QString QDesignerMetaPropertyInterface::typeName() const + + Returns the name of this property's type. +*/ + + +/*! + \fn int QDesignerMetaPropertyInterface::userType() const + + Returns this property's user type. +*/ + +/*! + \fn bool QDesignerMetaPropertyInterface::hasSetter() const + + Returns whether getter and setter methods exist for this property. +*/ + +/*! + \fn QVariant QDesignerMetaPropertyInterface::read(const QObject *object) const + + Reads the property's value from the given \a object. Returns the value if it was able to read it; otherwise returns an invalid variant. +*/ + +/*! + \fn bool QDesignerMetaPropertyInterface::reset(QObject *object) const + + Resets the property for the given \a object with a reset method. Returns true if the reset worked; otherwise returns false. +*/ + +/*! + \fn bool QDesignerMetaPropertyInterface::write(QObject *object, const QVariant &value) const + + Writes \a value as the property's value to the given \a object. Returns true if the write succeeded; otherwise returns false. +*/ + +/*! + \class QDesignerMetaMethodInterface + \internal + \since 4.4 + + \brief QDesignerMetaMethodInterface is part of \QD's introspection interface and represents a member function. + + \inmodule QtDesigner + + The QDesignerMetaMethodInterface class provides meta-data about a member function. + + \sa QDesignerMetaObjectInterface +*/ + +/*! + Constructs a QDesignerMetaMethodInterface object. +*/ + +QDesignerMetaMethodInterface::QDesignerMetaMethodInterface() +{ +} + +/*! + Destroys the QDesignerMetaMethodInterface object. +*/ + +QDesignerMetaMethodInterface::~QDesignerMetaMethodInterface() +{ +} + +/*! + \enum QDesignerMetaMethodInterface::MethodType + + This enum specifies the type of the method + + \value Method The function is a plain member function. + \value Signal The function is a signal. + \value Slot The function is a slot. + \value Constructor The function is a constructor. + +*/ + +/*! + \enum QDesignerMetaMethodInterface::Access + + This enum represents the access specification of the method + + \value Private A private member function + \value Protected A protected member function + \value Public A public member function +*/ + +/*! + \fn QDesignerMetaMethodInterface::Access QDesignerMetaMethodInterface::access() const + + Returns the access specification of this method. +*/ + + +/*! + \fn QDesignerMetaMethodInterface::MethodType QDesignerMetaMethodInterface::methodType() const + + Returns the type of this method. +*/ + +/*! + \fn QStringList QDesignerMetaMethodInterface::parameterNames() const + + Returns a list of parameter names. +*/ + +/*! + \fn QStringList QDesignerMetaMethodInterface::parameterTypes() const + + Returns a list of parameter types. +*/ + +/*! + \fn QString QDesignerMetaMethodInterface::signature() const + + Returns the signature of this method. +*/ + +/*! + \fn QString QDesignerMetaMethodInterface::normalizedSignature() const + + Returns the normalized signature of this method (suitable as signal/slot specification). +*/ + + +/*! + \fn QString QDesignerMetaMethodInterface::tag() const + + Returns the tag associated with this method. +*/ + +/*! + \fn QString QDesignerMetaMethodInterface::typeName() const + + Returns the return type of this method, or an empty string if the return type is void. +*/ + +/*! + \class QDesignerMetaObjectInterface + \internal + \since 4.4 + + \brief QDesignerMetaObjectInterface is part of \QD's introspection interface and provides meta-information about Qt objects + + \inmodule QtDesigner + + The QDesignerMetaObjectInterface class provides meta-data about Qt objects. For a given object, it can be obtained + by querying QDesignerIntrospectionInterface. + + \sa QDesignerIntrospectionInterface +*/ + +/*! + Constructs a QDesignerMetaObjectInterface object. +*/ + +QDesignerMetaObjectInterface::QDesignerMetaObjectInterface() +{ +} + +/*! + Destroys the QDesignerMetaObjectInterface object. +*/ + +QDesignerMetaObjectInterface::~QDesignerMetaObjectInterface() +{ +} + +/*! + \fn QString QDesignerMetaObjectInterface::className() const + + Returns the class name. +*/ + +/*! + \fn const QDesignerMetaEnumInterface *QDesignerMetaObjectInterface::enumerator(int index) const + + Returns the meta-data for the enumerator with the given \a index. +*/ + +/*! + \fn int QDesignerMetaObjectInterface::enumeratorCount() const + + Returns the number of enumerators in this class. +*/ + +/*! + \fn int QDesignerMetaObjectInterface::enumeratorOffset() const + + Returns the enumerator offset for this class; i.e. the index position of this class's first enumerator. +*/ + +/*! + \fn int QDesignerMetaObjectInterface::indexOfEnumerator(const QString &name) const + + Finds enumerator \a name and returns its index; otherwise returns -1. +*/ + +/*! + \fn int QDesignerMetaObjectInterface::indexOfMethod(const QString &method) const + + Finds \a method and returns its index; otherwise returns -1. +*/ + +/*! + \fn int QDesignerMetaObjectInterface::indexOfProperty(const QString &name) const + + Finds property \a name and returns its index; otherwise returns -1. +*/ + +/*! + \fn int QDesignerMetaObjectInterface::indexOfSignal(const QString &signal) const + + Finds \a signal and returns its index; otherwise returns -1. +*/ + +/*! + \fn int QDesignerMetaObjectInterface::indexOfSlot(const QString &slot) const + + Finds \a slot and returns its index; otherwise returns -1. +*/ + +/*! + \fn const QDesignerMetaMethodInterface *QDesignerMetaObjectInterface::method(int index) const + + Returns the meta-data for the method with the given \a index. +*/ + +/*! + \fn int QDesignerMetaObjectInterface::methodCount() const + + Returns the number of methods in this class. These include ordinary methods, signals, and slots. +*/ + +/*! + \fn int QDesignerMetaObjectInterface::methodOffset() const + + Returns the method offset for this class; i.e. the index position of this class's first member function. +*/ + +/*! + \fn const QDesignerMetaPropertyInterface *QDesignerMetaObjectInterface::property(int index) const + + Returns the meta-data for the property with the given \a index. +*/ +/*! + \fn int QDesignerMetaObjectInterface::propertyCount() const + + Returns the number of properties in this class. +*/ +/*! + \fn int QDesignerMetaObjectInterface::propertyOffset() const + + Returns the property offset for this class; i.e. the index position of this class's first property. +*/ + +/*! + \fn const QDesignerMetaObjectInterface *QDesignerMetaObjectInterface::superClass() const + + Returns the meta-object of the superclass, or 0 if there is no such object. +*/ + +/*! + \fn const QDesignerMetaPropertyInterface *QDesignerMetaObjectInterface::userProperty() const + + Returns the property that has the USER flag set to true. +*/ + +/*! + \class QDesignerIntrospectionInterface + \internal + \since 4.4 + + \brief QDesignerIntrospectionInterface provides access to a QDesignerMetaObjectInterface for a given Qt object. + + \inmodule QtDesigner + + QDesignerIntrospectionInterface is the main class of \QD's introspection interface. These + interfaces provide a layer of abstraction around QMetaObject and related classes to allow for the integration + of other programming languages. + + An instance of QDesignerIntrospectionInterface can be obtained from the core. + + \sa QDesignerMetaObjectInterface +*/ + +/*! + Constructs a QDesignerIntrospectionInterface object. +*/ + +QDesignerIntrospectionInterface::QDesignerIntrospectionInterface() +{ +} + +/*! + Destroys the QDesignerIntrospectionInterface object. +*/ + +QDesignerIntrospectionInterface::~QDesignerIntrospectionInterface() +{ +} + +/*! + \fn const QDesignerMetaObjectInterface* QDesignerIntrospectionInterface::metaObject(const QObject *object) const + + Returns the meta object of this \a object. +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractintrospection_p.h b/tools/designer/src/lib/sdk/abstractintrospection_p.h new file mode 100644 index 0000000..52f6807 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractintrospection_p.h @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt Designer. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#ifndef ABSTRACTMETAOBJECT_H +#define ABSTRACTMETAOBJECT_H + +#include <QtDesigner/sdk_global.h> +#include <QtCore/QVariant> +#include <QtCore/QFlags> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDESIGNER_SDK_EXPORT QDesignerMetaEnumInterface +{ +public: + QDesignerMetaEnumInterface(); + virtual ~QDesignerMetaEnumInterface(); + virtual bool isFlag() const = 0; + virtual QString key(int index) const = 0; + virtual int keyCount() const = 0; + virtual int keyToValue(const QString &key) const = 0; + virtual int keysToValue(const QString &keys) const = 0; + virtual QString name() const = 0; + virtual QString scope() const = 0; + virtual QString separator() const = 0; + virtual int value(int index) const = 0; + virtual QString valueToKey(int value) const = 0; + virtual QString valueToKeys(int value) const = 0; +}; + +class QDESIGNER_SDK_EXPORT QDesignerMetaPropertyInterface +{ +public: + enum Kind { EnumKind, FlagKind, OtherKind }; + enum AccessFlag { ReadAccess = 0x0001, WriteAccess = 0x0002, ResetAccess = 0x0004 }; + enum Attribute { DesignableAttribute = 0x0001, ScriptableAttribute = 0x0002, StoredAttribute = 0x0004, UserAttribute = 0x0008}; + Q_DECLARE_FLAGS(Attributes, Attribute) + Q_DECLARE_FLAGS(AccessFlags, AccessFlag) + + QDesignerMetaPropertyInterface(); + virtual ~QDesignerMetaPropertyInterface(); + + virtual const QDesignerMetaEnumInterface *enumerator() const = 0; + + virtual Kind kind() const = 0; + virtual AccessFlags accessFlags() const = 0; + virtual Attributes attributes(const QObject *object = 0) const = 0; + + virtual QVariant::Type type() const = 0; + virtual QString name() const = 0; + virtual QString typeName() const = 0; + virtual int userType() const = 0; + virtual bool hasSetter() const = 0; + + virtual QVariant read(const QObject *object) const = 0; + virtual bool reset(QObject *object) const = 0; + virtual bool write(QObject *object, const QVariant &value) const = 0; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerMetaPropertyInterface::AccessFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerMetaPropertyInterface::Attributes) + +class QDESIGNER_SDK_EXPORT QDesignerMetaMethodInterface +{ +public: + QDesignerMetaMethodInterface(); + virtual ~QDesignerMetaMethodInterface(); + + enum MethodType { Method, Signal, Slot, Constructor }; + enum Access { Private, Protected, Public }; + + virtual Access access() const = 0; + virtual MethodType methodType() const = 0; + virtual QStringList parameterNames() const = 0; + virtual QStringList parameterTypes() const = 0; + virtual QString signature() const = 0; + virtual QString normalizedSignature() const = 0; + virtual QString tag() const = 0; + virtual QString typeName() const = 0; +}; + +class QDESIGNER_SDK_EXPORT QDesignerMetaObjectInterface { +public: + QDesignerMetaObjectInterface(); + virtual ~QDesignerMetaObjectInterface(); + + virtual QString className() const = 0; + virtual const QDesignerMetaEnumInterface *enumerator(int index) const = 0; + virtual int enumeratorCount() const = 0; + virtual int enumeratorOffset() const = 0; + + virtual int indexOfEnumerator(const QString &name) const = 0; + virtual int indexOfMethod(const QString &method) const = 0; + virtual int indexOfProperty(const QString &name) const = 0; + virtual int indexOfSignal(const QString &signal) const = 0; + virtual int indexOfSlot(const QString &slot) const = 0; + + virtual const QDesignerMetaMethodInterface *method(int index) const = 0; + virtual int methodCount() const = 0; + virtual int methodOffset() const = 0; + + virtual const QDesignerMetaPropertyInterface *property(int index) const = 0; + virtual int propertyCount() const = 0; + virtual int propertyOffset() const = 0; + + virtual const QDesignerMetaObjectInterface *superClass() const = 0; + virtual const QDesignerMetaPropertyInterface *userProperty() const = 0; +}; + +// To be obtained from core +class QDESIGNER_SDK_EXPORT QDesignerIntrospectionInterface { +public: + QDesignerIntrospectionInterface(); + virtual ~QDesignerIntrospectionInterface(); + + virtual const QDesignerMetaObjectInterface* metaObject(const QObject *object) const = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTMETAOBJECT_H diff --git a/tools/designer/src/lib/sdk/abstractlanguage.h b/tools/designer/src/lib/sdk/abstractlanguage.h new file mode 100644 index 0000000..b997530 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractlanguage.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt Designer. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QDESIGNER_ABTRACT_LANGUAGE_H +#define QDESIGNER_ABTRACT_LANGUAGE_H + +#include <QtDesigner/extension.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDialog; +class QWidget; +class QDesignerFormWindowInterface; +class QDesignerFormEditorInterface; +class QDesignerResourceBrowserInterface; + +class QDesignerLanguageExtension +{ +public: + virtual ~QDesignerLanguageExtension() {} + + virtual QDialog *createFormWindowSettingsDialog(QDesignerFormWindowInterface *formWindow, QWidget *parentWidget) = 0; + virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parentWidget) = 0; + + virtual QDialog *createPromotionDialog(QDesignerFormEditorInterface *formEditor, QWidget *parentWidget = 0) = 0; + + virtual QDialog *createPromotionDialog(QDesignerFormEditorInterface *formEditor, + const QString &promotableWidgetClassName, + QString *promoteToClassName, + QWidget *parentWidget = 0) = 0; + + virtual bool isLanguageResource(const QString &path) const = 0; + + virtual QString classNameOf(QObject *object) const = 0; + + virtual bool signalMatchesSlot(const QString &signal, const QString &slot) const = 0; + + virtual QString widgetBoxContents() const = 0; + + virtual QString uiExtension() const = 0; +}; + +Q_DECLARE_EXTENSION_INTERFACE(QDesignerLanguageExtension, "com.trolltech.Qt.Designer.Language.3") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDESIGNER_ABTRACT_LANGUAGE_H diff --git a/tools/designer/src/lib/sdk/abstractmetadatabase.cpp b/tools/designer/src/lib/sdk/abstractmetadatabase.cpp new file mode 100644 index 0000000..16bab34 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractmetadatabase.cpp @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// sdk +#include "abstractmetadatabase.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerMetaDataBaseInterface + \brief The QDesignerMetaDataBaseInterface class provides an interface to Qt Designer's + object meta database. + \inmodule QtDesigner + \internal +*/ + +/*! + Constructs an interface to the meta database with the given \a parent. +*/ +QDesignerMetaDataBaseInterface::QDesignerMetaDataBaseInterface(QObject *parent) + : QObject(parent) +{ +} + +/*! + Destroys the interface to the meta database. +*/ +QDesignerMetaDataBaseInterface::~QDesignerMetaDataBaseInterface() +{ +} + +/*! + \fn QDesignerMetaDataBaseItemInterface *QDesignerMetaDataBaseInterface::item(QObject *object) const + + Returns the item in the meta database associated with the given \a object. +*/ + +/*! + \fn void QDesignerMetaDataBaseInterface::add(QObject *object) + + Adds the specified \a object to the meta database. +*/ + +/*! + \fn void QDesignerMetaDataBaseInterface::remove(QObject *object) + + Removes the specified \a object from the meta database. +*/ + +/*! + \fn QList<QObject*> QDesignerMetaDataBaseInterface::objects() const + + Returns the list of objects that have corresponding items in the meta database. +*/ + +/*! + \fn QDesignerFormEditorInterface *QDesignerMetaDataBaseInterface::core() const + + Returns the core interface that is associated with the meta database. +*/ + + +// Doc: Interface only + +/*! + \class QDesignerMetaDataBaseItemInterface + \brief The QDesignerMetaDataBaseItemInterface class provides an interface to individual + items in Qt Designer's meta database. + \inmodule QtDesigner + \internal + + This class allows individual items in \QD's meta-data database to be accessed and modified. + Use the QDesignerMetaDataBaseInterface class to change the properties of the database itself. +*/ + +/*! + \fn QDesignerMetaDataBaseItemInterface::~QDesignerMetaDataBaseItemInterface() + + Destroys the item interface to the meta-data database. +*/ + +/*! + \fn QString QDesignerMetaDataBaseItemInterface::name() const + + Returns the name of the item in the database. + + \sa setName() +*/ + +/*! + \fn void QDesignerMetaDataBaseItemInterface::setName(const QString &name) + + Sets the name of the item to the given \a name. + + \sa name() +*/ + +/*! + \fn QList<QWidget*> QDesignerMetaDataBaseItemInterface::tabOrder() const + + Returns a list of widgets in the order defined by the form's tab order. + + \sa setTabOrder() +*/ + + +/*! + \fn void QDesignerMetaDataBaseItemInterface::setTabOrder(const QList<QWidget*> &tabOrder) + + Sets the tab order in the form using the list of widgets defined by \a tabOrder. + + \sa tabOrder() +*/ + + +/*! + \fn bool QDesignerMetaDataBaseItemInterface::enabled() const + + Returns whether the item is enabled. + + \sa setEnabled() +*/ + +/*! + \fn void QDesignerMetaDataBaseItemInterface::setEnabled(bool enabled) + + If \a enabled is true, the item is enabled; otherwise it is disabled. + + \sa enabled() +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractmetadatabase.h b/tools/designer/src/lib/sdk/abstractmetadatabase.h new file mode 100644 index 0000000..0c5dcc5 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractmetadatabase.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTMETADATABASE_H +#define ABSTRACTMETADATABASE_H + +#include <QtDesigner/sdk_global.h> + +#include <QtCore/QObject> +#include <QtCore/QList> +#include <QtCore/QHash> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QCursor; +class QWidget; + +class QDesignerFormEditorInterface; + +class QDesignerMetaDataBaseItemInterface +{ +public: + virtual ~QDesignerMetaDataBaseItemInterface() {} + + virtual QString name() const = 0; + virtual void setName(const QString &name) = 0; + + virtual QList<QWidget*> tabOrder() const = 0; + virtual void setTabOrder(const QList<QWidget*> &tabOrder) = 0; + + virtual bool enabled() const = 0; + virtual void setEnabled(bool b) = 0; +}; + + +class QDESIGNER_SDK_EXPORT QDesignerMetaDataBaseInterface: public QObject +{ + Q_OBJECT +public: + QDesignerMetaDataBaseInterface(QObject *parent = 0); + virtual ~QDesignerMetaDataBaseInterface(); + + virtual QDesignerMetaDataBaseItemInterface *item(QObject *object) const = 0; + virtual void add(QObject *object) = 0; + virtual void remove(QObject *object) = 0; + + virtual QList<QObject*> objects() const = 0; + + virtual QDesignerFormEditorInterface *core() const = 0; + +Q_SIGNALS: + void changed(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTMETADATABASE_H diff --git a/tools/designer/src/lib/sdk/abstractnewformwidget.cpp b/tools/designer/src/lib/sdk/abstractnewformwidget.cpp new file mode 100644 index 0000000..ca1adde --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractnewformwidget.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractnewformwidget_p.h" +#include <newformwidget_p.h> + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerNewFormWidgetInterface + \since 4.5 + \internal + + \brief QDesignerNewFormWidgetInterface provides an interface for chooser + widgets that can be used within "New Form" dialogs and wizards. + It presents the user with a list of choices taken from built-in + templates, pre-defined template paths and suitable custom widgets. + It provides a static creation function that returns \QD's + implementation. + + \inmodule QtDesigner +*/ + +/*! + Constructs a QDesignerNewFormWidgetInterface object. +*/ + +QDesignerNewFormWidgetInterface::QDesignerNewFormWidgetInterface(QWidget *parent) : + QWidget(parent) +{ +} + +/*! + Destroys the QDesignerNewFormWidgetInterface object. +*/ + +QDesignerNewFormWidgetInterface::~QDesignerNewFormWidgetInterface() +{ +} + +/*! + Creates an instance of the QDesignerNewFormWidgetInterface as a child + of \a parent using \a core. +*/ + +QDesignerNewFormWidgetInterface *QDesignerNewFormWidgetInterface::createNewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent) +{ + return new qdesigner_internal::NewFormWidget(core, parent); +} + +/*! + \fn bool QDesignerNewFormWidgetInterface::hasCurrentTemplate() const + + Returns whether a form template is currently selected. +*/ + +/*! + \fn QString QDesignerNewFormWidgetInterface::currentTemplate(QString *errorMessage = 0) + + Returns the contents of the currently selected template. If the method fails, + an empty string is returned and \a errorMessage receives an error message. +*/ + +// Signals + +/*! + \fn void QDesignerNewFormWidgetInterface::templateActivated() + + This signal is emitted whenever the user activates a template by double-clicking. +*/ + +/*! + \fn void QDesignerNewFormWidgetInterface::currentTemplateChanged(bool templateSelected) + + This signal is emitted whenever the user changes the current template. + \a templateSelected indicates whether a template is currently selected. +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractnewformwidget_p.h b/tools/designer/src/lib/sdk/abstractnewformwidget_p.h new file mode 100644 index 0000000..df8020a --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractnewformwidget_p.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt Designer. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#ifndef ABSTRACTNEWFORMWIDGET_H +#define ABSTRACTNEWFORMWIDGET_H + +#include <QtDesigner/sdk_global.h> + +#include <QtGui/QWidget> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDesignerFormEditorInterface; + +class QDESIGNER_SDK_EXPORT QDesignerNewFormWidgetInterface : public QWidget +{ + Q_DISABLE_COPY(QDesignerNewFormWidgetInterface) + Q_OBJECT +public: + explicit QDesignerNewFormWidgetInterface(QWidget *parent = 0); + virtual ~QDesignerNewFormWidgetInterface(); + + virtual bool hasCurrentTemplate() const = 0; + virtual QString currentTemplate(QString *errorMessage = 0) = 0; + + static QDesignerNewFormWidgetInterface *createNewFormWidget(QDesignerFormEditorInterface *core, QWidget *parent = 0); + +Q_SIGNALS: + void templateActivated(); + void currentTemplateChanged(bool templateSelected); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTNEWFORMWIDGET_H diff --git a/tools/designer/src/lib/sdk/abstractobjectinspector.cpp b/tools/designer/src/lib/sdk/abstractobjectinspector.cpp new file mode 100644 index 0000000..61af96a --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractobjectinspector.cpp @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractobjectinspector.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerObjectInspectorInterface + + \brief The QDesignerObjectInspectorInterface class allows you to + change the focus of Qt Designer's object inspector. + + \inmodule QtDesigner + + You can use the QDesignerObjectInspectorInterface to change the + current form window selection. For example, when implementing a + custom widget plugin: + + \snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractobjectinspector.cpp 0 + + 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. + + The interface provides the core() function that you can use to + retrieve a pointer to \QD's current QDesignerFormEditorInterface + object, and the setFormWindow() function that enables you to + change the current form window selection. + + \sa QDesignerFormEditorInterface, QDesignerFormWindowInterface +*/ + +/*! + Constructs an object inspector interface with the given \a parent + and the specified window \a flags. +*/ +QDesignerObjectInspectorInterface::QDesignerObjectInspectorInterface(QWidget *parent, Qt::WindowFlags flags) + : QWidget(parent, flags) +{ +} + +/*! + Destroys the object inspector interface. +*/ +QDesignerObjectInspectorInterface::~QDesignerObjectInspectorInterface() +{ +} + +/*! + Returns a pointer to \QD's current QDesignerFormEditorInterface + object. +*/ +QDesignerFormEditorInterface *QDesignerObjectInspectorInterface::core() const +{ + return 0; +} + +/*! + \fn void QDesignerObjectInspectorInterface::setFormWindow(QDesignerFormWindowInterface *formWindow) + + Sets the currently selected form window to \a formWindow. +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractobjectinspector.h b/tools/designer/src/lib/sdk/abstractobjectinspector.h new file mode 100644 index 0000000..39f1361 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractobjectinspector.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTOBJECTINSPECTOR_H +#define ABSTRACTOBJECTINSPECTOR_H + +#include <QtDesigner/sdk_global.h> + +#include <QtGui/QWidget> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDesignerFormEditorInterface; +class QDesignerFormWindowInterface; + +class QDESIGNER_SDK_EXPORT QDesignerObjectInspectorInterface: public QWidget +{ + Q_OBJECT +public: + QDesignerObjectInspectorInterface(QWidget *parent, Qt::WindowFlags flags = 0); + virtual ~QDesignerObjectInspectorInterface(); + + virtual QDesignerFormEditorInterface *core() const; + +public Q_SLOTS: + virtual void setFormWindow(QDesignerFormWindowInterface *formWindow) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTOBJECTINSPECTOR_H diff --git a/tools/designer/src/lib/sdk/abstractoptionspage_p.h b/tools/designer/src/lib/sdk/abstractoptionspage_p.h new file mode 100644 index 0000000..415cc83 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractoptionspage_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt Designer. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#ifndef ABSTRACTOPTIONSPAGE_P_H +#define ABSTRACTOPTIONSPAGE_P_H + +#include <QtDesigner/sdk_global.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QString; +class QWidget; + +class QDESIGNER_SDK_EXPORT QDesignerOptionsPageInterface +{ +public: + virtual ~QDesignerOptionsPageInterface() {} + virtual QString name() const = 0; + virtual QWidget *createPage(QWidget *parent) = 0; + virtual void apply() = 0; + virtual void finish() = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTOPTIONSPAGE_P_H diff --git a/tools/designer/src/lib/sdk/abstractpromotioninterface.cpp b/tools/designer/src/lib/sdk/abstractpromotioninterface.cpp new file mode 100644 index 0000000..79fba01 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractpromotioninterface.cpp @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractpromotioninterface.h" + +QT_BEGIN_NAMESPACE + +QDesignerPromotionInterface::~QDesignerPromotionInterface() +{ +} + +/*! + \class QDesignerPromotionInterface + + \brief The QDesignerPromotionInterface provides functions for modifying + the promoted classes in Designer. + \inmodule QtDesigner + \internal + \since 4.3 +*/ + +/*! + \class QDesignerPromotionInterface::PromotedClass + A pair of database items containing the base class and the promoted class. + + \typedef QDesignerPromotionInterface::PromotedClasses + A list of PromotedClass items. + + virtual QDesignerPromotionInterface::PromotedClasses promotedClasses() const + + Returns a list of promoted classes along with their base classes in alphabetical order. + It can be used to populate tree models for editing promoted widgets. + +*/ + +/*! + \fn virtual QSet<QString> QDesignerPromotionInterface::referencedPromotedClassNames() const + + Returns a set of promoted classed that are referenced by the currently opened forms. +*/ + +/*! + \fn virtual bool QDesignerPromotionInterface::addPromotedClass(const QString &baseClass, const QString &className, const QString &includeFile, QString *errorMessage) + + Add a promoted class named \a with the base class \a and include file \a includeFile. Returns \c true on success or \c false along + with an error message in \a errorMessage on failure. +*/ + +/*! + \fn virtual bool QDesignerPromotionInterface::removePromotedClass(const QString &className, QString *errorMessage) + + Remove the promoted class named \a className unless it is referenced by a form. Returns \c true on success or \c false along + with an error message in \a errorMessage on failure. +*/ + +/*! + \fn virtual bool QDesignerPromotionInterface::changePromotedClassName(const QString &oldClassName, const QString &newClassName, QString *errorMessage) + + Change the class name of a promoted class from \a oldClassName to \a newClassName. Returns \c true on success or \c false along + with an error message in \a errorMessage on failure. +*/ + +/*! + \fn virtual bool QDesignerPromotionInterface::setPromotedClassIncludeFile(const QString &className, const QString &includeFile, QString *errorMessage) + + Change the include file of a promoted class named \a className to be \a includeFile. Returns \c true on success or \c false along + with an error message in \a errorMessage on failure. +*/ + +/*! \fn virtual QList<QDesignerWidgetDataBaseItemInterface *> QDesignerPromotionInterface::promotionBaseClasses() const + + Return a list of base classes that are suitable for promotion. +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractpromotioninterface.h b/tools/designer/src/lib/sdk/abstractpromotioninterface.h new file mode 100644 index 0000000..2acae74 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractpromotioninterface.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTPROMOTIONINTERFACE_H +#define ABSTRACTPROMOTIONINTERFACE_H + +#include <QtDesigner/sdk_global.h> + +#include <QtCore/QPair> +#include <QtCore/QList> +#include <QtCore/QSet> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDesignerWidgetDataBaseItemInterface; + +class QDESIGNER_SDK_EXPORT QDesignerPromotionInterface +{ +public: + virtual ~QDesignerPromotionInterface(); + + struct PromotedClass { + QDesignerWidgetDataBaseItemInterface *baseItem; + QDesignerWidgetDataBaseItemInterface *promotedItem; + }; + + typedef QList<PromotedClass> PromotedClasses; + + virtual PromotedClasses promotedClasses() const = 0; + + virtual QSet<QString> referencedPromotedClassNames() const = 0; + + virtual bool addPromotedClass(const QString &baseClass, + const QString &className, + const QString &includeFile, + QString *errorMessage) = 0; + + virtual bool removePromotedClass(const QString &className, QString *errorMessage) = 0; + + virtual bool changePromotedClassName(const QString &oldClassName, const QString &newClassName, QString *errorMessage) = 0; + + virtual bool setPromotedClassIncludeFile(const QString &className, const QString &includeFile, QString *errorMessage) = 0; + + virtual QList<QDesignerWidgetDataBaseItemInterface *> promotionBaseClasses() const = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTPROMOTIONINTERFACE_H diff --git a/tools/designer/src/lib/sdk/abstractpropertyeditor.cpp b/tools/designer/src/lib/sdk/abstractpropertyeditor.cpp new file mode 100644 index 0000000..f244a52 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractpropertyeditor.cpp @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractpropertyeditor.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerPropertyEditorInterface + + \brief The QDesignerPropertyEditorInterface class allows you to + query and manipulate the current state of Qt Designer's property + editor. + + \inmodule QtDesigner + + QDesignerPropertyEditorInterface contains a collection of + functions that is typically used to query the property editor for + its current state, and several slots manipulating it's state. The + interface also provide a signal, propertyChanged(), which is + emitted whenever a property changes in the property editor. The + signal's arguments are the property that changed and its new + value. + + For example, when implementing a custom widget plugin, you can + connect the signal to a custom slot: + + \snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractpropertyeditor.cpp 0 + + Then the custom slot can check if the new value is within the + range we want when a specified property, belonging to a particular + widget, changes: + + \snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractpropertyeditor.cpp 1 + + 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. + + The functions accessing the property editor are the core() + function that you can use to retrieve an interface to the form + editor, the currentPropertyName() function that returns the name + of the currently selected property in the property editor, the + object() function that returns the currently selected object in + \QD's workspace, and the isReadOnly() function that returns true + if the property editor is write proteced (otherwise false). + + The slots manipulating the property editor's state are the + setObject() slot that you can use to change the currently selected + object in \QD's workspace, the setPropertyValue() slot that + changes the value of a given property and the setReadOnly() slot + that control the write protection of the property editor. + + \sa QDesignerFormEditorInterface +*/ + +/*! + Constructs a property editor interface with the given \a parent and + the specified window \a flags. +*/ +QDesignerPropertyEditorInterface::QDesignerPropertyEditorInterface(QWidget *parent, Qt::WindowFlags flags) + : QWidget(parent, flags) +{ +} + +/*! + Destroys the property editor interface. +*/ +QDesignerPropertyEditorInterface::~QDesignerPropertyEditorInterface() +{ +} + +/*! + Returns a pointer to \QD's current QDesignerFormEditorInterface + object. +*/ +QDesignerFormEditorInterface *QDesignerPropertyEditorInterface::core() const +{ + return 0; +} + +/*! + \fn bool QDesignerPropertyEditorInterface::isReadOnly() const + + Returns true if the property editor is write protected; otherwise + false. + + \sa setReadOnly() +*/ + +/*! + \fn QObject *QDesignerPropertyEditorInterface::object() const + + Returns the currently selected object in \QD's workspace. + + \sa setObject() +*/ + +/*! + \fn QString QDesignerPropertyEditorInterface::currentPropertyName() const + + Returns the name of the currently selected property in the + property editor. + + \sa setPropertyValue() +*/ + +/*! + \fn void QDesignerPropertyEditorInterface::propertyChanged(const QString &name, const QVariant &value) + + This signal is emitted whenever a property changes in the property + editor. The property that changed and its new value are specified + by \a name and \a value respectively. + + \sa setPropertyValue() +*/ + +/*! + \fn void QDesignerPropertyEditorInterface::setObject(QObject *object) + + Changes the currently selected object in \QD's workspace, to \a + object. + + \sa object() +*/ + +/*! + \fn void QDesignerPropertyEditorInterface::setPropertyValue(const QString &name, const QVariant &value, bool changed = true) + + Sets the value of the property specified by \a name to \a + value. + + In addition, the property is marked as \a changed in the property + editor, i.e. its value is different from the default value. + + \sa currentPropertyName(), propertyChanged() +*/ + +/*! + \fn void QDesignerPropertyEditorInterface::setReadOnly(bool readOnly) + + If \a readOnly is true, the property editor is made write + protected; otherwise the write protection is removed. + + \sa isReadOnly() +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractpropertyeditor.h b/tools/designer/src/lib/sdk/abstractpropertyeditor.h new file mode 100644 index 0000000..acdcd4f --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractpropertyeditor.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTPROPERTYEDITOR_H +#define ABSTRACTPROPERTYEDITOR_H + +#include <QtDesigner/sdk_global.h> + +#include <QtGui/QWidget> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDesignerFormEditorInterface; +class QString; +class QVariant; + +class QDESIGNER_SDK_EXPORT QDesignerPropertyEditorInterface: public QWidget +{ + Q_OBJECT +public: + QDesignerPropertyEditorInterface(QWidget *parent, Qt::WindowFlags flags = 0); + virtual ~QDesignerPropertyEditorInterface(); + + virtual QDesignerFormEditorInterface *core() const; + + virtual bool isReadOnly() const = 0; + virtual QObject *object() const = 0; + + virtual QString currentPropertyName() const = 0; + +Q_SIGNALS: + void propertyChanged(const QString &name, const QVariant &value); + +public Q_SLOTS: + virtual void setObject(QObject *object) = 0; + virtual void setPropertyValue(const QString &name, const QVariant &value, bool changed = true) = 0; + virtual void setReadOnly(bool readOnly) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTPROPERTYEDITOR_H diff --git a/tools/designer/src/lib/sdk/abstractresourcebrowser.cpp b/tools/designer/src/lib/sdk/abstractresourcebrowser.cpp new file mode 100644 index 0000000..1aed6da --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractresourcebrowser.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractresourcebrowser.h" + +QT_BEGIN_NAMESPACE + +QDesignerResourceBrowserInterface::QDesignerResourceBrowserInterface(QWidget *parent) + : QWidget(parent) +{ + +} + +QDesignerResourceBrowserInterface::~QDesignerResourceBrowserInterface() +{ + +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractresourcebrowser.h b/tools/designer/src/lib/sdk/abstractresourcebrowser.h new file mode 100644 index 0000000..9f6b523 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractresourcebrowser.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTRESOURCEBROWSER_H +#define ABSTRACTRESOURCEBROWSER_H + +#include <QtDesigner/sdk_global.h> + +#include <QtGui/QWidget> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QWidget; // FIXME: fool syncqt + +class QDESIGNER_SDK_EXPORT QDesignerResourceBrowserInterface: public QWidget +{ + Q_OBJECT +public: + QDesignerResourceBrowserInterface(QWidget *parent = 0); + virtual ~QDesignerResourceBrowserInterface(); + + virtual void setCurrentPath(const QString &filePath) = 0; + virtual QString currentPath() const = 0; + +Q_SIGNALS: + void currentPathChanged(const QString &filePath); + void pathActivated(const QString &filePath); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTFORMEDITOR_H + diff --git a/tools/designer/src/lib/sdk/abstractsettings_p.h b/tools/designer/src/lib/sdk/abstractsettings_p.h new file mode 100644 index 0000000..2117b49 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractsettings_p.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt Designer. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#ifndef ABSTRACTSETTINGS_P_H +#define ABSTRACTSETTINGS_P_H + +#include <QtDesigner/sdk_global.h> + +#include <QVariant> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QString; + +/*! + To be implemented by IDEs that want to control the way designer retrieves/stores its settings. + */ +class QDESIGNER_SDK_EXPORT QDesignerSettingsInterface +{ +public: + virtual ~QDesignerSettingsInterface() {} + + virtual void beginGroup(const QString &prefix) = 0; + virtual void endGroup() = 0; + + virtual bool contains(const QString &key) const = 0; + virtual void setValue(const QString &key, const QVariant &value) = 0; + virtual QVariant value(const QString &key, const QVariant &defaultValue = QVariant()) const = 0; + virtual void remove(const QString &key) = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTSETTINGS_P_H diff --git a/tools/designer/src/lib/sdk/abstractwidgetbox.cpp b/tools/designer/src/lib/sdk/abstractwidgetbox.cpp new file mode 100644 index 0000000..a09f50e --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractwidgetbox.cpp @@ -0,0 +1,340 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractwidgetbox.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerWidgetBoxInterface + + \brief The QDesignerWidgetBoxInterface class allows you to control + the contents of Qt Designer's widget box. + + \inmodule QtDesigner + + QDesignerWidgetBoxInterface contains a collection of functions + that is typically used to manipulate the contents of \QD's widget + box. + + \QD uses an XML file to populate its widget box. The name of that + file is one of the widget box's properties, and you can retrieve + it using the fileName() function. + + QDesignerWidgetBoxInterface also provides the save() function that + saves the contents of the widget box in the file specified by the + widget box's file name property. If you have made changes to the + widget box, for example by dropping a widget into the widget box, + without calling the save() function, the original content can be + restored by a simple invocation of the load() function: + + \snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractwidgetbox.cpp 0 + + 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. + + If you want to save your changes, and at the same time preserve + the original contents, you can use the save() function combined + with the setFileName() function to save your changes into another + file. Remember to store the name of the original file first: + + \snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractwidgetbox.cpp 1 + + Then you can restore the original contents of the widget box by + resetting the file name to the original file and calling load(): + + \snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractwidgetbox.cpp 2 + + In a similar way, you can later use your customized XML file: + + \snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractwidgetbox.cpp 3 + + + \sa QDesignerFormEditorInterface +*/ + +/*! + Constructs a widget box interface with the given \a parent and + the specified window \a flags. +*/ +QDesignerWidgetBoxInterface::QDesignerWidgetBoxInterface(QWidget *parent, Qt::WindowFlags flags) + : QWidget(parent, flags) +{ +} + +/*! + Destroys the widget box interface. +*/ +QDesignerWidgetBoxInterface::~QDesignerWidgetBoxInterface() +{ +} + +/*! + \internal +*/ +int QDesignerWidgetBoxInterface::findOrInsertCategory(const QString &categoryName) +{ + int count = categoryCount(); + for (int index=0; index<count; ++index) { + Category c = category(index); + if (c.name() == categoryName) + return index; + } + + addCategory(Category(categoryName)); + return count; +} + +/*! + \internal + \fn int QDesignerWidgetBoxInterface::categoryCount() const +*/ + +/*! + \internal + \fn Category QDesignerWidgetBoxInterface::category(int cat_idx) const +*/ + +/*! + \internal + \fn void QDesignerWidgetBoxInterface::addCategory(const Category &cat) +*/ + +/*! + \internal + \fn void QDesignerWidgetBoxInterface::removeCategory(int cat_idx) +*/ + +/*! + \internal + \fn int QDesignerWidgetBoxInterface::widgetCount(int cat_idx) const +*/ + +/*! + \internal + \fn Widget QDesignerWidgetBoxInterface::widget(int cat_idx, int wgt_idx) const +*/ + +/*! + \internal + \fn void QDesignerWidgetBoxInterface::addWidget(int cat_idx, const Widget &wgt) +*/ + +/*! + \internal + \fn void QDesignerWidgetBoxInterface::removeWidget(int cat_idx, int wgt_idx) +*/ + +/*! + \internal + \fn void QDesignerWidgetBoxInterface::dropWidgets(const QList<QDesignerDnDItemInterface*> &item_list, const QPoint &global_mouse_pos) + +*/ + +/*! + \fn void QDesignerWidgetBoxInterface::setFileName(const QString &fileName) + + Sets the XML file that \QD will use to populate its widget box, to + \a fileName. You must call load() to update the widget box with + the new XML file. + + \sa fileName(), load() +*/ + +/*! + \fn QString QDesignerWidgetBoxInterface::fileName() const + + Returns the name of the XML file \QD is currently using to + populate its widget box. + + \sa setFileName() +*/ + +/*! + \fn bool QDesignerWidgetBoxInterface::load() + + Populates \QD's widget box by loading (or reloading) the currently + specified XML file. Returns true if the file is successfully + loaded; otherwise false. + + \sa setFileName() +*/ + +/*! + \fn bool QDesignerWidgetBoxInterface::save() + + Saves the contents of \QD's widget box in the file specified by + the fileName() function. Returns true if the content is + successfully saved; otherwise false. + + \sa fileName(), setFileName() +*/ + + +/*! + \internal + + \class QDesignerWidgetBoxInterface::Widget + + \brief The Widget class specified a widget in Qt Designer's widget + box component. +*/ + +/*! + \enum QDesignerWidgetBoxInterface::Widget::Type + + \value Default + \value Custom +*/ + +/*! + \fn QDesignerWidgetBoxInterface::Widget::Widget(const QString &aname, const QString &xml, const QString &icon_name, Type atype) +*/ + +/*! + \fn QString QDesignerWidgetBoxInterface::Widget::name() const +*/ + +/*! + \fn void QDesignerWidgetBoxInterface::Widget::setName(const QString &aname) +*/ + +/*! + \fn QString QDesignerWidgetBoxInterface::Widget::domXml() const +*/ + +/*! + \fn void QDesignerWidgetBoxInterface::Widget::setDomXml(const QString &xml) +*/ + +/*! + \fn QString QDesignerWidgetBoxInterface::Widget::iconName() const +*/ + +/*! + \fn void QDesignerWidgetBoxInterface::Widget::setIconName(const QString &icon_name) +*/ + +/*! + \fn Type QDesignerWidgetBoxInterface::Widget::type() const +*/ + +/*! + \fn void QDesignerWidgetBoxInterface::Widget::setType(Type atype) +*/ + +/*! + \fn bool QDesignerWidgetBoxInterface::Widget::isNull() const +*/ + + +/*! + \class QDesignerWidgetBoxInterface::Category + \brief The Category class specifies a category in Qt Designer's widget box component. + \internal +*/ + +/*! + \enum QDesignerWidgetBoxInterface::Category::Type + + \value Default + \value Scratchpad +*/ + +/*! + \fn QDesignerWidgetBoxInterface::Category::Category(const QString &aname, Type atype) +*/ + +/*! + \fn QString QDesignerWidgetBoxInterface::Category::name() const +*/ + +/*! + \fn void QDesignerWidgetBoxInterface::Category::setName(const QString &aname) +*/ + +/*! + \fn int QDesignerWidgetBoxInterface::Category::widgetCount() const +*/ + +/*! + \fn Widget QDesignerWidgetBoxInterface::Category::widget(int idx) const +*/ + +/*! + \fn void QDesignerWidgetBoxInterface::Category::removeWidget(int idx) +*/ + +/*! + \fn void QDesignerWidgetBoxInterface::Category::addWidget(const Widget &awidget) +*/ + +/*! + \fn Type QDesignerWidgetBoxInterface::Category::type() const +*/ + +/*! + \fn void QDesignerWidgetBoxInterface::Category::setType(Type atype) +*/ + +/*! + \fn bool QDesignerWidgetBoxInterface::Category::isNull() const +*/ + +/*! + \typedef QDesignerWidgetBoxInterface::CategoryList + \internal +*/ + +/*! + \typedef QDesignerWidgetBoxInterface::WidgetList + \internal +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractwidgetbox.h b/tools/designer/src/lib/sdk/abstractwidgetbox.h new file mode 100644 index 0000000..b5ccde1 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractwidgetbox.h @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTWIDGETBOX_H +#define ABSTRACTWIDGETBOX_H + +#include <QtDesigner/sdk_global.h> + +#include <QtCore/QMetaType> +#include <QtGui/QWidget> +#include <QtGui/QIcon> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class DomUI; +class QDesignerDnDItemInterface; + +class QDESIGNER_SDK_EXPORT QDesignerWidgetBoxInterface : public QWidget +{ + Q_OBJECT +public: + class Widget { + public: + enum Type { Default, Custom }; + Widget(const QString &aname = QString(), const QString &xml = QString(), + const QString &icon_name = QString(), Type atype = Default) + : m_name(aname), m_xml(xml), m_icon_name(icon_name), m_type(atype) {} + QString name() const { return m_name; } + void setName(const QString &aname) { m_name = aname; } + QString domXml() const { return m_xml; } + void setDomXml(const QString &xml) { m_xml = xml; } + QString iconName() const { return m_icon_name; } + void setIconName(const QString &icon_name) { m_icon_name = icon_name; } + Type type() const { return m_type; } + void setType(Type atype) { m_type = atype; } + + bool isNull() const { return m_name.isEmpty(); } + + private: + QString m_name; + QString m_xml; + QString m_icon_name; + Type m_type; + }; + typedef QList<Widget> WidgetList; + + class Category { + public: + enum Type { Default, Scratchpad }; + + Category(const QString &aname = QString(), Type atype = Default) + : m_name(aname), m_type(atype) {} + + QString name() const { return m_name; } + void setName(const QString &aname) { m_name = aname; } + int widgetCount() const { return m_widget_list.size(); } + Widget widget(int idx) const { return m_widget_list.at(idx); } + void removeWidget(int idx) { m_widget_list.removeAt(idx); } + void addWidget(const Widget &awidget) { m_widget_list.append(awidget); } + Type type() const { return m_type; } + void setType(Type atype) { m_type = atype; } + + bool isNull() const { return m_name.isEmpty(); } + + private: + QString m_name; + Type m_type; + QList<Widget> m_widget_list; + }; + typedef QList<Category> CategoryList; + + QDesignerWidgetBoxInterface(QWidget *parent = 0, Qt::WindowFlags flags = 0); + virtual ~QDesignerWidgetBoxInterface(); + + virtual int categoryCount() const = 0; + virtual Category category(int cat_idx) const = 0; + virtual void addCategory(const Category &cat) = 0; + virtual void removeCategory(int cat_idx) = 0; + + virtual int widgetCount(int cat_idx) const = 0; + virtual Widget widget(int cat_idx, int wgt_idx) const = 0; + virtual void addWidget(int cat_idx, const Widget &wgt) = 0; + virtual void removeWidget(int cat_idx, int wgt_idx) = 0; + + int findOrInsertCategory(const QString &categoryName); + + virtual void dropWidgets(const QList<QDesignerDnDItemInterface*> &item_list, + const QPoint &global_mouse_pos) = 0; + + virtual void setFileName(const QString &file_name) = 0; + virtual QString fileName() const = 0; + virtual bool load() = 0; + virtual bool save() = 0; +}; + +QT_END_NAMESPACE + +Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QDesignerWidgetBoxInterface::Widget)) + +QT_END_HEADER + +#endif // ABSTRACTWIDGETBOX_H diff --git a/tools/designer/src/lib/sdk/abstractwidgetdatabase.cpp b/tools/designer/src/lib/sdk/abstractwidgetdatabase.cpp new file mode 100644 index 0000000..39b64fc --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractwidgetdatabase.cpp @@ -0,0 +1,360 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstractwidgetdatabase.h" +#include <QtCore/qdebug.h> +#include <qalgorithms.h> + +QT_BEGIN_NAMESPACE + +namespace { + enum { debugWidgetDataBase = 0 }; +} + +/*! + \class QDesignerWidgetDataBaseInterface + \brief The QDesignerWidgetDataBaseInterface class provides an interface that is used to + access and modify Qt Designer's widget database. + \inmodule QtDesigner + \internal +*/ + +/*! + Constructs an interface to the widget database with the given \a parent. +*/ +QDesignerWidgetDataBaseInterface::QDesignerWidgetDataBaseInterface(QObject *parent) + : QObject(parent) +{ +} + +/*! + Destroys the interface to the widget database. +*/ +QDesignerWidgetDataBaseInterface::~QDesignerWidgetDataBaseInterface() +{ + qDeleteAll(m_items); +} + +/*! + +*/ +int QDesignerWidgetDataBaseInterface::count() const +{ + return m_items.count(); +} + +/*! +*/ +QDesignerWidgetDataBaseItemInterface *QDesignerWidgetDataBaseInterface::item(int index) const +{ + return index != -1 ? m_items.at(index) : 0; +} + +/*! +*/ +int QDesignerWidgetDataBaseInterface::indexOf(QDesignerWidgetDataBaseItemInterface *item) const +{ + return m_items.indexOf(item); +} + +/*! +*/ +void QDesignerWidgetDataBaseInterface::insert(int index, QDesignerWidgetDataBaseItemInterface *item) +{ + if (debugWidgetDataBase) + qDebug() << "insert at " << index << ' ' << item->name() << " derived from " << item->extends(); + + m_items.insert(index, item); +} + +/*! +*/ +void QDesignerWidgetDataBaseInterface::append(QDesignerWidgetDataBaseItemInterface *item) +{ + if (debugWidgetDataBase) + qDebug() << "append " << item->name() << " derived from " << item->extends(); + m_items.append(item); +} + +/*! +*/ +QDesignerFormEditorInterface *QDesignerWidgetDataBaseInterface::core() const +{ + return 0; +} + +/*! +*/ +int QDesignerWidgetDataBaseInterface::indexOfClassName(const QString &name, bool) const +{ + const int itemCount = count(); + for (int i=0; i<itemCount; ++i) { + const QDesignerWidgetDataBaseItemInterface *entry = item(i); + if (entry->name() == name) + return i; + } + + return -1; +} + +/*! +*/ +int QDesignerWidgetDataBaseInterface::indexOfObject(QObject *object, bool) const +{ + if (!object) + return -1; + + const QString className = QString::fromUtf8(object->metaObject()->className()); + return indexOfClassName(className); +} + +/*! +*/ +bool QDesignerWidgetDataBaseInterface::isContainer(QObject *object, bool resolveName) const +{ + if (const QDesignerWidgetDataBaseItemInterface *i = item(indexOfObject(object, resolveName))) + return i->isContainer(); + return false; +} + +/*! +*/ +bool QDesignerWidgetDataBaseInterface::isCustom(QObject *object, bool resolveName) const +{ + if (const QDesignerWidgetDataBaseItemInterface *i = item(indexOfObject(object, resolveName))) + return i->isCustom(); + return false; +} + +/*! + \fn void QDesignerWidgetDataBaseInterface::changed() + + This signal is emitted ... +*/ + + +// Doc: No implementation - an abstract class + +/*! + \class QDesignerWidgetDataBaseItemInterface + \brief The QDesignerWidgetDataBaseItemInterface class provides an interface that is used to + access individual items in Qt Designer's widget database. + \inmodule QtDesigner + \internal + + This class enables individual items in the widget database to be accessed and modified. + Changes to the widget database itself are made through the QDesignerWidgetDataBaseInterface + class. +*/ + +/*! + \fn virtual QDesignerWidgetDataBaseItemInterface::~QDesignerWidgetDataBaseItemInterface() + + Destroys the interface. +*/ + +/*! + \fn virtual QString QDesignerWidgetDataBaseItemInterface::name() const = 0 + + Returns the name of the widget. +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setName(const QString &name) = 0 +*/ + +/*! + \fn virtual QString QDesignerWidgetDataBaseItemInterface::group() const = 0 + + Returns the name of the group that the widget belongs to. +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setGroup(const QString &group) = 0 +*/ + +/*! + \fn virtual QString QDesignerWidgetDataBaseItemInterface::toolTip() const = 0 + + Returns the tool tip to be used by the widget. +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setToolTip(const QString &toolTip) = 0 +*/ + +/*! + \fn virtual QString QDesignerWidgetDataBaseItemInterface::whatsThis() const = 0 + + Returns the "What's This?" help for the widget. +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setWhatsThis(const QString &whatsThis) = 0 +*/ + +/*! + \fn virtual QString QDesignerWidgetDataBaseItemInterface::includeFile() const = 0 + + Returns the name of the include file that the widget needs when being built from source. +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setIncludeFile(const QString &includeFile) = 0 +*/ + +/*! + \fn virtual QIcon QDesignerWidgetDataBaseItemInterface::icon() const = 0 + + Returns the icon used to represent the item. +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setIcon(const QIcon &icon) = 0 +*/ + +/*! + \fn virtual bool QDesignerWidgetDataBaseItemInterface::isCompat() const = 0 + + Returns true if this type of widget is provided for compatibility purposes (e.g. Qt3Support + widgets); otherwise returns false. + + \sa setCompat() +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setCompat(bool compat) = 0 + + If \a compat is true, the widget is handled as a compatibility widget; otherwise it is + handled normally by \QD. + + \sa isCompat() +*/ + +/*! + \fn virtual bool QDesignerWidgetDataBaseItemInterface::isContainer() const = 0 + + Returns true if this widget is intended to be used to hold other widgets; otherwise returns + false. + + \sa setContainer() +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setContainer(bool container) = 0 + + If \a container is true, the widget can be used to hold other widgets in \QD; otherwise + \QD will refuse to let the user place other widgets inside it. + + \sa isContainer() +*/ + +/*! + \fn virtual bool QDesignerWidgetDataBaseItemInterface::isCustom() const = 0 + + Returns true if the widget is a custom widget; otherwise return false if it is a standard + Qt widget. + + \sa setCustom() +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setCustom(bool custom) = 0 + + If \a custom is true, the widget is handled specially by \QD; otherwise it is handled as + a standard Qt widget. + + \sa isCustom() +*/ + +/*! + \fn virtual QString QDesignerWidgetDataBaseItemInterface::pluginPath() const = 0 + + Returns the path to use for the widget plugin. +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setPluginPath(const QString &path) = 0 +*/ + +/*! + \fn virtual bool QDesignerWidgetDataBaseItemInterface::isPromoted() const = 0 + + Returns true if the widget is promoted; otherwise returns false. + + Promoted widgets are those that represent custom widgets, but which are represented in + \QD by either standard Qt widgets or readily-available custom widgets. + + \sa setPromoted() +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setPromoted(bool promoted) = 0 + + If \a promoted is true, the widget is handled as a promoted widget by \QD and will use + a placeholder widget to represent it; otherwise it is handled as a standard widget. + + \sa isPromoted() +*/ + +/*! + \fn virtual QString QDesignerWidgetDataBaseItemInterface::extends() const = 0 + + Returns the name of the widget that the item extends. +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setExtends(const QString &s) = 0 +*/ + +/*! + \fn virtual void QDesignerWidgetDataBaseItemInterface::setDefaultPropertyValues(const QList<QVariant> &list) = 0 + + Sets the default property values for the widget to the given \a list. +*/ + +/*! + \fn virtual QList<QVariant> QDesignerWidgetDataBaseItemInterface::defaultPropertyValues() const = 0 + + Returns a list of default values to be used as properties for the item. +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractwidgetdatabase.h b/tools/designer/src/lib/sdk/abstractwidgetdatabase.h new file mode 100644 index 0000000..7c66710 --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractwidgetdatabase.h @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTWIDGETDATABASE_H +#define ABSTRACTWIDGETDATABASE_H + +#include <QtDesigner/sdk_global.h> + +#include <QtCore/QObject> +#include <QtCore/QList> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QIcon; +class QString; +class QDesignerFormEditorInterface; +class QDebug; + +class QDesignerWidgetDataBaseItemInterface +{ +public: + virtual ~QDesignerWidgetDataBaseItemInterface() {} + + virtual QString name() const = 0; + virtual void setName(const QString &name) = 0; + + virtual QString group() const = 0; + virtual void setGroup(const QString &group) = 0; + + virtual QString toolTip() const = 0; + virtual void setToolTip(const QString &toolTip) = 0; + + virtual QString whatsThis() const = 0; + virtual void setWhatsThis(const QString &whatsThis) = 0; + + virtual QString includeFile() const = 0; + virtual void setIncludeFile(const QString &includeFile) = 0; + + virtual QIcon icon() const = 0; + virtual void setIcon(const QIcon &icon) = 0; + + virtual bool isCompat() const = 0; + virtual void setCompat(bool compat) = 0; + + virtual bool isContainer() const = 0; + virtual void setContainer(bool container) = 0; + + virtual bool isCustom() const = 0; + virtual void setCustom(bool custom) = 0; + + virtual QString pluginPath() const = 0; + virtual void setPluginPath(const QString &path) = 0; + + virtual bool isPromoted() const = 0; + virtual void setPromoted(bool b) = 0; + + virtual QString extends() const = 0; + virtual void setExtends(const QString &s) = 0; + + virtual void setDefaultPropertyValues(const QList<QVariant> &list) = 0; + virtual QList<QVariant> defaultPropertyValues() const = 0; +}; + +class QDESIGNER_SDK_EXPORT QDesignerWidgetDataBaseInterface: public QObject +{ + Q_OBJECT +public: + QDesignerWidgetDataBaseInterface(QObject *parent = 0); + virtual ~QDesignerWidgetDataBaseInterface(); + + virtual int count() const; + virtual QDesignerWidgetDataBaseItemInterface *item(int index) const; + + virtual int indexOf(QDesignerWidgetDataBaseItemInterface *item) const; + virtual void insert(int index, QDesignerWidgetDataBaseItemInterface *item); + virtual void append(QDesignerWidgetDataBaseItemInterface *item); + + virtual int indexOfObject(QObject *object, bool resolveName = true) const; + virtual int indexOfClassName(const QString &className, bool resolveName = true) const; + + virtual QDesignerFormEditorInterface *core() const; + + bool isContainer(QObject *object, bool resolveName = true) const; + bool isCustom(QObject *object, bool resolveName = true) const; + +Q_SIGNALS: + void changed(); + +protected: + QList<QDesignerWidgetDataBaseItemInterface *> m_items; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTWIDGETDATABASE_H diff --git a/tools/designer/src/lib/sdk/abstractwidgetfactory.cpp b/tools/designer/src/lib/sdk/abstractwidgetfactory.cpp new file mode 100644 index 0000000..88d310e --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractwidgetfactory.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtDesigner/abstractwidgetfactory.h> +#include "abstractformeditor.h" +#include "abstractwidgetdatabase.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerWidgetFactoryInterface + \brief The QDesignerWidgetFactoryInterface class provides an interface that is used to control + the widget factory used by Qt Designer. + \inmodule QtDesigner + \internal +*/ + +/*! + \fn QDesignerWidgetFactoryInterface::QDesignerWidgetFactoryInterface(QObject *parent) + + Constructs an interface to a widget factory with the given \a parent. +*/ +QDesignerWidgetFactoryInterface::QDesignerWidgetFactoryInterface(QObject *parent) + : QObject(parent) +{ +} + +/*! + \fn virtual QDesignerWidgetFactoryInterface::~QDesignerWidgetFactoryInterface() +*/ +QDesignerWidgetFactoryInterface::~QDesignerWidgetFactoryInterface() +{ +} + +/*! + \fn virtual QDesignerFormEditorInterface *QDesignerWidgetFactoryInterface::core() const = 0 + + Returns the core form editor interface associated with this interface. +*/ + +/*! + \fn virtual QWidget* QDesignerWidgetFactoryInterface::containerOfWidget(QWidget *child) const = 0 + + Returns the widget that contains the specified \a child widget. +*/ + +/*! + \fn virtual QWidget* QDesignerWidgetFactoryInterface::widgetOfContainer(QWidget *container) const = 0 + + +*/ + +/*! + \fn virtual QWidget *QDesignerWidgetFactoryInterface::createWidget(const QString &name, QWidget *parent) const = 0 + + Returns a new widget with the given \a name and \a parent widget. If no parent is specified, + the widget created will be a top-level widget. +*/ + +/*! + \fn virtual QLayout *QDesignerWidgetFactoryInterface::createLayout(QWidget *widget, QLayout *layout, int type) const = 0 + + Returns a new layout of the specified \a type for the given \a widget or \a layout. +*/ + +/*! + \fn virtual bool QDesignerWidgetFactoryInterface::isPassiveInteractor(QWidget *widget) = 0 +*/ + +/*! + \fn virtual void QDesignerWidgetFactoryInterface::initialize(QObject *object) const = 0 +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/abstractwidgetfactory.h b/tools/designer/src/lib/sdk/abstractwidgetfactory.h new file mode 100644 index 0000000..e2d4cde --- /dev/null +++ b/tools/designer/src/lib/sdk/abstractwidgetfactory.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTWIDGETFACTORY_H +#define ABSTRACTWIDGETFACTORY_H + +#include <QtDesigner/sdk_global.h> +#include <QtCore/QObject> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDesignerFormEditorInterface; +class QWidget; +class QLayout; + +class QDESIGNER_SDK_EXPORT QDesignerWidgetFactoryInterface: public QObject +{ + Q_OBJECT +public: + QDesignerWidgetFactoryInterface(QObject *parent = 0); + virtual ~QDesignerWidgetFactoryInterface(); + + virtual QDesignerFormEditorInterface *core() const = 0; + + virtual QWidget* containerOfWidget(QWidget *w) const = 0; + virtual QWidget* widgetOfContainer(QWidget *w) const = 0; + + virtual QWidget *createWidget(const QString &name, QWidget *parentWidget = 0) const = 0; + virtual QLayout *createLayout(QWidget *widget, QLayout *layout, int type) const = 0; + + virtual bool isPassiveInteractor(QWidget *widget) = 0; + virtual void initialize(QObject *object) const = 0; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // ABSTRACTWIDGETFACTORY_H diff --git a/tools/designer/src/lib/sdk/dynamicpropertysheet.h b/tools/designer/src/lib/sdk/dynamicpropertysheet.h new file mode 100644 index 0000000..fa5eb4b --- /dev/null +++ b/tools/designer/src/lib/sdk/dynamicpropertysheet.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt Designer. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#ifndef DYNAMICPROPERTYSHEET_H +#define DYNAMICPROPERTYSHEET_H + +#include <QtDesigner/extension.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QString; // FIXME: fool syncqt + +class QDesignerDynamicPropertySheetExtension +{ +public: + virtual ~QDesignerDynamicPropertySheetExtension() {} + + virtual bool dynamicPropertiesAllowed() const = 0; + virtual int addDynamicProperty(const QString &propertyName, const QVariant &value) = 0; + virtual bool removeDynamicProperty(int index) = 0; + virtual bool isDynamicProperty(int index) const = 0; + virtual bool canAddDynamicProperty(const QString &propertyName) const = 0; +}; +Q_DECLARE_EXTENSION_INTERFACE(QDesignerDynamicPropertySheetExtension, "com.trolltech.Qt.Designer.DynamicPropertySheet") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // DYNAMICPROPERTYSHEET_H diff --git a/tools/designer/src/lib/sdk/extrainfo.cpp b/tools/designer/src/lib/sdk/extrainfo.cpp new file mode 100644 index 0000000..ab57685 --- /dev/null +++ b/tools/designer/src/lib/sdk/extrainfo.cpp @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "extrainfo.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerExtraInfoExtension + \brief The QDesignerExtraInfoExtension class provides extra information about a widget in + Qt Designer. + \inmodule QtDesigner + \internal +*/ + +/*! + Returns the path to the working directory used by this extension.*/ +QString QDesignerExtraInfoExtension::workingDirectory() const +{ + return m_workingDirectory; +} + +/*! + Sets the path to the working directory used by the extension to \a workingDirectory.*/ +void QDesignerExtraInfoExtension::setWorkingDirectory(const QString &workingDirectory) +{ + m_workingDirectory = workingDirectory; +} + +/*! + \fn virtual QDesignerExtraInfoExtension::~QDesignerExtraInfoExtension() + + Destroys the extension. +*/ + +/*! + \fn virtual QDesignerFormEditorInterface *QDesignerExtraInfoExtension::core() const = 0 + + \omit + ### Description required + \endomit +*/ + +/*! + \fn virtual QWidget *QDesignerExtraInfoExtension::widget() const = 0 + + Returns the widget described by this extension. +*/ + +/*! + \fn virtual bool QDesignerExtraInfoExtension::saveUiExtraInfo(DomUI *ui) = 0 + + Saves the information about the user interface specified by \a ui, and returns true if + successful; otherwise returns false. +*/ + +/*! + \fn virtual bool QDesignerExtraInfoExtension::loadUiExtraInfo(DomUI *ui) = 0 + + Loads extra information about the user interface specified by \a ui, and returns true if + successful; otherwise returns false. +*/ + +/*! + \fn virtual bool QDesignerExtraInfoExtension::saveWidgetExtraInfo(DomWidget *widget) = 0 + + Saves the information about the specified \a widget, and returns true if successful; + otherwise returns false. +*/ + +/*! + \fn virtual bool QDesignerExtraInfoExtension::loadWidgetExtraInfo(DomWidget *widget) = 0 + + Loads extra information about the specified \a widget, and returns true if successful; + otherwise returns false. +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/extrainfo.h b/tools/designer/src/lib/sdk/extrainfo.h new file mode 100644 index 0000000..910dedb --- /dev/null +++ b/tools/designer/src/lib/sdk/extrainfo.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef EXTRAINFO_H +#define EXTRAINFO_H + +#include <QtDesigner/sdk_global.h> +#include <QtDesigner/extension.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class DomWidget; +class DomUI; +class QWidget; + +class QDesignerFormEditorInterface; + +class QDESIGNER_SDK_EXPORT QDesignerExtraInfoExtension +{ +public: + virtual ~QDesignerExtraInfoExtension() {} + + virtual QDesignerFormEditorInterface *core() const = 0; + virtual QWidget *widget() const = 0; + + virtual bool saveUiExtraInfo(DomUI *ui) = 0; + virtual bool loadUiExtraInfo(DomUI *ui) = 0; + + virtual bool saveWidgetExtraInfo(DomWidget *ui_widget) = 0; + virtual bool loadWidgetExtraInfo(DomWidget *ui_widget) = 0; + + QString workingDirectory() const; + void setWorkingDirectory(const QString &workingDirectory); + +private: + QString m_workingDirectory; +}; +Q_DECLARE_EXTENSION_INTERFACE(QDesignerExtraInfoExtension, "com.trolltech.Qt.Designer.ExtraInfo.2") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // EXTRAINFO_H diff --git a/tools/designer/src/lib/sdk/layoutdecoration.h b/tools/designer/src/lib/sdk/layoutdecoration.h new file mode 100644 index 0000000..c99cae4 --- /dev/null +++ b/tools/designer/src/lib/sdk/layoutdecoration.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef LAYOUTDECORATION_H +#define LAYOUTDECORATION_H + +#include <QtDesigner/extension.h> + +#include <QtCore/QObject> +#include <QtCore/QPair> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QPoint; +class QLayoutItem; +class QWidget; +class QRect; +class QLayout; + +class QDesignerLayoutDecorationExtension +{ +public: + enum InsertMode + { + InsertWidgetMode, + InsertRowMode, + InsertColumnMode + }; + + virtual ~QDesignerLayoutDecorationExtension() {} + + virtual QList<QWidget*> widgets(QLayout *layout) const = 0; + + virtual QRect itemInfo(int index) const = 0; + virtual int indexOf(QWidget *widget) const = 0; + virtual int indexOf(QLayoutItem *item) const = 0; + + virtual InsertMode currentInsertMode() const = 0; + virtual int currentIndex() const = 0; + virtual QPair<int, int> currentCell() const = 0; + virtual void insertWidget(QWidget *widget, const QPair<int, int> &cell) = 0; + virtual void removeWidget(QWidget *widget) = 0; + + virtual void insertRow(int row) = 0; + virtual void insertColumn(int column) = 0; + virtual void simplify() = 0; + + virtual int findItemAt(const QPoint &pos) const = 0; + virtual int findItemAt(int row, int column) const = 0; // atm only for grid. + + virtual void adjustIndicator(const QPoint &pos, int index) = 0; +}; +Q_DECLARE_EXTENSION_INTERFACE(QDesignerLayoutDecorationExtension, "com.trolltech.Qt.Designer.LayoutDecoration") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // LAYOUTDECORATION_H diff --git a/tools/designer/src/lib/sdk/membersheet.h b/tools/designer/src/lib/sdk/membersheet.h new file mode 100644 index 0000000..14c4aba --- /dev/null +++ b/tools/designer/src/lib/sdk/membersheet.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MEMBERSHEET_H +#define MEMBERSHEET_H + +#include <QtDesigner/extension.h> + +#include <QtCore/QList> +#include <QtCore/QByteArray> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QString; // FIXME: fool syncqt + +class QDesignerMemberSheetExtension +{ +public: + virtual ~QDesignerMemberSheetExtension() {} + + virtual int count() const = 0; + + virtual int indexOf(const QString &name) const = 0; + + virtual QString memberName(int index) const = 0; + virtual QString memberGroup(int index) const = 0; + virtual void setMemberGroup(int index, const QString &group) = 0; + + virtual bool isVisible(int index) const = 0; + virtual void setVisible(int index, bool b) = 0; + + virtual bool isSignal(int index) const = 0; + virtual bool isSlot(int index) const = 0; + + virtual bool inheritedFromWidget(int index) const = 0; + + virtual QString declaredInClass(int index) const = 0; + + virtual QString signature(int index) const = 0; + virtual QList<QByteArray> parameterTypes(int index) const = 0; + virtual QList<QByteArray> parameterNames(int index) const = 0; +}; +Q_DECLARE_EXTENSION_INTERFACE(QDesignerMemberSheetExtension, "com.trolltech.Qt.Designer.MemberSheet") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // MEMBERSHEET_H diff --git a/tools/designer/src/lib/sdk/propertysheet.h b/tools/designer/src/lib/sdk/propertysheet.h new file mode 100644 index 0000000..1104f9e --- /dev/null +++ b/tools/designer/src/lib/sdk/propertysheet.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PROPERTYSHEET_H +#define PROPERTYSHEET_H + +#include <QtDesigner/extension.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QVariant; + +class QDesignerPropertySheetExtension +{ +public: + virtual ~QDesignerPropertySheetExtension() {} + + virtual int count() const = 0; + + virtual int indexOf(const QString &name) const = 0; + + virtual QString propertyName(int index) const = 0; + virtual QString propertyGroup(int index) const = 0; + virtual void setPropertyGroup(int index, const QString &group) = 0; + + virtual bool hasReset(int index) const = 0; + virtual bool reset(int index) = 0; + + virtual bool isVisible(int index) const = 0; + virtual void setVisible(int index, bool b) = 0; + + virtual bool isAttribute(int index) const = 0; + virtual void setAttribute(int index, bool b) = 0; + + virtual QVariant property(int index) const = 0; + virtual void setProperty(int index, const QVariant &value) = 0; + + virtual bool isChanged(int index) const = 0; + virtual void setChanged(int index, bool changed) = 0; + +}; + +Q_DECLARE_EXTENSION_INTERFACE(QDesignerPropertySheetExtension, + "com.trolltech.Qt.Designer.PropertySheet") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // PROPERTYSHEET_H diff --git a/tools/designer/src/lib/sdk/script.cpp b/tools/designer/src/lib/sdk/script.cpp new file mode 100644 index 0000000..cd34f2a --- /dev/null +++ b/tools/designer/src/lib/sdk/script.cpp @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "script_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QDesignerScriptExtension + \brief The QDesignerScriptExtension class allows you to generate a + per-widget \l{QtScript} {Qt Script} snippet to be executed while + building the form. + + \internal + \inmodule QtDesigner + \since 4.3 + + On saving the form, the extension is queried for a script snippet + to be associated with the widget while saving the \c .ui file. + This script is then run after creating the widget by \l uic or + QUiLoader. + + As opposed to \l QDesignerCustomWidgetInterface::codeTemplate(), + it allows for applying an internal state of the widget + that can be manipulated using \QD. + + Such a state might for example be the contents of a custom item view widget, + for which an editor is provided by the QDesignerTaskMenuExtension. + + While saving the form, the state is serialized as a QVariantMap of + \QD-supported properties, which is stored in the \c .ui file. This is + handled by data() and setData(). + + For item view contents, there might be for example a key that determines + the number of items and other keys that contain the actual items following + a naming scheme (\c numItems, \c item1, \c item2, ...). + + On saving, script() is invoked, which should return a script snippet that + applies the state to the widget while building the form. + + \sa {Creating Custom Widgets for Qt Designer#Using Qt Script to Aid in Building Forms}{Creating Custom Widgets for Qt Designer}, QtScript +*/ + +/*! + Destroys the extension. +*/ + +QDesignerScriptExtension::~QDesignerScriptExtension() +{ +} + +/*! + \fn virtual QString QDesignerScriptExtension::script() const + + Returns a script snippet to be associated with the widget. +*/ + +/*! + \fn virtual QVariantMap QDesignerScriptExtension::data() const + + Returns a map of variants describing the internal state to be + stored in the \c .ui file. +*/ + +/*! + \fn virtual void QDesignerScriptExtension::setData(const QVariantMap &data) + + Applies the internal state stored in \a data to the widget while loading a form. +*/ + +QT_END_NAMESPACE diff --git a/tools/designer/src/lib/sdk/script_p.h b/tools/designer/src/lib/sdk/script_p.h new file mode 100644 index 0000000..a93fbfa --- /dev/null +++ b/tools/designer/src/lib/sdk/script_p.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of Qt Designer. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#ifndef SCRIPT_H +#define SCRIPT_H + +#include <QtDesigner/sdk_global.h> +#include <QtDesigner/extension.h> +#include <QtCore/QVariant> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QString; // FIXME: fool syncqt + +class QDESIGNER_SDK_EXPORT QDesignerScriptExtension +{ +public: + virtual ~QDesignerScriptExtension(); + + virtual QVariantMap data() const = 0; + virtual void setData(const QVariantMap &data) = 0; + + virtual QString script() const = 0; + +}; +Q_DECLARE_EXTENSION_INTERFACE(QDesignerScriptExtension, "com.trolltech.Qt.Designer.Script") + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // SCRIPT_H diff --git a/tools/designer/src/lib/sdk/sdk.pri b/tools/designer/src/lib/sdk/sdk.pri new file mode 100644 index 0000000..bc46a1e --- /dev/null +++ b/tools/designer/src/lib/sdk/sdk.pri @@ -0,0 +1,58 @@ +# Input + +INCLUDEPATH += $$PWD + +HEADERS += $$PWD/abstractformeditor.h \ + $$PWD/abstractintrospection_p.h \ + $$PWD/abstractsettings_p.h \ + $$PWD/abstractformeditorplugin.h \ + $$PWD/abstractresourcebrowser.h \ + $$PWD/abstractintegration.h \ + $$PWD/abstractpropertyeditor.h \ + $$PWD/abstractformwindow.h \ + $$PWD/abstractformwindowtool.h \ + $$PWD/abstractformwindowcursor.h \ + $$PWD/abstractformwindowmanager.h \ + $$PWD/abstractwidgetdatabase.h \ + $$PWD/abstractmetadatabase.h \ + $$PWD/abstractwidgetfactory.h \ + $$PWD/abstractobjectinspector.h \ + $$PWD/abstractactioneditor.h \ + $$PWD/abstractbrushmanager.h \ + $$PWD/abstracticoncache.h \ + $$PWD/abstractlanguage.h \ + $$PWD/abstractoptionspage_p.h \ + $$PWD/propertysheet.h \ + $$PWD/dynamicpropertysheet.h \ + $$PWD/membersheet.h \ + $$PWD/taskmenu.h \ + $$PWD/extrainfo.h \ + $$PWD/abstractwidgetbox.h \ + $$PWD/layoutdecoration.h \ + $$PWD/abstractdnditem.h \ + $$PWD/abstractpromotioninterface.h \ + $$PWD/abstractdialoggui_p.h \ + $$PWD/script_p.h \ + $$PWD/abstractnewformwidget_p.h + +SOURCES += $$PWD/abstractformeditor.cpp \ + $$PWD/abstractintrospection.cpp \ + $$PWD/abstractformeditorplugin.cpp \ + $$PWD/abstractresourcebrowser.cpp \ + $$PWD/abstractintegration.cpp \ + $$PWD/abstractpropertyeditor.cpp \ + $$PWD/abstractformwindow.cpp \ + $$PWD/abstractformwindowtool.cpp \ + $$PWD/abstractformwindowcursor.cpp \ + $$PWD/abstractformwindowmanager.cpp \ + $$PWD/abstractwidgetdatabase.cpp \ + $$PWD/abstractmetadatabase.cpp \ + $$PWD/abstractwidgetfactory.cpp \ + $$PWD/abstractobjectinspector.cpp \ + $$PWD/abstractactioneditor.cpp \ + $$PWD/abstractwidgetbox.cpp \ + $$PWD/extrainfo.cpp \ + $$PWD/abstractpromotioninterface.cpp \ + $$PWD/abstractdialoggui.cpp \ + $$PWD/script.cpp \ + $$PWD/abstractnewformwidget.cpp diff --git a/tools/designer/src/lib/sdk/sdk_global.h b/tools/designer/src/lib/sdk/sdk_global.h new file mode 100644 index 0000000..679870a --- /dev/null +++ b/tools/designer/src/lib/sdk/sdk_global.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SDK_GLOBAL_H +#define SDK_GLOBAL_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +#define QDESIGNER_SDK_EXTERN Q_DECL_EXPORT +#define QDESIGNER_SDK_IMPORT Q_DECL_IMPORT + +#ifdef QT_DESIGNER_STATIC +# define QDESIGNER_SDK_EXPORT +#elif defined(QDESIGNER_SDK_LIBRARY) +# define QDESIGNER_SDK_EXPORT QDESIGNER_SDK_EXTERN +#else +# define QDESIGNER_SDK_EXPORT QDESIGNER_SDK_IMPORT +#endif + +QT_END_NAMESPACE +QT_END_HEADER + +#endif // SDK_GLOBAL_H diff --git a/tools/designer/src/lib/sdk/taskmenu.h b/tools/designer/src/lib/sdk/taskmenu.h new file mode 100644 index 0000000..930fef6 --- /dev/null +++ b/tools/designer/src/lib/sdk/taskmenu.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the Qt Designer of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TASKMENU_H +#define TASKMENU_H + +#include <QtDesigner/extension.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QAction; + +class QDesignerTaskMenuExtension +{ +public: + virtual ~QDesignerTaskMenuExtension() {} + + virtual QAction *preferredEditAction() const; + + virtual QList<QAction*> taskActions() const = 0; +}; +Q_DECLARE_EXTENSION_INTERFACE(QDesignerTaskMenuExtension, "com.trolltech.Qt.Designer.TaskMenu") + + +inline QAction *QDesignerTaskMenuExtension::preferredEditAction() const +{ return 0; } + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // TASKMENU_H |