diff options
| author | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:12 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:12 +0100 |
| commit | 98c02f78b26811ba5d9962ba27ec24cacf82bb22 (patch) | |
| tree | daaf609cde31d8fb3b6c3457c43663d14f0dda80 /qt_helpers.cpp | |
| parent | 332d2ce88c2f0bc2908cacdc6707e2f9fa49f26d (diff) | |
| parent | 992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 (diff) | |
Update upstream source from tag 'upstream/2.7.0_rc8+repack'
Update to upstream version '2.7.0~rc8+repack'
with Debian dir 6fce941c8282d35c8df23d3de779a42e27688bc1
Diffstat (limited to 'qt_helpers.cpp')
| -rwxr-xr-x | qt_helpers.cpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/qt_helpers.cpp b/qt_helpers.cpp index aecbaf24..dd474e19 100755 --- a/qt_helpers.cpp +++ b/qt_helpers.cpp @@ -1,50 +1,50 @@ -#include "qt_helpers.hpp"
-
-#include <QString>
-#include <QFont>
-#include <QWidget>
-#include <QStyle>
-#include <QVariant>
-#include <QDateTime>
-
-QString font_as_stylesheet (QFont const& font)
-{
- QString font_weight;
- switch (font.weight ())
- {
- case QFont::Light: font_weight = "light"; break;
- case QFont::Normal: font_weight = "normal"; break;
- case QFont::DemiBold: font_weight = "demibold"; break;
- case QFont::Bold: font_weight = "bold"; break;
- case QFont::Black: font_weight = "black"; break;
- }
- return QString {
- " font-family: %1;\n"
- " font-size: %2pt;\n"
- " font-style: %3;\n"
- " font-weight: %4;\n"}
- .arg (font.family ())
- .arg (font.pointSize ())
- .arg (font.styleName ())
- .arg (font_weight);
-}
-
-void update_dynamic_property (QWidget * widget, char const * property, QVariant const& value)
-{
- widget->setProperty (property, value);
- widget->style ()->unpolish (widget);
- 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;
-}
+#include "qt_helpers.hpp" + +#include <QString> +#include <QFont> +#include <QWidget> +#include <QStyle> +#include <QVariant> +#include <QDateTime> + +QString font_as_stylesheet (QFont const& font) +{ + QString font_weight; + switch (font.weight ()) + { + case QFont::Light: font_weight = "light"; break; + case QFont::Normal: font_weight = "normal"; break; + case QFont::DemiBold: font_weight = "demibold"; break; + case QFont::Bold: font_weight = "bold"; break; + case QFont::Black: font_weight = "black"; break; + } + return QString { + " font-family: %1;\n" + " font-size: %2pt;\n" + " font-style: %3;\n" + " font-weight: %4;\n"} + .arg (font.family ()) + .arg (font.pointSize ()) + .arg (font.styleName ()) + .arg (font_weight); +} + +void update_dynamic_property (QWidget * widget, char const * property, QVariant const& value) +{ + widget->setProperty (property, value); + widget->style ()->unpolish (widget); + 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; +} |
