summaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/guiSQLiteStudio/selectabledbobjmodel.h
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2014-12-06 17:33:25 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2014-12-06 17:33:25 -0500
commit7167ce41b61d2ba2cdb526777a4233eb84a3b66a (patch)
treea35c14143716e1f2c98f808c81f89426045a946f /SQLiteStudio3/guiSQLiteStudio/selectabledbobjmodel.h
Imported Upstream version 2.99.6upstream/2.99.6
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/selectabledbobjmodel.h')
-rw-r--r--SQLiteStudio3/guiSQLiteStudio/selectabledbobjmodel.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/selectabledbobjmodel.h b/SQLiteStudio3/guiSQLiteStudio/selectabledbobjmodel.h
new file mode 100644
index 0000000..2fca1b4
--- /dev/null
+++ b/SQLiteStudio3/guiSQLiteStudio/selectabledbobjmodel.h
@@ -0,0 +1,44 @@
+#ifndef SELECTABLEDBOBJMODEL_H
+#define SELECTABLEDBOBJMODEL_H
+
+#include "guiSQLiteStudio_global.h"
+#include <QSortFilterProxyModel>
+#include <QSet>
+
+class DbTreeItem;
+class QTreeView;
+
+class GUI_API_EXPORT SelectableDbObjModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+ public:
+ explicit SelectableDbObjModel(QObject *parent = 0);
+
+ QVariant data(const QModelIndex& index, int role) const;
+ bool setData(const QModelIndex& index, const QVariant& value, int role);
+ Qt::ItemFlags flags(const QModelIndex& index) const;
+
+ QString getDbName() const;
+ void setDbName(const QString& value);
+
+ QStringList getCheckedObjects() const;
+ void setCheckedObjects(const QStringList& value);
+
+ void setRootChecked(bool checked);
+ DbTreeItem* getItemForIndex(const QModelIndex& index) const;
+
+ protected:
+ bool filterAcceptsRow(int srcRow, const QModelIndex& srcParent) const;
+
+ private:
+ DbTreeItem* getItemForProxyIndex(const QModelIndex& index) const;
+ Qt::CheckState getStateFromChilds(const QModelIndex& index) const;
+ void setRecurrently(const QModelIndex& index, Qt::CheckState checked);
+ bool isObject(DbTreeItem* item) const;
+ bool checkRecurrentlyForDb(DbTreeItem* item) const;
+
+ QSet<QString> checkedObjects;
+ QString dbName;
+};
+
+#endif // SELECTABLEDBOBJMODEL_H