From: Steinar H. Gunderson Date: Mon, 11 Jun 2018 20:47:49 +0000 (+0200) Subject: Make an enum for the view columns. X-Git-Tag: 1.8.0~76^2~283 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=1dac74cfab34339b19fd01d0d1c36a84ef2458af;p=nageru Make an enum for the view columns. --- 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;