ui/qt/model.h

changeset 72
a00b46d92c54
parent 69
419c8c3209e8
child 130
212b63dd61be
--- a/ui/qt/model.h	Sun Jan 11 16:33:28 2015 +0100
+++ b/ui/qt/model.h	Mon Jan 12 12:03:05 2015 +0100
@@ -32,11 +32,35 @@
 #include "toolkit.h"
 #include "../ui/tree.h"
 #include "../common/context.h"
+#include <QListView>
 #include <QTreeView>
+#include <QAbstractListModel>
 #include <QAbstractTableModel>
 #include <QAbstractItemModel>
 #include <QItemSelectionModel>
 
+class ListModel : public QAbstractListModel {
+    Q_OBJECT
+    
+    UiObject    *obj;
+    UiListPtr   *list;
+    ui_model_getvalue_f getvalue;
+    ui_callback callback;
+    void        *userdata;
+    QListView   *view;
+    
+public:
+    ListModel(UiObject *obj, QListView *view, UiListPtr *list, ui_model_getvalue_f getvalue, ui_callback f, void *userdata);
+    
+    int rowCount(const QModelIndex &parent = QModelIndex()) const;
+    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+    
+public slots:
+    void selectionChanged(
+        const QItemSelection & selected,
+        const QItemSelection & deselected);
+};
+
 class TableModel : public QAbstractTableModel {
     Q_OBJECT
     
@@ -47,13 +71,10 @@
 public:
     TableModel(UiObject *obj, QTreeView *view, UiListPtr *list, UiModelInfo *info);
     
-    int rowCount(const QModelIndex &parent = QModelIndex()) const ;
+    int rowCount(const QModelIndex &parent = QModelIndex()) const;
     int columnCount(const QModelIndex &parent = QModelIndex()) const;
     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
-
-private:
-    UiListSelection* listSelection();
     
 public slots:
     void selectionChanged(
@@ -62,5 +83,7 @@
     void activate(const QModelIndex &);
 };
 
+UiListSelection* listSelection(QItemSelectionModel *s);
+
 #endif	/* MODEL_H */
 

mercurial