From 3885a45e48b7fd680b6cb83e2d0d618fd04cf690 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 10 Oct 2011 15:24:17 +0200 Subject: [PATCH] Make foreground and backgroundColor proper functions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I93d4355a6c0b6edb1902df6399df7884b25ea744 Reviewed-by: Jan-Arve Sæther --- src/gui/accessible/qaccessible.cpp | 23 +++++++++++++++----- src/gui/accessible/qaccessible.h | 9 +++----- src/widgets/accessible/qaccessiblewidget.cpp | 14 ++++++++---- src/widgets/accessible/qaccessiblewidget.h | 3 +++ 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 172bd7f8e3d..2de60e1bd47 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -1060,10 +1060,6 @@ QVector > QAccessibleInterfa \sa text(), role() */ -/*! - \fn QColor QAccessibleInterface::backgroundColor() - \internal -*/ /*! \fn QAccessibleEditableTextInterface *QAccessibleInterface::editableTextInterface() @@ -1071,9 +1067,24 @@ QVector > QAccessibleInterfa */ /*! - \fn QColor QAccessibleInterface::foregroundColor() - \internal + Returns the accessible's foreground color if applicable or an invalid QColor. + + \sa backgroundColor() */ +QColor QAccessibleInterface::foregroundColor() const +{ + return QColor(); +} + +/*! + Returns the accessible's background color if applicable or an invalid QColor. + + \sa foregroundColor() +*/ +QColor QAccessibleInterface::backgroundColor() const +{ + return QColor(); +} /*! \fn QAccessibleTextInterface *QAccessibleInterface::textInterface() diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index b0c334c90bf..cba50f3ac4c 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -389,18 +389,15 @@ public: virtual Role role(int child = 0) const = 0; virtual State state(int child = 0) const = 0; + virtual QColor foregroundColor() const; + virtual QColor backgroundColor() const; + virtual QVariant invokeMethod(Method method, int child = 0, const QVariantList ¶ms = QVariantList()); inline QSet supportedMethods() { return qvariant_cast >(invokeMethod(ListSupportedMethods)); } - inline QColor foregroundColor() - { return qvariant_cast(invokeMethod(ForegroundColor)); } - - inline QColor backgroundColor() - { return qvariant_cast(invokeMethod(BackgroundColor)); } - inline QAccessibleTextInterface *textInterface() { return reinterpret_cast(cast_helper(QAccessible2::TextInterface)); } diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index a4a1da72426..73ccb903479 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -866,6 +866,16 @@ QAccessible::State QAccessibleWidget::state(int child) const return state; } +QColor QAccessibleWidget::foregroundColor() const +{ + return widget()->palette().color(widget()->foregroundRole()); +} + +QColor QAccessibleWidget::backgroundColor() const +{ + return widget()->palette().color(widget()->backgroundRole()); +} + QVariant QAccessibleWidget::invokeMethod(Method method, int child, const QVariantList & /*params*/) { if (child) @@ -877,10 +887,6 @@ QVariant QAccessibleWidget::invokeMethod(Method method, int child, const QVarian set << ListSupportedMethods << ForegroundColor << BackgroundColor; return QVariant::fromValue(set); } - case ForegroundColor: - return widget()->palette().color(widget()->foregroundRole()); - case BackgroundColor: - return widget()->palette().color(widget()->backgroundRole()); default: return QVariant(); } diff --git a/src/widgets/accessible/qaccessiblewidget.h b/src/widgets/accessible/qaccessiblewidget.h index 07fdd97734f..9a6dae69e7e 100644 --- a/src/widgets/accessible/qaccessiblewidget.h +++ b/src/widgets/accessible/qaccessiblewidget.h @@ -75,6 +75,9 @@ public: Role role(int child = 0) const; State state(int child = 0) const; + QColor foregroundColor() const; + QColor backgroundColor() const; + QVariant invokeMethod(Method method, int child, const QVariantList ¶ms); protected: