DecoderSelector: Use proxy model to permit sorting
[pulseview.git] / pv / subwindows / decoder_selector / subwindow.hpp
index baeedd36dad343a7247a8bdf53be2b2643c49916..dba6f6deed8f72515d58bcd15df5fa0175e2f836 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <QAbstractItemModel>
 #include <QLabel>
+#include <QSortFilterProxyModel>
 #include <QSplitter>
 #include <QTreeView>
 
@@ -84,6 +85,17 @@ private:
 };
 
 
+class QCustomTreeView : public QTreeView
+{
+       Q_OBJECT
+
+public:
+       void currentChanged(const QModelIndex& current, const QModelIndex& previous);
+
+Q_SIGNALS:
+       void currentChanged(const QModelIndex& current);
+};
+
 class SubWindow : public SubWindowBase
 {
        Q_OBJECT
@@ -112,17 +124,18 @@ Q_SIGNALS:
        void new_decoders_selected(vector<const srd_decoder*> decoders);
 
 public Q_SLOTS:
-       void on_item_clicked(const QModelIndex& index);
-       void on_item_double_clicked(const QModelIndex& index);
+       void on_item_changed(const QModelIndex& index);
+       void on_item_activated(const QModelIndex& index);
 
 private:
        QSplitter* splitter_;
-       QTreeView* tree_view_;
+       QCustomTreeView* tree_view_;
        QWidget* info_box_;
        QLabel* info_label_header_;
        QLabel* info_label_body_;
        QLabel* info_label_footer_;
        DecoderCollectionModel* model_;
+       QSortFilterProxyModel* sort_filter_model_;
 };
 
 } // decoder_selector