summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qguiapplication_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2011-05-04 11:51:33 +0200
committerLars Knoll <lars.knoll@nokia.com>2011-05-04 11:51:33 +0200
commit0e3823d30c2294eb11c205ca11fca55508478151 (patch)
tree3ce927318590ce3e9e790ee08bc489d3f3f386ec /src/gui/kernel/qguiapplication_p.h
parentb9798615b43746b26619b7abdad3abf89f6fb2fb (diff)
remove dependency to QStyle::visualAlignment
The current position of the code in QGuiAppPrivate is a bit messy, but we can later on consider consolidating some of this in some helper namespace.
Diffstat (limited to 'src/gui/kernel/qguiapplication_p.h')
-rw-r--r--src/gui/kernel/qguiapplication_p.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 23b3a4b4d2..2cc2e54f6c 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -105,6 +105,19 @@ public:
static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e);
static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e);
+ static inline Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
+ {
+ if (!(alignment & Qt::AlignHorizontal_Mask))
+ alignment |= Qt::AlignLeft;
+ if ((alignment & Qt::AlignAbsolute) == 0 && (alignment & (Qt::AlignLeft | Qt::AlignRight))) {
+ if (direction == Qt::RightToLeft)
+ alignment ^= (Qt::AlignLeft | Qt::AlignRight);
+ alignment |= Qt::AlignAbsolute;
+ }
+ return alignment;
+ }
+
+
static bool app_do_modal;
static QPointer<QWidget> qt_last_mouse_receiver;