summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-01-23 18:21:58 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2020-01-30 13:32:57 +0100
commit2130d282b1a2671049c90dd4e99e512b8009de9a (patch)
tree6786ba174134cd8263f54429b2ada2676bb7a77b
parent45967dfbd8192a14a324a75377d1860891845fbf (diff)
Change examples and snippets to pass QDate and QTime by value
They're value types, so we should show them being used as such. Change-Id: If9f0c366fac66306b7861f04e2f047540d444acc Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
-rw-r--r--examples/embedded/flightinfo/flightinfo.cpp4
-rw-r--r--examples/sql/books/initdb.h4
-rw-r--r--examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp8
-rw-r--r--examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h8
-rw-r--r--examples/widgets/widgets/calendarwidget/window.cpp6
-rw-r--r--examples/widgets/widgets/calendarwidget/window.h7
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp4
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp2
8 files changed, 22 insertions, 21 deletions
diff --git a/examples/embedded/flightinfo/flightinfo.cpp b/examples/embedded/flightinfo/flightinfo.cpp
index f46fc9693f..f7df368dd7 100644
--- a/examples/embedded/flightinfo/flightinfo.cpp
+++ b/examples/embedded/flightinfo/flightinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the demonstration applications of the Qt Toolkit.
@@ -198,7 +198,7 @@ private slots:
public slots:
- void request(const QString &flightCode, const QDate &date) {
+ void request(const QString &flightCode, QDate date) {
setWindowTitle("Loading...");
diff --git a/examples/sql/books/initdb.h b/examples/sql/books/initdb.h
index 773e3fb74c..e1f690a234 100644
--- a/examples/sql/books/initdb.h
+++ b/examples/sql/books/initdb.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the demonstration applications of the Qt Toolkit.
@@ -71,7 +71,7 @@ QVariant addGenre(QSqlQuery &q, const QString &name)
return q.lastInsertId();
}
-QVariant addAuthor(QSqlQuery &q, const QString &name, const QDate &birthdate)
+QVariant addAuthor(QSqlQuery &q, const QString &name, QDate birthdate)
{
q.addBindValue(name);
q.addBindValue(birthdate);
diff --git a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp
index 4753d04d9b..430a086fd6 100644
--- a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp
+++ b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -60,7 +60,7 @@ MySortFilterProxyModel::MySortFilterProxyModel(QObject *parent)
//! [0]
//! [1]
-void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date)
+void MySortFilterProxyModel::setFilterMinimumDate(QDate date)
{
minDate = date;
invalidateFilter();
@@ -68,7 +68,7 @@ void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date)
//! [1]
//! [2]
-void MySortFilterProxyModel::setFilterMaximumDate(const QDate &date)
+void MySortFilterProxyModel::setFilterMaximumDate(QDate date)
{
maxDate = date;
invalidateFilter();
@@ -122,7 +122,7 @@ bool MySortFilterProxyModel::lessThan(const QModelIndex &left,
//! [5] //! [6]
//! [7]
-bool MySortFilterProxyModel::dateInRange(const QDate &date) const
+bool MySortFilterProxyModel::dateInRange(QDate date) const
{
return (!minDate.isValid() || date > minDate)
&& (!maxDate.isValid() || date < maxDate);
diff --git a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h
index e2aff3c829..5fdabbd5df 100644
--- a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h
+++ b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -63,17 +63,17 @@ public:
MySortFilterProxyModel(QObject *parent = 0);
QDate filterMinimumDate() const { return minDate; }
- void setFilterMinimumDate(const QDate &date);
+ void setFilterMinimumDate(QDate date);
QDate filterMaximumDate() const { return maxDate; }
- void setFilterMaximumDate(const QDate &date);
+ void setFilterMaximumDate(QDate date);
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
private:
- bool dateInRange(const QDate &date) const;
+ bool dateInRange(QDate date) const;
QDate minDate;
QDate maxDate;
diff --git a/examples/widgets/widgets/calendarwidget/window.cpp b/examples/widgets/widgets/calendarwidget/window.cpp
index b8a3d03552..ae10223dd4 100644
--- a/examples/widgets/widgets/calendarwidget/window.cpp
+++ b/examples/widgets/widgets/calendarwidget/window.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -126,7 +126,7 @@ void Window::selectedDateChanged()
//! [2]
//! [3]
-void Window::minimumDateChanged(const QDate &date)
+void Window::minimumDateChanged(QDate date)
{
calendar->setMinimumDate(date);
maximumDateEdit->setDate(calendar->maximumDate());
@@ -134,7 +134,7 @@ void Window::minimumDateChanged(const QDate &date)
//! [3]
//! [4]
-void Window::maximumDateChanged(const QDate &date)
+void Window::maximumDateChanged(QDate date)
{
calendar->setMaximumDate(date);
minimumDateEdit->setDate(calendar->minimumDate());
diff --git a/examples/widgets/widgets/calendarwidget/window.h b/examples/widgets/widgets/calendarwidget/window.h
index 83ea494fc2..1b673b8ce0 100644
--- a/examples/widgets/widgets/calendarwidget/window.h
+++ b/examples/widgets/widgets/calendarwidget/window.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -52,6 +52,7 @@
#define WINDOW_H
#include <QWidget>
+#include <QDateTime>
QT_BEGIN_NAMESPACE
class QCalendarWidget;
@@ -79,8 +80,8 @@ private slots:
void horizontalHeaderChanged(int index);
void verticalHeaderChanged(int index);
void selectedDateChanged();
- void minimumDateChanged(const QDate &date);
- void maximumDateChanged(const QDate &date);
+ void minimumDateChanged(QDate date);
+ void maximumDateChanged(QDate date);
void weekdayFormatChanged();
void weekendFormatChanged();
void reformatHeaders();
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp
index 9813cc98d5..e070ada069 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -151,7 +151,7 @@ class Employee
{
public:
Employee() {}
- Employee(const QString &name, const QDate &dateOfBirth);
+ Employee(const QString &name, QDate dateOfBirth);
...
private:
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp
index 506022f082..145cd10d84 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qmap.cpp
@@ -151,7 +151,7 @@ class Employee
{
public:
Employee() {}
- Employee(const QString &name, const QDate &dateOfBirth);
+ Employee(const QString &name, QDate dateOfBirth);
...
private: