diff -r 3e021c5f18a0 -r a00b46d92c54 ui/qt/model.h --- 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 #include +#include #include #include #include +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 */