aboutsummaryrefslogtreecommitdiff
path: root/src/qt/guiutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/guiutil.cpp')
-rw-r--r--src/qt/guiutil.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index bab17562a6..70e76f765b 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -920,4 +920,35 @@ void PopupMenu(QMenu* menu, const QPoint& point, QAction* at_action)
menu->popup(point, at_action);
}
+QDateTime StartOfDay(const QDate& date)
+{
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+ return date.startOfDay();
+#else
+ return QDateTime(date);
+#endif
+}
+
+bool HasPixmap(const QLabel* label)
+{
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
+ return !label->pixmap(Qt::ReturnByValue).isNull();
+#else
+ return label->pixmap() != nullptr;
+#endif
+}
+
+QImage GetImage(const QLabel* label)
+{
+ if (!HasPixmap(label)) {
+ return QImage();
+ }
+
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
+ return label->pixmap(Qt::ReturnByValue).toImage();
+#else
+ return label->pixmap()->toImage();
+#endif
+}
+
} // namespace GUIUtil