summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-09-19 16:03:32 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-09-19 16:03:32 (GMT)
commit3a7e23ef51b6099fc6dcfca36e04ec61bfa4337b (patch)
treead61ff8a561bb5b53c428bc4d203992aebe2a7a9
parent7b3e644089ded4ce8a1ca70c213a8f50b1654680 (diff)
parent7c7c4fefd242bba7947306656fb7163512b86da5 (diff)
downloadQt-3a7e23ef51b6099fc6dcfca36e04ec61bfa4337b.zip
Qt-3a7e23ef51b6099fc6dcfca36e04ec61bfa4337b.tar.gz
Qt-3a7e23ef51b6099fc6dcfca36e04ec61bfa4337b.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-water-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-water-staging: minor docu fixes Mingw compile error src/gui/accessible/qaccessible_win.cpp Implement QAccessibleActionInterface for menu actions. Do not leak memory
-rw-r--r--src/gui/accessible/qaccessible_win.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp9
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp10
-rw-r--r--src/plugins/accessible/widgets/qaccessiblemenu.cpp77
-rw-r--r--src/plugins/accessible/widgets/qaccessiblemenu.h14
5 files changed, 94 insertions, 18 deletions
diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/gui/accessible/qaccessible_win.cpp
index caabae5..1fd1bfd 100644
--- a/src/gui/accessible/qaccessible_win.cpp
+++ b/src/gui/accessible/qaccessible_win.cpp
@@ -1316,7 +1316,7 @@ HRESULT STDMETHODCALLTYPE QWindowsAccessible::get_accState(VARIANT varID, VARIAN
(*pvarState).vt = VT_I4;
AccessibleElement elem(varID.lVal, accessible);
- (*pvarState).lVal = elem.iface ? elem.iface->state(elem.entry) : 0;
+ (*pvarState).lVal = elem.iface ? elem.iface->state(elem.entry) : State(Normal);
return S_OK;
}
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index eaa8ac2..deda3ff 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -2966,11 +2966,12 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(const QList<QSimplexConstraint
AnchorData *ad = variables.at(i);
ad->sizeAtPreferred = ad->result - g_offset;
}
-
- // Make sure we delete the simplex solver -before- we delete the
- // constraints used by it.
- delete simplex;
}
+
+ // Make sure we delete the simplex solver -before- we delete the
+ // constraints used by it.
+ delete simplex;
+
// Delete constraints and variables we created.
qDeleteAll(preferredConstraints);
qDeleteAll(preferredVariables);
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index d3562fc..c275968 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -152,7 +152,7 @@ QT_BEGIN_NAMESPACE
\row \o Qt::WA_SetPalette
\o Set by setPalette().
\row \o Qt::WA_SetFont
- \o Set by setPalette().
+ \o Set by setFont().
\row \o Qt::WA_WindowPropagation
\o Enables propagation to window widgets.
\endtable
@@ -1674,7 +1674,7 @@ void QGraphicsWidget::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
/*!
This event handler, for \a event, can be reimplemented in a subclass to
- receive notifications for Qt::GrabMouse events.
+ receive notifications for QEvent::GrabMouse events.
\sa grabMouse(), grabKeyboard()
*/
@@ -1685,7 +1685,7 @@ void QGraphicsWidget::grabMouseEvent(QEvent *event)
/*!
This event handler, for \a event, can be reimplemented in a subclass to
- receive notifications for Qt::UngrabMouse events.
+ receive notifications for QEvent::UngrabMouse events.
\sa ungrabMouse(), ungrabKeyboard()
*/
@@ -1696,7 +1696,7 @@ void QGraphicsWidget::ungrabMouseEvent(QEvent *event)
/*!
This event handler, for \a event, can be reimplemented in a subclass to
- receive notifications for Qt::GrabKeyboard events.
+ receive notifications for QEvent::GrabKeyboard events.
\sa grabKeyboard(), grabMouse()
*/
@@ -1707,7 +1707,7 @@ void QGraphicsWidget::grabKeyboardEvent(QEvent *event)
/*!
This event handler, for \a event, can be reimplemented in a subclass to
- receive notifications for Qt::UngrabKeyboard events.
+ receive notifications for QEvent::UngrabKeyboard events.
\sa ungrabKeyboard(), ungrabMouse()
*/
diff --git a/src/plugins/accessible/widgets/qaccessiblemenu.cpp b/src/plugins/accessible/widgets/qaccessiblemenu.cpp
index 1454c7c..4ae1d15 100644
--- a/src/plugins/accessible/widgets/qaccessiblemenu.cpp
+++ b/src/plugins/accessible/widgets/qaccessiblemenu.cpp
@@ -433,6 +433,8 @@ QString QAccessibleMenuItem::actionText(int action, Text text, int child ) const
switch (action) {
case Press:
case DefaultAction:
+ if (m_action->menu())
+ return QMenu::tr("Open");
return QMenu::tr("Execute");
break;
default:
@@ -444,11 +446,41 @@ QString QAccessibleMenuItem::actionText(int action, Text text, int child ) const
bool QAccessibleMenuItem::doAction(int action, int child, const QVariantList & /*params = QVariantList()*/ )
{
- if ((action == Press || action == DefaultAction) && child == 0) {
- m_action->trigger();
- return true;
+ if ((child) || ((action != DefaultAction) && (action != Press)))
+ return false;
+
+ // if the action has a menu, expand/hide it
+ if (m_action->menu()) {
+ if (m_action->menu()->isVisible()) {
+ m_action->menu()->hide();
+ return true;
+ } else {
+ if (QMenuBar *bar = qobject_cast<QMenuBar*>(owner())) {
+ bar->setActiveAction(m_action);
+ return true;
+ } else if (QMenu *menu = qobject_cast<QMenu*>(owner())){
+ menu->setActiveAction(m_action);
+ return true;
+ }
+ }
}
- return false;
+ // no menu
+ m_action->trigger();
+ return true;
+}
+
+// action interface
+int QAccessibleMenuItem::actionCount()
+{
+ return 1;
+}
+
+void QAccessibleMenuItem::doAction(int actionIndex)
+{
+ if (actionIndex)
+ return;
+
+ doAction(DefaultAction, 0);
}
int QAccessibleMenuItem::indexOfChild( const QAccessibleInterface * child ) const
@@ -618,7 +650,7 @@ QAccessible::State QAccessibleMenuItem::state(int child ) const
delete iface;
}
}
- return s;
+ return s | HasInvokeExtension;;
}
QString QAccessibleMenuItem::text ( Text t, int child ) const
@@ -654,17 +686,50 @@ QString QAccessibleMenuItem::text ( Text t, int child ) const
return str;
}
+// action interface
int QAccessibleMenuItem::userActionCount ( int /*child*/ ) const
{
return 0;
}
-
QAction *QAccessibleMenuItem::action() const
{
return m_action;
}
+QString QAccessibleMenuItem::description(int)
+{
+ return text(QAccessible::Description, 0);
+}
+
+QString QAccessibleMenuItem::name(int)
+{
+ return actionText(DefaultAction, QAccessible::Name, 0);
+}
+
+QString QAccessibleMenuItem::localizedName(int)
+{
+ return text(QAccessible::Name, 0);
+}
+
+QStringList QAccessibleMenuItem::keyBindings(int)
+{
+ QStringList keys;
+#ifndef QT_NO_SHORTCUT
+ QKeySequence key = m_action->shortcut();
+ if (!key.isEmpty()) {
+ keys.append(key.toString());
+ }
+#endif
+ return keys;
+}
+
+
+QVariant QAccessibleMenuItem::invokeMethodEx(Method, int, const QVariantList &)
+{
+ return QVariant();
+}
+
QWidget *QAccessibleMenuItem::owner() const
{
return m_owner;
diff --git a/src/plugins/accessible/widgets/qaccessiblemenu.h b/src/plugins/accessible/widgets/qaccessiblemenu.h
index 680594d..47f42cb 100644
--- a/src/plugins/accessible/widgets/qaccessiblemenu.h
+++ b/src/plugins/accessible/widgets/qaccessiblemenu.h
@@ -43,6 +43,7 @@
#define QACCESSIBLEMENU_H
#include <QtGui/qaccessiblewidget.h>
+#include <QtGui/qaccessible2.h>
QT_BEGIN_NAMESPACE
@@ -101,8 +102,9 @@ protected:
-class QAccessibleMenuItem : public QAccessibleInterface
+class QAccessibleMenuItem : public QAccessibleActionInterface, public QAccessibleInterfaceEx
{
+ Q_ACCESSIBLE_OBJECT
public:
explicit QAccessibleMenuItem(QWidget *owner, QAction *w);
@@ -123,9 +125,17 @@ public:
virtual QString text ( Text t, int child ) const;
virtual int userActionCount ( int child ) const;
- QWidget *owner() const;
+ // action interface
+ virtual int actionCount();
+ virtual void doAction(int actionIndex);
+ virtual QString description(int);
+ virtual QString name(int);
+ virtual QString localizedName(int);
+ virtual QStringList keyBindings(int);
+ virtual QVariant invokeMethodEx(Method, int, const QVariantList &);
+ QWidget *owner() const;
protected:
QAction *action() const;
private: