summaryrefslogtreecommitdiff
path: root/qt_helpers.cpp
diff options
context:
space:
mode:
authorChristoph Berg <christoph.berg@credativ.de>2022-08-23 10:23:16 +0200
committerChristoph Berg <christoph.berg@credativ.de>2022-08-23 10:23:16 +0200
commit2d1068e60bce7ae1fff11623454900e8cee956b1 (patch)
treeacebe276e30466ef0ab91bc3da5e379bec0d7dc5 /qt_helpers.cpp
parent43bebfbad6e7ba026bd3d55720c7d9e12a7ef8ef (diff)
New upstream version 2.6.0~rc3+repackupstream/2.6.0_rc3+repack
Diffstat (limited to 'qt_helpers.cpp')
-rwxr-xr-xqt_helpers.cpp100
1 files changed, 50 insertions, 50 deletions
diff --git a/qt_helpers.cpp b/qt_helpers.cpp
index dd474e19..aecbaf24 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;
+}