Changeset View
Changeset View
Standalone View
Standalone View
examples/Sql/main.cpp
Show All 38 Lines | |||||
39 | 39 | | |||
40 | /** | 40 | /** | ||
41 | * Proxymodel that transposes columns and rows. | 41 | * Proxymodel that transposes columns and rows. | ||
42 | */ | 42 | */ | ||
43 | class TransposeProxyModel : public QAbstractProxyModel{ | 43 | class TransposeProxyModel : public QAbstractProxyModel{ | ||
44 | public: | 44 | public: | ||
45 | explicit TransposeProxyModel(QObject* parent = nullptr) : QAbstractProxyModel(parent) {} | 45 | explicit TransposeProxyModel(QObject* parent = nullptr) : QAbstractProxyModel(parent) {} | ||
46 | virtual ~TransposeProxyModel() {} | 46 | virtual ~TransposeProxyModel() {} | ||
47 | QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const Q_DECL_OVERRIDE { return index(sourceIndex.column(), sourceIndex.row()); } | 47 | QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const override { return index(sourceIndex.column(), sourceIndex.row()); } | ||
48 | QModelIndex mapToSource ( const QModelIndex & proxyIndex ) const Q_DECL_OVERRIDE { return sourceModel()->index(proxyIndex.column(), proxyIndex.row()); } | 48 | QModelIndex mapToSource ( const QModelIndex & proxyIndex ) const override { return sourceModel()->index(proxyIndex.column(), proxyIndex.row()); } | ||
49 | QModelIndex index(int r, int c, const QModelIndex &ind=QModelIndex()) const Q_DECL_OVERRIDE { Q_UNUSED(ind) return createIndex(r,c); } | 49 | QModelIndex index(int r, int c, const QModelIndex &ind=QModelIndex()) const override { Q_UNUSED(ind) return createIndex(r,c); } | ||
50 | QModelIndex parent(const QModelIndex&) const Q_DECL_OVERRIDE { return QModelIndex(); } | 50 | QModelIndex parent(const QModelIndex&) const override { return QModelIndex(); } | ||
51 | int rowCount(const QModelIndex &) const Q_DECL_OVERRIDE { return sourceModel()->columnCount(); } | 51 | int rowCount(const QModelIndex &) const override { return sourceModel()->columnCount(); } | ||
52 | int columnCount(const QModelIndex &) const Q_DECL_OVERRIDE { return sourceModel()->rowCount(); } | 52 | int columnCount(const QModelIndex &) const override { return sourceModel()->rowCount(); } | ||
53 | QVariant data(const QModelIndex &ind, int role) const Q_DECL_OVERRIDE { return sourceModel()->data(mapToSource(ind), role); } | 53 | QVariant data(const QModelIndex &ind, int role) const override { return sourceModel()->data(mapToSource(ind), role); } | ||
54 | }; | 54 | }; | ||
55 | 55 | | |||
56 | /** | 56 | /** | ||
57 | * The example that creates the SQL-model, adds data to it and display the data in a model. | 57 | * The example that creates the SQL-model, adds data to it and display the data in a model. | ||
58 | */ | 58 | */ | ||
59 | class ChartWidget : public QWidget { | 59 | class ChartWidget : public QWidget { | ||
60 | Q_OBJECT | 60 | Q_OBJECT | ||
61 | public: | 61 | public: | ||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |