MCPcopy Create free account
hub / github.com/KDAB/KDChart / compareAttributes

Method compareAttributes

src/KDChart/KDChartAttributesModel.cpp:168–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168bool AttributesModel::compareAttributes(
169 int role, const QVariant &a, const QVariant &b) const
170{
171 if (isKnownAttributesRole(role)) {
172 switch (role) {
173 case DataValueLabelAttributesRole:
174 return (a.value<DataValueAttributes>() == b.value<DataValueAttributes>());
175 case DatasetBrushRole:
176 return (a.value<QBrush>() == b.value<QBrush>());
177 case DatasetPenRole:
178 return (a.value<QPen>() == b.value<QPen>());
179 case ThreeDAttributesRole:
180 // As of yet there is no ThreeDAttributes class,
181 // and the AbstractThreeDAttributes class is pure virtual,
182 // so we ignore this role for now.
183 // (khz, 04.04.2007)
184 /*
185 return (qVariantValue<ThreeDAttributes>( a ) ==
186 qVariantValue<ThreeDAttributes>( b ));
187 */
188 break;
189 case LineAttributesRole:
190 return (a.value<LineAttributes>() == b.value<LineAttributes>());
191 case ThreeDLineAttributesRole:
192 return (a.value<ThreeDLineAttributes>() == b.value<ThreeDLineAttributes>());
193 case BarAttributesRole:
194 return (a.value<BarAttributes>() == b.value<BarAttributes>());
195 case StockBarAttributesRole:
196 return (a.value<StockBarAttributes>() == b.value<StockBarAttributes>());
197 case ThreeDBarAttributesRole:
198 return (a.value<ThreeDBarAttributes>() == b.value<ThreeDBarAttributes>());
199 case PieAttributesRole:
200 return (a.value<PieAttributes>() == b.value<PieAttributes>());
201 case ThreeDPieAttributesRole:
202 return (a.value<ThreeDPieAttributes>() == b.value<ThreeDPieAttributes>());
203 case ValueTrackerAttributesRole:
204 return (a.value<ValueTrackerAttributes>() == b.value<ValueTrackerAttributes>());
205 case DataHiddenRole:
206 return (a.value<bool>() == b.value<bool>());
207 default:
208 Q_ASSERT(false); // all of our own roles need to be handled
209 break;
210 }
211 } else {
212 return (a == b);
213 }
214 return true;
215}
216
217QVariant AttributesModel::headerData(int section, Qt::Orientation orientation,
218 int role /* = Qt::DisplayRole */) const

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected