summaryrefslogtreecommitdiffstats
path: root/qt-models/cleanertablemodel.h
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-05-28 15:00:58 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-29 14:08:36 -0700
commit6e4aa7d044a344527e61f17c2254851ba799c4bd (patch)
tree1c0d4efddf9a9fc617f6a62789fd8aa48c1a125a /qt-models/cleanertablemodel.h
parent338c0f22aabefcfd5a5e87fceb4c82e73af3f5a9 (diff)
downloadsubsurface-6e4aa7d044a344527e61f17c2254851ba799c4bd.tar.gz
Move CleanerTableModel to its own file
models.h / .cpp was getting too big (around 2.5k lines), and each change triggered a rebuild in tons of parts of Subsurface, this is the first commit trying to make the models code sane by removing them all of the models.h/cpp file and also clearning code in the process. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models/cleanertablemodel.h')
-rw-r--r--qt-models/cleanertablemodel.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/qt-models/cleanertablemodel.h b/qt-models/cleanertablemodel.h
new file mode 100644
index 000000000..a717d7032
--- /dev/null
+++ b/qt-models/cleanertablemodel.h
@@ -0,0 +1,27 @@
+#ifndef CLEANERTABLEMODEL_H
+#define CLEANERTABLEMODEL_H
+
+#include <QAbstractTableModel>
+#include <QStringList>
+
+/* When using a QAbstractTableModel, consider using this instead
+ * of the default implementation, as it's easyer to setup the columns
+ * and headers.
+ * Most subsurface classes uses this one to save loads of lines
+ * of code and share a consistent layout. */
+
+class CleanerTableModel : public QAbstractTableModel {
+ Q_OBJECT
+public:
+ explicit CleanerTableModel(QObject *parent = 0);
+ virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+
+protected:
+ void setHeaderDataStrings(const QStringList &headers);
+
+private:
+ QStringList headers;
+};
+
+#endif