summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-02-14 17:45:41 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-17 11:24:40 +0100
commit70f4bf1a487aa56e9667b92f420926e353ba7862 (patch)
treec21425b059adcc209545fb5e10954bb34c2a6ad9 /src/gui
parent00b96399e6d3bcd7a1081721cafeb15da3ab9781 (diff)
QPlatformDialogHelper: change ButtonRole flags to ensure 32-bit size
0x80000000 is too big for a signed 32-bit int, so the compiler ends up choosing a 64-bit number. Then it will not be the same size as the parallel enum QDialogButtonBox::ButtonRole, which does not have these extra flags. By making EOL be the same as InvalidRole and changing Reverse to 0x40000000, we don't need to use 0x80000000 at all, so again the compiler can choose a 32-bit representation for both if appropriate. EOL is used as a terminator in the static const int buttonRoleLayouts table and therefore as a terminator in arrays returned from QPlatformDialogHelper::buttonLayout(). It's internal API so it's OK to change in a minor release, but QtQuick.Dialogs is also looking for the EOL now, so we should avoid changing it again if possible. This is mainly for efficiency and for avoiding surprise data type conversions when casting from one enum to the other. Change-Id: Ia7b7ce43c8f929d09dd999769e9b7114f695e9a4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp4
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index c119b90001..66a2fdff96 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
*/
-static const quint32 buttonRoleLayouts[2][5][14] =
+static const int buttonRoleLayouts[2][5][14] =
{
// Qt::Horizontal
{
@@ -800,7 +800,7 @@ QPlatformDialogHelper::ButtonRole QPlatformDialogHelper::buttonRole(QPlatformDia
return InvalidRole;
}
-const quint32 *QPlatformDialogHelper::buttonLayout(Qt::Orientation orientation, ButtonLayout policy)
+const int *QPlatformDialogHelper::buttonLayout(Qt::Orientation orientation, ButtonLayout policy)
{
if (policy == UnknownLayout) {
#if defined (Q_OS_OSX)
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index 87fac83d50..731440723b 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -133,8 +133,8 @@ public:
RoleMask = 0x0FFFFFFF,
AlternateRole = 0x10000000,
Stretch = 0x20000000,
- EOL = 0x40000000,
- Reverse = 0x80000000
+ Reverse = 0x40000000,
+ EOL = InvalidRole
};
enum ButtonLayout {
@@ -160,7 +160,7 @@ public:
static QVariant defaultStyleHint(QPlatformDialogHelper::StyleHint hint);
- static const quint32 *buttonLayout(Qt::Orientation orientation = Qt::Horizontal, ButtonLayout policy = UnknownLayout);
+ static const int *buttonLayout(Qt::Orientation orientation = Qt::Horizontal, ButtonLayout policy = UnknownLayout);
static ButtonRole buttonRole(StandardButton button);
Q_SIGNALS: