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/plugins/widgets | |
download | Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2 |
Long live Qt 4.5!
Diffstat (limited to 'tools/designer/src/plugins/widgets')
42 files changed, 5545 insertions, 0 deletions
diff --git a/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.cpp b/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.cpp new file mode 100644 index 0000000..3f0b0b5 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.cpp @@ -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$ +** +****************************************************************************/ + +#include "q3iconview_extrainfo.h" + +#include <QtDesigner/QDesignerIconCacheInterface> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/private/ui4_p.h> + +#include <Qt3Support/Q3IconView> + +QT_BEGIN_NAMESPACE + +inline QHash<QString, DomProperty *> propertyMap(const QList<DomProperty *> &properties) // ### remove me +{ + QHash<QString, DomProperty *> map; + + for (int i=0; i<properties.size(); ++i) { + DomProperty *p = properties.at(i); + map.insert(p->attributeName(), p); + } + + return map; +} + +Q3IconViewExtraInfo::Q3IconViewExtraInfo(Q3IconView *widget, QDesignerFormEditorInterface *core, QObject *parent) + : QObject(parent), m_widget(widget), m_core(core) +{} + +QWidget *Q3IconViewExtraInfo::widget() const +{ return m_widget; } + +QDesignerFormEditorInterface *Q3IconViewExtraInfo::core() const +{ return m_core; } + +bool Q3IconViewExtraInfo::saveUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + +bool Q3IconViewExtraInfo::loadUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + + +bool Q3IconViewExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget) +{ + // ### finish me + Q3IconView *iconView = qobject_cast<Q3IconView*>(widget()); + Q_ASSERT(iconView != 0); + + QList<DomItem*> ui_items; + + Q3IconViewItem *__item = iconView->firstItem(); + while (__item != 0) { + DomItem *ui_item = new DomItem(); + + QList<DomProperty*> properties; + + // text property + DomProperty *ptext = new DomProperty(); + DomString *str = new DomString(); + str->setText(__item->text()); + ptext->setAttributeName(QLatin1String("text")); + ptext->setElementString(str); + properties.append(ptext); + + ui_item->setElementProperty(properties); + ui_items.append(ui_item); + + if (__item->pixmap() != 0 && core()->iconCache()) { + QPixmap pix = *__item->pixmap(); + QString filePath = core()->iconCache()->pixmapToFilePath(pix); + QString qrcPath = core()->iconCache()->pixmapToQrcPath(pix); + DomResourcePixmap *ui_pix = new DomResourcePixmap(); + if (!qrcPath.isEmpty()) + ui_pix->setAttributeResource(qrcPath); + ui_pix->setText(filePath); + + DomProperty *ppix = new DomProperty(); + ppix->setAttributeName(QLatin1String("pixmap")); + ppix->setElementPixmap(ui_pix); + properties.append(ppix); + } + + __item = __item->nextItem(); + } + + ui_widget->setElementItem(ui_items); + + return true; +} + +bool Q3IconViewExtraInfo::loadWidgetExtraInfo(DomWidget *ui_widget) +{ + Q3IconView *iconView = qobject_cast<Q3IconView*>(widget()); + Q_ASSERT(iconView != 0); + Q_UNUSED(iconView); + + if (ui_widget->elementItem().size()) { + initializeQ3IconViewItems(ui_widget->elementItem()); + } + + return true; +} + +void Q3IconViewExtraInfo::initializeQ3IconViewItems(const QList<DomItem *> &items) +{ + Q3IconView *iconView = qobject_cast<Q3IconView*>(widget()); + Q_ASSERT(iconView != 0); + + for (int i=0; i<items.size(); ++i) { + DomItem *item = items.at(i); + + Q3IconViewItem *__item = new Q3IconViewItem(iconView); + + QList<DomProperty*> properties = item->elementProperty(); + for (int i=0; i<properties.size(); ++i) { + DomProperty *p = properties.at(i); + if (p->attributeName() == QLatin1String("text")) + __item->setText(p->elementString()->text()); + + if (p->attributeName() == QLatin1String("pixmap")) { + DomResourcePixmap *pix = p->elementPixmap(); + QPixmap pixmap(core()->iconCache()->resolveQrcPath(pix->text(), pix->attributeResource(), workingDirectory())); + __item->setPixmap(pixmap); + } + } + } +} + + +Q3IconViewExtraInfoFactory::Q3IconViewExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent) + : QExtensionFactory(parent), m_core(core) +{} + +QObject *Q3IconViewExtraInfoFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerExtraInfoExtension)) + return 0; + + if (Q3IconView *w = qobject_cast<Q3IconView*>(object)) + return new Q3IconViewExtraInfo(w, m_core, parent); + + return 0; +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.h b/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.h new file mode 100644 index 0000000..bd07bf6 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3iconview/q3iconview_extrainfo.h @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** 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 Q3ICONVIEW_EXTRAINFO_H +#define Q3ICONVIEW_EXTRAINFO_H + +#include <QtDesigner/QDesignerExtraInfoExtension> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/QExtensionFactory> + +#include <QtCore/QPointer> + +QT_BEGIN_NAMESPACE + +class Q3IconView; +class Q3IconViewItem; +class DomItem; + +class Q3IconViewExtraInfo: public QObject, public QDesignerExtraInfoExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerExtraInfoExtension) +public: + Q3IconViewExtraInfo(Q3IconView *widget, QDesignerFormEditorInterface *core, QObject *parent); + + virtual QWidget *widget() const; + virtual QDesignerFormEditorInterface *core() const; + + virtual bool saveUiExtraInfo(DomUI *ui); + virtual bool loadUiExtraInfo(DomUI *ui); + + virtual bool saveWidgetExtraInfo(DomWidget *ui_widget); + virtual bool loadWidgetExtraInfo(DomWidget *ui_widget); + + void initializeQ3IconViewItems(const QList<DomItem *> &items); + +private: + QPointer<Q3IconView> m_widget; + QPointer<QDesignerFormEditorInterface> m_core; +}; + +class Q3IconViewExtraInfoFactory: public QExtensionFactory +{ + Q_OBJECT +public: + Q3IconViewExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + +protected: + virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; + +private: + QDesignerFormEditorInterface *m_core; +}; + +QT_END_NAMESPACE + +#endif // Q3ICONVIEW_EXTRAINFO_H diff --git a/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.cpp b/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.cpp new file mode 100644 index 0000000..6d85326 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.cpp @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** 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 "q3iconview_plugin.h" +#include "q3iconview_extrainfo.h" + +#include <QtDesigner/QExtensionFactory> +#include <QtDesigner/QExtensionManager> + +#include <QtCore/qplugin.h> +#include <QtGui/QIcon> +#include <Qt3Support/Q3IconView> + +QT_BEGIN_NAMESPACE + +Q3IconViewPlugin::Q3IconViewPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3IconViewPlugin::name() const +{ return QLatin1String("Q3IconView"); } + +QString Q3IconViewPlugin::group() const +{ return QLatin1String("Qt 3 Support"); } + +QString Q3IconViewPlugin::toolTip() const +{ return QString(); } + +QString Q3IconViewPlugin::whatsThis() const +{ return QString(); } + +QString Q3IconViewPlugin::includeFile() const +{ return QLatin1String("q3iconview.h"); } + +QIcon Q3IconViewPlugin::icon() const +{ return m_icon; } + +bool Q3IconViewPlugin::isContainer() const +{ return false; } + +QWidget *Q3IconViewPlugin::createWidget(QWidget *parent) +{ return new Q3IconView(parent); } + +bool Q3IconViewPlugin::isInitialized() const +{ return m_initialized; } + +void Q3IconViewPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + + if (m_initialized) + return; + + QExtensionManager *mgr = core->extensionManager(); + Q_ASSERT(mgr != 0); + + mgr->registerExtensions(new Q3IconViewExtraInfoFactory(core, mgr), Q_TYPEID(QDesignerExtraInfoExtension)); + + m_initialized = true; +} + +QString Q3IconViewPlugin::codeTemplate() const +{ return QString(); } + +QString Q3IconViewPlugin::domXml() const +{ return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3IconView\" name=\"iconView\">\ + <property name=\"geometry\">\ + <rect>\ + <x>0</x>\ + <y>0</y>\ + <width>100</width>\ + <height>80</height>\ + </rect>\ + </property>\ + </widget>\ +</ui>"); +} + + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.h b/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.h new file mode 100644 index 0000000..982bbf3 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3iconview/q3iconview_plugin.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 Q3ICONVIEW_PLUGIN_H +#define Q3ICONVIEW_PLUGIN_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class Q3IconViewPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3IconViewPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString codeTemplate() const; + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +QT_END_NAMESPACE + +#endif // Q3ICONVIEW_PLUGIN_H diff --git a/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.cpp b/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.cpp new file mode 100644 index 0000000..36a6fc1 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.cpp @@ -0,0 +1,151 @@ +/**************************************************************************** +** +** 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 "q3listbox_extrainfo.h" + +#include <QtDesigner/QDesignerIconCacheInterface> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/private/ui4_p.h> + +#include <Qt3Support/Q3ListBox> + +QT_BEGIN_NAMESPACE + +inline QHash<QString, DomProperty *> propertyMap(const QList<DomProperty *> &properties) // ### remove me +{ + QHash<QString, DomProperty *> map; + + for (int i=0; i<properties.size(); ++i) { + DomProperty *p = properties.at(i); + map.insert(p->attributeName(), p); + } + + return map; +} + +Q3ListBoxExtraInfo::Q3ListBoxExtraInfo(Q3ListBox *widget, QDesignerFormEditorInterface *core, QObject *parent) + : QObject(parent), m_widget(widget), m_core(core) +{} + +QWidget *Q3ListBoxExtraInfo::widget() const +{ return m_widget; } + +QDesignerFormEditorInterface *Q3ListBoxExtraInfo::core() const +{ return m_core; } + +bool Q3ListBoxExtraInfo::saveUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + +bool Q3ListBoxExtraInfo::loadUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + + +bool Q3ListBoxExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget) +{ + Q3ListBox *listBox = qobject_cast<Q3ListBox*>(widget()); + Q_ASSERT(listBox != 0); + + QList<DomItem *> items; + const int childCount = listBox->count(); + for (int i = 0; i < childCount; ++i) { + DomItem *item = new DomItem(); + + QList<DomProperty*> properties; + + DomString *str = new DomString(); + str->setText(listBox->text(i)); + + DomProperty *ptext = new DomProperty(); + ptext->setAttributeName(QLatin1String("text")); + ptext->setElementString(str); + + properties.append(ptext); + item->setElementProperty(properties); + items.append(item); + } + ui_widget->setElementItem(items); + + return true; +} + +bool Q3ListBoxExtraInfo::loadWidgetExtraInfo(DomWidget *ui_widget) +{ + Q3ListBox *listBox = qobject_cast<Q3ListBox*>(widget()); + Q_ASSERT(listBox != 0); + + QList<DomItem *> items = ui_widget->elementItem(); + for (int i = 0; i < items.size(); ++i) { + DomItem *item = items.at(i); + + QHash<QString, DomProperty*> properties = propertyMap(item->elementProperty()); + DomProperty *text = properties.value(QLatin1String("text")); + DomProperty *pixmap = properties.value(QLatin1String("pixmap")); + + QString txt = text->elementString()->text(); + + if (pixmap != 0) { + DomResourcePixmap *pix = pixmap->elementPixmap(); + QPixmap pixmap(core()->iconCache()->resolveQrcPath(pix->text(), pix->attributeResource(), workingDirectory())); + listBox->insertItem(pixmap, txt); + } else { + listBox->insertItem(txt); + } + } + + return true; +} + +Q3ListBoxExtraInfoFactory::Q3ListBoxExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent) + : QExtensionFactory(parent), m_core(core) +{} + +QObject *Q3ListBoxExtraInfoFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerExtraInfoExtension)) + return 0; + + if (Q3ListBox *w = qobject_cast<Q3ListBox*>(object)) + return new Q3ListBoxExtraInfo(w, m_core, parent); + + return 0; +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.h b/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.h new file mode 100644 index 0000000..ddfa83f --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3listbox/q3listbox_extrainfo.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** 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 Q3LISTBOX_EXTRAINFO_H +#define Q3LISTBOX_EXTRAINFO_H + +#include <QtDesigner/QDesignerExtraInfoExtension> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/QExtensionFactory> + +#include <QtCore/QPointer> + +QT_BEGIN_NAMESPACE + +class Q3ListBox; +class Q3ListBoxItem; +class DomItem; + +class Q3ListBoxExtraInfo: public QObject, public QDesignerExtraInfoExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerExtraInfoExtension) +public: + Q3ListBoxExtraInfo(Q3ListBox *widget, QDesignerFormEditorInterface *core, QObject *parent); + + virtual QWidget *widget() const; + virtual QDesignerFormEditorInterface *core() const; + + virtual bool saveUiExtraInfo(DomUI *ui); + virtual bool loadUiExtraInfo(DomUI *ui); + + virtual bool saveWidgetExtraInfo(DomWidget *ui_widget); + virtual bool loadWidgetExtraInfo(DomWidget *ui_widget); + +private: + QPointer<Q3ListBox> m_widget; + QPointer<QDesignerFormEditorInterface> m_core; +}; + +class Q3ListBoxExtraInfoFactory: public QExtensionFactory +{ + Q_OBJECT +public: + Q3ListBoxExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + +protected: + virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; + +private: + QDesignerFormEditorInterface *m_core; +}; + +QT_END_NAMESPACE + +#endif // Q3LISTBOX_EXTRAINFO_H diff --git a/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.cpp b/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.cpp new file mode 100644 index 0000000..ab383f5 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.cpp @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** 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 "q3listbox_plugin.h" +#include "q3listbox_extrainfo.h" + +#include <QtDesigner/QExtensionFactory> +#include <QtDesigner/QExtensionManager> + +#include <QtCore/qplugin.h> +#include <QtGui/QIcon> +#include <Qt3Support/Q3ListBox> + +QT_BEGIN_NAMESPACE + +Q3ListBoxPlugin::Q3ListBoxPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3ListBoxPlugin::name() const +{ return QLatin1String("Q3ListBox"); } + +QString Q3ListBoxPlugin::group() const +{ return QLatin1String("Qt 3 Support"); } + +QString Q3ListBoxPlugin::toolTip() const +{ return QString(); } + +QString Q3ListBoxPlugin::whatsThis() const +{ return QString(); } + +QString Q3ListBoxPlugin::includeFile() const +{ return QLatin1String("q3listbox.h"); } + +QIcon Q3ListBoxPlugin::icon() const +{ return m_icon; } + +bool Q3ListBoxPlugin::isContainer() const +{ return false; } + +QWidget *Q3ListBoxPlugin::createWidget(QWidget *parent) +{ return new Q3ListBox(parent); } + +bool Q3ListBoxPlugin::isInitialized() const +{ return m_initialized; } + +void Q3ListBoxPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + + if (m_initialized) + return; + + QExtensionManager *mgr = core->extensionManager(); + Q_ASSERT(mgr != 0); + + mgr->registerExtensions(new Q3ListBoxExtraInfoFactory(core, mgr), Q_TYPEID(QDesignerExtraInfoExtension)); + + m_initialized = true; +} + +QString Q3ListBoxPlugin::codeTemplate() const +{ return QString(); } + +QString Q3ListBoxPlugin::domXml() const +{ return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3ListBox\" name=\"listBox\">\ + <property name=\"geometry\">\ + <rect>\ + <x>0</x>\ + <y>0</y>\ + <width>100</width>\ + <height>80</height>\ + </rect>\ + </property>\ + </widget>\ +</ui>"); +} + + + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.h b/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.h new file mode 100644 index 0000000..e48f898 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3listbox/q3listbox_plugin.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 Q3LISTBOX_PLUGIN_H +#define Q3LISTBOX_PLUGIN_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class Q3ListBoxPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3ListBoxPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString codeTemplate() const; + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +QT_END_NAMESPACE + +#endif // Q3LISTBOX_PLUGIN_H diff --git a/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.cpp b/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.cpp new file mode 100644 index 0000000..8ba507d --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.cpp @@ -0,0 +1,249 @@ +/**************************************************************************** +** +** 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 "q3listview_extrainfo.h" + +#include <QtDesigner/QDesignerIconCacheInterface> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/private/ui4_p.h> + +#include <Qt3Support/Q3ListView> +#include <Qt3Support/Q3Header> + +QT_BEGIN_NAMESPACE + +inline QHash<QString, DomProperty *> propertyMap(const QList<DomProperty *> &properties) // ### remove me +{ + QHash<QString, DomProperty *> map; + + for (int i=0; i<properties.size(); ++i) { + DomProperty *p = properties.at(i); + map.insert(p->attributeName(), p); + } + + return map; +} + +Q3ListViewExtraInfo::Q3ListViewExtraInfo(Q3ListView *widget, QDesignerFormEditorInterface *core, QObject *parent) + : QObject(parent), m_widget(widget), m_core(core) +{} + +QWidget *Q3ListViewExtraInfo::widget() const +{ return m_widget; } + +QDesignerFormEditorInterface *Q3ListViewExtraInfo::core() const +{ return m_core; } + +bool Q3ListViewExtraInfo::saveUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + +bool Q3ListViewExtraInfo::loadUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + + +bool Q3ListViewExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget) +{ + // ### finish me + Q3ListView *listView = qobject_cast<Q3ListView*>(widget()); + Q_ASSERT(listView != 0); + + QList<DomColumn*> columns; + Q3Header *header = listView->header(); + for (int i=0; i<header->count(); ++i) { + DomColumn *c = new DomColumn(); + + QList<DomProperty*> properties; + + DomString *str = new DomString(); + str->setText(header->label(i)); + + DomProperty *ptext = new DomProperty(); + ptext->setAttributeName(QLatin1String("text")); + ptext->setElementString(str); + + DomProperty *pclickable = new DomProperty(); + pclickable->setAttributeName(QLatin1String("clickable")); + pclickable->setElementBool(header->isClickEnabled(i) ? QLatin1String("true") : QLatin1String("false")); + + DomProperty *presizable = new DomProperty(); + presizable->setAttributeName(QLatin1String("resizable")); + presizable->setElementBool(header->isResizeEnabled(i) ? QLatin1String("true") : QLatin1String("false")); + + properties.append(ptext); + properties.append(pclickable); + properties.append(presizable); + + c->setElementProperty(properties); + columns.append(c); + } + + ui_widget->setElementColumn(columns); + + QList<DomItem *> items; + Q3ListViewItem *child = listView->firstChild(); + while (child) { + items.append(saveQ3ListViewItem(child)); + child = child->nextSibling(); + } + ui_widget->setElementItem(items); + + + return true; +} + +bool Q3ListViewExtraInfo::loadWidgetExtraInfo(DomWidget *ui_widget) +{ + Q3ListView *listView = qobject_cast<Q3ListView*>(widget()); + Q_ASSERT(listView != 0); + + Q3Header *header = listView->header(); + + QList<DomColumn*> columns = ui_widget->elementColumn(); + for (int i=0; i<columns.size(); ++i) { + DomColumn *column = columns.at(i); + + QHash<QString, DomProperty*> properties = propertyMap(column->elementProperty()); + DomProperty *text = properties.value(QLatin1String("text")); + DomProperty *pixmap = properties.value(QLatin1String("pixmap")); + DomProperty *clickable = properties.value(QLatin1String("clickable")); + DomProperty *resizable = properties.value(QLatin1String("resizable")); + + QString txt = text->elementString()->text(); + + if (pixmap != 0) { + DomResourcePixmap *pix = pixmap->elementPixmap(); + QIcon icon(core()->iconCache()->resolveQrcPath(pix->text(), pix->attributeResource(), workingDirectory())); + listView->addColumn(icon, txt); + } else { + listView->addColumn(txt); + } + + if (clickable != 0) { + header->setClickEnabled(clickable->elementBool() == QLatin1String("true"), header->count() - 1); + } + + if (resizable != 0) { + header->setResizeEnabled(resizable->elementBool() == QLatin1String("true"), header->count() - 1); + } + } + + if (ui_widget->elementItem().size()) { + initializeQ3ListViewItems(ui_widget->elementItem()); + } + + return true; +} + +DomItem *Q3ListViewExtraInfo::saveQ3ListViewItem(Q3ListViewItem *item) const +{ + DomItem *pitem = new DomItem(); + QList<DomProperty *> properties; + const int columnCount = static_cast<Q3ListView*>(widget())->columns(); + for (int i = 0; i < columnCount; ++i) { + DomString *str = new DomString(); + str->setText(item->text(i)); + + DomProperty *ptext = new DomProperty(); + ptext->setAttributeName(QLatin1String("text")); + ptext->setElementString(str); + + properties.append(ptext); + } + pitem->setElementProperty(properties); + QList<DomItem *> items; + Q3ListViewItem *child = item->firstChild(); + while (child) { + items.append(saveQ3ListViewItem(child)); + child = child->nextSibling(); + } + pitem->setElementItem(items); + return pitem; +} + +void Q3ListViewExtraInfo::initializeQ3ListViewItems(const QList<DomItem *> &items, Q3ListViewItem *parentItem) +{ + for (int i=0; i<items.size(); ++i) { + DomItem *item = items.at(i); + + Q3ListViewItem *__item = 0; + if (parentItem != 0) + __item = new Q3ListViewItem(parentItem); + else + __item = new Q3ListViewItem(static_cast<Q3ListView*>(widget())); + + int textCount = 0, pixCount = 0; + QList<DomProperty*> properties = item->elementProperty(); + for (int i=0; i<properties.size(); ++i) { + DomProperty *p = properties.at(i); + if (p->attributeName() == QLatin1String("text")) + __item->setText(textCount++, p->elementString()->text()); + + if (p->attributeName() == QLatin1String("pixmap")) { + DomResourcePixmap *pix = p->elementPixmap(); + QPixmap pixmap(core()->iconCache()->resolveQrcPath(pix->text(), pix->attributeResource(), workingDirectory())); + __item->setPixmap(pixCount++, pixmap); + } + } + + if (item->elementItem().size()) { + __item->setOpen(true); + initializeQ3ListViewItems(item->elementItem(), __item); + } + } +} + + +Q3ListViewExtraInfoFactory::Q3ListViewExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent) + : QExtensionFactory(parent), m_core(core) +{} + +QObject *Q3ListViewExtraInfoFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerExtraInfoExtension)) + return 0; + + if (Q3ListView *w = qobject_cast<Q3ListView*>(object)) + return new Q3ListViewExtraInfo(w, m_core, parent); + + return 0; +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.h b/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.h new file mode 100644 index 0000000..15fb0dc --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3listview/q3listview_extrainfo.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** 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 Q3LISTVIEW_EXTRAINFO_H +#define Q3LISTVIEW_EXTRAINFO_H + +#include <QtDesigner/QDesignerExtraInfoExtension> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/QExtensionFactory> + +#include <QtCore/QPointer> + +QT_BEGIN_NAMESPACE + +class Q3ListView; +class Q3ListViewItem; +class DomItem; + +class Q3ListViewExtraInfo: public QObject, public QDesignerExtraInfoExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerExtraInfoExtension) +public: + Q3ListViewExtraInfo(Q3ListView *widget, QDesignerFormEditorInterface *core, QObject *parent); + + virtual QWidget *widget() const; + virtual QDesignerFormEditorInterface *core() const; + + virtual bool saveUiExtraInfo(DomUI *ui); + virtual bool loadUiExtraInfo(DomUI *ui); + + virtual bool saveWidgetExtraInfo(DomWidget *ui_widget); + virtual bool loadWidgetExtraInfo(DomWidget *ui_widget); + + DomItem *saveQ3ListViewItem(Q3ListViewItem *item) const; + void initializeQ3ListViewItems(const QList<DomItem *> &items, Q3ListViewItem *parentItem = 0); + +private: + QPointer<Q3ListView> m_widget; + QPointer<QDesignerFormEditorInterface> m_core; +}; + +class Q3ListViewExtraInfoFactory: public QExtensionFactory +{ + Q_OBJECT +public: + Q3ListViewExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + +protected: + virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; + +private: + QDesignerFormEditorInterface *m_core; +}; + +QT_END_NAMESPACE + +#endif // Q3LISTVIEW_EXTRAINFO_H diff --git a/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.cpp b/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.cpp new file mode 100644 index 0000000..16e4179 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.cpp @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** 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 "q3listview_plugin.h" +#include "q3listview_extrainfo.h" + +#include <QtDesigner/QExtensionFactory> +#include <QtDesigner/QExtensionManager> + +#include <QtCore/qplugin.h> +#include <QtGui/QIcon> +#include <Qt3Support/Q3ListView> + +QT_BEGIN_NAMESPACE + +Q3ListViewPlugin::Q3ListViewPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3ListViewPlugin::name() const +{ return QLatin1String("Q3ListView"); } + +QString Q3ListViewPlugin::group() const +{ return QLatin1String("Qt 3 Support"); } + +QString Q3ListViewPlugin::toolTip() const +{ return QString(); } + +QString Q3ListViewPlugin::whatsThis() const +{ return QString(); } + +QString Q3ListViewPlugin::includeFile() const +{ return QLatin1String("q3listview.h"); } + +QIcon Q3ListViewPlugin::icon() const +{ return m_icon; } + +bool Q3ListViewPlugin::isContainer() const +{ return false; } + +QWidget *Q3ListViewPlugin::createWidget(QWidget *parent) +{ return new Q3ListView(parent); } + +bool Q3ListViewPlugin::isInitialized() const +{ return m_initialized; } + +void Q3ListViewPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + + if (m_initialized) + return; + + QExtensionManager *mgr = core->extensionManager(); + Q_ASSERT(mgr != 0); + + mgr->registerExtensions(new Q3ListViewExtraInfoFactory(core, mgr), Q_TYPEID(QDesignerExtraInfoExtension)); + + m_initialized = true; +} + +QString Q3ListViewPlugin::codeTemplate() const +{ return QString(); } + +QString Q3ListViewPlugin::domXml() const +{ return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3ListView\" name=\"listView\">\ + <property name=\"geometry\">\ + <rect>\ + <x>0</x>\ + <y>0</y>\ + <width>100</width>\ + <height>80</height>\ + </rect>\ + </property>\ + </widget>\ +</ui>"); +} + + + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.h b/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.h new file mode 100644 index 0000000..85e35c6 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3listview/q3listview_plugin.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 Q3LISTVIEW_PLUGIN_H +#define Q3LISTVIEW_PLUGIN_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class Q3ListViewPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3ListViewPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString codeTemplate() const; + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +QT_END_NAMESPACE + +#endif // Q3LISTVIEW_PLUGIN_H diff --git a/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_container.cpp b/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_container.cpp new file mode 100644 index 0000000..f0bebd5 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_container.cpp @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** 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 "q3mainwindow_container.h" + +#include <Qt3Support/Q3MainWindow> + +#include <QtCore/qdebug.h> +#include <QtGui/QToolBar> +#include <QtGui/QMenuBar> +#include <QtGui/QStatusBar> + +#include <Qt3Support/Q3ToolBar> + +QT_BEGIN_NAMESPACE + +Q3MainWindowContainer::Q3MainWindowContainer(Q3MainWindow *widget, QObject *parent) + : QObject(parent), + m_mainWindow(widget) +{} + +int Q3MainWindowContainer::count() const +{ + return m_widgets.count(); +} + +QWidget *Q3MainWindowContainer::widget(int index) const +{ + if (index == -1) + return 0; + + return m_widgets.at(index); +} + +int Q3MainWindowContainer::currentIndex() const +{ + return m_mainWindow->centralWidget() ? 0 : -1; +} + +void Q3MainWindowContainer::setCurrentIndex(int index) +{ + Q_UNUSED(index); +} + +void Q3MainWindowContainer::addWidget(QWidget *widget) +{ + if (qobject_cast<QToolBar*>(widget)) { + m_widgets.append(widget); + } else if (qobject_cast<Q3ToolBar*>(widget)) { + m_widgets.append(widget); + } else if (qobject_cast<QMenuBar*>(widget)) { + (void) m_mainWindow->menuBar(); + m_widgets.append(widget); + } else if (qobject_cast<QStatusBar*>(widget)) { + (void) m_mainWindow->statusBar(); + m_widgets.append(widget); + } else { + Q_ASSERT(m_mainWindow->centralWidget() == 0); + widget->setParent(m_mainWindow); + m_mainWindow->setCentralWidget(widget); + m_widgets.prepend(widget); + } +} + +void Q3MainWindowContainer::insertWidget(int index, QWidget *widget) +{ + m_widgets.insert(index, widget); +} + +void Q3MainWindowContainer::remove(int index) +{ + m_widgets.removeAt(index); +} + +Q3MainWindowContainerFactory::Q3MainWindowContainerFactory(QExtensionManager *parent) + : QExtensionFactory(parent) +{ +} + +QObject *Q3MainWindowContainerFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerContainerExtension)) + return 0; + + if (Q3MainWindow *w = qobject_cast<Q3MainWindow*>(object)) + return new Q3MainWindowContainer(w, parent); + + return 0; +} + + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_container.h b/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_container.h new file mode 100644 index 0000000..ad44265 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_container.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 Q3MAINWINDOW_CONTAINER_H +#define Q3MAINWINDOW_CONTAINER_H + +#include <QtDesigner/QDesignerContainerExtension> +#include <QtDesigner/QExtensionFactory> + +QT_BEGIN_NAMESPACE + +class Q3MainWindow; + +class Q3MainWindowContainer: public QObject, public QDesignerContainerExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerContainerExtension) +public: + explicit Q3MainWindowContainer(Q3MainWindow *widget, QObject *parent = 0); + + virtual int count() const; + virtual QWidget *widget(int index) const; + virtual int currentIndex() const; + virtual void setCurrentIndex(int index); + virtual void addWidget(QWidget *widget); + virtual void insertWidget(int index, QWidget *widget); + virtual void remove(int index); + +private: + Q3MainWindow *m_mainWindow; + QList<QWidget*> m_widgets; +}; + +class Q3MainWindowContainerFactory: public QExtensionFactory +{ + Q_OBJECT +public: + explicit Q3MainWindowContainerFactory(QExtensionManager *parent = 0); + +protected: + virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; +}; + +QT_END_NAMESPACE + +#endif // Q3MAINWINDOW_CONTAINER_H diff --git a/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.cpp b/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.cpp new file mode 100644 index 0000000..dd21833 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** 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 "q3mainwindow_plugin.h" +#include "q3mainwindow_container.h" + +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/QExtensionManager> + +#include <QtCore/qplugin.h> +#include <Qt3Support/Q3MainWindow> + +QT_BEGIN_NAMESPACE + +Q3MainWindowPlugin::Q3MainWindowPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3MainWindowPlugin::name() const +{ return QLatin1String("Q3MainWindow"); } + +QString Q3MainWindowPlugin::group() const +{ return QLatin1String("[invisible]"); } + +QString Q3MainWindowPlugin::toolTip() const +{ return QString(); } + +QString Q3MainWindowPlugin::whatsThis() const +{ return QString(); } + +QString Q3MainWindowPlugin::includeFile() const +{ return QLatin1String("q3mainwindow.h"); } + +QIcon Q3MainWindowPlugin::icon() const +{ return m_icon; } + +bool Q3MainWindowPlugin::isContainer() const +{ return true; } + +QWidget *Q3MainWindowPlugin::createWidget(QWidget *parent) +{ return new Q3MainWindow(parent); } + +bool Q3MainWindowPlugin::isInitialized() const +{ return m_initialized; } + +void Q3MainWindowPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + + if (m_initialized) + return; + + m_initialized = true; + QExtensionManager *mgr = core->extensionManager(); + mgr->registerExtensions(new Q3MainWindowContainerFactory(mgr), Q_TYPEID(QDesignerContainerExtension)); +} + +QString Q3MainWindowPlugin::codeTemplate() const +{ return QString(); } + +QString Q3MainWindowPlugin::domXml() const +{ + return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3MainWindow\" name=\"mainWindow\">\ + <property name=\"geometry\">\ + <rect>\ + <x>0</x>\ + <y>0</y>\ + <width>100</width>\ + <height>80</height>\ + </rect>\ + </property>\ + <widget class=\"QWidget\" name=\"centralWidget\" />\ + </widget>\ +</ui>"); +} + + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.h b/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.h new file mode 100644 index 0000000..524506f --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3mainwindow/q3mainwindow_plugin.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 Q3MAINWINDOW_PLUGIN_H +#define Q3MAINWINDOW_PLUGIN_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class Q3MainWindowPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3MainWindowPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString codeTemplate() const; + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +QT_END_NAMESPACE + +#endif // Q3MAINWINDOW_PLUGIN_H diff --git a/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.cpp b/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.cpp new file mode 100644 index 0000000..8353466 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.cpp @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** 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 "q3table_extrainfo.h" + +#include <QtDesigner/QDesignerIconCacheInterface> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/private/ui4_p.h> + +#include <Qt3Support/Q3Table> + +QT_BEGIN_NAMESPACE + +inline QHash<QString, DomProperty *> propertyMap(const QList<DomProperty *> &properties) // ### remove me +{ + QHash<QString, DomProperty *> map; + + for (int i=0; i<properties.size(); ++i) { + DomProperty *p = properties.at(i); + map.insert(p->attributeName(), p); + } + + return map; +} + +Q3TableExtraInfo::Q3TableExtraInfo(Q3Table *widget, QDesignerFormEditorInterface *core, QObject *parent) + : QObject(parent), m_widget(widget), m_core(core) +{} + +QWidget *Q3TableExtraInfo::widget() const +{ return m_widget; } + +QDesignerFormEditorInterface *Q3TableExtraInfo::core() const +{ return m_core; } + +bool Q3TableExtraInfo::saveUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + +bool Q3TableExtraInfo::loadUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + + +bool Q3TableExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget) +{ + Q_UNUSED(ui_widget); + + Q3Table *table = qobject_cast<Q3Table*>(widget()); + Q_ASSERT(table != 0); + + Q3Header *hHeader = table->horizontalHeader(); + + QList<DomColumn*> columns; + for (int i=0; i<hHeader->count(); ++i) { + DomColumn *column = new DomColumn(); + QList<DomProperty *> properties; + + DomProperty *property = new DomProperty(); + DomString *string = new DomString(); + string->setText(hHeader->label(i)); + property->setElementString(string); + property->setAttributeName("text"); + properties.append(property); + + column->setElementProperty(properties); + columns.append(column); + } + ui_widget->setElementColumn(columns); + + Q3Header *vHeader = table->verticalHeader(); + + QList<DomRow*> rows; + for (int i=0; i<vHeader->count(); ++i) { + DomRow *row = new DomRow(); + QList<DomProperty *> properties; + + DomProperty *property = new DomProperty(); + DomString *string = new DomString(); + string->setText(vHeader->label(i)); + property->setElementString(string); + property->setAttributeName("text"); + properties.append(property); + + row->setElementProperty(properties); + rows.append(row); + } + ui_widget->setElementRow(rows); + + return true; +} + +bool Q3TableExtraInfo::loadWidgetExtraInfo(DomWidget *ui_widget) +{ + Q_UNUSED(ui_widget); + + Q3Table *table = qobject_cast<Q3Table*>(widget()); + Q_ASSERT(table != 0); + + Q3Header *hHeader = table->horizontalHeader(); + + QList<DomColumn*> columns = ui_widget->elementColumn(); + for (int i=0; i<columns.size(); ++i) { + DomColumn *column = columns.at(i); + + QHash<QString, DomProperty*> properties = propertyMap(column->elementProperty()); + DomProperty *text = properties.value(QLatin1String("text")); + DomProperty *pixmap = properties.value(QLatin1String("pixmap")); + + QString txt = text->elementString()->text(); + + if (pixmap != 0) { + DomResourcePixmap *pix = pixmap->elementPixmap(); + QIcon icon(core()->iconCache()->resolveQrcPath(pix->text(), pix->attributeResource(), workingDirectory())); + hHeader->setLabel(i, icon, txt); + } else { + hHeader->setLabel(i, txt); + } + } + + Q3Header *vHeader = table->verticalHeader(); + + QList<DomRow*> rows = ui_widget->elementRow(); + for (int i=0; i<rows.size(); ++i) { + DomRow *row = rows.at(i); + + QHash<QString, DomProperty*> properties = propertyMap(row->elementProperty()); + DomProperty *text = properties.value(QLatin1String("text")); + DomProperty *pixmap = properties.value(QLatin1String("pixmap")); + + QString txt = text->elementString()->text(); + + if (pixmap != 0) { + DomResourcePixmap *pix = pixmap->elementPixmap(); + QIcon icon(core()->iconCache()->resolveQrcPath(pix->text(), pix->attributeResource(), workingDirectory())); + vHeader->setLabel(i, icon, txt); + } else { + vHeader->setLabel(i, txt); + } + } + + return true; +} + +Q3TableExtraInfoFactory::Q3TableExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent) + : QExtensionFactory(parent), m_core(core) +{} + +QObject *Q3TableExtraInfoFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerExtraInfoExtension)) + return 0; + + if (Q3Table *w = qobject_cast<Q3Table*>(object)) + return new Q3TableExtraInfo(w, m_core, parent); + + return 0; +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.h b/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.h new file mode 100644 index 0000000..6dc7a30 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3table/q3table_extrainfo.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** 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 Q3TABLE_EXTRAINFO_H +#define Q3TABLE_EXTRAINFO_H + +#include <QtDesigner/QDesignerExtraInfoExtension> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/QExtensionFactory> + +#include <QtCore/QPointer> + +QT_BEGIN_NAMESPACE + +class Q3Table; +class Q3TableItem; +class DomItem; + +class Q3TableExtraInfo: public QObject, public QDesignerExtraInfoExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerExtraInfoExtension) +public: + Q3TableExtraInfo(Q3Table *widget, QDesignerFormEditorInterface *core, QObject *parent); + + virtual QWidget *widget() const; + virtual QDesignerFormEditorInterface *core() const; + + virtual bool saveUiExtraInfo(DomUI *ui); + virtual bool loadUiExtraInfo(DomUI *ui); + + virtual bool saveWidgetExtraInfo(DomWidget *ui_widget); + virtual bool loadWidgetExtraInfo(DomWidget *ui_widget); + +private: + QPointer<Q3Table> m_widget; + QPointer<QDesignerFormEditorInterface> m_core; +}; + +class Q3TableExtraInfoFactory: public QExtensionFactory +{ + Q_OBJECT +public: + Q3TableExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + +protected: + virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; + +private: + QDesignerFormEditorInterface *m_core; +}; + +QT_END_NAMESPACE + +#endif // Q3TABLE_EXTRAINFO_H diff --git a/tools/designer/src/plugins/widgets/q3table/q3table_plugin.cpp b/tools/designer/src/plugins/widgets/q3table/q3table_plugin.cpp new file mode 100644 index 0000000..142a15b --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3table/q3table_plugin.cpp @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** 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 "q3table_plugin.h" +#include "q3table_extrainfo.h" + +#include <QtDesigner/QExtensionFactory> +#include <QtDesigner/QExtensionManager> + +#include <QtCore/qplugin.h> +#include <QtGui/QIcon> +#include <Qt3Support/Q3Table> + +QT_BEGIN_NAMESPACE + +Q3TablePlugin::Q3TablePlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3TablePlugin::name() const +{ return QLatin1String("Q3Table"); } + +QString Q3TablePlugin::group() const +{ return QLatin1String("Qt 3 Support"); } + +QString Q3TablePlugin::toolTip() const +{ return QString(); } + +QString Q3TablePlugin::whatsThis() const +{ return QString(); } + +QString Q3TablePlugin::includeFile() const +{ return QLatin1String("q3table.h"); } + +QIcon Q3TablePlugin::icon() const +{ return m_icon; } + +bool Q3TablePlugin::isContainer() const +{ return false; } + +QWidget *Q3TablePlugin::createWidget(QWidget *parent) +{ return new Q3Table(parent); } + +bool Q3TablePlugin::isInitialized() const +{ return m_initialized; } + +void Q3TablePlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + + if (m_initialized) + return; + + QExtensionManager *mgr = core->extensionManager(); + Q_ASSERT(mgr != 0); + + mgr->registerExtensions(new Q3TableExtraInfoFactory(core, mgr), Q_TYPEID(QDesignerExtraInfoExtension)); + + m_initialized = true; +} + +QString Q3TablePlugin::codeTemplate() const +{ return QString(); } + +QString Q3TablePlugin::domXml() const +{ return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3Table\" name=\"table\">\ + <property name=\"geometry\">\ + <rect>\ + <x>0</x>\ + <y>0</y>\ + <width>100</width>\ + <height>80</height>\ + </rect>\ + </property>\ + </widget>\ +</ui>"); +} + + + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3table/q3table_plugin.h b/tools/designer/src/plugins/widgets/q3table/q3table_plugin.h new file mode 100644 index 0000000..0a23e97 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3table/q3table_plugin.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 Q3TABLE_PLUGIN_H +#define Q3TABLE_PLUGIN_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class Q3TablePlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3TablePlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString codeTemplate() const; + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +QT_END_NAMESPACE + +#endif // Q3TABLE_PLUGIN_H diff --git a/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.cpp b/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.cpp new file mode 100644 index 0000000..f60c395 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3textedit/q3textedit_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 "q3textedit_extrainfo.h" + +#include <QtDesigner/QDesignerIconCacheInterface> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/private/ui4_p.h> + +#include <Qt3Support/Q3TextEdit> + +QT_BEGIN_NAMESPACE + +inline QHash<QString, DomProperty *> propertyMap(const QList<DomProperty *> &properties) // ### remove me +{ + QHash<QString, DomProperty *> map; + + for (int i=0; i<properties.size(); ++i) { + DomProperty *p = properties.at(i); + map.insert(p->attributeName(), p); + } + + return map; +} + +Q3TextEditExtraInfo::Q3TextEditExtraInfo(Q3TextEdit *widget, QDesignerFormEditorInterface *core, QObject *parent) + : QObject(parent), m_widget(widget), m_core(core) +{} + +QWidget *Q3TextEditExtraInfo::widget() const +{ return m_widget; } + +QDesignerFormEditorInterface *Q3TextEditExtraInfo::core() const +{ return m_core; } + +bool Q3TextEditExtraInfo::saveUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + +bool Q3TextEditExtraInfo::loadUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + + +bool Q3TextEditExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget) +{ + Q_UNUSED(ui_widget); + + Q3TextEdit *textEdit = qobject_cast<Q3TextEdit*>(widget()); + Q_ASSERT(textEdit != 0); + Q_UNUSED(textEdit); + return true; +} + +bool Q3TextEditExtraInfo::loadWidgetExtraInfo(DomWidget *ui_widget) +{ + Q_UNUSED(ui_widget); + + Q3TextEdit *textEdit = qobject_cast<Q3TextEdit*>(widget()); + Q_ASSERT(textEdit != 0); + Q_UNUSED(textEdit); + return true; +} + +Q3TextEditExtraInfoFactory::Q3TextEditExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent) + : QExtensionFactory(parent), m_core(core) +{} + +QObject *Q3TextEditExtraInfoFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerExtraInfoExtension)) + return 0; + + if (Q3TextEdit *w = qobject_cast<Q3TextEdit*>(object)) + return new Q3TextEditExtraInfo(w, m_core, parent); + + return 0; +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.h b/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.h new file mode 100644 index 0000000..3ccc211 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3textedit/q3textedit_extrainfo.h @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** 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 Q3TEXTEDIT_EXTRAINFO_H +#define Q3TEXTEDIT_EXTRAINFO_H + +#include <QtDesigner/QDesignerExtraInfoExtension> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/QExtensionFactory> + +#include <QtCore/QPointer> + +QT_BEGIN_NAMESPACE + +class Q3TextEdit; +class Q3TextEditItem; +class DomItem; + +class Q3TextEditExtraInfo: public QObject, public QDesignerExtraInfoExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerExtraInfoExtension) +public: + Q3TextEditExtraInfo(Q3TextEdit *widget, QDesignerFormEditorInterface *core, QObject *parent); + + virtual QWidget *widget() const; + virtual QDesignerFormEditorInterface *core() const; + + virtual bool saveUiExtraInfo(DomUI *ui); + virtual bool loadUiExtraInfo(DomUI *ui); + + virtual bool saveWidgetExtraInfo(DomWidget *ui_widget); + virtual bool loadWidgetExtraInfo(DomWidget *ui_widget); + +private: + QPointer<Q3TextEdit> m_widget; + QPointer<QDesignerFormEditorInterface> m_core; +}; + +class Q3TextEditExtraInfoFactory: public QExtensionFactory +{ + Q_OBJECT +public: + Q3TextEditExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + +protected: + virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; + +private: + QDesignerFormEditorInterface *m_core; +}; + +QT_END_NAMESPACE + +#endif // Q3TEXTEDIT_EXTRAINFO_H diff --git a/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.cpp b/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.cpp new file mode 100644 index 0000000..804c4cd --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.cpp @@ -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$ +** +****************************************************************************/ + +#include "q3textedit_plugin.h" +#include "q3textedit_extrainfo.h" + +#include <QtDesigner/QExtensionFactory> +#include <QtDesigner/QExtensionManager> + +#include <QtCore/qplugin.h> +#include <QtGui/QIcon> +#include <Qt3Support/Q3TextEdit> + +QT_BEGIN_NAMESPACE + +Q3TextEditPlugin::Q3TextEditPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3TextEditPlugin::name() const +{ return QLatin1String("Q3TextEdit"); } + +QString Q3TextEditPlugin::group() const +{ return QLatin1String("Qt 3 Support"); } + +QString Q3TextEditPlugin::toolTip() const +{ return QString(); } + +QString Q3TextEditPlugin::whatsThis() const +{ return QString(); } + +QString Q3TextEditPlugin::includeFile() const +{ return QLatin1String("q3textedit.h"); } + +QIcon Q3TextEditPlugin::icon() const +{ return m_icon; } + + +bool Q3TextEditPlugin::isContainer() const +{ return false; } + +QWidget *Q3TextEditPlugin::createWidget(QWidget *parent) +{ return new Q3TextEdit(parent); } + +bool Q3TextEditPlugin::isInitialized() const +{ return m_initialized; } + +void Q3TextEditPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + + if (m_initialized) + return; + + QExtensionManager *mgr = core->extensionManager(); + Q_ASSERT(mgr != 0); + + mgr->registerExtensions(new Q3TextEditExtraInfoFactory(core, mgr), Q_TYPEID(QDesignerExtraInfoExtension)); + + m_initialized = true; +} + +QString Q3TextEditPlugin::codeTemplate() const +{ return QString(); } + +QString Q3TextEditPlugin::domXml() const +{ return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3TextEdit\" name=\"textEdit\">\ + <property name=\"geometry\">\ + <rect>\ + <x>0</x>\ + <y>0</y>\ + <width>100</width>\ + <height>80</height>\ + </rect>\ + </property>\ + </widget>\ +</ui>"); +} + + + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.h b/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.h new file mode 100644 index 0000000..7ab94c7 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3textedit/q3textedit_plugin.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 Q3TEXTEDIT_PLUGIN_H +#define Q3TEXTEDIT_PLUGIN_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class Q3TextEditPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3TextEditPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString codeTemplate() const; + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +QT_END_NAMESPACE + +#endif // Q3TEXTEDIT_PLUGIN_H diff --git a/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.cpp b/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.cpp new file mode 100644 index 0000000..0ad538c --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** 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 "q3toolbar_extrainfo.h" + +#include <QtDesigner/QDesignerIconCacheInterface> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/private/ui4_p.h> + +#include <Qt3Support/Q3ToolBar> + +QT_BEGIN_NAMESPACE + +inline QHash<QString, DomProperty *> propertyMap(const QList<DomProperty *> &properties) // ### remove me +{ + QHash<QString, DomProperty *> map; + + for (int i=0; i<properties.size(); ++i) { + DomProperty *p = properties.at(i); + map.insert(p->attributeName(), p); + } + + return map; +} + +Q3ToolBarExtraInfo::Q3ToolBarExtraInfo(Q3ToolBar *widget, QDesignerFormEditorInterface *core, QObject *parent) + : QObject(parent), m_widget(widget), m_core(core) +{} + +QWidget *Q3ToolBarExtraInfo::widget() const +{ return m_widget; } + +QDesignerFormEditorInterface *Q3ToolBarExtraInfo::core() const +{ return m_core; } + +bool Q3ToolBarExtraInfo::saveUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + +bool Q3ToolBarExtraInfo::loadUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + + +bool Q3ToolBarExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget) +{ + Q_UNUSED(ui_widget); + return true; +} + +bool Q3ToolBarExtraInfo::loadWidgetExtraInfo(DomWidget *ui_widget) +{ + Q_UNUSED(ui_widget); + return true; +} + +Q3ToolBarExtraInfoFactory::Q3ToolBarExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent) + : QExtensionFactory(parent), m_core(core) +{} + +QObject *Q3ToolBarExtraInfoFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerExtraInfoExtension)) + return 0; + + if (Q3ToolBar *w = qobject_cast<Q3ToolBar*>(object)) + return new Q3ToolBarExtraInfo(w, m_core, parent); + + return 0; +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.h b/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.h new file mode 100644 index 0000000..c2e3c54 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_extrainfo.h @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** 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 Q3TOOLBAR_EXTRAINFO_H +#define Q3TOOLBAR_EXTRAINFO_H + +#include <QtDesigner/QDesignerExtraInfoExtension> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/QExtensionFactory> + +#include <QtCore/QPointer> + +QT_BEGIN_NAMESPACE + +class Q3ToolBar; +class DomItem; + +class Q3ToolBarExtraInfo: public QObject, public QDesignerExtraInfoExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerExtraInfoExtension) +public: + Q3ToolBarExtraInfo(Q3ToolBar *widget, QDesignerFormEditorInterface *core, QObject *parent); + + virtual QWidget *widget() const; + virtual QDesignerFormEditorInterface *core() const; + + virtual bool saveUiExtraInfo(DomUI *ui); + virtual bool loadUiExtraInfo(DomUI *ui); + + virtual bool saveWidgetExtraInfo(DomWidget *ui_widget); + virtual bool loadWidgetExtraInfo(DomWidget *ui_widget); + +private: + QPointer<Q3ToolBar> m_widget; + QPointer<QDesignerFormEditorInterface> m_core; +}; + +class Q3ToolBarExtraInfoFactory: public QExtensionFactory +{ + Q_OBJECT +public: + Q3ToolBarExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + +protected: + virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; + +private: + QDesignerFormEditorInterface *m_core; +}; + +QT_END_NAMESPACE + +#endif // Q3TOOLBAR_EXTRAINFO_H diff --git a/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.cpp b/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.cpp new file mode 100644 index 0000000..1f5debe --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.cpp @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** 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 "q3toolbar_plugin.h" +#include "q3toolbar_extrainfo.h" + +#include <QtDesigner/QExtensionFactory> +#include <QtDesigner/QExtensionManager> + +#include <QtCore/qplugin.h> +#include <QtGui/QIcon> +#include <QtCore/QDebug> + +#include <Qt3Support/Q3MainWindow> +#include <Qt3Support/Q3ToolBar> +#include <QtGui/QMainWindow> +#include <QtGui/QToolBar> + +QT_BEGIN_NAMESPACE + +Q3ToolBarPlugin::Q3ToolBarPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3ToolBarPlugin::name() const +{ return QLatin1String("Q3ToolBar"); } + +QString Q3ToolBarPlugin::group() const +{ return QLatin1String("Qt 3 Support"); } + +QString Q3ToolBarPlugin::toolTip() const +{ return QString(); } + +QString Q3ToolBarPlugin::whatsThis() const +{ return QString(); } + +QString Q3ToolBarPlugin::includeFile() const +{ return QLatin1String("q3listview.h"); } + +QIcon Q3ToolBarPlugin::icon() const +{ return m_icon; } + +bool Q3ToolBarPlugin::isContainer() const +{ return false; } + +QWidget *Q3ToolBarPlugin::createWidget(QWidget *parent) +{ + if (!parent) + return new Q3ToolBar; + // If there is a parent, it must be a Q3MainWindow + if (Q3MainWindow *mw3 = qobject_cast<Q3MainWindow*>(parent)) + return new Q3ToolBar(mw3); + // Somebody hacked up a form? + if (QMainWindow *mw4 = qobject_cast<QMainWindow*>(parent)) { + qDebug() << "*** WARNING QMainWindow was passed as a parent widget of Q3ToolBar. Creating a QToolBar..."; + return new QToolBar(mw4); + } + // Can't be helped + const QString msg = QString::fromUtf8("*** WARNING Parent widget of Q3ToolBar must be a Q3MainWindow (%1)!").arg(QLatin1String(parent->metaObject()->className())); + qDebug() << msg; + return 0; +} + +bool Q3ToolBarPlugin::isInitialized() const +{ return m_initialized; } + +void Q3ToolBarPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + + if (m_initialized) + return; + + QExtensionManager *mgr = core->extensionManager(); + Q_ASSERT(mgr != 0); + + mgr->registerExtensions(new Q3ToolBarExtraInfoFactory(core, mgr), Q_TYPEID(QDesignerExtraInfoExtension)); + + m_initialized = true; +} + +QString Q3ToolBarPlugin::codeTemplate() const +{ return QString(); } + +QString Q3ToolBarPlugin::domXml() const +{ return QString(); } + + + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.h b/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.h new file mode 100644 index 0000000..7cb85bb --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.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 Q3TOOLBAR_PLUGIN_H +#define Q3TOOLBAR_PLUGIN_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class Q3ToolBarPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3ToolBarPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString codeTemplate() const; + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +QT_END_NAMESPACE + +#endif // Q3TOOLBAR_PLUGIN_H diff --git a/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.cpp b/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.cpp new file mode 100644 index 0000000..faf3da6 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.cpp @@ -0,0 +1,601 @@ +/**************************************************************************** +** +** 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 "q3widget_plugins.h" + +#include <QtCore/qplugin.h> +#include <QtGui/QIcon> +#include <QtGui/QLayout> +#include <Qt3Support/Q3ButtonGroup> +#include <Qt3Support/Q3ComboBox> +#include <Qt3Support/Q3DateEdit> +#include <Qt3Support/Q3DateTimeEdit> +#include <Qt3Support/Q3Frame> +#include <Qt3Support/Q3GroupBox> +#include <Qt3Support/Q3ProgressBar> +#include <Qt3Support/Q3TextBrowser> +#include <Qt3Support/Q3TimeEdit> + +static const char *groupNameC = "Qt 3 Support"; + +QT_BEGIN_NAMESPACE + +Q3ButtonGroupPlugin::Q3ButtonGroupPlugin(const QIcon &icon, QObject *parent) : + QObject(parent), + m_initialized(false), + m_icon(icon) +{ +} + +Q3ButtonGroupPlugin::~Q3ButtonGroupPlugin() +{ +} + +QString Q3ButtonGroupPlugin::name() const +{ + return QLatin1String("Q3ButtonGroup"); +} + +QString Q3ButtonGroupPlugin::group() const +{ + return QLatin1String(groupNameC); +} + +QString Q3ButtonGroupPlugin::toolTip() const +{ + return QString(); +} + +QString Q3ButtonGroupPlugin::whatsThis() const +{ + return QString(); +} + +QString Q3ButtonGroupPlugin::includeFile() const +{ + return QLatin1String("Qt3Support/Q3ButtonGroup"); +} + +QIcon Q3ButtonGroupPlugin::icon() const +{ + return m_icon; +} + +bool Q3ButtonGroupPlugin::isContainer() const +{ + return true; +} + +QWidget *Q3ButtonGroupPlugin::createWidget(QWidget *parent) +{ + Q3ButtonGroup *g = new Q3ButtonGroup(parent); + g->setColumnLayout(0, Qt::Vertical); + g->setInsideMargin(0); + g->layout()->setSpacing(-1); + return g; +} + +bool Q3ButtonGroupPlugin::isInitialized() const +{ + return m_initialized; +} + +void Q3ButtonGroupPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + m_initialized = true; +} + +QString Q3ButtonGroupPlugin::domXml() const +{ + return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3ButtonGroup\" name=\"buttonGroup\">\ + <property name=\"geometry\">\ + <rect>\ + <x>0</x>\ + <y>0</y>\ + <width>100</width>\ + <height>80</height>\ + </rect>\ + </property>\ + </widget>\ +</ui>"); +} + +Q3ComboBoxPlugin::Q3ComboBoxPlugin(const QIcon &icon, QObject *parent) : + QObject(parent), + m_initialized(false), + m_icon(icon) +{ +} + +Q3ComboBoxPlugin::~Q3ComboBoxPlugin() +{ +} + +QString Q3ComboBoxPlugin::name() const +{ + return QLatin1String("Q3ComboBox"); +} + +QString Q3ComboBoxPlugin::group() const +{ + return QLatin1String(groupNameC); +} + +QString Q3ComboBoxPlugin::toolTip() const +{ + return QString(); +} + +QString Q3ComboBoxPlugin::whatsThis() const +{ + return QString(); +} + +QString Q3ComboBoxPlugin::includeFile() const +{ + return QLatin1String("Qt3Support/Q3ComboBox"); +} + +QIcon Q3ComboBoxPlugin::icon() const +{ + return m_icon; +} + +bool Q3ComboBoxPlugin::isContainer() const +{ + return false; +} + +QWidget *Q3ComboBoxPlugin::createWidget(QWidget *parent) +{ + return new Q3ComboBox(parent); +} + +bool Q3ComboBoxPlugin::isInitialized() const +{ + return m_initialized; +} + +QString Q3ComboBoxPlugin::domXml() const +{ + return QLatin1String("\ +<ui language=\"c++\">\ +<widget class=\"Q3ComboBox\" name=\"comboBox\"/>\ +</ui>"); +} + +void Q3ComboBoxPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + m_initialized = true; +} + +Q3DateEditPlugin::Q3DateEditPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3DateEditPlugin::name() const +{ return QLatin1String("Q3DateEdit"); } + +QString Q3DateEditPlugin::group() const +{ return QLatin1String(groupNameC); } + +QString Q3DateEditPlugin::toolTip() const +{ return QString(); } + +QString Q3DateEditPlugin::whatsThis() const +{ return QString(); } + +QString Q3DateEditPlugin::includeFile() const +{ return QLatin1String("Qt3Support/Q3DateEdit"); } + +QIcon Q3DateEditPlugin::icon() const +{ return m_icon; } + +bool Q3DateEditPlugin::isContainer() const +{ return false; } + +QWidget *Q3DateEditPlugin::createWidget(QWidget *parent) +{ return new Q3DateEdit(parent); } + +bool Q3DateEditPlugin::isInitialized() const +{ return m_initialized; } + +void Q3DateEditPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + m_initialized = true; +} + +QString Q3DateEditPlugin::domXml() const +{ + return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3DateEdit\" name=\"dateEdit\"/>\ +</ui>"); +} + +Q3DateTimeEditPlugin::Q3DateTimeEditPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3DateTimeEditPlugin::name() const +{ return QLatin1String("Q3DateTimeEdit"); } + +QString Q3DateTimeEditPlugin::group() const +{ return QLatin1String(groupNameC); } + +QString Q3DateTimeEditPlugin::toolTip() const +{ return QString(); } + +QString Q3DateTimeEditPlugin::whatsThis() const +{ return QString(); } + +QString Q3DateTimeEditPlugin::includeFile() const +{ return QLatin1String("Qt3Support/Q3DateTimeEdit"); } + +QIcon Q3DateTimeEditPlugin::icon() const +{ return m_icon; } + +bool Q3DateTimeEditPlugin::isContainer() const +{ return false; } + +QWidget *Q3DateTimeEditPlugin::createWidget(QWidget *parent) +{ return new Q3DateTimeEdit(parent); } + +bool Q3DateTimeEditPlugin::isInitialized() const +{ return m_initialized; } + +void Q3DateTimeEditPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + m_initialized = true; +} + +QString Q3DateTimeEditPlugin::domXml() const +{ + return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3DateTimeEdit\" name=\"dateTimeEdit\"/>\ +</ui>"); +} + +Q3FramePlugin::Q3FramePlugin(const QIcon &icon, QObject *parent) + : QObject(parent), + m_initialized(false), + m_icon(icon) +{ +} + +Q3FramePlugin::~Q3FramePlugin() +{ +} + +QString Q3FramePlugin::name() const +{ + return QLatin1String("Q3Frame"); +} + +QString Q3FramePlugin::group() const +{ + return QLatin1String(groupNameC); +} + +QString Q3FramePlugin::toolTip() const +{ + return QString(); +} + +QString Q3FramePlugin::whatsThis() const +{ + return QString(); +} + +QString Q3FramePlugin::includeFile() const +{ + return QLatin1String("Qt3Support/Q3Frame"); +} + +QIcon Q3FramePlugin::icon() const +{ + return m_icon; +} + +bool Q3FramePlugin::isContainer() const +{ + return true; +} + +QWidget *Q3FramePlugin::createWidget(QWidget *parent) +{ + return new Q3Frame(parent); +} + +bool Q3FramePlugin::isInitialized() const +{ + return m_initialized; +} + +void Q3FramePlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + m_initialized = true; +} + +QString Q3FramePlugin::domXml() const +{ + return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3Frame\" name=\"frame\">\ + <property name=\"geometry\">\ + <rect>\ + <x>0</x>\ + <y>0</y>\ + <width>100</width>\ + <height>80</height>\ + </rect>\ + </property>\ + </widget>\ +</ui>"); +} + +Q3GroupBoxPlugin::Q3GroupBoxPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), + m_initialized(false), + m_icon(icon) +{ +} + +Q3GroupBoxPlugin::~Q3GroupBoxPlugin() +{ +} + +QString Q3GroupBoxPlugin::name() const +{ + return QLatin1String("Q3GroupBox"); +} + +QString Q3GroupBoxPlugin::group() const +{ + return QLatin1String(groupNameC); +} + +QString Q3GroupBoxPlugin::toolTip() const +{ + return QString(); +} + +QString Q3GroupBoxPlugin::whatsThis() const +{ + return QString(); +} + +QString Q3GroupBoxPlugin::includeFile() const +{ + return QLatin1String("Qt3Support/Q3GroupBox"); +} + +QIcon Q3GroupBoxPlugin::icon() const +{ + return m_icon; +} + +bool Q3GroupBoxPlugin::isContainer() const +{ + return true; +} + +QWidget *Q3GroupBoxPlugin::createWidget(QWidget *parent) +{ + Q3GroupBox *g = new Q3GroupBox(parent); + g->setColumnLayout(0, Qt::Vertical); + g->setInsideMargin(0); + g->layout()->setSpacing(-1); + return g; +} + +bool Q3GroupBoxPlugin::isInitialized() const +{ + return m_initialized; +} + +void Q3GroupBoxPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + m_initialized = true; +} + +QString Q3GroupBoxPlugin::domXml() const +{ + return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3GroupBox\" name=\"groupBox\">\ + <property name=\"geometry\">\ + <rect>\ + <x>0</x>\ + <y>0</y>\ + <width>100</width>\ + <height>80</height>\ + </rect>\ + </property>\ + </widget>\ +</ui>"); +} + +Q3ProgressBarPlugin::Q3ProgressBarPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3ProgressBarPlugin::name() const +{ return QLatin1String("Q3ProgressBar"); } + +QString Q3ProgressBarPlugin::group() const +{ return QLatin1String(groupNameC); } + +QString Q3ProgressBarPlugin::toolTip() const +{ return QString(); } + +QString Q3ProgressBarPlugin::whatsThis() const +{ return QString(); } + +QString Q3ProgressBarPlugin::includeFile() const +{ return QLatin1String("Qt3Support/Q3ProgressBar"); } + +QIcon Q3ProgressBarPlugin::icon() const +{ return m_icon; } + +bool Q3ProgressBarPlugin::isContainer() const +{ return false; } + +QWidget *Q3ProgressBarPlugin::createWidget(QWidget *parent) +{ return new Q3ProgressBar(parent); } + +bool Q3ProgressBarPlugin::isInitialized() const +{ return m_initialized; } + +void Q3ProgressBarPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + m_initialized = true; +} + +QString Q3ProgressBarPlugin::domXml() const +{ + return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3ProgressBar\" name=\"progressBar\"/>\ +</ui>"); +} + +Q3TextBrowserPlugin::Q3TextBrowserPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3TextBrowserPlugin::name() const +{ return QLatin1String("Q3TextBrowser"); } + +QString Q3TextBrowserPlugin::group() const +{ return QLatin1String(groupNameC); } + +QString Q3TextBrowserPlugin::toolTip() const +{ return QString(); } + +QString Q3TextBrowserPlugin::whatsThis() const +{ return QString(); } + +QString Q3TextBrowserPlugin::includeFile() const +{ return QLatin1String("Qt3Support/Q3TextBrowser"); } + +QIcon Q3TextBrowserPlugin::icon() const +{ return m_icon; } + +bool Q3TextBrowserPlugin::isContainer() const +{ return false; } + +QWidget *Q3TextBrowserPlugin::createWidget(QWidget *parent) +{ return new Q3TextBrowser(parent); } + +bool Q3TextBrowserPlugin::isInitialized() const +{ return m_initialized; } + +void Q3TextBrowserPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + m_initialized = true; +} + +QString Q3TextBrowserPlugin::domXml() const +{ + return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3TextBrowser\" name=\"textBrowser\"/>\ +</ui>"); +} + +Q3TimeEditPlugin::Q3TimeEditPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3TimeEditPlugin::name() const +{ return QLatin1String("Q3TimeEdit"); } + +QString Q3TimeEditPlugin::group() const +{ return QLatin1String(groupNameC); } + +QString Q3TimeEditPlugin::toolTip() const +{ return QString(); } + +QString Q3TimeEditPlugin::whatsThis() const +{ return QString(); } + +QString Q3TimeEditPlugin::includeFile() const +{ return QLatin1String("Qt3Support/Q3TimeEdit"); } + +QIcon Q3TimeEditPlugin::icon() const +{ return m_icon; } + +bool Q3TimeEditPlugin::isContainer() const +{ return false; } + +QWidget *Q3TimeEditPlugin::createWidget(QWidget *parent) +{ return new Q3TimeEdit(parent); } + +bool Q3TimeEditPlugin::isInitialized() const +{ return m_initialized; } + +void Q3TimeEditPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + m_initialized = true; +} + +QString Q3TimeEditPlugin::domXml() const +{ + return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3TimeEdit\" name=\"timeEdit\"/>\ +</ui>"); +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h b/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h new file mode 100644 index 0000000..76a14c5 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h @@ -0,0 +1,287 @@ +/**************************************************************************** +** +** 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 Q3WIDGET_PLUGINS_H +#define Q3WIDGET_PLUGINS_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class Q3ButtonGroupPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3ButtonGroupPlugin(const QIcon &icon, QObject *parent = 0); + virtual ~Q3ButtonGroupPlugin(); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + + virtual bool isContainer() const; + + virtual QWidget *createWidget(QWidget *parent); + + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +class Q3ComboBoxPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3ComboBoxPlugin(const QIcon &icon, QObject *parent = 0); + virtual ~Q3ComboBoxPlugin(); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + + virtual bool isContainer() const; + + virtual QWidget *createWidget(QWidget *parent); + + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +class Q3DateEditPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3DateEditPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +class Q3DateTimeEditPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3DateTimeEditPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +class Q3FramePlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3FramePlugin(const QIcon &icon, QObject *parent = 0); + virtual ~Q3FramePlugin(); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + + virtual bool isContainer() const; + + virtual QWidget *createWidget(QWidget *parent); + + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +class Q3GroupBoxPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3GroupBoxPlugin(const QIcon &icon, QObject *parent = 0); + virtual ~Q3GroupBoxPlugin(); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + + virtual bool isContainer() const; + + virtual QWidget *createWidget(QWidget *parent); + + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +class Q3ProgressBarPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3ProgressBarPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +class Q3TextBrowserPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3TextBrowserPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +class Q3TimeEditPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3TimeEditPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +QT_END_NAMESPACE + +#endif // Q3WIDGET_PLUGINS_H diff --git a/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_container.cpp b/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_container.cpp new file mode 100644 index 0000000..9482d4b --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_container.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** 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 "q3widgetstack_container.h" +#include "qdesigner_q3widgetstack_p.h" + +#include <QtCore/qdebug.h> + +QT_BEGIN_NAMESPACE + +Q3WidgetStackContainer::Q3WidgetStackContainer(QDesignerQ3WidgetStack *widget, QObject *parent) + : QObject(parent), + m_widget(widget) +{} + +int Q3WidgetStackContainer::count() const +{ return m_pages.count(); } + +QWidget *Q3WidgetStackContainer::widget(int index) const +{ + if (index == -1) + return 0; + + return m_pages.at(index); +} + +int Q3WidgetStackContainer::currentIndex() const +{ return m_pages.indexOf(m_widget->visibleWidget()); } + +void Q3WidgetStackContainer::setCurrentIndex(int index) +{ m_widget->raiseWidget(m_pages.at(index)); } + +void Q3WidgetStackContainer::addWidget(QWidget *widget) +{ + m_pages.append(widget); + m_widget->addWidget(widget); +} + +void Q3WidgetStackContainer::insertWidget(int index, QWidget *widget) +{ + m_pages.insert(index, widget); + m_widget->addWidget(widget); + m_widget->setCurrentIndex(index); +} + +void Q3WidgetStackContainer::remove(int index) +{ + int current = currentIndex(); + m_widget->removeWidget(m_pages.at(index)); + m_pages.removeAt(index); + if (index == current) { + if (count() > 0) + m_widget->setCurrentIndex((index == count()) ? index-1 : index); + } else if (index < current) { + if (current > 0) + m_widget->setCurrentIndex(current-1); + } +} + +Q3WidgetStackContainerFactory::Q3WidgetStackContainerFactory(QExtensionManager *parent) + : QExtensionFactory(parent) +{ +} + +QObject *Q3WidgetStackContainerFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerContainerExtension)) + return 0; + + if (QDesignerQ3WidgetStack *w = qobject_cast<QDesignerQ3WidgetStack*>(object)) + return new Q3WidgetStackContainer(w, parent); + + return 0; +} + + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_container.h b/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_container.h new file mode 100644 index 0000000..3d6045d --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_container.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 Q3WIDGETSTACK_CONTAINER_H +#define Q3WIDGETSTACK_CONTAINER_H + +#include <QtDesigner/QDesignerContainerExtension> +#include <QtDesigner/QExtensionFactory> + +QT_BEGIN_NAMESPACE + +class QDesignerQ3WidgetStack; + +class Q3WidgetStackContainer: public QObject, public QDesignerContainerExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerContainerExtension) +public: + explicit Q3WidgetStackContainer(QDesignerQ3WidgetStack *widget, QObject *parent = 0); + + virtual int count() const; + virtual QWidget *widget(int index) const; + virtual int currentIndex() const; + virtual void setCurrentIndex(int index); + virtual void addWidget(QWidget *widget); + virtual void insertWidget(int index, QWidget *widget); + virtual void remove(int index); + +private: + QDesignerQ3WidgetStack *m_widget; + QList<QWidget*> m_pages; +}; + +class Q3WidgetStackContainerFactory: public QExtensionFactory +{ + Q_OBJECT +public: + explicit Q3WidgetStackContainerFactory(QExtensionManager *parent = 0); + +protected: + virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; +}; + +QT_END_NAMESPACE + +#endif // Q3WIDGETSTACK_CONTAINER_H diff --git a/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.cpp b/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.cpp new file mode 100644 index 0000000..61907a6 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.cpp @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** 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 "q3widgetstack_plugin.h" +#include "q3widgetstack_container.h" + +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/QExtensionManager> + +#include <QtCore/qplugin.h> +#include "qdesigner_q3widgetstack_p.h" + +QT_BEGIN_NAMESPACE + +Q3WidgetStackPlugin::Q3WidgetStackPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3WidgetStackPlugin::name() const +{ return QLatin1String("Q3WidgetStack"); } + +QString Q3WidgetStackPlugin::group() const +{ return QLatin1String("Qt 3 Support"); } + +QString Q3WidgetStackPlugin::toolTip() const +{ return QString(); } + +QString Q3WidgetStackPlugin::whatsThis() const +{ return QString(); } + +QString Q3WidgetStackPlugin::includeFile() const +{ return QLatin1String("q3widgetstack.h"); } + +QIcon Q3WidgetStackPlugin::icon() const +{ return m_icon; } + +bool Q3WidgetStackPlugin::isContainer() const +{ return true; } + +QWidget *Q3WidgetStackPlugin::createWidget(QWidget *parent) +{ return new QDesignerQ3WidgetStack(parent); } + +bool Q3WidgetStackPlugin::isInitialized() const +{ return m_initialized; } + +void Q3WidgetStackPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + + if (m_initialized) + return; + + m_initialized = true; + QExtensionManager *mgr = core->extensionManager(); + mgr->registerExtensions(new Q3WidgetStackContainerFactory(mgr), Q_TYPEID(QDesignerContainerExtension)); +} + +QString Q3WidgetStackPlugin::codeTemplate() const +{ return QString(); } + +QString Q3WidgetStackPlugin::domXml() const +{ + return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3WidgetStack\" name=\"widgetStack\">\ + <property name=\"geometry\">\ + <rect>\ + <x>0</x>\ + <y>0</y>\ + <width>100</width>\ + <height>80</height>\ + </rect>\ + </property>\ + <widget class=\"QWidget\" name=\"page\"/>\ + <widget class=\"QWidget\" name=\"page_2\"/>\ + </widget>\ +</ui>"); +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.h b/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.h new file mode 100644 index 0000000..bbe85ff --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.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 Q3WIDGETSTACK_PLUGIN_H +#define Q3WIDGETSTACK_PLUGIN_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class Q3WidgetStackPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3WidgetStackPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString codeTemplate() const; + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +QT_END_NAMESPACE + +#endif // Q3WIDGETSTACK_PLUGIN_H diff --git a/tools/designer/src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack.cpp b/tools/designer/src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack.cpp new file mode 100644 index 0000000..adb3d56 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack.cpp @@ -0,0 +1,217 @@ +/**************************************************************************** +** +** 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 "qdesigner_q3widgetstack_p.h" +#include "../../../lib/shared/qdesigner_propertycommand_p.h" + +#include <QtDesigner/QDesignerFormWindowInterface> +#include <QtDesigner/QDesignerContainerExtension> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/QExtensionManager> + +#include <QtCore/QEvent> +#include <QtGui/QToolButton> + +QT_BEGIN_NAMESPACE + +namespace { + QToolButton *createToolButton(QWidget *parent, Qt::ArrowType at, const QString &name) { + QToolButton *rc = new QToolButton(); + rc->setAttribute(Qt::WA_NoChildEventsForParent, true); + rc->setParent(parent); + rc->setObjectName(name); + rc->setArrowType(at); + rc->setAutoRaise(true); + rc->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); + rc->setFixedSize(QSize(15, 15)); + return rc; + } +} + +QDesignerQ3WidgetStack::QDesignerQ3WidgetStack(QWidget *parent) : + Q3WidgetStack(parent), + m_prev(createToolButton(this, Qt::LeftArrow, QLatin1String("__qt__passive_prev"))), + m_next(createToolButton(this, Qt::RightArrow, QLatin1String("__qt__passive_next"))) +{ + connect(m_prev, SIGNAL(clicked()), this, SLOT(prevPage())); + connect(m_next, SIGNAL(clicked()), this, SLOT(nextPage())); + updateButtons(); + + connect(this, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int))); +} + +QDesignerFormWindowInterface *QDesignerQ3WidgetStack::formWindow() +{ + return QDesignerFormWindowInterface::findFormWindow(this); +} + +QDesignerContainerExtension *QDesignerQ3WidgetStack::container() +{ + if (formWindow()) { + QDesignerFormEditorInterface *core = formWindow()->core(); + return qt_extension<QDesignerContainerExtension*>(core->extensionManager(), this); + } + return 0; +} + +int QDesignerQ3WidgetStack::count() +{ + return container() ? container()->count() : 0; +} + +int QDesignerQ3WidgetStack::currentIndex() +{ + return container() ? container()->currentIndex() : -1; +} + +void QDesignerQ3WidgetStack::setCurrentIndex(int index) +{ + if (container() && (index >= 0) && (index < count())) { + container()->setCurrentIndex(index); + emit currentChanged(index); + } +} + +QWidget *QDesignerQ3WidgetStack::widget(int index) +{ + return container() ? container()->widget(index) : 0; +} + +void QDesignerQ3WidgetStack::updateButtons() +{ + if (m_prev) { + m_prev->move(width() - 31, 1); + m_prev->show(); + m_prev->raise(); + } + + if (m_next) { + m_next->move(width() - 16, 1); + m_next->show(); + m_next->raise(); + } +} + +void QDesignerQ3WidgetStack::gotoPage(int page) { + // Are we on a form or in a preview? + if (QDesignerFormWindowInterface *fw = formWindow()) { + qdesigner_internal::SetPropertyCommand *cmd = new qdesigner_internal::SetPropertyCommand(fw); + cmd->init(this, QLatin1String("currentIndex"), page); + fw->commandHistory()->push(cmd); + fw->emitSelectionChanged(); // Magically prevent an endless loop triggered by auto-repeat. + } else { + setCurrentIndex(page); + } + updateButtons(); +} + + +void QDesignerQ3WidgetStack::prevPage() +{ + if (count() > 1) { + int newIndex = currentIndex() - 1; + if (newIndex < 0) + newIndex = count() - 1; + gotoPage(newIndex); + } +} + +void QDesignerQ3WidgetStack::nextPage() +{ + if (count() > 1) + gotoPage((currentIndex() + 1) % count()); +} + +QString QDesignerQ3WidgetStack::currentPageName() +{ + if (currentIndex() == -1) + return QString(); + + return widget(currentIndex())->objectName(); +} + +void QDesignerQ3WidgetStack::setCurrentPageName(const QString &pageName) +{ + if (currentIndex() == -1) + return; + + if (QWidget *w = widget(currentIndex())) + w->setObjectName(pageName); +} + +bool QDesignerQ3WidgetStack::event(QEvent *e) +{ + if (e->type() == QEvent::LayoutRequest) { + updateButtons(); + } + + return Q3WidgetStack::event(e); +} + +void QDesignerQ3WidgetStack::childEvent(QChildEvent *e) +{ + Q3WidgetStack::childEvent(e); + updateButtons(); +} + +void QDesignerQ3WidgetStack::resizeEvent(QResizeEvent *e) +{ + Q3WidgetStack::resizeEvent(e); + updateButtons(); +} + +void QDesignerQ3WidgetStack::showEvent(QShowEvent *e) +{ + Q3WidgetStack::showEvent(e); + updateButtons(); +} + +void QDesignerQ3WidgetStack::slotCurrentChanged(int index) +{ + if (widget(index)) { + if (QDesignerFormWindowInterface *fw = formWindow()) { + fw->clearSelection(); + fw->selectWidget(this, true); + } + } +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack_p.h b/tools/designer/src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack_p.h new file mode 100644 index 0000000..5c35514 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3widgetstack/qdesigner_q3widgetstack_p.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** 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_Q3WIDGETSTACK_P_H +#define QDESIGNER_Q3WIDGETSTACK_P_H + +#include <Qt3Support/Q3WidgetStack> + +QT_BEGIN_NAMESPACE + +class QDesignerFormWindowInterface; +class QDesignerContainerExtension; +class QToolButton; +class QChildEvent; +class QResizeEvent; +class QShowEvent; +class QEvent; + +class QDesignerQ3WidgetStack : public Q3WidgetStack +{ + Q_OBJECT + Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex STORED false DESIGNABLE true) + Q_PROPERTY(QString currentPageName READ currentPageName WRITE setCurrentPageName STORED false DESIGNABLE true) +public: + QDesignerQ3WidgetStack(QWidget *parent = 0); + int currentIndex(); + QString currentPageName(); + +public slots: + void updateButtons(); + void setCurrentIndex(int index); + void setCurrentPageName(const QString &pageName); + +private slots: + void prevPage(); + void nextPage(); + void slotCurrentChanged(int index); + +signals: + void currentChanged(int index); + +protected: + virtual void childEvent(QChildEvent *e); + virtual void resizeEvent(QResizeEvent *e); + virtual void showEvent(QShowEvent *e); + virtual bool event(QEvent *e); + +private: + void gotoPage(int page); + QDesignerFormWindowInterface *formWindow(); + QDesignerContainerExtension *container(); + int count(); + QWidget *widget(int index); + QToolButton *m_prev, *m_next; +}; + +QT_END_NAMESPACE + +#endif // !QDESIGNER_Q3WIDGETSTACK_P_H diff --git a/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.cpp b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.cpp new file mode 100644 index 0000000..57252b9 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.cpp @@ -0,0 +1,235 @@ +/**************************************************************************** +** +** 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 "q3wizard_container.h" +#include <Qt3Support/Q3Wizard> + +#include <QtDesigner/QDesignerFormWindowInterface> +#include <QtDesigner/private/ui4_p.h> + +#include <QtCore/qdebug.h> + +QT_BEGIN_NAMESPACE + +static const char *currentPageText = "currentPageText"; + +Q3WizardHelper::Q3WizardHelper(Q3Wizard *wizard) + : QObject(wizard), + m_wizard(wizard) +{ + connect(m_wizard, SIGNAL(selected(const QString &)), this, SLOT(slotCurrentChanged())); +} + +void Q3WizardHelper::slotCurrentChanged() +{ + if (QDesignerFormWindowInterface *fw = QDesignerFormWindowInterface::findFormWindow(m_wizard)) { + fw->clearSelection(); + fw->selectWidget(m_wizard, true); + } +} + +Q3WizardExtraInfo::Q3WizardExtraInfo(Q3Wizard *wizard, QDesignerFormEditorInterface *core, QObject *parent) + : QObject(parent), m_wizard(wizard), m_core(core) +{} + +QWidget *Q3WizardExtraInfo::widget() const +{ return m_wizard; } + +Q3Wizard *Q3WizardExtraInfo::wizard() const +{ return m_wizard; } + +QDesignerFormEditorInterface *Q3WizardExtraInfo::core() const +{ return m_core; } + +bool Q3WizardExtraInfo::saveUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + +bool Q3WizardExtraInfo::loadUiExtraInfo(DomUI *ui) +{ Q_UNUSED(ui); return false; } + +bool Q3WizardExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget) +{ + int i = 0; + foreach (DomWidget *ui_child, ui_widget->elementWidget()) { + DomProperty *p = new DomProperty(); + p->setAttributeName(QLatin1String("title")); + DomString *str = new DomString(); + str->setText(wizard()->title(wizard()->page(i))); + p->setElementString(str); + + QList<DomProperty *> attributes = ui_child->elementAttribute(); + attributes.append(p); + ui_child->setElementAttribute(attributes); + + i++; + } + return true; +} + +bool Q3WizardExtraInfo::loadWidgetExtraInfo(DomWidget *ui_widget) +{ + int i = 0; + foreach (const DomWidget *ui_child, ui_widget->elementWidget()) { + foreach (const DomProperty *ui_prop, ui_child->elementAttribute()) { + if (ui_prop->attributeName() == QLatin1String("title")) { + const DomString *ui_string = ui_prop->elementString(); + if (ui_string) + wizard()->setTitle(wizard()->page(i), ui_string->text()); + } + } + i++; + } + return true; +} + +Q3WizardExtraInfoFactory::Q3WizardExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent) + : QExtensionFactory(parent), m_core(core) +{} + +QObject *Q3WizardExtraInfoFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerExtraInfoExtension)) + return 0; + + if (Q3Wizard *w = qobject_cast<Q3Wizard *>(object)) + return new Q3WizardExtraInfo(w, m_core, parent); + + return 0; +} + +Q3WizardContainer::Q3WizardContainer(Q3Wizard *wizard, QObject *parent) + : QObject(parent), + m_wizard(wizard) +{} + +int Q3WizardContainer::count() const +{ + return m_wizard->pageCount(); +} + +QWidget *Q3WizardContainer::widget(int index) const +{ + Q_ASSERT(index != -1); + return m_wizard->page(index); +} + +int Q3WizardContainer::currentIndex() const +{ + if (m_wizard->currentPage() == 0 && m_wizard->pageCount()) + m_wizard->showPage(widget(0)); + + return m_wizard->indexOf(m_wizard->currentPage()); +} + +void Q3WizardContainer::setCurrentIndex(int index) +{ + const bool blocked = m_wizard->signalsBlocked(); + m_wizard->blockSignals(true); + m_wizard->showPage(widget(index)); + m_wizard->blockSignals(blocked); +} + +void Q3WizardContainer::addWidget(QWidget *widget) +{ + m_wizard->addPage(widget, tr("Page")); +} + +void Q3WizardContainer::insertWidget(int index, QWidget *widget) +{ + m_wizard->insertPage(widget, tr("Page"), index); +} + +void Q3WizardContainer::remove(int index) +{ + m_wizard->removePage(widget(index)); +} + +Q3WizardContainerFactory::Q3WizardContainerFactory(QExtensionManager *parent) + : QExtensionFactory(parent) +{ +} + +QObject *Q3WizardContainerFactory::createExtension(QObject *object, const QString &iid, QObject *parent) const +{ + if (iid != Q_TYPEID(QDesignerContainerExtension)) + return 0; + + if (Q3Wizard *w = qobject_cast<Q3Wizard*>(object)) + return new Q3WizardContainer(w, parent); + + return 0; +} + +Q3WizardPropertySheet::Q3WizardPropertySheet(Q3Wizard *object, QObject *parent) + : QDesignerPropertySheet(object, parent), m_wizard(object) +{ + createFakeProperty(QLatin1String(currentPageText), QString()); +} + +void Q3WizardPropertySheet::setProperty(int index, const QVariant &value) +{ + const QString prop = propertyName(index); + if (prop == QLatin1String(currentPageText)) { + m_wizard->setTitle(m_wizard->currentPage(), value.toString()); + return; + } + QDesignerPropertySheet::setProperty(index, value); +} + +QVariant Q3WizardPropertySheet::property(int index) const +{ + const QString prop = propertyName(index); + if (prop == QLatin1String(currentPageText)) + return m_wizard->title(m_wizard->currentPage()); + return QDesignerPropertySheet::property(index); +} + +bool Q3WizardPropertySheet::reset(int index) +{ + const QString prop = propertyName(index); + if (prop == QLatin1String(currentPageText)) { + m_wizard->setTitle(m_wizard->currentPage(), QString()); + return true; + } + return QDesignerPropertySheet::reset(index); +} + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h new file mode 100644 index 0000000..1e28176 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** 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 Q3WIZARD_CONTAINER_H +#define Q3WIZARD_CONTAINER_H + +#include <QtDesigner/QDesignerContainerExtension> +#include <QtDesigner/QExtensionFactory> +#include <QtDesigner/QDesignerExtraInfoExtension> +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/private/qdesigner_propertysheet_p.h> + +#include <QtCore/QPointer> +#include <Qt3Support/Q3Wizard> + +QT_BEGIN_NAMESPACE + +class Q3Wizard; + +class Q3WizardHelper : public QObject +{ + Q_OBJECT +public: + Q3WizardHelper(Q3Wizard *wizard); +private slots: + void slotCurrentChanged(); +private: + Q3Wizard *m_wizard; +}; + +class Q3WizardExtraInfo: public QObject, public QDesignerExtraInfoExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerExtraInfoExtension) +public: + Q3WizardExtraInfo(Q3Wizard *wizard, QDesignerFormEditorInterface *core, QObject *parent); + + virtual QWidget *widget() const; + virtual Q3Wizard *wizard() const; + virtual QDesignerFormEditorInterface *core() const; + + virtual bool saveUiExtraInfo(DomUI *ui); + virtual bool loadUiExtraInfo(DomUI *ui); + + virtual bool saveWidgetExtraInfo(DomWidget *ui_widget); + virtual bool loadWidgetExtraInfo(DomWidget *ui_widget); + +private: + QPointer<Q3Wizard> m_wizard; + QPointer<QDesignerFormEditorInterface> m_core; +}; + +class Q3WizardExtraInfoFactory: public QExtensionFactory +{ + Q_OBJECT +public: + Q3WizardExtraInfoFactory(QDesignerFormEditorInterface *core, QExtensionManager *parent = 0); + +protected: + virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; + +private: + QDesignerFormEditorInterface *m_core; +}; + +class Q3WizardContainer: public QObject, public QDesignerContainerExtension +{ + Q_OBJECT + Q_INTERFACES(QDesignerContainerExtension) +public: + explicit Q3WizardContainer(Q3Wizard *wizard, QObject *parent = 0); + + virtual int count() const; + virtual QWidget *widget(int index) const; + virtual int currentIndex() const; + virtual void setCurrentIndex(int index); + virtual void addWidget(QWidget *widget); + virtual void insertWidget(int index, QWidget *widget); + virtual void remove(int index); + +private: + Q3Wizard *m_wizard; +}; + +class Q3WizardContainerFactory: public QExtensionFactory +{ + Q_OBJECT +public: + explicit Q3WizardContainerFactory(QExtensionManager *parent = 0); + +protected: + virtual QObject *createExtension(QObject *object, const QString &iid, QObject *parent) const; +}; + +class Q3WizardPropertySheet : public QDesignerPropertySheet { +public: + explicit Q3WizardPropertySheet(Q3Wizard *object, QObject *parent = 0); + + virtual void setProperty(int index, const QVariant &value); + virtual QVariant property(int index) const; + virtual bool reset(int index); + +private: + Q3Wizard *m_wizard; +}; + +typedef QDesignerPropertySheetFactory<Q3Wizard, Q3WizardPropertySheet> Q3WizardPropertySheetFactory; + +QT_END_NAMESPACE + +#endif // Q3WIZARD_CONTAINER_H diff --git a/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.cpp b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.cpp new file mode 100644 index 0000000..bdd6ddc --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.cpp @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** 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 "q3wizard_plugin.h" +#include "q3wizard_container.h" + +#include <QtDesigner/QDesignerFormEditorInterface> +#include <QtDesigner/QExtensionManager> + +#include <QtCore/qplugin.h> +#include <QtGui/QPushButton> +#include <Qt3Support/Q3Wizard> + +QT_BEGIN_NAMESPACE + +Q3WizardPlugin::Q3WizardPlugin(const QIcon &icon, QObject *parent) + : QObject(parent), m_initialized(false), m_icon(icon) +{} + +QString Q3WizardPlugin::name() const +{ return QLatin1String("Q3Wizard"); } + +QString Q3WizardPlugin::group() const +{ return QLatin1String("[invisible]"); } + +QString Q3WizardPlugin::toolTip() const +{ return QString(); } + +QString Q3WizardPlugin::whatsThis() const +{ return QString(); } + +QString Q3WizardPlugin::includeFile() const +{ return QLatin1String("q3wizard.h"); } + +QIcon Q3WizardPlugin::icon() const +{ return m_icon; } + +bool Q3WizardPlugin::isContainer() const +{ return true; } + +QWidget *Q3WizardPlugin::createWidget(QWidget *parent) +{ + Q3Wizard *wizard = new Q3Wizard(parent); + new Q3WizardHelper(wizard); + wizard->backButton()->setObjectName(QLatin1String("__qt__passive_") + wizard->backButton()->objectName()); + wizard->nextButton()->setObjectName(QLatin1String("__qt__passive_") + wizard->nextButton()->objectName()); + return wizard; +} + +bool Q3WizardPlugin::isInitialized() const +{ return m_initialized; } + +void Q3WizardPlugin::initialize(QDesignerFormEditorInterface *core) +{ + Q_UNUSED(core); + + if (m_initialized) + return; + + m_initialized = true; + QExtensionManager *mgr = core->extensionManager(); + Q3WizardPropertySheetFactory::registerExtension(mgr); + mgr->registerExtensions(new Q3WizardContainerFactory(mgr), Q_TYPEID(QDesignerContainerExtension)); + mgr->registerExtensions(new Q3WizardExtraInfoFactory(core, mgr), Q_TYPEID(QDesignerExtraInfoExtension)); +} + +QString Q3WizardPlugin::codeTemplate() const +{ return QString(); } + +QString Q3WizardPlugin::domXml() const +{ + return QLatin1String("\ +<ui language=\"c++\">\ + <widget class=\"Q3Wizard\" name=\"wizard\">\ + <property name=\"geometry\">\ + <rect>\ + <x>0</x>\ + <y>0</y>\ + <width>100</width>\ + <height>80</height>\ + </rect>\ + </property>\ + <widget class=\"QWidget\" />\ + <widget class=\"QWidget\" />\ + </widget>\ +</ui>"); +} + + +QT_END_NAMESPACE diff --git a/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.h b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.h new file mode 100644 index 0000000..f21dfd3 --- /dev/null +++ b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_plugin.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 Q3WIZARD_PLUGIN_H +#define Q3WIZARD_PLUGIN_H + +#include <QtDesigner/QDesignerCustomWidgetInterface> + +QT_BEGIN_NAMESPACE + +class Q3WizardPlugin: public QObject, public QDesignerCustomWidgetInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetInterface) +public: + Q3WizardPlugin(const QIcon &icon, QObject *parent = 0); + + virtual QString name() const; + virtual QString group() const; + virtual QString toolTip() const; + virtual QString whatsThis() const; + virtual QString includeFile() const; + virtual QIcon icon() const; + virtual bool isContainer() const; + virtual QWidget *createWidget(QWidget *parent); + virtual bool isInitialized() const; + virtual void initialize(QDesignerFormEditorInterface *core); + virtual QString codeTemplate() const; + virtual QString domXml() const; + +private: + bool m_initialized; + QIcon m_icon; +}; + +QT_END_NAMESPACE + +#endif // Q3WIZARD_PLUGIN_H diff --git a/tools/designer/src/plugins/widgets/qt3supportwidgets.cpp b/tools/designer/src/plugins/widgets/qt3supportwidgets.cpp new file mode 100644 index 0000000..eafcf7a --- /dev/null +++ b/tools/designer/src/plugins/widgets/qt3supportwidgets.cpp @@ -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$ +** +****************************************************************************/ + +#include "q3toolbar/q3toolbar_plugin.h" +#include "q3iconview/q3iconview_plugin.h" +#include "q3wizard/q3wizard_plugin.h" +#include "q3mainwindow/q3mainwindow_plugin.h" +#include "q3widgetstack/q3widgetstack_plugin.h" +#include "q3listview/q3listview_plugin.h" +#include "q3table/q3table_plugin.h" +#include "q3listbox/q3listbox_plugin.h" +#include "q3listview/q3listview_plugin.h" +#include "q3textedit/q3textedit_plugin.h" +#include "q3widgets/q3widget_plugins.h" + +#include <QtDesigner/QDesignerCustomWidgetCollectionInterface> +#include <QtCore/qplugin.h> +#include <QtCore/qdebug.h> +#include <QtGui/QIcon> + +QT_BEGIN_NAMESPACE + +class Qt3SupportWidgets: public QObject, public QDesignerCustomWidgetCollectionInterface +{ + Q_OBJECT + Q_INTERFACES(QDesignerCustomWidgetCollectionInterface) +public: + Qt3SupportWidgets(QObject *parent = 0); + + virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const; + +private: + QList<QDesignerCustomWidgetInterface*> m_plugins; +}; + +Qt3SupportWidgets::Qt3SupportWidgets(QObject *parent) + : QObject(parent) +{ + const QIcon qt3Icon(QLatin1String(":/trolltech/formeditor/images/qt3logo.png")); + m_plugins.append(new Q3ToolBarPlugin(qt3Icon, this)); + m_plugins.append(new Q3IconViewPlugin(qt3Icon, this)); + m_plugins.append(new Q3GroupBoxPlugin(qt3Icon, this)); + m_plugins.append(new Q3FramePlugin(qt3Icon, this)); + m_plugins.append(new Q3WizardPlugin(qt3Icon, this)); + m_plugins.append(new Q3MainWindowPlugin(qt3Icon, this)); + m_plugins.append(new Q3WidgetStackPlugin(qt3Icon, this)); + m_plugins.append(new Q3ButtonGroupPlugin(qt3Icon, this)); + m_plugins.append(new Q3TablePlugin(qt3Icon, this)); + m_plugins.append(new Q3ListBoxPlugin(qt3Icon, this)); + m_plugins.append(new Q3ListViewPlugin(qt3Icon, this)); + m_plugins.append(new Q3ComboBoxPlugin(qt3Icon, this)); + m_plugins.append(new Q3TextEditPlugin(qt3Icon, this)); + m_plugins.append(new Q3DateEditPlugin(qt3Icon, this)); + m_plugins.append(new Q3TimeEditPlugin(qt3Icon, this)); + m_plugins.append(new Q3DateTimeEditPlugin(qt3Icon, this)); + m_plugins.append(new Q3ProgressBarPlugin(qt3Icon, this)); + m_plugins.append(new Q3TextBrowserPlugin(qt3Icon, this)); +} + +QList<QDesignerCustomWidgetInterface*> Qt3SupportWidgets::customWidgets() const +{ + return m_plugins; +} + +Q_EXPORT_PLUGIN(Qt3SupportWidgets) + +QT_END_NAMESPACE + +#include "qt3supportwidgets.moc" diff --git a/tools/designer/src/plugins/widgets/widgets.pro b/tools/designer/src/plugins/widgets/widgets.pro new file mode 100644 index 0000000..4d8f9ba --- /dev/null +++ b/tools/designer/src/plugins/widgets/widgets.pro @@ -0,0 +1,82 @@ +QT += qt3support +TEMPLATE = lib +CONFIG += plugin +DESTDIR = +TARGET = qt3supportwidgets + +CONFIG += qt warn_on qt_no_compat_warning + +include(../plugins.pri) +build_all:!build_pass { + CONFIG -= build_all + CONFIG += release +} + +DEPENDPATH += q3iconview \ + q3listview \ + q3mainwindow \ + q3toolbar \ + q3widgetstack \ + q3wizard \ + q3listbox \ + q3table \ + q3textedit \ + q3widgets + +INCLUDEPATH += . \ + q3iconview \ + q3listview \ + q3mainwindow \ + q3toolbar \ + q3widgetstack \ + q3wizard \ + q3listbox \ + q3table \ + q3textedit \ + q3widgets + + +SOURCES += qt3supportwidgets.cpp + +# Input +HEADERS += q3iconview/q3iconview_extrainfo.h \ + q3iconview/q3iconview_plugin.h \ + q3listview/q3listview_extrainfo.h \ + q3listview/q3listview_plugin.h \ + q3mainwindow/q3mainwindow_container.h \ + q3mainwindow/q3mainwindow_plugin.h \ + q3toolbar/q3toolbar_extrainfo.h \ + q3toolbar/q3toolbar_plugin.h \ + q3widgetstack/q3widgetstack_container.h \ + q3widgetstack/q3widgetstack_plugin.h \ + q3widgetstack/qdesigner_q3widgetstack_p.h \ + q3wizard/q3wizard_container.h \ + q3wizard/q3wizard_plugin.h \ + q3listbox/q3listbox_extrainfo.h \ + q3listbox/q3listbox_plugin.h \ + q3table/q3table_extrainfo.h \ + q3table/q3table_plugin.h \ + q3textedit/q3textedit_extrainfo.h \ + q3textedit/q3textedit_plugin.h \ + q3widgets/q3widget_plugins.h \ + +SOURCES += q3iconview/q3iconview_extrainfo.cpp \ + q3iconview/q3iconview_plugin.cpp \ + q3listview/q3listview_extrainfo.cpp \ + q3listview/q3listview_plugin.cpp \ + q3mainwindow/q3mainwindow_container.cpp \ + q3mainwindow/q3mainwindow_plugin.cpp \ + q3toolbar/q3toolbar_extrainfo.cpp \ + q3toolbar/q3toolbar_plugin.cpp \ + q3widgetstack/q3widgetstack_container.cpp \ + q3widgetstack/q3widgetstack_plugin.cpp \ + q3widgetstack/qdesigner_q3widgetstack.cpp \ + q3wizard/q3wizard_container.cpp \ + q3wizard/q3wizard_plugin.cpp \ + q3listbox/q3listbox_extrainfo.cpp \ + q3listbox/q3listbox_plugin.cpp \ + q3table/q3table_extrainfo.cpp \ + q3table/q3table_plugin.cpp \ + q3textedit/q3textedit_extrainfo.cpp \ + q3textedit/q3textedit_plugin.cpp \ + q3widgets/q3widget_plugins.cpp |