From 1dac74cfab34339b19fd01d0d1c36a84ef2458af Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 11 Jun 2018 22:47:49 +0200 Subject: [PATCH] Make an enum for the view columns. --- clip_list.cpp | 16 ++++++++-------- clip_list.h | 11 +++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/clip_list.cpp b/clip_list.cpp index d8eada8..2599dcc 100644 --- a/clip_list.cpp +++ b/clip_list.cpp @@ -15,7 +15,7 @@ int ClipList::rowCount(const QModelIndex &parent) const { int ClipList::columnCount(const QModelIndex &parent) const { if (parent.isValid()) return 0; - return 7; + return Column::NUM_COLUMNS; } QVariant ClipList::data(const QModelIndex &parent, int role) const { @@ -55,19 +55,19 @@ QVariant ClipList::headerData(int section, Qt::Orientation orientation, int role return QVariant(); switch (section) { - case 0: + case Column::IN: return "In"; - case 1: + case Column::OUT: return "Out"; - case 2: + case Column::DURATION: return "Duration"; - case 3: + case Column::CAMERA_1: return "Camera 1"; - case 4: + case Column::CAMERA_2: return "Camera 2"; - case 5: + case Column::CAMERA_3: return "Camera 3"; - case 6: + case Column::CAMERA_4: return "Camera 4"; default: return ""; diff --git a/clip_list.h b/clip_list.h index da76f8c..1cdbf35 100644 --- a/clip_list.h +++ b/clip_list.h @@ -17,6 +17,17 @@ class ClipList : public QAbstractTableModel { Q_OBJECT public: + enum Column { + IN, + OUT, + DURATION, + CAMERA_1, + CAMERA_2, + CAMERA_3, + CAMERA_4, + NUM_COLUMNS + }; + int rowCount(const QModelIndex &parent) const override; int columnCount(const QModelIndex &parent) const override; QVariant data(const QModelIndex &parent, int role) const override; -- 2.39.2