From 703b4a0e20b2eae982ea48e075db480da9851a9a Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Tue, 13 Mar 2012 13:12:09 +1000 Subject: Move variant animation interpolators from QtWidgets to QtGui There is no reason these interpolators need to stay in QtWidgets library. Change-Id: I27db49fea2cfd8f0ef417dc52edf66dd1835e7a1 Reviewed-by: Michael Brasser Reviewed-by: Martin Jones --- src/widgets/animation/animation.pri | 3 - src/widgets/animation/qguivariantanimation.cpp | 95 -------------------------- src/widgets/widgets.pro | 1 - 3 files changed, 99 deletions(-) delete mode 100644 src/widgets/animation/animation.pri delete mode 100644 src/widgets/animation/qguivariantanimation.cpp (limited to 'src/widgets') diff --git a/src/widgets/animation/animation.pri b/src/widgets/animation/animation.pri deleted file mode 100644 index 27763ca003..0000000000 --- a/src/widgets/animation/animation.pri +++ /dev/null @@ -1,3 +0,0 @@ -# Qt gui animation module - -SOURCES += animation/qguivariantanimation.cpp diff --git a/src/widgets/animation/qguivariantanimation.cpp b/src/widgets/animation/qguivariantanimation.cpp deleted file mode 100644 index c344a18b8a..0000000000 --- a/src/widgets/animation/qguivariantanimation.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include - -#ifndef QT_NO_ANIMATION - -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -template<> Q_INLINE_TEMPLATE QColor _q_interpolate(const QColor &f,const QColor &t, qreal progress) -{ - return QColor(qBound(0,_q_interpolate(f.red(), t.red(), progress),255), - qBound(0,_q_interpolate(f.green(), t.green(), progress),255), - qBound(0,_q_interpolate(f.blue(), t.blue(), progress),255), - qBound(0,_q_interpolate(f.alpha(), t.alpha(), progress),255)); -} - -template<> Q_INLINE_TEMPLATE QQuaternion _q_interpolate(const QQuaternion &f,const QQuaternion &t, qreal progress) -{ - return QQuaternion::slerp(f, t, progress); -} - -static void qRegisterGuiGetInterpolator() -{ - qRegisterAnimationInterpolator(_q_interpolateVariant); - qRegisterAnimationInterpolator(_q_interpolateVariant); - qRegisterAnimationInterpolator(_q_interpolateVariant); - qRegisterAnimationInterpolator(_q_interpolateVariant); - qRegisterAnimationInterpolator(_q_interpolateVariant); -} -Q_CONSTRUCTOR_FUNCTION(qRegisterGuiGetInterpolator) - -static void qUnregisterGuiGetInterpolator() -{ - // casts required by Sun CC 5.5 - qRegisterAnimationInterpolator( - (QVariant (*)(const QColor &, const QColor &, qreal))0); - qRegisterAnimationInterpolator( - (QVariant (*)(const QVector2D &, const QVector2D &, qreal))0); - qRegisterAnimationInterpolator( - (QVariant (*)(const QVector3D &, const QVector3D &, qreal))0); - qRegisterAnimationInterpolator( - (QVariant (*)(const QVector4D &, const QVector4D &, qreal))0); - qRegisterAnimationInterpolator( - (QVariant (*)(const QQuaternion &, const QQuaternion &, qreal))0); -} -Q_DESTRUCTOR_FUNCTION(qUnregisterGuiGetInterpolator) - -QT_END_NAMESPACE - -#endif //QT_NO_ANIMATION diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro index 8f6a9713f6..596e8a994a 100644 --- a/src/widgets/widgets.pro +++ b/src/widgets/widgets.pro @@ -25,7 +25,6 @@ mac:include(kernel/mac.pri) win32:include(kernel/win.pri) #modules -include(animation/animation.pri) include(kernel/kernel.pri) include(styles/styles.pri) include(widgets/widgets.pri) -- cgit v1.2.3 From 1de1a50603a50fde4b9ac0400a66f54ff4a0cbb1 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Mon, 12 Mar 2012 21:14:37 +0100 Subject: take opportunity to use const Change-Id: Ief12d4b55e1705c758dae8078cf52948fcd9565b Reviewed-by: Richard J. Moore --- src/widgets/styles/qstylesheetstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 7a0cc09452..c909def969 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2505,7 +2505,7 @@ void QStyleSheetStyle::setProperties(QWidget *w) // properties in the order they are specified. QHash propertyHash; QVector properties; - QVector decls = declarations(styleRules(w), QString()); + const QVector decls = declarations(styleRules(w), QString()); // run through the declarations in order for (int i = 0; i < decls.count(); i++) { @@ -2521,7 +2521,7 @@ void QStyleSheetStyle::setProperties(QWidget *w) qWarning() << w << " does not have a property named " << property; continue; } - QMetaProperty metaProperty = metaObject->property(index); + const QMetaProperty metaProperty = metaObject->property(index); if (!metaProperty.isWritable() || !metaProperty.isDesignable()) { qWarning() << w << " cannot design property named " << property; continue; -- cgit v1.2.3 From 6c2c6a48e730888760d2328f18f2be81d6dee6d3 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Tue, 13 Mar 2012 10:32:58 +0100 Subject: use QStringLiteral Change-Id: I0f2b6ff758524e872d38dcbdc9335264431e3dc6 Reviewed-by: Robin Burchell --- src/widgets/styles/qstylesheetstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index c909def969..15e03af69b 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2511,7 +2511,7 @@ void QStyleSheetStyle::setProperties(QWidget *w) for (int i = 0; i < decls.count(); i++) { const Declaration &decl = decls.at(i); QString property = decl.d->property; - if (!property.startsWith(QLatin1String("qproperty-"), Qt::CaseInsensitive)) + if (!property.startsWith(QStringLiteral("qproperty-"), Qt::CaseInsensitive)) continue; property.remove(0, 10); // strip "qproperty-" const QVariant value = w->property(property.toLatin1()); -- cgit v1.2.3 From e9fdfd746bc374b7b2cbccb875d36727b3946990 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Mon, 12 Mar 2012 21:16:40 +0100 Subject: improve declaration scope Change-Id: Id8d8f4e59793ba5fc2d3afa31674009af73a59c9 Reviewed-by: Robin Burchell --- src/widgets/styles/qstylesheetstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 15e03af69b..0f53809215 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2514,7 +2514,6 @@ void QStyleSheetStyle::setProperties(QWidget *w) if (!property.startsWith(QStringLiteral("qproperty-"), Qt::CaseInsensitive)) continue; property.remove(0, 10); // strip "qproperty-" - const QVariant value = w->property(property.toLatin1()); const QMetaObject *metaObject = w->metaObject(); int index = metaObject->indexOfProperty(property.toLatin1()); if (index == -1) { @@ -2527,6 +2526,7 @@ void QStyleSheetStyle::setProperties(QWidget *w) continue; } QVariant v; + const QVariant value = w->property(property.toLatin1()); switch (value.type()) { // ### Qt 5 // case QVariant::Icon: v = decl.iconValue(); break; -- cgit v1.2.3 From 2d68c8ee8d28556eb40eb576d30b64fdac9b388d Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 12 Mar 2012 13:36:25 +0200 Subject: Windows: Fix QSpinBox background setting via stylesheet When using stylesheets, palette mask for drawing the background of line edit child of spinbox is already correctly resolved to style options in QStyleSheetStyle::drawPrimitive(), so we cannot simply ignore that mask and check the palette mask of the parent spinbox. Fixed by using a union mask of the parent spinbox palette and the palette supplied by style option instead of simply using the mask from parent spinbox. If either specifies custom base color, use that to paint the background of the spinbox's line edit. Task-number: QTBUG-24323 Change-Id: I1e738192db83b16d9bd48da54d29779e18788ef7 Reviewed-by: Friedemann Kleint --- src/widgets/styles/qwindowsvistastyle.cpp | 6 ++++-- src/widgets/styles/qwindowsxpstyle.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 1aecb64acf..c18b2266b8 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -586,10 +586,12 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt bool isEnabled = option->state & State_Enabled; uint resolve_mask = panel->palette.resolve(); if (widget) { - //Since spin box and combo box includes a line edit we need to resolve the palette on the parent instead + // Since spin box includes a line edit we need to resolve the palette mask also from + // the parent, as while the color is always correct on the palette supplied by panel, + // the mask can still be empty. If either mask specifies custom base color, use that. #ifndef QT_NO_SPINBOX if (QAbstractSpinBox *spinbox = qobject_cast(widget->parentWidget())) - resolve_mask = spinbox->palette().resolve(); + resolve_mask |= spinbox->palette().resolve(); #endif // QT_NO_SPINBOX } if (resolve_mask & (1 << QPalette::Base)) { diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 5aab69983c..8b745ba114 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -1583,10 +1583,12 @@ case PE_Frame: uint resolve_mask = panel->palette.resolve(); #ifndef QT_NO_SPINBOX - //Since spin box includes a line edit we need to resolve the palette on the spin box instead + // Since spin box includes a line edit we need to resolve the palette mask also from + // the parent, as while the color is always correct on the palette supplied by panel, + // the mask can still be empty. If either mask specifies custom base color, use that. if (widget) { if (QAbstractSpinBox *spinbox = qobject_cast(widget->parentWidget())) - resolve_mask = spinbox->palette().resolve(); + resolve_mask |= spinbox->palette().resolve(); } #endif // QT_NO_SPINBOX if (resolve_mask & (1 << QPalette::Base)) { -- cgit v1.2.3 From 8c3e5700a14ff52c2dfff5ab1b1fb47d7240aa02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Sat, 10 Mar 2012 14:31:15 +0100 Subject: Add two (forgotten) since 5.0 SHA for QWidget::hasHeightForWidth change: 466107107a85e7211c4b7f77b36ec50625657061 SHA for QAbstractItemDelegate::destoryeditor change 15f253a46aa45e2a9fa1055799fa2768ba49b9a3 Change-Id: Ic7e38c15f62eef22ab95414fad6e7b6c9c7d4f59 Reviewed-by: Girish Ramakrishnan Reviewed-by: Stephen Kelly --- src/widgets/itemviews/qabstractitemdelegate.cpp | 2 ++ src/widgets/kernel/qwidget.cpp | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index 6184a5845a..ecba3e238f 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -243,6 +243,8 @@ QWidget *QAbstractItemDelegate::createEditor(QWidget *, /*! + \since 5.0 + A function called when the editor is no longer needed and should be destroyed. The default behavior is a call to deleteLater on the editor. It possible e.g. to avoid this delete by reimplementing this function. diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 1493f61972..be1782bc4d 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -9228,6 +9228,8 @@ int QWidget::heightForWidth(int w) const /*! + \Since 5.0 + Returns true if the widget's preferred height depends on its width; otherwise returns false. */ bool QWidget::hasHeightForWidth() const -- cgit v1.2.3 From b64426248d2212eb59535b2ca383d30fdb5e1c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Sat, 3 Mar 2012 06:05:54 +0100 Subject: QHeaderView - renaming functions in Qt5 This patch renames the functions in Qt5 according to the notes. It also renames resizeMode to be consistent. The old functions are both marked with both QT_DEPRECATED and '### Qt 6 - remove' All usage of the function within the qtbase are also changed to use the new functions. Change-Id: I9e05fa41d232e9ca43b945fcc949987017f3aedd Reviewed-by: Stephen Kelly --- src/widgets/itemviews/qheaderview.cpp | 124 +++++++++++++++++++++++--------- src/widgets/itemviews/qheaderview.h | 27 +++++-- src/widgets/itemviews/qtableview.cpp | 4 +- src/widgets/itemviews/qtreeview.cpp | 4 +- src/widgets/itemviews/qtreewidget.cpp | 2 +- src/widgets/widgets/qcalendarwidget.cpp | 4 +- 6 files changed, 117 insertions(+), 48 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index eac543d37d..766d7ce6b6 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -120,9 +120,9 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span) \section1 Moving Header Sections - A header can be fixed in place, or made movable with setMovable(). It can - be made clickable with setClickable(), and has resizing behavior in - accordance with setResizeMode(). + A header can be fixed in place, or made movable with setSectionsMovable(). It can + be made clickable with setSectionsClickable(), and has resizing behavior in + accordance with setResizeMode() and setSectionResizeMode() \note Double-clicking on a header to resize a section only applies for visible rows. @@ -185,7 +185,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span) The following values are obsolete: \value Custom Use Fixed instead. - \sa setResizeMode() stretchLastSection minimumSectionSize + \sa setResizeMode() setSectionResizeMode() stretchLastSection minimumSectionSize */ /*! @@ -216,7 +216,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span) This signal is emitted when a section is pressed. The section's logical index is specified by \a logicalIndex. - \sa setClickable() + \sa setSectionsClickable() */ /*! @@ -227,7 +227,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span) Note that the sectionPressed signal will also be emitted. - \sa setClickable(), sectionPressed() + \sa setSectionsClickable(), sectionPressed() */ /*! @@ -238,7 +238,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span) mouse button is pressed. The section's logical index is specified by \a logicalIndex. - \sa setClickable(), sectionPressed() + \sa setSectionsClickable(), sectionPressed() */ /*! @@ -247,7 +247,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span) This signal is emitted when a section is double-clicked. The section's logical index is specified by \a logicalIndex. - \sa setClickable() + \sa setSectionsClickable() */ /*! @@ -266,7 +266,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span) This signal is emitted when a section is double-clicked. The section's logical index is specified by \a logicalIndex. - \sa setClickable() + \sa setSectionsClickable() */ /*! @@ -1085,62 +1085,98 @@ int QHeaderView::logicalIndex(int visualIndex) const } /*! - If \a movable is true, the header may be moved by the user; otherwise it + If \a sectionsMovable is true, the header may be moved by the user; otherwise it is fixed in place. - \sa isMovable(), sectionMoved() + \sa sectionsMovable(), sectionMoved() */ -// ### Qt 5: change to setSectionsMovable() -void QHeaderView::setMovable(bool movable) +void QHeaderView::setSectionsMovable(bool movable) { Q_D(QHeaderView); d->movableSections = movable; } +// ### Qt 6 - remove this obsolete function +/*! + \obsolete + \fn void QHeaderView::setMovable(bool movable) + + Use setSectionsMovable instead. + + \sa setSectionsMovable() +*/ + /*! Returns true if the header can be moved by the user; otherwise returns false. - \sa setMovable() + \sa setSectionsMovable() */ -// ### Qt 5: change to sectionsMovable() -bool QHeaderView::isMovable() const +bool QHeaderView::sectionsMovable() const { Q_D(const QHeaderView); return d->movableSections; } +// ### Qt 6 - remove this obsolete function +/*! + \obsolete + \fn bool QHeaderView::isMovable(bool movable) + + Use sectionsMovable instead. + + \sa sectionsMovable() +*/ + /*! If \a clickable is true, the header will respond to single clicks. - \sa isClickable(), sectionClicked(), sectionPressed(), + \sa sectionsClickable(), sectionClicked(), sectionPressed(), setSortIndicatorShown() */ -// ### Qt 5: change to setSectionsClickable() -void QHeaderView::setClickable(bool clickable) +void QHeaderView::setSectionsClickable(bool clickable) { Q_D(QHeaderView); d->clickableSections = clickable; } +// ### Qt 6 - remove this obsolete function +/*! + \obsolete + \fn void QHeaderView::setClickable(bool clickable) + + Use setSectionsClickable instead. + + \sa setSectionsClickable() +*/ + /*! Returns true if the header is clickable; otherwise returns false. A clickable header could be set up to allow the user to change the representation of the data in the view related to the header. - \sa setClickable() + \sa setSectionsClickable() */ -// ### Qt 5: change to sectionsClickable() -bool QHeaderView::isClickable() const +bool QHeaderView::sectionsClickable() const { Q_D(const QHeaderView); return d->clickableSections; } +// ### Qt 6 - remove this obsolete function +/*! + \obsolete + \fn bool QHeaderView::isClickable() const + + Use sectionsClickable instead. + + \sa sectionsClickable() +*/ + void QHeaderView::setHighlightSections(bool highlight) { Q_D(QHeaderView); @@ -1172,8 +1208,6 @@ void QHeaderView::setResizeMode(ResizeMode mode) } /*! - \overload - Sets the constraints on how the section specified by \a logicalIndex in the header can be resized to those described by the given \a mode. The logical index should exist at the time this function is called. @@ -1185,8 +1219,7 @@ void QHeaderView::setResizeMode(ResizeMode mode) \sa setStretchLastSection() */ -// ### Qt 5: change to setSectionResizeMode() -void QHeaderView::setResizeMode(int logicalIndex, ResizeMode mode) +void QHeaderView::setSectionResizeMode(int logicalIndex, ResizeMode mode) { Q_D(QHeaderView); int visual = visualIndex(logicalIndex); @@ -1208,6 +1241,17 @@ void QHeaderView::setResizeMode(int logicalIndex, ResizeMode mode) d->doDelayedResizeSections(); // section sizes may change as a result of the new mode } +// ### Qt 6 - remove this obsolete function +/*! + \overload + \obsolete + \fn void QHeaderView::setResizeMode(int logicalIndex, ResizeMode mode) + + Use setSectionResizeMode instead. + + \sa setSectionResizeMode() +*/ + /*! Returns the resize mode that applies to the section specified by the given \a logicalIndex. @@ -1215,7 +1259,7 @@ void QHeaderView::setResizeMode(int logicalIndex, ResizeMode mode) \sa setResizeMode() */ -QHeaderView::ResizeMode QHeaderView::resizeMode(int logicalIndex) const +QHeaderView::ResizeMode QHeaderView::sectionResizeMode(int logicalIndex) const { Q_D(const QHeaderView); int visual = visualIndex(logicalIndex); @@ -1224,6 +1268,16 @@ QHeaderView::ResizeMode QHeaderView::resizeMode(int logicalIndex) const return d->headerSectionResizeMode(visual); } +// ### Qt 6 - remove this obsolete function +/*! + \obsolete + \fn QHeaderView::ResizeMode QHeaderView::resizeMode(int logicalIndex) const + + Use sectionResizeMode instead. + + \sa sectionResizeMode() +*/ + /*! \since 4.1 @@ -1246,7 +1300,7 @@ int QHeaderView::stretchSectionCount() const By default, this property is false. - \sa setClickable() + \sa setSectionsClickable() */ void QHeaderView::setSortIndicatorShown(bool show) @@ -1299,8 +1353,8 @@ void QHeaderView::setSortIndicator(int logicalIndex, Qt::SortOrder order) } if (old != logicalIndex - && ((logicalIndex >= 0 && resizeMode(logicalIndex) == ResizeToContents) - || old >= d->sectionCount() || (old >= 0 && resizeMode(old) == ResizeToContents))) { + && ((logicalIndex >= 0 && sectionResizeMode(logicalIndex) == ResizeToContents) + || old >= d->sectionCount() || (old >= 0 && sectionResizeMode(old) == ResizeToContents))) { resizeSections(); d->viewport->update(); } else { @@ -2207,7 +2261,7 @@ void QHeaderView::mousePressEvent(QMouseEvent *e) updateSection(d->pressed); d->state = QHeaderViewPrivate::SelectSections; } - } else if (resizeMode(handle) == Interactive) { + } else if (sectionResizeMode(handle) == Interactive) { d->originalSize = sectionSize(handle); d->state = QHeaderViewPrivate::ResizeSection; d->section = handle; @@ -2289,7 +2343,7 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e) #ifndef QT_NO_CURSOR int handle = d->sectionHandleAt(pos); bool hasCursor = testAttribute(Qt::WA_SetCursor); - if (handle != -1 && (resizeMode(handle) == Interactive)) { + if (handle != -1 && (sectionResizeMode(handle) == Interactive)) { if (!hasCursor) setCursor(d->orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor); } else if (hasCursor) { @@ -2360,7 +2414,7 @@ void QHeaderView::mouseDoubleClickEvent(QMouseEvent *e) Q_D(QHeaderView); int pos = d->orientation == Qt::Horizontal ? e->x() : e->y(); int handle = d->sectionHandleAt(pos); - if (handle > -1 && resizeMode(handle) == Interactive) { + if (handle > -1 && sectionResizeMode(handle) == Interactive) { emit sectionHandleDoubleClicked(handle); #ifndef QT_NO_CURSOR Qt::CursorShape splitCursor = (d->orientation == Qt::Horizontal) @@ -2368,7 +2422,7 @@ void QHeaderView::mouseDoubleClickEvent(QMouseEvent *e) if (cursor().shape() == splitCursor) { // signal handlers may have changed the section size handle = d->sectionHandleAt(pos); - if (!(handle > -1 && resizeMode(handle) == Interactive)) + if (!(handle > -1 && sectionResizeMode(handle) == Interactive)) setCursor(Qt::ArrowCursor); } #endif @@ -2673,7 +2727,7 @@ void QHeaderView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bot int first = orientation() == Qt::Horizontal ? topLeft.column() : topLeft.row(); int last = orientation() == Qt::Horizontal ? bottomRight.column() : bottomRight.row(); for (int i = first; i <= last && !resizeRequired; ++i) - resizeRequired = (resizeMode(i) == ResizeToContents); + resizeRequired = (sectionResizeMode(i) == ResizeToContents); if (resizeRequired) d->doDelayedResizeSections(); } diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h index d72b8cd735..bf686e2925 100644 --- a/src/widgets/itemviews/qheaderview.h +++ b/src/widgets/itemviews/qheaderview.h @@ -114,18 +114,33 @@ public: int visualIndex(int logicalIndex) const; int logicalIndex(int visualIndex) const; - void setMovable(bool movable); - bool isMovable() const; + void setSectionsMovable(bool movable); + bool sectionsMovable() const; +#if QT_DEPRECATED_SINCE(5, 0) + inline QT_DEPRECATED void setMovable(bool movable) { setSectionsMovable(movable); } + inline QT_DEPRECATED bool isMovable() const { return sectionsMovable(); } +#endif - void setClickable(bool clickable); - bool isClickable() const; + void setSectionsClickable(bool clickable); + bool sectionsClickable() const; +#if QT_DEPRECATED_SINCE(5, 0) + inline QT_DEPRECATED void setClickable(bool clickable) { setSectionsClickable(clickable); } + inline QT_DEPRECATED bool isClickable() const { return sectionsClickable(); } +#endif void setHighlightSections(bool highlight); bool highlightSections() const; void setResizeMode(ResizeMode mode); - void setResizeMode(int logicalIndex, ResizeMode mode); - ResizeMode resizeMode(int logicalIndex) const; + ResizeMode sectionResizeMode(int logicalIndex) const; + void setSectionResizeMode(int logicalIndex, ResizeMode mode); +#if QT_DEPRECATED_SINCE(5, 0) + inline QT_DEPRECATED void setResizeMode(int logicalindex, ResizeMode mode) + { setSectionResizeMode(logicalindex, mode); } + inline QT_DEPRECATED ResizeMode resizeMode(int logicalindex) const + { return sectionResizeMode(logicalindex); } +#endif + int stretchSectionCount() const; void setSortIndicatorShown(bool show); diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index d3bc826750..57f29641de 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -616,12 +616,12 @@ void QTableViewPrivate::init() q->setEditTriggers(editTriggers|QAbstractItemView::AnyKeyPressed); QHeaderView *vertical = new QHeaderView(Qt::Vertical, q); - vertical->setClickable(true); + vertical->setSectionsClickable(true); vertical->setHighlightSections(true); q->setVerticalHeader(vertical); QHeaderView *horizontal = new QHeaderView(Qt::Horizontal, q); - horizontal->setClickable(true); + horizontal->setSectionsClickable(true); horizontal->setHighlightSections(true); q->setHorizontalHeader(horizontal); diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index c54c11d0f5..e2be4990d9 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -848,7 +848,7 @@ void QTreeView::setSortingEnabled(bool enable) { Q_D(QTreeView); header()->setSortIndicatorShown(enable); - header()->setClickable(enable); + header()->setSectionsClickable(enable); if (enable) { //sortByColumn has to be called before we connect or set the sortingEnabled flag // because otherwise it will not call sort on the model. @@ -2886,7 +2886,7 @@ void QTreeViewPrivate::initialize() q->setAttribute(Qt::WA_MacShowFocusRect); QHeaderView *header = new QHeaderView(Qt::Horizontal, q); - header->setMovable(true); + header->setSectionsMovable(true); header->setStretchLastSection(true); header->setDefaultAlignment(Qt::AlignLeft|Qt::AlignVCenter); q->setHeader(header); diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 156121a533..f8e3a375a4 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -2535,7 +2535,7 @@ QTreeWidget::QTreeWidget(QWidget *parent) this, SLOT(_q_sort())); connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(_q_selectionChanged(QItemSelection,QItemSelection))); - header()->setClickable(false); + header()->setSectionsClickable(false); } /*! diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index 129da9d94d..427af68b64 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -2068,9 +2068,9 @@ QCalendarWidget::QCalendarWidget(QWidget *parent) d->m_view->setSelectionBehavior(QAbstractItemView::SelectItems); d->m_view->setSelectionMode(QAbstractItemView::SingleSelection); d->m_view->horizontalHeader()->setResizeMode(QHeaderView::Stretch); - d->m_view->horizontalHeader()->setClickable(false); + d->m_view->horizontalHeader()->setSectionsClickable(false); d->m_view->verticalHeader()->setResizeMode(QHeaderView::Stretch); - d->m_view->verticalHeader()->setClickable(false); + d->m_view->verticalHeader()->setSectionsClickable(false); d->m_selection = d->m_view->selectionModel(); d->createNavigationBar(this); d->m_view->setFrameStyle(QFrame::NoFrame); -- cgit v1.2.3 From 39e0d35fe9acb2b2b539cc96170be2d227936b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Sun, 11 Mar 2012 10:52:25 +0100 Subject: QHeaderView - documentation update. Prefer hideSection over 0-resize. There is a different behavior on 0 sections and hidden sections e.g with scrollbars. Normally people want to use hideSection. Change-Id: Id99de30ea46906bb4ef7720ed12d4ac9615c9743 Reviewed-by: Stephen Kelly --- src/widgets/itemviews/qheaderview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 766d7ce6b6..425eb4cd95 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -866,9 +866,11 @@ void QHeaderView::swapSections(int first, int second) \fn void QHeaderView::resizeSection(int logicalIndex, int size) Resizes the section specified by \a logicalIndex to \a size measured in - pixels. + pixels. The size parameter must be a value larger or equal to zero. A + size equal to zero is however not recommended. In that situation hideSection + should be used instead. - \sa sectionResized(), resizeMode(), sectionSize() + \sa sectionResized(), resizeMode(), sectionSize(), hideSection() */ void QHeaderView::resizeSection(int logical, int size) -- cgit v1.2.3 From c8ba6a49da174982c881fef1b54b54bbe03405b7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 14 Mar 2012 10:53:00 +0100 Subject: QStyleSheetStyle: Fix icon properties. Convert icon structure returned by the CSS parser. Change-Id: I19b846c6cb0ec19045b6d07b3caa5ecfac75ca86 Reviewed-by: Mark Brand Reviewed-by: Friedemann Kleint --- src/widgets/styles/qstylesheetstyle.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 0f53809215..a10a531b7d 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2528,8 +2528,7 @@ void QStyleSheetStyle::setProperties(QWidget *w) QVariant v; const QVariant value = w->property(property.toLatin1()); switch (value.type()) { - // ### Qt 5 -// case QVariant::Icon: v = decl.iconValue(); break; + case QVariant::Icon: v = cssIconValueToIcon(decl.iconValue()); break; case QVariant::Image: v = QImage(decl.uriValue()); break; case QVariant::Pixmap: v = QPixmap(decl.uriValue()); break; case QVariant::Rect: v = decl.rectValue(); break; -- cgit v1.2.3 From d6311a06515221e41edb69722b571080c08d11ce Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Fri, 16 Dec 2011 13:12:39 +0100 Subject: Cocoa: Improve basic window handling. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor NSWindow creation into createNSWindow and setNSWindow. This is necessary to support QMacNativeWidget where we re-use an already created window. Implement popup window handling. Make sure the window is displayed correctly and closes when it should. Take control over window activation in order to prevent infinite loops involving the QtCreator "cmd-k" window. Activation events are for now not sent to popup-type windows. There is now a different set of test failures: add and remove some QEXPECT_FAILs. Change-Id: I229761b59f90c9815b968eacc2cbc9c20cc5047e Reviewed-by: Morten Johan Sørvig --- src/widgets/widgets/qcombobox.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index c5f5d6e6e1..8d40d17fb1 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -2545,17 +2546,25 @@ void QComboBox::hidePopup() // Fade out. bool needFade = style()->styleHint(QStyle::SH_Menu_FadeOutOnHide); + bool didFade = false; if (needFade) { -#if defined(Q_WS_MAC) - macWindowFade(qt_mac_window_for(d->container)); -#endif // Q_WS_MAC +#if defined(Q_OS_MAC) + QPlatformNativeInterface *platformNativeInterface = qApp->platformNativeInterface(); + int at = platformNativeInterface->metaObject()->indexOfMethod("fadeWindow()"); + if (at != -1) { + QMetaMethod windowFade = platformNativeInterface->metaObject()->method(at); + windowFade.invoke(platformNativeInterface, Q_ARG(QWindow *, d->container->windowHandle())); + didFade = true; + } + +#endif // Q_OS_MAC // Other platform implementations welcome :-) } d->model->blockSignals(false); d->container->itemView()->blockSignals(false); d->container->blockSignals(false); - if (!needFade) + if (!didFade) #endif // QT_NO_EFFECTS // Fade should implicitly hide as well ;-) d->container->hide(); -- cgit v1.2.3 From 9e87104295b019a1afa49f856ddcef07249d1afb Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Tue, 13 Mar 2012 11:40:25 +0100 Subject: QTableView: call model->submit() on row change QTreeView already does this in the exact same way. It's necessary to call submit() so edit strategy OnRowChange in QSqlTableModel will work as expected. Change-Id: Ib430143e8a71f3b0bcd842fcc772cc7ee4525f0a Reviewed-by: Olivier Goffart --- src/widgets/itemviews/qtableview.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 57f29641de..a5e03ca9e4 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -1071,6 +1071,10 @@ void QTableView::setModel(QAbstractItemModel *model) disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)), this, SLOT(_q_updateSpanRemovedColumns(QModelIndex,int,int))); } + if (d->selectionModel) { // support row editing + disconnect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), + d->model, SLOT(submit())); + } if (model) { //and connect to the new one connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(_q_updateSpanInsertedRows(QModelIndex,int,int))); @@ -1123,9 +1127,21 @@ void QTableView::setSelectionModel(QItemSelectionModel *selectionModel) { Q_D(QTableView); Q_ASSERT(selectionModel); + if (d->selectionModel) { + // support row editing + disconnect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), + d->model, SLOT(submit())); + } + d->verticalHeader->setSelectionModel(selectionModel); d->horizontalHeader->setSelectionModel(selectionModel); QAbstractItemView::setSelectionModel(selectionModel); + + if (d->selectionModel) { + // support row editing + connect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), + d->model, SLOT(submit())); + } } /*! -- cgit v1.2.3 From 6d67ff4061c7648708cdc2e462f248a4a8f486db Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Mon, 12 Mar 2012 21:05:31 +0100 Subject: improve processing stylesheet properties By scanning the properties in reverse order we don't have to save properties in the list only to remove them later when the occur again. It's also unnecessary to cache the values since they can be easily plucked out of decls. Various other tests can be done once per property instead of once per property occurence in decls. Change-Id: I81cf60c59efaeed57fc9c12df98279d6cae116cd Reviewed-by: Robin Burchell Reviewed-by: Rick Stockton Reviewed-by: Girish Ramakrishnan Reviewed-by: John Brooks --- src/widgets/styles/qstylesheetstyle.cpp | 49 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index a10a531b7d..0e928b13c2 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2498,22 +2498,32 @@ void QStyleSheetStyle::setGeometry(QWidget *w) void QStyleSheetStyle::setProperties(QWidget *w) { - // we have two data structures here: a hash of property -> value for lookup, - // and a vector giving properties in the order they are specified. - // - // this means we only set a property once (thanks to the hash) but we set - // properties in the order they are specified. - QHash propertyHash; - QVector properties; + // The final occurrence of each property is authoritative. + // Set value for each property in the order of property final occurrence + // since properties interact. + const QVector decls = declarations(styleRules(w), QString()); + QVector finals; // indices in reverse order of each property's final occurrence + + { + // scan decls for final occurence of each "qproperty" + QSet propertySet; + for (int i = decls.count() - 1; i >= 0; --i) { + const QString property = decls.at(i).d->property; + if (!property.startsWith(QStringLiteral("qproperty-"), Qt::CaseInsensitive)) + continue; + if (!propertySet.contains(property)) { + propertySet.insert(property); + finals.append(i); + } + } + } - // run through the declarations in order - for (int i = 0; i < decls.count(); i++) { - const Declaration &decl = decls.at(i); + for (int i = finals.count() - 1; i >= 0; --i) { + const Declaration &decl = decls.at(finals[i]); QString property = decl.d->property; - if (!property.startsWith(QStringLiteral("qproperty-"), Qt::CaseInsensitive)) - continue; property.remove(0, 10); // strip "qproperty-" + const QMetaObject *metaObject = w->metaObject(); int index = metaObject->indexOfProperty(property.toLatin1()); if (index == -1) { @@ -2525,6 +2535,7 @@ void QStyleSheetStyle::setProperties(QWidget *w) qWarning() << w << " cannot design property named " << property; continue; } + QVariant v; const QVariant value = w->property(property.toLatin1()); switch (value.type()) { @@ -2541,19 +2552,7 @@ void QStyleSheetStyle::setProperties(QWidget *w) default: v = decl.d->values.at(0).variant; break; } - if (propertyHash.contains(property)) { - // we're ignoring the original appearance of this property - properties.remove(properties.indexOf(property)); - } - - propertyHash[property] = v; - properties.append(property); - } - - // apply the values from left to right order - for (int i = 0; i < properties.count(); i++) { - const QString &property = properties.at(i); - w->setProperty(property.toLatin1(), propertyHash[property]); + w->setProperty(property.toLatin1(), v); } } -- cgit v1.2.3 From 7e3c632e96dbbd6f577c2ba98464a54176c5b7b0 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Fri, 2 Mar 2012 12:17:24 +0100 Subject: Port QMacPrintEngine and QCoreGraphicsPaintEngine from Qt 4 to Qt 5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copy qprintengine_mac_p.h, qprintengine_mac.mm, qpaintengine_mac_p.h, and qpaintengine_mac.cpp (as qpaintengine_mac.mm) from src/gui/painting/ in the 4.8 branch of http://git.gitorious.org/qt/qt.git at commit e6bd33d4aef0e4538d7918e7ab130624c911b553. The following changes are necessary to port these files to the Qt 5 API: - The copyright notice on these files has been updated to match the header.LGPL template. - Fix #includes for qprintengine_mac* and qpaintengine_mac*, as some headers have moved in Qt 5. - Remove extern forward declarations for functions that no longer exist. - Remove friend declarations for classes/functions that are not part of the Cocoa platform plugin. - Remove QT_MAC_USE_COCOA blocks. Qt is always using Cocoa now, there is no need to keep the non-Cocoa code paths anymore. The QMacPrintEngine::shouldSuppressStatus() method was also removed, since it is no longer used. - Do not use Qt::UniteClip, it was removed in commit 01b72952c38b9193138eabdab6bdab632cd75ebd - Use QCocoaAutoReleasePool in qprintengine_mac.mm - Use QPlatformPrintSupport::convert*() functions in QMacPrintEngine, since we cannot use non-exported functions from QtPrintSupport in the Cocoa plugin. - Use qt_mac_image_to_cg_image() to convert QPixmap to CGImageRef. First convert QPixmap to QImage (cheap, since the Cocoa platform plugin uses QRasterPlatformPixmap), and then convert the QImage to CFImageRef using the existing helper function. - Copy qt_mac_cg_context() to the Cocoa platform plugin from qmacstyle_mac.mm, adding a note at each location about the duplication. - Add qt_mac_QRegionToHIMutableShape() helper. Adapt the Qt 4.x code for QRegion::toHIMutableShape(), and use this in QCoreGraphicsPaintEngine. - Add qt_mac_drawCGImage() and qt_mac_get_scalefactor() helper. These functions are copied directly from the 4.8 branch of http://git.gitorious.org/qt/qt.git at the same revision shown above. - Add qt_mac_create_imagemask() helper in qpaintengine_mac.cpp. This helper is based on the function with the same name from the 4.8 branch of http://git.gitorious.org/qt/qt.git at the same revision shown above. The correctness of the implementation has not yet been verified. Since these files use the QPrinter API from QtPrintSupport, the Cocoa plugin now needs to link to that library as well. Change-Id: I90b9bbe201327489ef9e1b3294e68e91ddda27bd Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qmacstyle_mac.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src/widgets') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 1f91fa4d00..7e07cc1532 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -6390,6 +6390,7 @@ CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice) CGContextRelease the context when finished using it. \warning This function is only available on Mac OS X. + \warning This function is duplicated in the Cocoa platform plugin. */ CGContextRef qt_mac_cg_context(const QPaintDevice *pdev) -- cgit v1.2.3 From a17907829e6b180f2bb4af9a8594996b2a0e531a Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 8 Mar 2012 16:10:10 +0100 Subject: Use pointers for QAccessibleEvent. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At least on mac g++ badly wants to copy the event and cannot use the copy ctor. The sensible solution is thus to use pointers. This is in line with QCoreApplication::sendEvent. Change-Id: Icb58852be351ab04ffa17069989d7a07d4b377da Reviewed-by: Jan-Arve Sæther --- src/widgets/dialogs/qdialog.cpp | 9 +++++--- src/widgets/dialogs/qmessagebox.cpp | 3 ++- src/widgets/graphicsview/qgraphicsscene.cpp | 3 ++- src/widgets/itemviews/qabstractitemview.cpp | 18 ++++++++++----- src/widgets/itemviews/qlistview.cpp | 9 +++++--- src/widgets/itemviews/qtableview.cpp | 30 +++++-------------------- src/widgets/itemviews/qtreeview.cpp | 15 ++++++++----- src/widgets/kernel/qwhatsthis.cpp | 6 +++-- src/widgets/kernel/qwidget.cpp | 35 ++++++++++++++++++++--------- src/widgets/widgets/qabstractbutton.cpp | 6 +++-- src/widgets/widgets/qabstractslider.cpp | 3 ++- src/widgets/widgets/qabstractspinbox.cpp | 6 +++-- src/widgets/widgets/qcombobox.cpp | 15 ++++++++----- src/widgets/widgets/qgroupbox.cpp | 3 ++- src/widgets/widgets/qlabel.cpp | 6 +++-- src/widgets/widgets/qlineedit_p.cpp | 3 ++- src/widgets/widgets/qmenu.cpp | 12 ++++++---- src/widgets/widgets/qmenubar.cpp | 6 +++-- src/widgets/widgets/qprogressbar.cpp | 3 ++- src/widgets/widgets/qpushbutton.cpp | 3 ++- src/widgets/widgets/qtabbar.cpp | 6 +++-- src/widgets/widgets/qwidgetlinecontrol.cpp | 9 +++++--- 22 files changed, 126 insertions(+), 83 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index f1a6a294d2..5d36bc07e8 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -754,7 +754,8 @@ void QDialog::setVisible(bool visible) } #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DialogStart, this)); + QAccessibleEvent event(QAccessible::DialogStart, this); + QAccessible::updateAccessibility(&event); #endif } else { @@ -762,8 +763,10 @@ void QDialog::setVisible(bool visible) return; #ifndef QT_NO_ACCESSIBILITY - if (isVisible()) - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DialogEnd, this)); + if (isVisible()) { + QAccessibleEvent event(QAccessible::DialogEnd, this); + QAccessible::updateAccessibility(&event); + } #endif // Reimplemented to exit a modal event loop when the dialog is hidden. diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index e1b134ee48..040f61dfc5 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1463,7 +1463,8 @@ void QMessageBox::showEvent(QShowEvent *e) d->updateSize(); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Alert, this)); + QAccessibleEvent event(QAccessible::Alert, this); + QAccessible::updateAccessibility(&event); #endif #ifdef Q_OS_WIN if (const HMENU systemMenu = qt_getWindowsSystemMenu(this)) { diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 830853094a..752542c1ee 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -843,7 +843,8 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, #ifndef QT_NO_ACCESSIBILITY if (focusItem) { if (QGraphicsObject *focusObj = focusItem->toGraphicsObject()) { - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, focusObj)); + QAccessibleEvent event(QAccessible::Focus, focusObj); + QAccessible::updateAccessibility(&event); } } #endif diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 8530e2c23e..8992a3bdfe 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1112,7 +1112,8 @@ void QAbstractItemView::reset() #ifdef Q_WS_X11 if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(this)->table2Interface()->modelReset(); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, this, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, this, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -3342,7 +3343,8 @@ void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int star #ifdef Q_WS_X11 if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsRemoved(index, start, end); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -3422,7 +3424,8 @@ void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int s #ifdef Q_WS_X11 if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsRemoved(index, start, end); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -3445,7 +3448,8 @@ void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int sta Q_Q(QAbstractItemView); if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsInserted(index, start, end); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -3469,7 +3473,8 @@ void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int #ifdef Q_WS_X11 if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsInserted(index, start, end); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -3497,7 +3502,8 @@ void QAbstractItemViewPrivate::_q_layoutChanged() Q_Q(QAbstractItemView); if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(q)->table2Interface()->modelReset(); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index b00b1073a3..872798a8e9 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -3169,7 +3169,8 @@ void QListView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr if (QAccessible::isActive()) { if (current.isValid()) { int entry = visualIndex(current) + 1; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, entry)); + QAccessibleEvent event(QAccessible::Focus, this, entry); + QAccessible::updateAccessibility(&event); } } #endif @@ -3188,12 +3189,14 @@ void QListView::selectionChanged(const QItemSelection &selected, QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { int entry = visualIndex(sel) + 1; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, entry)); + QAccessibleEvent event(QAccessible::Selection, this, entry); + QAccessible::updateAccessibility(&event); } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { int entry = visualIndex(desel) + 1; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, this, entry)); + QAccessibleEvent event(QAccessible::SelectionRemove, this, entry); + QAccessible::updateAccessibility(&event); } } #endif diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index a5e03ca9e4..55cf18d78c 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -3180,16 +3180,10 @@ void QTableView::currentChanged(const QModelIndex ¤t, const QModelIndex &p #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { if (current.isValid()) { -#ifdef Q_OS_UNIX Q_D(QTableView); int entry = d->accessibleTable2Index(current); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, entry)); -#else - int entry = visualIndex(current) + 1; - if (horizontalHeader()) - ++entry; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, viewport(), entry)); -#endif + QAccessibleEvent event(QAccessible::Focus, this, entry); + QAccessible::updateAccessibility(&event); } } #endif @@ -3209,27 +3203,15 @@ void QTableView::selectionChanged(const QItemSelection &selected, // ### does not work properly for selection ranges. QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { -#ifdef Q_OS_UNIX int entry = d->accessibleTable2Index(sel); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, entry)); -#else - int entry = visualIndex(sel); - if (horizontalHeader()) - ++entry; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, viewport(), entry)); -#endif + QAccessibleEvent event(QAccessible::Selection, this, entry); + QAccessible::updateAccessibility(&event); } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { -#ifdef Q_OS_UNIX int entry = d->accessibleTable2Index(desel); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, this, entry)); -#else - int entry = visualIndex(sel); - if (horizontalHeader()) - ++entry; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, viewport(), entry)); -#endif + QAccessibleEvent event(QAccessible::SelectionRemove, this, entry); + QAccessible::updateAccessibility(&event); } } #endif diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index e2be4990d9..6166823754 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -2937,7 +2937,8 @@ void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem & #ifndef QT_NO_ACCESSIBILITY #ifdef Q_OS_UNIX if (QAccessible::isActive()) { - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -2955,7 +2956,8 @@ void QTreeViewPrivate::removeViewItems(int pos, int count) #ifndef QT_NO_ACCESSIBILITY #ifdef Q_OS_UNIX if (QAccessible::isActive()) { - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0)); + QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); + QAccessible::updateAccessibility(&event); } #endif #endif @@ -3769,7 +3771,8 @@ void QTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr if (QAccessible::isActive() && current.isValid()) { #ifdef Q_OS_UNIX int entry = (visualIndex(current) + (header()?1:0))*current.model()->columnCount()+current.column() + 1; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, entry)); + QAccessibleEvent event(QAccessible::Focus, this, entry); + QAccessible::updateAccessibility(&event); #else int entry = visualIndex(current) + 1; if (header()) @@ -3794,13 +3797,15 @@ void QTreeView::selectionChanged(const QItemSelection &selected, if (sel.isValid()) { int entry = (visualIndex(sel) + (header()?1:0))*sel.model()->columnCount()+sel.column() + 1; Q_ASSERT(entry > 0); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, entry)); + QAccessibleEvent event(QAccessible::Selection, this, entry); + QAccessible::updateAccessibility(&event); } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { int entry = (visualIndex(desel) + (header()?1:0))*desel.model()->columnCount()+desel.column() + 1; Q_ASSERT(entry > 0); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, this, entry)); + QAccessibleEvent event(QAccessible::SelectionRemove, this, entry); + QAccessible::updateAccessibility(&event); } } #endif diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 1c20b98139..114cde59e9 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -412,7 +412,8 @@ QWhatsThisPrivate::QWhatsThisPrivate() #endif } #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ContextHelpStart, this)); + QAccessibleEvent event(QAccessible::ContextHelpStart, this); + QAccessible::updateAccessibility(&event); #endif } @@ -424,7 +425,8 @@ QWhatsThisPrivate::~QWhatsThisPrivate() QApplication::restoreOverrideCursor(); #endif #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ContextHelpEnd, this)); + QAccessibleEvent event(QAccessible::ContextHelpEnd, this); + QAccessible::updateAccessibility(&event); #endif instance = 0; } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index be1782bc4d..a4bb205b76 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5965,7 +5965,10 @@ void QWidget::setFocus(Qt::FocusReason reason) // menus update the focus manually and this would create bogus events if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem"))) # endif - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, f)); + { + QAccessibleEvent event(QAccessible::Focus, f); + QAccessible::updateAccessibility(&event); + } #endif #ifndef QT_NO_GRAPHICSVIEW if (QWExtra *topData = window()->d_func()->extra) { @@ -6045,7 +6048,8 @@ void QWidget::clearFocus() #endif { #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this)); + QAccessibleEvent event(QAccessible::Focus, this); + QAccessible::updateAccessibility(&event); #endif } } @@ -7051,8 +7055,10 @@ void QWidgetPrivate::show_helper() qApp->d_func()->openPopup(q); #ifndef QT_NO_ACCESSIBILITY - if (q->windowType() != Qt::ToolTip) // Tooltips are read aloud twice in MS narrator. - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectShow, q)); + if (q->windowType() != Qt::ToolTip) { // Tooltips are read aloud twice in MS narrator. + QAccessibleEvent event(QAccessible::ObjectShow, q); + QAccessible::updateAccessibility(&event); + } #endif if (QApplicationPrivate::hidden_focus_widget == q) { @@ -7142,8 +7148,10 @@ void QWidgetPrivate::hide_helper() bs->removeDirtyWidget(q); #ifndef QT_NO_ACCESSIBILITY - if (wasVisible) - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectHide, q)); + if (wasVisible) { + QAccessibleEvent event(QAccessible::ObjectHide, q); + QAccessible::updateAccessibility(&event); + } #endif } @@ -7374,8 +7382,10 @@ void QWidgetPrivate::hideChildren(bool spontaneous) } qApp->d_func()->sendSyntheticEnterLeave(widget); #ifndef QT_NO_ACCESSIBILITY - if (!spontaneous) - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectHide, widget)); + if (!spontaneous) { + QAccessibleEvent event(QAccessible::ObjectHide, widget); + QAccessible::updateAccessibility(&event); + } #endif } } @@ -8250,7 +8260,8 @@ void QWidget::changeEvent(QEvent * event) #ifndef QT_NO_ACCESSIBILITY QAccessible::State s; s.disabled = true; - QAccessible::updateAccessibility(QAccessibleStateChangeEvent(s, this)); + QAccessibleStateChangeEvent event(s, this); + QAccessible::updateAccessibility(&event); #endif break; } @@ -10391,7 +10402,8 @@ void QWidget::setAccessibleName(const QString &name) { Q_D(QWidget); d->accessibleName = name; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this)); + QAccessibleEvent event(QAccessible::NameChanged, this); + QAccessible::updateAccessibility(&event); } QString QWidget::accessibleName() const @@ -10413,7 +10425,8 @@ void QWidget::setAccessibleDescription(const QString &description) { Q_D(QWidget); d->accessibleDescription = description; - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DescriptionChanged, this)); + QAccessibleEvent event(QAccessible::DescriptionChanged, this); + QAccessible::updateAccessibility(&event); } QString QWidget::accessibleDescription() const diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index aebef8ddc9..0b24799a56 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -644,7 +644,8 @@ void QAbstractButton::setText(const QString &text) update(); updateGeometry(); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this)); + QAccessibleEvent event(QAccessible::NameChanged, this); + QAccessible::updateAccessibility(&event); #endif } @@ -769,7 +770,8 @@ void QAbstractButton::setChecked(bool checked) #ifndef QT_NO_ACCESSIBILITY QAccessible::State s; s.checked = true; - QAccessible::updateAccessibility(QAccessibleStateChangeEvent(s, this)); + QAccessibleStateChangeEvent event(s, this); + QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index b0216e5277..2d3f79e43d 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -538,7 +538,8 @@ void QAbstractSlider::setValue(int value) emit sliderMoved((d->position = value)); } #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this)); + QAccessibleEvent event(QAccessible::ValueChanged, this); + QAccessible::updateAccessibility(&event); #endif sliderChange(SliderValueChange); emit valueChanged(value); diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index c083369136..7b55b0fa8c 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -976,7 +976,8 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) } } #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this)); + QAccessibleEvent event(QAccessible::ValueChanged, this); + QAccessible::updateAccessibility(&event); #endif return; } @@ -1595,7 +1596,8 @@ void QAbstractSpinBoxPrivate::updateState(bool up, bool fromKeyboard /* = false buttonState = (up ? Up : Down) | (fromKeyboard ? Keyboard : Mouse); q->stepBy(up ? 1 : -1); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, q)); + QAccessibleEvent event(QAccessible::ValueChanged, q); + QAccessible::updateAccessibility(&event); #endif } } diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 8d40d17fb1..88c17ca704 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -983,7 +983,8 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn q->update(); } #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, q, 0)); + QAccessibleEvent event(QAccessible::NameChanged, q, 0); + QAccessible::updateAccessibility(&event); #endif } @@ -1239,7 +1240,8 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index) emit q->currentIndexChanged(index.row()); emit q->currentIndexChanged(itemText(index)); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, q, 0)); + QAccessibleEvent event(QAccessible::NameChanged, q, 0); + QAccessible::updateAccessibility(&event); #endif } @@ -2587,7 +2589,8 @@ void QComboBox::clear() Q_D(QComboBox); d->model->removeRows(0, d->model->rowCount(d->root), d->root); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0)); + QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessible::updateAccessibility(&event); #endif } @@ -2606,7 +2609,8 @@ void QComboBox::clearEditText() if (d->lineEdit) d->lineEdit->clear(); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0)); + QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessible::updateAccessibility(&event); #endif } @@ -2619,7 +2623,8 @@ void QComboBox::setEditText(const QString &text) if (d->lineEdit) d->lineEdit->setText(text); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0)); + QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp index cf3e14871f..7186ddfccc 100644 --- a/src/widgets/widgets/qgroupbox.cpp +++ b/src/widgets/widgets/qgroupbox.cpp @@ -249,7 +249,8 @@ void QGroupBox::setTitle(const QString &title) update(); updateGeometry(); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0)); + QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index 82e56f3354..f36dea52dd 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -315,8 +315,10 @@ void QLabel::setText(const QString &text) d->updateLabel(); #ifndef QT_NO_ACCESSIBILITY - if (accessibleName().isEmpty()) - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0)); + if (accessibleName().isEmpty()) { + QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessible::updateAccessibility(&event); + } #endif } diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index d06e98e31a..37e956c27f 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -144,7 +144,8 @@ void QLineEditPrivate::_q_selectionChanged() emit q->selectionChanged(); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextSelectionChanged, q)); + QAccessibleEvent event(QAccessible::TextSelectionChanged, q); + QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index af4a87e282..7d4f7151a4 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1076,8 +1076,10 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { int actionIndex = indexOf(action); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, q, actionIndex)); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, q, actionIndex)); + QAccessibleEvent focusEvent(QAccessible::Focus, q, actionIndex); + QAccessible::updateAccessibility(&focusEvent); + QAccessibleEvent selectionEvent(QAccessible::Selection, q, actionIndex); + QAccessible::updateAccessibility(&selectionEvent); } #endif action->showStatusText(topCausedWidget()); @@ -1970,7 +1972,8 @@ void QMenu::popup(const QPoint &p, QAction *atAction) } #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::PopupMenuStart, this ,0)); + QAccessibleEvent event(QAccessible::PopupMenuStart, this ,0); + QAccessible::updateAccessibility(&event); #endif } @@ -2091,7 +2094,8 @@ void QMenu::hideEvent(QHideEvent *) d->eventLoop->exit(); d->setCurrentAction(0); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::PopupMenuEnd, this)); + QAccessibleEvent event(QAccessible::PopupMenuEnd, this); + QAccessible::updateAccessibility(&event); #endif #ifndef QT_NO_MENUBAR if (QMenuBar *mb = qobject_cast(d->causedPopup.widget)) diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 0efa6caebc..2712839103 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -531,8 +531,10 @@ void QMenuBarPrivate::_q_actionHovered() #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { int actionIndex = actions.indexOf(action); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, q, actionIndex)); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, q, actionIndex)); + QAccessibleEvent focusEvent(QAccessible::Focus, q, actionIndex); + QAccessible::updateAccessibility(&focusEvent); + QAccessibleEvent selectionEvent(QAccessible::Selection, q, actionIndex); + QAccessible::updateAccessibility(&selectionEvent); } #endif //QT_NO_ACCESSIBILITY } diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp index c1a34bfb7a..0439caeb88 100644 --- a/src/widgets/widgets/qprogressbar.cpp +++ b/src/widgets/widgets/qprogressbar.cpp @@ -314,7 +314,8 @@ void QProgressBar::setValue(int value) d->value = value; emit valueChanged(value); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this)); + QAccessibleEvent event(QAccessible::ValueChanged, this); + QAccessible::updateAccessibility(&event); #endif if (d->repaintRequired()) repaint(); diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 059b0f801c..5dae4e0b34 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -378,7 +378,8 @@ void QPushButton::setDefault(bool enable) #ifndef QT_NO_ACCESSIBILITY QAccessible::State s; s.defaultButton = true; - QAccessible::updateAccessibility(QAccessibleStateChangeEvent(s, this)); + QAccessibleStateChangeEvent event(s, this); + QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index ce25a22847..af360701fa 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -1183,8 +1183,10 @@ void QTabBar::setCurrentIndex(int index) d->layoutTab(index); #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, index)); - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, index)); + QAccessibleEvent focusEvent(QAccessible::Focus, this, index); + QAccessible::updateAccessibility(&focusEvent); + QAccessibleEvent selectionEvent(QAccessible::Selection, this, index); + QAccessible::updateAccessibility(&selectionEvent); } #endif emit currentChanged(index); diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index a04339f864..7c659ebb64 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -767,8 +767,10 @@ void QWidgetLineControl::internalSetText(const QString &txt, int pos, bool edite bool changed = finishChange(-1, true, edited); #ifndef QT_NO_ACCESSIBILITY - if (changed) - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextUpdated, parent())); + if (changed) { + QAccessibleEvent event(QAccessible::TextUpdated, parent()); + QAccessible::updateAccessibility(&event); + } #endif } @@ -1367,7 +1369,8 @@ void QWidgetLineControl::emitCursorPositionChanged() m_lastCursorPos = m_cursor; cursorPositionChanged(oldLast, m_cursor); #ifndef QT_NO_ACCESSIBILITY - QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextCaretMoved, parent())); + QAccessibleEvent event(QAccessible::TextCaretMoved, parent()); + QAccessible::updateAccessibility(&event); #endif } } -- cgit v1.2.3 From 006a49b19ac100df587f23eb76dc4ba8855047a0 Mon Sep 17 00:00:00 2001 From: Jerome Leclanche Date: Thu, 15 Mar 2012 00:41:15 +0000 Subject: Fix compiling with --no-accessibility Adds missing QT_NO_ACCESSIBILITY checks where required to build without accessibility support. Change-Id: Id98ecdcb9b351289b21dc2d382100d0b63857db9 Reviewed-by: Frederik Gladhorn --- src/widgets/kernel/qwidgetwindow_qpa.cpp | 4 ++++ src/widgets/kernel/qwidgetwindow_qpa_p.h | 2 ++ src/widgets/widgets/qtabbar.cpp | 4 +++- src/widgets/widgets/qtabbar.h | 3 ++- 4 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidgetwindow_qpa.cpp b/src/widgets/kernel/qwidgetwindow_qpa.cpp index 4d5e9d5774..f58dddb70f 100644 --- a/src/widgets/kernel/qwidgetwindow_qpa.cpp +++ b/src/widgets/kernel/qwidgetwindow_qpa.cpp @@ -43,7 +43,9 @@ #include "private/qwidget_p.h" #include "private/qapplication_p.h" +#ifndef QT_NO_ACCESSIBILITY #include +#endif QT_BEGIN_NAMESPACE @@ -60,12 +62,14 @@ QWidgetWindow::QWidgetWindow(QWidget *widget) { } +#ifndef QT_NO_ACCESSIBILITY QAccessibleInterface *QWidgetWindow::accessibleRoot() const { if (m_widget) return QAccessible::queryAccessibleInterface(m_widget); return 0; } +#endif QObject *QWidgetWindow::focusObject() const { diff --git a/src/widgets/kernel/qwidgetwindow_qpa_p.h b/src/widgets/kernel/qwidgetwindow_qpa_p.h index 1e8813fddc..e5c07a2d3a 100644 --- a/src/widgets/kernel/qwidgetwindow_qpa_p.h +++ b/src/widgets/kernel/qwidgetwindow_qpa_p.h @@ -62,7 +62,9 @@ public: QWidgetWindow(QWidget *widget); QWidget *widget() const { return m_widget; } +#ifndef QT_NO_ACCESSIBILITY QAccessibleInterface *accessibleRoot() const; +#endif QObject *focusObject() const; protected: diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index af360701fa..84c32e519b 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -359,8 +359,10 @@ void QTabBarPrivate::init() #endif q->setFocusPolicy(Qt::TabFocus); +#ifndef QT_NO_ACCESSIBILITY leftB->setAccessibleName(QTabBar::tr("Scroll Left")); rightB->setAccessibleName(QTabBar::tr("Scroll Right")); +#endif q->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); elideMode = Qt::TextElideMode(q->style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, q)); useScrollButtons = !q->style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, q); @@ -1737,7 +1739,7 @@ void QTabBar::mouseMoveEvent(QMouseEvent *event) if (d->pressedIndex != -1 && event->buttons() == Qt::NoButton) d->moveTabFinished(d->pressedIndex); - + // Start drag if (!d->dragInProgress && d->pressedIndex != -1) { if ((event->pos() - d->dragStartPosition).manhattanLength() > QApplication::startDragDistance()) { diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h index 3a4b9198d3..85586f5e57 100644 --- a/src/widgets/widgets/qtabbar.h +++ b/src/widgets/widgets/qtabbar.h @@ -197,8 +197,9 @@ protected: void changeEvent(QEvent *); void initStyleOption(QStyleOptionTab *option, int tabIndex) const; - +#ifndef QT_NO_ACCESSIBILITY friend class QAccessibleTabBar; +#endif private: Q_DISABLE_COPY(QTabBar) Q_DECLARE_PRIVATE(QTabBar) -- cgit v1.2.3 From e3726609d6431aaa1200e12ee9a65ea144008c34 Mon Sep 17 00:00:00 2001 From: Jonathan Liu Date: Fri, 16 Mar 2012 01:10:02 +1100 Subject: QSystemTrayIcon/Win: Fix compilation on MinGW Define NOTIFYICON_VERSION_4 if it is not already defined. Change-Id: Ic432cbebf18f8b1e8b4727659dcedd7063e126ee Reviewed-by: Friedemann Kleint --- src/widgets/util/qsystemtrayicon_win.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/widgets') diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp index f3d4347986..fa72e791ba 100644 --- a/src/widgets/util/qsystemtrayicon_win.cpp +++ b/src/widgets/util/qsystemtrayicon_win.cpp @@ -81,6 +81,7 @@ struct Q_NOTIFYICONIDENTIFIER { # define NIN_BALLOONTIMEOUT (WM_USER + 4) # define NIN_BALLOONUSERCLICK (WM_USER + 5) # define NIF_SHOWTIP 0x00000080 +# define NOTIFYICON_VERSION_4 4 #endif #define Q_MSGFLT_ALLOW 1 -- cgit v1.2.3 From e2b6bebbed0d905c6461a65518de010d9db57176 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 15 Mar 2012 15:15:07 +0100 Subject: Remove Q_WS_X11 The define is removed and only added an include. Change-Id: I85090023cb9eb33f83ccc7fe2ab69556b4ff89fb Reviewed-by: Robin Burchell --- src/widgets/kernel/qiconloader.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qiconloader.cpp b/src/widgets/kernel/qiconloader.cpp index 2f9576f864..a0ee95c80c 100644 --- a/src/widgets/kernel/qiconloader.cpp +++ b/src/widgets/kernel/qiconloader.cpp @@ -61,10 +61,6 @@ #include #endif -#ifdef Q_WS_X11 -#include -#endif - #include QT_BEGIN_NAMESPACE -- cgit v1.2.3