diff src/metadataview.cpp @ 88:3916cb3c9105

Add new FilterSort model that allows to include empty values
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 19 Jun 2015 14:26:16 +0200
parents 9a03703622b8
children b8c7644a9d49
line wrap: on
line diff
--- a/src/metadataview.cpp	Thu Jun 18 19:35:22 2015 +0200
+++ b/src/metadataview.cpp	Fri Jun 19 14:26:16 2015 +0200
@@ -8,6 +8,7 @@
 #include "metadataview.h"
 #include "qxtcsvmodel.h"
 #include "filterwidget.h"
+#include "includeemptysortmodel.h"
 #include "constants.h"
 
 #include <QTextCodec>
@@ -47,7 +48,7 @@
     QWidget(parent, f),
     mDateColIdx(-1) {
     /* Create models */
-    mSortModel = new QSortFilterProxyModel;
+    mSortModel = new IncludeEmptySortModel;
     mCSVModel = new numericSortCSVModel;
     setupGUI();
 
@@ -61,12 +62,14 @@
 void MetaDataView::setupGUI() {
     QVBoxLayout *baseLayout = new QVBoxLayout;
 
-    FilterWidget *filterWidget = new FilterWidget(mSortModel);
-    connect(filterWidget, &FilterWidget::filterHasChanged,
+    mFilterWidget = new FilterWidget(mSortModel, true);
+    connect(mFilterWidget, &FilterWidget::filterHasChanged,
             this, &MetaDataView::applyDefaultSort);
-    connect(filterWidget, &FilterWidget::filterHasChanged,
+    connect(mFilterWidget, &FilterWidget::includeEmptyChanged,
+            mSortModel, &IncludeEmptySortModel::setIncludeEmpty);
+    connect(mFilterWidget, &FilterWidget::filterHasChanged,
             this, &MetaDataView::selectFirstRow);
-    baseLayout->addWidget(filterWidget);
+    baseLayout->addWidget(mFilterWidget);
 
     mView = new QTableView;
     mView->setModel(mSortModel);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)