diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-08-17 13:35:54 +0200 |
---|---|---|
committer | Chris Adams <chris.adams@qinetic.com.au> | 2020-11-02 13:17:14 +1000 |
commit | cfdeb1637b96dcfb729c00a10430b03c293abc77 (patch) | |
tree | 9de2ddd86d3b799759988e842957693cca2e825a /examples | |
parent | 848d4a2b49adca12666081788a05a8fc5d9fbb56 (diff) |
Prefer QDate::startOfDay() over QDateTime(const QDate &)
The latter is deprecated, the former does something sensible.
Also use startOfDay() and endOfDay() rather than QTime(0, 0) or QTime(23, 59, 59).
Change-Id: Id1bc510833bfd2274e9945ab24c16ae07f3bd14e
Reviewed-by: Alberto Mardegan <mardy@users.sourceforge.net>
Reviewed-by: Christopher Adams <chris.adams@jolla.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/organizer/calendardemo/src/daypage.cpp | 5 | ||||
-rw-r--r-- | examples/organizer/todo/window.cpp | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/examples/organizer/calendardemo/src/daypage.cpp b/examples/organizer/calendardemo/src/daypage.cpp index e82a7bb74..7ad595b55 100644 --- a/examples/organizer/calendardemo/src/daypage.cpp +++ b/examples/organizer/calendardemo/src/daypage.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples for the Qt PIM module of the Qt Toolkit. @@ -104,7 +104,8 @@ void DayPage::refresh() m_itemList->clear(); // Today's item - QList<QOrganizerItem> items = m_manager->items(QDateTime(m_day), QDateTime(m_day, QTime(23, 59, 59))); + QList<QOrganizerItem> items + = m_manager->items(m_day.startOfDay(), m_day.endOfDay()); foreach (const QOrganizerItem &item, items) { diff --git a/examples/organizer/todo/window.cpp b/examples/organizer/todo/window.cpp index 97c9d275f..ecdbe2cc1 100644 --- a/examples/organizer/todo/window.cpp +++ b/examples/organizer/todo/window.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples for the Qt PIM module of the Qt Toolkit. @@ -149,10 +149,8 @@ void Window::refreshList() foreach(QOrganizerItem item, items) { if (item.type() == QOrganizerItemType::TypeTodo) { QOrganizerTodo todo = static_cast<QOrganizerTodo>(item); - if (todo.startDateTime() > - QDateTime(calendarWidget->selectedDate(), QTime(23,59)) || - todo.dueDateTime() < - QDateTime(calendarWidget->selectedDate(), QTime(0, 0))) + if (todo.startDateTime() > calendarWidget->selectedDate().endOfDay() || + todo.dueDateTime() < calendarWidget->selectedDate().startOfDay()) continue; QString display = todo.startDateTime().toString("yy/MM/dd hh:mm") + |