diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-11-12 21:20:34 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-12-04 07:00:41 +0000 |
commit | 51f6d5d8c261fb94adc9bf5754cabf8e37236af5 (patch) | |
tree | 88a374c564ffadd6b1f90e97121ab7274484bf71 /examples/widgets/itemviews/addressbook/tablemodel.h | |
parent | 8c38b08343b226883ef368d31a085b0a620f7995 (diff) |
Cleanup Addressbook example
Cleanup the Addressbook example:
- use nullptr
- use for instead foreach
- don't use public members but setters/getters
- use QVector instead QList
- make user-visible translatable
Change-Id: Ie7bdad8a2799c8fa6f634659b51c3064cc8a04ce
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Diffstat (limited to 'examples/widgets/itemviews/addressbook/tablemodel.h')
-rw-r--r-- | examples/widgets/itemviews/addressbook/tablemodel.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/widgets/itemviews/addressbook/tablemodel.h b/examples/widgets/itemviews/addressbook/tablemodel.h index 1004a35d31..e4025fc734 100644 --- a/examples/widgets/itemviews/addressbook/tablemodel.h +++ b/examples/widgets/itemviews/addressbook/tablemodel.h @@ -52,7 +52,7 @@ #define TABLEMODEL_H #include <QAbstractTableModel> -#include <QList> +#include <QVector> //! [0] @@ -82,8 +82,8 @@ class TableModel : public QAbstractTableModel Q_OBJECT public: - TableModel(QObject *parent = 0); - TableModel(QList<Contact> contacts, QObject *parent = 0); + TableModel(QObject *parent = nullptr); + TableModel(const QVector<Contact> &contacts, QObject *parent = nullptr); int rowCount(const QModelIndex &parent) const override; int columnCount(const QModelIndex &parent) const override; @@ -93,10 +93,10 @@ public: bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) override; bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) override; - QList<Contact> getContacts() const; + const QVector<Contact> &getContacts() const; private: - QList<Contact> contacts; + QVector<Contact> contacts; }; //! [0] |