diff options
author | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-06-28 12:37:10 (GMT) |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-06-28 12:47:12 (GMT) |
commit | 276d16583b80da2838f9af47e15fe3a83cdb0485 (patch) | |
tree | 448e70ccd487339faa984302a66104589dd1b7d4 /src/plugins/accessible/widgets | |
parent | f067c2b3016182862e82805b13c7944ebe8671a9 (diff) | |
download | Qt-276d16583b80da2838f9af47e15fe3a83cdb0485.zip Qt-276d16583b80da2838f9af47e15fe3a83cdb0485.tar.gz Qt-276d16583b80da2838f9af47e15fe3a83cdb0485.tar.bz2 |
Fix a11y crash: dock doesn't always have a widget.
Also return dock widget title.
Reviewed-by: Gabriel de Dietrich <gabriel.dietrich-de@nokia.com>
Diffstat (limited to 'src/plugins/accessible/widgets')
-rw-r--r-- | src/plugins/accessible/widgets/qaccessiblewidgets.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index c62624b..a0dde37 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -73,6 +73,9 @@ QT_BEGIN_NAMESPACE using namespace QAccessible2; +QString Q_GUI_EXPORT qt_accStripAmp(const QString &text); +QString Q_GUI_EXPORT qt_accHotKey(const QString &text); + QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel) { if (widget == 0) @@ -1139,8 +1142,8 @@ int QAccessibleTitleBar::childCount() const QString QAccessibleTitleBar::text(Text t, int child) const { if (!child) { - if (t == Value) { - return dockWidget()->windowTitle(); + if (t == Name || t == Value) { + return qt_accStripAmp(dockWidget()->windowTitle()); } } return QString(); @@ -1171,17 +1174,19 @@ QAccessible::State QAccessibleTitleBar::state(int child) const return state; } -QRect QAccessibleTitleBar::rect (int child ) const +QRect QAccessibleTitleBar::rect(int child) const { bool mapToGlobal = true; QRect rect; if (child == 0) { if (dockWidget()->isFloating()) { rect = dockWidget()->frameGeometry(); - QPoint globalPos = dockWidget()->mapToGlobal( dockWidget()->widget()->rect().topLeft() ); - globalPos.ry()--; - rect.setBottom(globalPos.y()); - mapToGlobal = false; + if (dockWidget()->widget()) { + QPoint globalPos = dockWidget()->mapToGlobal(dockWidget()->widget()->rect().topLeft()); + globalPos.ry()--; + rect.setBottom(globalPos.y()); + mapToGlobal = false; + } } else { QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(dockWidget()->layout()); rect = layout->titleArea(); |