widgetdatabase.cpp
来自「奇趣公司比较新的qt/emd版本」· C++ 代码 · 共 533 行 · 第 1/2 页
CPP
533 行
/******************************************************************************** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.**** This file is part of the Qt Designer of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.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 GNU** General Public Licensing requirements will be met:** http://trolltech.com/products/qt/licenses/licensing/opensource/**** If you are unsure which license is appropriate for your use, please** review the following information:** http://trolltech.com/products/qt/licenses/licensing/licensingoverview** or contact the sales department at sales@trolltech.com.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#include "widgetdatabase_p.h"#include "widgetfactory_p.h"#include "spacer_widget_p.h"#include "abstractlanguage.h"#include "pluginmanager_p.h"#include "qdesigner_utils_p.h"#include <QtDesigner/customwidget.h>#include <QtDesigner/propertysheet.h>#include <QtDesigner/QExtensionManager>#include <QtDesigner/QDesignerFormEditorInterface>#include <qalgorithms.h>#include <QtCore/qdebug.h>#include <QtCore/QMetaProperty>namespace { enum { debugWidgetDataBase = 0 };}namespace qdesigner_internal {// ----------------------------------------------------------WidgetDataBaseItem::WidgetDataBaseItem(const QString &name, const QString &group) : m_name(name), m_group(group), m_compat(0), m_container(0), m_form(0), m_custom(0), m_promoted(0){}QString WidgetDataBaseItem::name() const{ return m_name;}void WidgetDataBaseItem::setName(const QString &name){ m_name = name;}QString WidgetDataBaseItem::group() const{ return m_group;}void WidgetDataBaseItem::setGroup(const QString &group){ m_group = group;}QString WidgetDataBaseItem::toolTip() const{ return m_toolTip;}void WidgetDataBaseItem::setToolTip(const QString &toolTip){ m_toolTip = toolTip;}QString WidgetDataBaseItem::whatsThis() const{ return m_whatsThis;}void WidgetDataBaseItem::setWhatsThis(const QString &whatsThis){ m_whatsThis = whatsThis;}QString WidgetDataBaseItem::includeFile() const{ return m_includeFile;}void WidgetDataBaseItem::setIncludeFile(const QString &includeFile){ m_includeFile = includeFile;}QIcon WidgetDataBaseItem::icon() const{ return m_icon;}void WidgetDataBaseItem::setIcon(const QIcon &icon){ m_icon = icon;}bool WidgetDataBaseItem::isCompat() const{ return m_compat;}void WidgetDataBaseItem::setCompat(bool b){ m_compat = b;}bool WidgetDataBaseItem::isContainer() const{ return m_container;}void WidgetDataBaseItem::setContainer(bool b){ m_container = b;}bool WidgetDataBaseItem::isCustom() const{ return m_custom;}void WidgetDataBaseItem::setCustom(bool b){ m_custom = b;}QString WidgetDataBaseItem::pluginPath() const{ return m_pluginPath;}void WidgetDataBaseItem::setPluginPath(const QString &path){ m_pluginPath = path;}bool WidgetDataBaseItem::isPromoted() const{ return m_promoted;}void WidgetDataBaseItem::setPromoted(bool b){ m_promoted = b;}QString WidgetDataBaseItem::extends() const{ return m_extends;}void WidgetDataBaseItem::setExtends(const QString &s){ m_extends = s;}void WidgetDataBaseItem::setDefaultPropertyValues(const QList<QVariant> &list){ m_defaultPropertyValues = list;}QList<QVariant> WidgetDataBaseItem::defaultPropertyValues() const{ return m_defaultPropertyValues;}WidgetDataBaseItem *WidgetDataBaseItem::clone(const QDesignerWidgetDataBaseItemInterface *item){ WidgetDataBaseItem *rc = new WidgetDataBaseItem(item->name(), item->group()); rc->setToolTip(item->toolTip()); rc->setWhatsThis(item->whatsThis()); rc->setIncludeFile(item->includeFile()); rc->setIcon(item->icon()); rc->setCompat(item->isCompat()); rc->setContainer(item->isContainer()); rc->setCustom(item->isCustom() ); rc->setPluginPath(item->pluginPath()); rc->setPromoted(item->isPromoted()); rc->setExtends(item->extends()); rc->setDefaultPropertyValues(item->defaultPropertyValues()); return rc;}// ----------------------------------------------------------WidgetDataBase::WidgetDataBase(QDesignerFormEditorInterface *core, QObject *parent) : QDesignerWidgetDataBaseInterface(parent), m_core(core){#define DECLARE_LAYOUT(L, C)#define DECLARE_COMPAT_WIDGET(W, C) DECLARE_WIDGET(W, C)#define DECLARE_WIDGET(W, C) append(new WidgetDataBaseItem(QString::fromUtf8(#W)));#include "widgets.table"#undef DECLARE_COMPAT_WIDGET#undef DECLARE_LAYOUT#undef DECLARE_WIDGET#undef DECLARE_WIDGET_1 append(new WidgetDataBaseItem(QString::fromUtf8("Line"))); append(new WidgetDataBaseItem(QString::fromUtf8("Spacer"))); append(new WidgetDataBaseItem(QString::fromUtf8("QSplitter"))); append(new WidgetDataBaseItem(QString::fromUtf8("QLayoutWidget"))); // QDesignerWidget is used as central widget and as container for tab widgets, etc. WidgetDataBaseItem *designerWidgetItem = new WidgetDataBaseItem(QString::fromUtf8("QDesignerWidget")); designerWidgetItem->setContainer(true); append(designerWidgetItem); append(new WidgetDataBaseItem(QString::fromUtf8("QDesignerDialog"))); append(new WidgetDataBaseItem(QString::fromUtf8("QDesignerMenu"))); append(new WidgetDataBaseItem(QString::fromUtf8("QDesignerMenuBar"))); append(new WidgetDataBaseItem(QString::fromUtf8("QDesignerDockWidget"))); append(new WidgetDataBaseItem(QString::fromUtf8("QDesignerQ3WidgetStack"))); append(new WidgetDataBaseItem(QString::fromUtf8("QAction"))); // ### remove me // ### check the casts#if 0 // ### enable me after 4.1 static_cast<WidgetDataBaseItem *>(item(indexOfClassName(QLatin1String("QToolBar"))))->setContainer(true);#endif static_cast<WidgetDataBaseItem *>(item(indexOfClassName(QLatin1String("QTabWidget"))))->setContainer(true); static_cast<WidgetDataBaseItem *>(item(indexOfClassName(QLatin1String("QGroupBox"))))->setContainer(true); static_cast<WidgetDataBaseItem *>(item(indexOfClassName(QLatin1String("QStackedWidget"))))->setContainer(true); static_cast<WidgetDataBaseItem *>(item(indexOfClassName(QLatin1String("QToolBox"))))->setContainer(true); static_cast<WidgetDataBaseItem *>(item(indexOfClassName(QLatin1String("QFrame"))))->setContainer(true); static_cast<WidgetDataBaseItem *>(item(indexOfClassName(QLatin1String("QLayoutWidget"))))->setContainer(true); static_cast<WidgetDataBaseItem *>(item(indexOfClassName(QLatin1String("QDesignerWidget"))))->setContainer(true); static_cast<WidgetDataBaseItem *>(item(indexOfClassName(QLatin1String("QDesignerDialog"))))->setContainer(true); static_cast<WidgetDataBaseItem *>(item(indexOfClassName(QLatin1String("QSplitter"))))->setContainer(true); static_cast<WidgetDataBaseItem *>(item(indexOfClassName(QLatin1String("QMainWindow"))))->setContainer(true);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?