From 51f6d5d8c261fb94adc9bf5754cabf8e37236af5 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 12 Nov 2018 21:20:34 +0100 Subject: 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 Reviewed-by: Sze Howe Koh Reviewed-by: Paul Wicking Reviewed-by: Luca Beldi --- examples/widgets/itemviews/addressbook/tablemodel.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/widgets/itemviews/addressbook/tablemodel.h') 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 -#include +#include //! [0] @@ -82,8 +82,8 @@ class TableModel : public QAbstractTableModel Q_OBJECT public: - TableModel(QObject *parent = 0); - TableModel(QList contacts, QObject *parent = 0); + TableModel(QObject *parent = nullptr); + TableModel(const QVector &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 getContacts() const; + const QVector &getContacts() const; private: - QList contacts; + QVector contacts; }; //! [0] -- cgit v1.2.3