From 2130d282b1a2671049c90dd4e99e512b8009de9a Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 23 Jan 2020 18:21:58 +0100 Subject: 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 --- .../itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp | 8 ++++---- .../itemviews/customsortfiltermodel/mysortfilterproxymodel.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'examples/widgets/itemviews') 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; -- cgit v1.2.3 From c7f59cad196dae2ee83e2073e546428695f0e1f0 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 29 Jan 2020 19:58:01 +0100 Subject: Examples: fix compile without printsupport Checking for QT_CONFIG(printdialog) is not enough when printsupport is completely disabled since then the macro will throw an error. Therefore add an additional check 'defined(QT_PRINTSUPPORT_LIB)' before using the QT_CONFIG macro. Fixes: QTBUG-81626 Change-Id: Ie9898f057cdd6bf9daf4ba9135987cb6e901e7bf Reviewed-by: Friedemann Kleint --- examples/widgets/itemviews/pixelator/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/widgets/itemviews') diff --git a/examples/widgets/itemviews/pixelator/mainwindow.cpp b/examples/widgets/itemviews/pixelator/mainwindow.cpp index f6b67e4dba..abd4a8b1ab 100644 --- a/examples/widgets/itemviews/pixelator/mainwindow.cpp +++ b/examples/widgets/itemviews/pixelator/mainwindow.cpp @@ -167,7 +167,7 @@ void MainWindow::openImage(const QString &fileName) void MainWindow::printImage() { -#if QT_CONFIG(printdialog) +#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog) if (model->rowCount(QModelIndex())*model->columnCount(QModelIndex()) > 90000) { QMessageBox::StandardButton answer; answer = QMessageBox::question(this, tr("Large Image Size"), -- cgit v1.2.3