Make foreground and backgroundColor proper functions.

Change-Id: I93d4355a6c0b6edb1902df6399df7884b25ea744
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
This commit is contained in:
Frederik Gladhorn 2011-10-10 15:24:17 +02:00 committed by Qt by Nokia
parent c7f8213bc5
commit 3885a45e48
4 changed files with 33 additions and 16 deletions

View File

@ -1060,10 +1060,6 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
\sa text(), role() \sa text(), role()
*/ */
/*!
\fn QColor QAccessibleInterface::backgroundColor()
\internal
*/
/*! /*!
\fn QAccessibleEditableTextInterface *QAccessibleInterface::editableTextInterface() \fn QAccessibleEditableTextInterface *QAccessibleInterface::editableTextInterface()
@ -1071,9 +1067,24 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
*/ */
/*! /*!
\fn QColor QAccessibleInterface::foregroundColor() Returns the accessible's foreground color if applicable or an invalid QColor.
\internal
\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() \fn QAccessibleTextInterface *QAccessibleInterface::textInterface()

View File

@ -389,18 +389,15 @@ public:
virtual Role role(int child = 0) const = 0; virtual Role role(int child = 0) const = 0;
virtual State state(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, virtual QVariant invokeMethod(Method method, int child = 0,
const QVariantList &params = QVariantList()); const QVariantList &params = QVariantList());
inline QSet<Method> supportedMethods() inline QSet<Method> supportedMethods()
{ return qvariant_cast<QSet<Method> >(invokeMethod(ListSupportedMethods)); } { return qvariant_cast<QSet<Method> >(invokeMethod(ListSupportedMethods)); }
inline QColor foregroundColor()
{ return qvariant_cast<QColor>(invokeMethod(ForegroundColor)); }
inline QColor backgroundColor()
{ return qvariant_cast<QColor>(invokeMethod(BackgroundColor)); }
inline QAccessibleTextInterface *textInterface() inline QAccessibleTextInterface *textInterface()
{ return reinterpret_cast<QAccessibleTextInterface *>(cast_helper(QAccessible2::TextInterface)); } { return reinterpret_cast<QAccessibleTextInterface *>(cast_helper(QAccessible2::TextInterface)); }

View File

@ -866,6 +866,16 @@ QAccessible::State QAccessibleWidget::state(int child) const
return state; 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*/) QVariant QAccessibleWidget::invokeMethod(Method method, int child, const QVariantList & /*params*/)
{ {
if (child) if (child)
@ -877,10 +887,6 @@ QVariant QAccessibleWidget::invokeMethod(Method method, int child, const QVarian
set << ListSupportedMethods << ForegroundColor << BackgroundColor; set << ListSupportedMethods << ForegroundColor << BackgroundColor;
return QVariant::fromValue(set); return QVariant::fromValue(set);
} }
case ForegroundColor:
return widget()->palette().color(widget()->foregroundRole());
case BackgroundColor:
return widget()->palette().color(widget()->backgroundRole());
default: default:
return QVariant(); return QVariant();
} }

View File

@ -75,6 +75,9 @@ public:
Role role(int child = 0) const; Role role(int child = 0) const;
State state(int child = 0) const; State state(int child = 0) const;
QColor foregroundColor() const;
QColor backgroundColor() const;
QVariant invokeMethod(Method method, int child, const QVariantList &params); QVariant invokeMethod(Method method, int child, const QVariantList &params);
protected: protected: