aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/referenceexamples/grouped/birthdayparty.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-11-02 09:04:21 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-11-04 10:51:39 +0100
commitc442ed4d65b0319e4abd7a931cfb2f1f72842b84 (patch)
tree99009060ae1c23ee98bef51f213926cd961f468a /examples/qml/referenceexamples/grouped/birthdayparty.cpp
parent33b16814c90fb4b70043be4f65fbbf783aee5d86 (diff)
Polish the QML reference examples
- Use member initialization, which allows for using constructors from the base classes - Use qsizetype for indexes - Use qInfo() instead of qWarning() for printing - Add spaces/fix formatting Pick-to: 6.2 Change-Id: Iebce1b810ce00f29395207d93303363b3b71e52e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'examples/qml/referenceexamples/grouped/birthdayparty.cpp')
-rw-r--r--examples/qml/referenceexamples/grouped/birthdayparty.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/examples/qml/referenceexamples/grouped/birthdayparty.cpp b/examples/qml/referenceexamples/grouped/birthdayparty.cpp
index 81db8ab1b8..269f45e02c 100644
--- a/examples/qml/referenceexamples/grouped/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/grouped/birthdayparty.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "birthdayparty.h"
-BirthdayParty::BirthdayParty(QObject *parent)
-: QObject(parent), m_host(nullptr)
-{
-}
+#include "birthdayparty.h"
Person *BirthdayParty::host() const
{
@@ -69,13 +65,12 @@ QQmlListProperty<Person> BirthdayParty::guests()
return {this, &m_guests};
}
-int BirthdayParty::guestCount() const
+qsizetype BirthdayParty::guestCount() const
{
return m_guests.count();
}
-Person *BirthdayParty::guest(int index) const
+Person *BirthdayParty::guest(qsizetype index) const
{
return m_guests.at(index);
}
-