#ifndef APPPROPERTIESMODEL_H #define APPPROPERTIESMODEL_H #include #include #include #include #include class AppPropertiesModel : public QAbstractTableModel { Q_OBJECT struct AppProp { QString key; QString value; }; public: AppPropertiesModel(QObject* parent = 0); ~AppPropertiesModel(); void setProp(const QString& key, const QString& value); void removeProp(const QString& key); void clear(); QVariant data(const QModelIndex &i, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); private: typedef QMap Map; typedef QMap IndexHelper; typedef std::deque Index; typedef std::pair Pair; typedef std::list List; Index index; IndexHelper helper; Map map; List toInsert; }; #endif // APPPROPERTIESMODEL_H