summaryrefslogtreecommitdiffstats
path: root/src/sessiontreemodel.h
diff options
context:
space:
mode:
authorJan Darmochwal2010-10-03 18:39:42 +0200
committerJan Darmochwal2010-10-03 18:39:42 +0200
commitee3f7eafae9e2e570c95e1afa9bea156ba3bf736 (patch)
tree7ffcb71280a344bde5249069991a1b5b841474df /src/sessiontreemodel.h
parentQt port is almost complete (at least it compiles) (diff)
downloadvmchooser-ee3f7eafae9e2e570c95e1afa9bea156ba3bf736.tar.gz
vmchooser-ee3f7eafae9e2e570c95e1afa9bea156ba3bf736.tar.xz
vmchooser-ee3f7eafae9e2e570c95e1afa9bea156ba3bf736.zip
TreeView for sessions (replaces ListView)
TreeView with SessionTreeModel replaces the old List View Other changes: * fixed bad copy and paste in CMakeLists.txt * added make clean to build.sh * removed moc_ and ui_ files from src
Diffstat (limited to 'src/sessiontreemodel.h')
-rw-r--r--src/sessiontreemodel.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/sessiontreemodel.h b/src/sessiontreemodel.h
new file mode 100644
index 0000000..31611cb
--- /dev/null
+++ b/src/sessiontreemodel.h
@@ -0,0 +1,36 @@
+#ifndef VMCHOOSER_SESSIONTREEMODEL_H
+#define VMCHOOSER_SESSIONTREEMODEL_H
+
+#include <QAbstractItemModel>
+#include <QModelIndex>
+#include <QVariant>
+
+class SessionTreeItem;
+class Session;
+
+class SessionTreeModel : public QAbstractItemModel
+{
+ Q_OBJECT
+
+public:
+ SessionTreeModel(QObject *parent = 0);
+ ~SessionTreeModel();
+
+ QVariant data(const QModelIndex &index, int role) const;
+ Qt::ItemFlags flags(const QModelIndex &index) const;
+ QVariant headerData(int section, Qt::Orientation orientation,
+ int role = Qt::DisplayRole) const;
+ QModelIndex index(int row, int column,
+ const QModelIndex &parent = QModelIndex()) const;
+ QModelIndex parent(const QModelIndex &index) const;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+
+ void addItems(const QList<Session*>& sessions, const QString& section);
+
+
+private:
+ SessionTreeItem* root_;
+};
+
+#endif // VMCHOOSER_SESSIONTREEMODEL_H