diff options
author | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-01-09 11:49:43 +0100 |
---|---|---|
committer | Sergio Ahumada <sergio.ahumada@digia.com> | 2013-01-09 11:49:47 +0100 |
commit | 63f24f6ba8417e90294a1a90d01a3c3de80b7af4 (patch) | |
tree | 27b5788a3e7c1e94b484e642142b1be8ff8da318 /src/widgets | |
parent | ae2359d49e171c61450b17b1eb0e0dd7a20c7ca4 (diff) | |
parent | 05659223bf02c8bac0463fe1e7a9364ef5677b75 (diff) |
Merge branch 'stable' into dev
Change-Id: I7f0dab6bdb1f3cc1d3e6c30166ff6db9dfae37e9
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dialogs/qmessagebox.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/qstylehelper.cpp | 18 | ||||
-rw-r--r-- | src/widgets/styles/qstylehelper_p.h | 1 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsvistastyle.cpp | 48 |
4 files changed, 43 insertions, 26 deletions
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h index fdcfdc8779..2f8b4576fa 100644 --- a/src/widgets/dialogs/qmessagebox.h +++ b/src/widgets/dialogs/qmessagebox.h @@ -292,7 +292,7 @@ public: Q_SIGNALS: void buttonClicked(QAbstractButton *button); -#ifdef qdoc +#ifdef Q_QDOC public Q_SLOTS: int exec(); #endif diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index 1630130de2..ee44d01634 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -86,6 +86,20 @@ qreal dpiScaled(qreal value) #endif } +bool isInstanceOf(QObject *obj, QAccessible::Role role) +{ + bool match = false; +#ifndef QT_NO_ACCESSIBILITY + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(obj); + match = iface && iface->role() == role; + delete iface; +#else + Q_UNUSED(obj) + Q_UNUSED(role) +#endif // QT_NO_ACCESSIBILITY + return match; +} + // Searches for an ancestor of a particular accessible role bool hasAncestor(QObject *obj, QAccessible::Role role) { @@ -93,10 +107,8 @@ bool hasAncestor(QObject *obj, QAccessible::Role role) #ifndef QT_NO_ACCESSIBILITY QObject *parent = obj ? obj->parent() : 0; while (parent && !found) { - QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(parent); - if (iface && iface->role() == role) + if (isInstanceOf(parent, role)) found = true; - delete iface; parent = parent->parent(); } #else diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h index ab6a97e59a..642db68d9e 100644 --- a/src/widgets/styles/qstylehelper_p.h +++ b/src/widgets/styles/qstylehelper_p.h @@ -82,6 +82,7 @@ namespace QStyleHelper void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rect, int left = 0, int top = 0, int right = 0, int bottom = 0); + bool isInstanceOf(QObject *obj, QAccessible::Role role); bool hasAncestor(QObject *obj, QAccessible::Role role); } diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 5c197071ec..34fddde604 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -502,29 +502,33 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt } break; case PE_Frame: { - painter->save(); - int stateId = ETS_NORMAL; - if (!(state & State_Enabled)) - stateId = ETS_DISABLED; - else if (state & State_ReadOnly) - stateId = ETS_READONLY; - else if (state & State_HasFocus) - stateId = ETS_SELECTED; - XPThemeData theme(widget, painter, - QWindowsXPStylePrivate::EditTheme, - EP_EDITBORDER_HVSCROLL, stateId, option->rect); - uint resolve_mask = option->palette.resolve(); - if (resolve_mask & (1 << QPalette::Base)) { - // Since EP_EDITBORDER_HVSCROLL does not us borderfill, theme.noContent cannot be used for clipping - int borderSize = 1; - pGetThemeInt(theme.handle(), theme.partId, theme.stateId, TMT_BORDERSIZE, &borderSize); - QRegion clipRegion = option->rect; - QRegion content = option->rect.adjusted(borderSize, borderSize, -borderSize, -borderSize); - clipRegion ^= content; - painter->setClipRegion(clipRegion); + if (QStyleHelper::isInstanceOf(option->styleObject, QAccessible::EditableText)) { + painter->save(); + int stateId = ETS_NORMAL; + if (!(state & State_Enabled)) + stateId = ETS_DISABLED; + else if (state & State_ReadOnly) + stateId = ETS_READONLY; + else if (state & State_HasFocus) + stateId = ETS_SELECTED; + XPThemeData theme(widget, painter, + QWindowsXPStylePrivate::EditTheme, + EP_EDITBORDER_HVSCROLL, stateId, option->rect); + uint resolve_mask = option->palette.resolve(); + if (resolve_mask & (1 << QPalette::Base)) { + // Since EP_EDITBORDER_HVSCROLL does not us borderfill, theme.noContent cannot be used for clipping + int borderSize = 1; + pGetThemeInt(theme.handle(), theme.partId, theme.stateId, TMT_BORDERSIZE, &borderSize); + QRegion clipRegion = option->rect; + QRegion content = option->rect.adjusted(borderSize, borderSize, -borderSize, -borderSize); + clipRegion ^= content; + painter->setClipRegion(clipRegion); + } + d->drawBackground(theme); + painter->restore(); + } else { + QWindowsXPStyle::drawPrimitive(element, option, painter, widget); } - d->drawBackground(theme); - painter->restore(); } break; |