qpropertyeditor_items_p.h
来自「奇趣公司比较新的qt/emd版本」· C头文件 代码 · 共 678 行 · 第 1/2 页
H
678 行
/******************************************************************************** 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.******************************************************************************/#ifndef QPROPERTYEDITOR_ITEMS_P_H#define QPROPERTYEDITOR_ITEMS_P_H//// W A R N I N G// -------------//// This file is not part of the Qt API. It exists purely as an// implementation detail. This header file may change from version to// version without notice, or even be removed.//// We mean it.//#include "propertyeditor_global.h"#include <shared_enums_p.h>#include <QtCore/QStringList>#include <QtCore/QVariant>#include <QtCore/QMap>#include <QtCore/QDateTime>#include <QtCore/QUrl>#include <QtGui/QCursor>#include <QtGui/QPalette>#include <QtGui/QFont>#include <QtGui/QKeySequence>class QWidget;class QComboBox;namespace qdesigner_internal {class QT_PROPERTYEDITOR_EXPORT IProperty{ IProperty(const IProperty&); IProperty& operator=(const IProperty&);public: enum Kind { Property_Normal, Property_Group // ### more }; inline IProperty() : m_parent(0), m_changed(0), m_dirty(0), m_fake(0), m_reset(0) {} virtual ~IProperty() {} // ### pure bool changed() const { return m_changed; } void setChanged(bool b); bool dirty() const { return m_dirty; } void setDirty(bool b); bool hasReset() const { return m_reset; } void setHasReset(bool b) { m_reset = b; } bool isFake() const { return m_fake; } void setFake(bool b) { m_fake = b; } virtual IProperty::Kind kind() const = 0; virtual bool isSeparator() const { return false; } virtual IProperty *parent() const { return m_parent; } virtual void setParent(IProperty *parent) { m_parent = parent; } virtual QString propertyName() const = 0; virtual QVariant value() const = 0; virtual void setValue(const QVariant &value) = 0; virtual QString toString() const = 0; virtual QVariant decoration() const = 0; virtual bool hasEditor() const = 0; virtual QWidget *createEditor(QWidget *parent, const QObject *target, const char *receiver) const = 0; // ### pure virtual void updateEditorContents(QWidget *editor) { Q_UNUSED(editor); } virtual void updateValue(QWidget *editor) { Q_UNUSED(editor); } virtual bool hasExternalEditor() const = 0; virtual QWidget *createExternalEditor(QWidget *parent) = 0;protected: IProperty *m_parent; uint m_changed : 1; uint m_dirty : 1; uint m_fake : 1; uint m_reset : 1;};class QT_PROPERTYEDITOR_EXPORT IPropertyGroup: public IProperty{public: virtual int indexOf(IProperty *property) const = 0; virtual int propertyCount() const = 0; virtual IProperty *propertyAt(int index) const = 0;};template <typename T>class QT_PROPERTYEDITOR_EXPORT AbstractProperty: public IProperty{public: AbstractProperty(const T &value, const QString &name) : m_value(value), m_name(name) {} IProperty::Kind kind() const { return IProperty::Property_Normal; }//// IProperty Interface// QVariant decoration() const { return QVariant(); } QString propertyName() const { return m_name; } QVariant value() const { return qVariantFromValue(m_value); } bool hasEditor() const { return true; } bool hasExternalEditor() const { return false; } QWidget *createExternalEditor(QWidget *parent) { Q_UNUSED(parent); return 0; }protected: T m_value; const QString m_name;};class QT_PROPERTYEDITOR_EXPORT AbstractPropertyGroup: public IPropertyGroup{public: AbstractPropertyGroup(const QString &name) : m_name(name) {} ~AbstractPropertyGroup() { qDeleteAll(m_properties); } IProperty::Kind kind() const { return Property_Group; }//// IPropertyGroup Interface// int indexOf(IProperty *property) const { return m_properties.indexOf(property); } int propertyCount() const { return m_properties.size(); } IProperty *propertyAt(int index) const { return m_properties.at(index); }//// IProperty Interface// inline QString propertyName() const { return m_name; } inline QVariant decoration() const { return QVariant(); } QString toString() const; inline bool hasEditor() const { return true; } QWidget *createEditor(QWidget *parent, const QObject *target, const char *receiver) const; virtual void updateEditorContents(QWidget *editor); inline bool hasExternalEditor() const { return false; } QWidget *createExternalEditor(QWidget *parent) { Q_UNUSED(parent); return 0; }protected: const QString m_name; QList<IProperty*> m_properties;};class QT_PROPERTYEDITOR_EXPORT PropertyCollection: public IPropertyGroup{public: PropertyCollection(const QString &name); ~PropertyCollection(); inline IProperty::Kind kind() const { return Property_Group; } void addProperty(IProperty *property); void removeProperty(IProperty *property);//// IPropertyGroup Interface// int indexOf(IProperty *property) const; int propertyCount() const; IProperty *propertyAt(int index) const;//// IProperty Interface// QString propertyName() const; QVariant value() const; void setValue(const QVariant &value); QVariant decoration() const { return QVariant(); } QString toString() const; bool hasEditor() const; QWidget *createEditor(QWidget *parent, const QObject *target, const char *receiver) const; bool hasExternalEditor() const; QWidget *createExternalEditor(QWidget *parent);private: const QString m_name; QList<IProperty*> m_properties;};class QT_PROPERTYEDITOR_EXPORT IntProperty: public AbstractProperty<int>{public: IntProperty(int value, const QString &name); QString specialValue() const; void setSpecialValue(const QString &specialValue); void setRange(int low, int hi); void setValue(const QVariant &value); QString toString() const; QWidget *createEditor(QWidget *parent, const QObject *target, const char *receiver) const; void updateEditorContents(QWidget *editor); void updateValue(QWidget *editor);private: QString m_specialValue; int m_low; int m_hi;};class QT_PROPERTYEDITOR_EXPORT BoolProperty: public AbstractProperty<bool>{public: BoolProperty(bool value, const QString &name); void setValue(const QVariant &value); QString toString() const; QWidget *createEditor(QWidget *parent, const QObject *target, const char *receiver) const; void updateEditorContents(QWidget *editor); void updateValue(QWidget *editor);};class QT_PROPERTYEDITOR_EXPORT LongLongProperty: public AbstractProperty<qlonglong>{public: LongLongProperty(qlonglong value, const QString &name); void setValue(const QVariant &value); QString toString() const; QWidget *createEditor(QWidget *parent, const QObject *target, const char *receiver) const; void updateEditorContents(QWidget *editor); void updateValue(QWidget *editor);};class QT_PROPERTYEDITOR_EXPORT DoubleProperty: public AbstractProperty<double>{public: DoubleProperty(double value, const QString &name); void setValue(const QVariant &value); QString toString() const; QWidget *createEditor(QWidget *parent, const QObject *target, const char *receiver) const; void updateEditorContents(QWidget *editor); void updateValue(QWidget *editor);};class QT_PROPERTYEDITOR_EXPORT SpinBoxDoubleProperty: public AbstractProperty<double>{public: SpinBoxDoubleProperty(double value, const QString &name); QString specialValue() const; void setSpecialValue(const QString &specialValue); void setRange(double low, double hi); void setValue(const QVariant &value); QString toString() const; QWidget *createEditor(QWidget *parent, const QObject *target, const char *receiver) const; void updateEditorContents(QWidget *editor); void updateValue(QWidget *editor);private: QString m_specialValue;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?