Mercurial > hg > svcore
comparison data/model/TextModel.h @ 1580:c01cbe41aeb5 fix-static-analysis
Use override throughout
author | Chris Cannam |
---|---|
date | Mon, 26 Nov 2018 13:48:45 +0000 |
parents | 48e9f538e6e9 |
children | ad5f892c0c4d |
comparison
equal
deleted
inserted
replaced
1579:232d6ddf257d | 1580:c01cbe41aeb5 |
---|---|
42 QString label; | 42 QString label; |
43 | 43 |
44 QString getLabel() const { return label; } | 44 QString getLabel() const { return label; } |
45 | 45 |
46 void toXml(QTextStream &stream, QString indent = "", | 46 void toXml(QTextStream &stream, QString indent = "", |
47 QString extraAttributes = "") const | 47 QString extraAttributes = "") const override |
48 { | 48 { |
49 stream << QString("%1<point frame=\"%2\" height=\"%3\" label=\"%4\" %5/>\n") | 49 stream << QString("%1<point frame=\"%2\" height=\"%3\" label=\"%4\" %5/>\n") |
50 .arg(indent).arg(frame).arg(height) | 50 .arg(indent).arg(frame).arg(height) |
51 .arg(encodeEntities(label)).arg(extraAttributes); | 51 .arg(encodeEntities(label)).arg(extraAttributes); |
52 } | 52 } |
87 public: | 87 public: |
88 TextModel(sv_samplerate_t sampleRate, int resolution, bool notifyOnAdd = true) : | 88 TextModel(sv_samplerate_t sampleRate, int resolution, bool notifyOnAdd = true) : |
89 SparseModel<TextPoint>(sampleRate, resolution, notifyOnAdd) | 89 SparseModel<TextPoint>(sampleRate, resolution, notifyOnAdd) |
90 { } | 90 { } |
91 | 91 |
92 virtual void toXml(QTextStream &out, | 92 void toXml(QTextStream &out, |
93 QString indent = "", | 93 QString indent = "", |
94 QString extraAttributes = "") const | 94 QString extraAttributes = "") const override |
95 { | 95 { |
96 SparseModel<TextPoint>::toXml | 96 SparseModel<TextPoint>::toXml |
97 (out, | 97 (out, |
98 indent, | 98 indent, |
99 QString("%1 subtype=\"text\"") | 99 QString("%1 subtype=\"text\"") |
100 .arg(extraAttributes)); | 100 .arg(extraAttributes)); |
101 } | 101 } |
102 | 102 |
103 QString getTypeName() const { return tr("Text"); } | 103 QString getTypeName() const override { return tr("Text"); } |
104 | 104 |
105 /** | 105 /** |
106 * TabularModel methods. | 106 * TabularModel methods. |
107 */ | 107 */ |
108 | 108 |
109 virtual int getColumnCount() const | 109 int getColumnCount() const override |
110 { | 110 { |
111 return 4; | 111 return 4; |
112 } | 112 } |
113 | 113 |
114 virtual QString getHeading(int column) const | 114 QString getHeading(int column) const override |
115 { | 115 { |
116 switch (column) { | 116 switch (column) { |
117 case 0: return tr("Time"); | 117 case 0: return tr("Time"); |
118 case 1: return tr("Frame"); | 118 case 1: return tr("Frame"); |
119 case 2: return tr("Height"); | 119 case 2: return tr("Height"); |
120 case 3: return tr("Label"); | 120 case 3: return tr("Label"); |
121 default: return tr("Unknown"); | 121 default: return tr("Unknown"); |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 virtual QVariant getData(int row, int column, int role) const | 125 QVariant getData(int row, int column, int role) const override |
126 { | 126 { |
127 if (column < 2) { | 127 if (column < 2) { |
128 return SparseModel<TextPoint>::getData | 128 return SparseModel<TextPoint>::getData |
129 (row, column, role); | 129 (row, column, role); |
130 } | 130 } |
137 case 3: return i->label; | 137 case 3: return i->label; |
138 default: return QVariant(); | 138 default: return QVariant(); |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role) | 142 Command *getSetDataCommand(int row, int column, const QVariant &value, int role) override |
143 { | 143 { |
144 if (column < 2) { | 144 if (column < 2) { |
145 return SparseModel<TextPoint>::getSetDataCommand | 145 return SparseModel<TextPoint>::getSetDataCommand |
146 (row, column, value, role); | 146 (row, column, value, role); |
147 } | 147 } |
161 | 161 |
162 command->addPoint(point); | 162 command->addPoint(point); |
163 return command->finish(); | 163 return command->finish(); |
164 } | 164 } |
165 | 165 |
166 virtual bool isColumnTimeValue(int column) const | 166 bool isColumnTimeValue(int column) const override |
167 { | 167 { |
168 return (column < 2); | 168 return (column < 2); |
169 } | 169 } |
170 | 170 |
171 virtual SortType getSortType(int column) const | 171 SortType getSortType(int column) const override |
172 { | 172 { |
173 if (column == 3) return SortAlphabetical; | 173 if (column == 3) return SortAlphabetical; |
174 return SortNumeric; | 174 return SortNumeric; |
175 } | 175 } |
176 | 176 |