⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propertyselectormodel.h

📁 压缩包里有教材<<C++模式设计-基于QT4开源跨平台开发框架>>所有源码
💻 H
字号:
#ifndef _PROPERTY_SELECTOR_MODEL_H_#define _PROPERTY_SELECTOR_MODEL_H_#include <QObject>#include <QStringList>#include <QAbstractListModel>#include <QVariant>#include <QItemSelection>using namespace Qt;class DataObject;class QAction;/** This class facilitates the use of the properties of another class ascolumn headers in a view. It has methods that allow the user to selectproperties in the associated list view and it has accessors forgetting either the full list of properties or the list of selected properties.*///start id=overridesclass PropertySelectorModel : public QAbstractListModel {    Q_OBJECTpublic:    PropertySelectorModel(DataObject* propnamesrc, QObject* parent = 0);    int rowCount(const QModelIndex& parent = QModelIndex()) const;    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;    QVariant headerData(int section, Qt::Orientation orientation,                        int role = DisplayRole) const;    ItemFlags flags(const QModelIndex &index) const;    bool setData(const QModelIndex &index, const QVariant &value,                 int role = EditRole);    bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex());    bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex());//end//start id=additional-methods    void initializePropertyNames();    QStringList getAllPropertyNames() const;    QStringList getSelectedPropertyNames() const;//end    //start id=signals-slotssignals:    void readyQuit();    void readyCloseWindow(bool);    void readyRestore(QList<QPersistentModelIndex>);public slots:    void updateSelects(QModelIndexList selects);    void prepareShow();//end//start id=overridesprivate:    QStringList m_PropertyNames;    DataObject* m_PropNameSource;//stop//start id=signals-slots    QList<QPersistentModelIndex> m_SelectedIndexes;//stop//start id=overrides};//stop#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -