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

Method defaultHeaderData

src/KDChart/KDChartAttributesModel.cpp:241–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241QVariant AttributesModel::defaultHeaderData(int section, Qt::Orientation orientation, int role) const
242{
243 // Default values if nothing else matches
244
245 const int dataset = section / d->dataDimension;
246
247 switch (role) {
248 case Qt::DisplayRole:
249 // TODO for KDChart 3.0: return QString::number( dataset + 1 );
250 return QLatin1String(orientation == Qt::Vertical ? "Series " : "Item ") + QString::number(dataset);
251 case KDChart::DatasetBrushRole:
252 return d->palette.getBrush(dataset);
253 case KDChart::DatasetPenRole:
254 // if no per model override was set, use the (possibly default) color set for the brush
255 if (!modelData(role).isValid()) {
256 QBrush brush = headerData(section, orientation, DatasetBrushRole).value<QBrush>();
257 return QPen(brush.color());
258 }
259 default:
260 break;
261 }
262
263 return QVariant();
264}
265
266QVariant AttributesModel::data(int role) const
267{

Callers

nothing calls this directly

Calls 3

getBrushMethod · 0.80
QPenClass · 0.70
isValidMethod · 0.45

Tested by

no test coverage detected