diff options
| author | Christoph Berg <myon@debian.org> | 2020-09-28 23:28:26 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2020-09-28 23:28:26 +0200 |
| commit | c345880e5818351aec994d60cfb9a42351a4a6bd (patch) | |
| tree | 82e554ce75a62e7cca37968ee6e8ce08972eef04 /qt_helpers.cpp | |
| parent | d55aefc872a0b03ac40c44e8b7d635dc0fa19f4e (diff) | |
| parent | 7aa3c56b01768ba7d38fccedc17b30a4046b3fbb (diff) | |
Update upstream source from tag 'upstream/2.3.0_rc1+repack'
Update to upstream version '2.3.0~rc1+repack'
with Debian dir 278ece20e94e89020b1ea45fb83e61a2cecbb31e
Diffstat (limited to 'qt_helpers.cpp')
| -rw-r--r-- | qt_helpers.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/qt_helpers.cpp b/qt_helpers.cpp index 62def121..dd474e19 100644 --- a/qt_helpers.cpp +++ b/qt_helpers.cpp @@ -5,6 +5,7 @@ #include <QWidget> #include <QStyle> #include <QVariant> +#include <QDateTime> QString font_as_stylesheet (QFont const& font) { @@ -35,3 +36,15 @@ void update_dynamic_property (QWidget * widget, char const * property, QVariant widget->style ()->polish (widget); widget->update (); } + +QDateTime qt_round_date_time_to (QDateTime dt, int milliseconds) +{ + dt.setMSecsSinceEpoch (dt.addMSecs (milliseconds / 2).toMSecsSinceEpoch () / milliseconds * milliseconds); + return dt; +} + +QDateTime qt_truncate_date_time_to (QDateTime dt, int milliseconds) +{ + dt.setMSecsSinceEpoch (dt.toMSecsSinceEpoch () / milliseconds * milliseconds); + return dt; +} |
