summaryrefslogtreecommitdiffstats
path: root/examples/widgets/tutorials/modelview/3_changingmodel
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/tutorials/modelview/3_changingmodel')
-rw-r--r--examples/widgets/tutorials/modelview/3_changingmodel/mymodel.cpp4
-rw-r--r--examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h9
2 files changed, 8 insertions, 5 deletions
diff --git a/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.cpp b/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.cpp
index 82ba17dc45..5ce56632ff 100644
--- a/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.cpp
+++ b/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.cpp
@@ -44,9 +44,9 @@ QVariant MyModel::data(const QModelIndex &index, int role) const
//! [quoting mymodel_b ]
void MyModel::timerHit()
{
- //we identify the top left cell
+ // we identify the top left cell
QModelIndex topLeft = createIndex(0,0);
- //emit a signal to make the view reread identified data
+ // emit a signal to make the view reread identified data
emit dataChanged(topLeft, topLeft, {Qt::DisplayRole});
}
//! [quoting mymodel_b ]
diff --git a/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h b/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h
index 70a32f10be..5fab806c42 100644
--- a/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h
+++ b/examples/widgets/tutorials/modelview/3_changingmodel/mymodel.h
@@ -11,14 +11,17 @@ class MyModel : public QAbstractTableModel
{
Q_OBJECT
public:
- MyModel(QObject *parent = nullptr);
+ explicit MyModel(QObject *parent = nullptr);
+
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
-private:
- QTimer *timer;
+
private slots:
void timerHit();
+
+private:
+ QTimer *timer;
};
#endif // MYMODEL_H