From ab84aa53affd6215abcdbe6dc56a0ca021a49d6b Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Fri, 16 Mar 2012 17:02:49 -0700 Subject: QWidget: update documents of mouseDoubleClickEvent() Double click behavior has been changed. see SHA: b371f3f943703840d0dfbe30505018bcca06e260 Change-Id: Ibd921d01fb25b8c31f75105a4ff63c42bf00c335 Reviewed-by: Casper van Donderen Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qwidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index a4bb205b76..5457c54f5d 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -612,8 +612,9 @@ void QWidget::setAutoFillBackground(bool enabled) steals the mouse events. \li mouseDoubleClickEvent() is called when the user double-clicks in the widget. If the user double-clicks, the widget receives a mouse - press event, a mouse release event and finally this event instead - of a second mouse press event. (Some mouse move events may also be + press event, a mouse release event, (a mouse click event,) a second + mouse press, this event and finally a second mouse release event. + (Some mouse move events may also be received if the mouse is not held steady during this operation.) It is \e{not possible} to distinguish a click from a double-click until the second click arrives. (This is one reason why most GUI -- cgit v1.2.3 From 478658fd41dba6c0d94edfbe31086dc3cabff533 Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Sat, 17 Mar 2012 22:59:10 -0700 Subject: QtWidgets: cleanup several Q3* items Change-Id: I0812cdd74f19b4c98336724ea722807d4c68cf7d Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qwidget.cpp | 2 +- src/widgets/widgets/qframe.cpp | 2 +- src/widgets/widgets/qmenubar_p.h | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 5457c54f5d..1bf3d3cff9 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2708,7 +2708,7 @@ Qt::WindowStates QWidget::windowState() const The function sets the window state on child widgets similar to setWindowState(). The difference is that the window state changed event has the isOverride() flag set. It exists mainly to keep - Q3Workspace working. + QWorkspace working. */ void QWidget::overrideWindowState(Qt::WindowStates newstate) { diff --git a/src/widgets/widgets/qframe.cpp b/src/widgets/widgets/qframe.cpp index 29c213f7af..b69f65828b 100644 --- a/src/widgets/widgets/qframe.cpp +++ b/src/widgets/widgets/qframe.cpp @@ -486,7 +486,7 @@ void QFrame::paintEvent(QPaintEvent *) /*! \internal - Mostly for the sake of Q3Frame + Used by QLabel and QLCDNumber */ void QFrame::drawFrame(QPainter *p) { diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h index 9e1d3179c7..139f5703de 100644 --- a/src/widgets/widgets/qmenubar_p.h +++ b/src/widgets/widgets/qmenubar_p.h @@ -53,7 +53,6 @@ // We mean it. // -#ifndef QMAC_Q3MENUBAR_CPP_FILE #include "QtWidgets/qstyleoption.h" #include // Mac needs what in this file! @@ -190,7 +189,6 @@ public: QAction *menuBarAction; #endif }; -#endif #endif // QT_NO_MENUBAR -- cgit v1.2.3 From 477c43260eea8461dff1e0e8acb4b61a1600518a Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 30 Jan 2012 18:52:46 +0100 Subject: Accessibility: add text update events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iece9d100b3f5a379d7d8e29dea67a10d0c918c06 Reviewed-by: Jan-Arve Sæther --- src/widgets/widgets/qabstractslider.cpp | 2 +- src/widgets/widgets/qabstractspinbox.cpp | 4 +-- src/widgets/widgets/qlineedit_p.cpp | 5 ++-- src/widgets/widgets/qprogressbar.cpp | 2 +- src/widgets/widgets/qwidgetlinecontrol.cpp | 42 +++++++++++++++++++++++++++--- 5 files changed, 45 insertions(+), 10 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index 2d3f79e43d..083b9303f4 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -538,7 +538,7 @@ void QAbstractSlider::setValue(int value) emit sliderMoved((d->position = value)); } #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::ValueChanged, this); + QAccessibleValueChangeEvent event(d->value, this); QAccessible::updateAccessibility(&event); #endif sliderChange(SliderValueChange); diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 7b55b0fa8c..384fff7f7b 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -976,7 +976,7 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) } } #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::ValueChanged, this); + QAccessibleValueChangeEvent event(d->value, this); QAccessible::updateAccessibility(&event); #endif return; @@ -1596,7 +1596,7 @@ void QAbstractSpinBoxPrivate::updateState(bool up, bool fromKeyboard /* = false buttonState = (up ? Up : Down) | (fromKeyboard ? Keyboard : Mouse); q->stepBy(up ? 1 : -1); #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::ValueChanged, q); + QAccessibleValueChangeEvent event(value, q); QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 37e956c27f..36e394450b 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -144,8 +144,9 @@ void QLineEditPrivate::_q_selectionChanged() emit q->selectionChanged(); #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::TextSelectionChanged, q); - QAccessible::updateAccessibility(&event); + QAccessibleTextSelectionEvent ev(control->selectionStart(), control->selectionEnd(), q); + ev.setCursorPosition(control->cursorPosition()); + QAccessible::updateAccessibility(&ev); #endif } diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp index 0439caeb88..22b35d05a5 100644 --- a/src/widgets/widgets/qprogressbar.cpp +++ b/src/widgets/widgets/qprogressbar.cpp @@ -314,7 +314,7 @@ void QProgressBar::setValue(int value) d->value = value; emit valueChanged(value); #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::ValueChanged, this); + QAccessibleValueChangeEvent event(value, this); QAccessible::updateAccessibility(&event); #endif if (d->repaintRequired()) diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 7c659ebb64..8806999355 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -768,8 +768,19 @@ void QWidgetLineControl::internalSetText(const QString &txt, int pos, bool edite #ifndef QT_NO_ACCESSIBILITY if (changed) { - QAccessibleEvent event(QAccessible::TextUpdated, parent()); - QAccessible::updateAccessibility(&event); + if (oldText.isEmpty()) { + QAccessibleTextInsertEvent event(0, txt, parent()); + event.setCursorPosition(m_cursor); + QAccessible::updateAccessibility(&event); + } else if (txt.isEmpty()) { + QAccessibleTextRemoveEvent event(0, oldText, parent()); + event.setCursorPosition(m_cursor); + QAccessible::updateAccessibility(&event); + } else { + QAccessibleTextUpdateEvent event(0, oldText, txt, parent()); + event.setCursorPosition(m_cursor); + QAccessible::updateAccessibility(&event); + } } #endif } @@ -816,6 +827,10 @@ void QWidgetLineControl::internalInsert(const QString &s) addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); if (m_maskData) { QString ms = maskString(m_cursor, s); +#ifndef QT_NO_ACCESSIBILITY + QAccessibleTextInsertEvent insertEvent(m_cursor, ms, parent()); + QAccessible::updateAccessibility(&insertEvent); +#endif for (int i = 0; i < (int) ms.length(); ++i) { addCommand (Command(DeleteSelection, m_cursor + i, m_text.at(m_cursor + i), -1, -1)); addCommand(Command(Insert, m_cursor + i, ms.at(i), -1, -1)); @@ -824,9 +839,17 @@ void QWidgetLineControl::internalInsert(const QString &s) m_cursor += ms.length(); m_cursor = nextMaskBlank(m_cursor); m_textDirty = true; +#ifndef QT_NO_ACCESSIBILITY + QAccessibleTextCursorEvent event(m_cursor, parent()); + QAccessible::updateAccessibility(&event); +#endif } else { int remaining = m_maxLength - m_text.length(); if (remaining != 0) { +#ifndef QT_NO_ACCESSIBILITY + QAccessibleTextInsertEvent insertEvent(m_cursor, s, parent()); + QAccessible::updateAccessibility(&insertEvent); +#endif m_text.insert(m_cursor, s.left(remaining)); for (int i = 0; i < (int) s.left(remaining).length(); ++i) addCommand(Command(Insert, m_cursor++, s.at(i), -1, -1)); @@ -854,6 +877,10 @@ void QWidgetLineControl::internalDelete(bool wasBackspace) addCommand(Command(SetSelection, m_cursor, 0, m_selstart, m_selend)); addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)), m_cursor, m_text.at(m_cursor), -1, -1)); +#ifndef QT_NO_ACCESSIBILITY + QAccessibleTextRemoveEvent event(m_cursor, m_text.at(m_cursor), parent()); + QAccessible::updateAccessibility(&event); +#endif if (m_maskData) { m_text.replace(m_cursor, 1, clearString(m_cursor, 1)); addCommand(Command(Insert, m_cursor, m_text.at(m_cursor), -1, -1)); @@ -891,6 +918,10 @@ void QWidgetLineControl::removeSelectedText() for (i = m_selend-1; i >= m_selstart; --i) addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1)); } +#ifndef QT_NO_ACCESSIBILITY + QAccessibleTextRemoveEvent event(m_selstart, m_text.mid(m_selstart, m_selend - m_selstart), parent()); + QAccessible::updateAccessibility(&event); +#endif if (m_maskData) { m_text.replace(m_selstart, m_selend - m_selstart, clearString(m_selstart, m_selend - m_selstart)); for (int i = 0; i < m_selend - m_selstart; ++i) @@ -1369,8 +1400,11 @@ void QWidgetLineControl::emitCursorPositionChanged() m_lastCursorPos = m_cursor; cursorPositionChanged(oldLast, m_cursor); #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::TextCaretMoved, parent()); - QAccessible::updateAccessibility(&event); + // otherwise we send a selection update which includes the cursor + if (!hasSelectedText()) { + QAccessibleTextCursorEvent event(m_cursor, parent()); + QAccessible::updateAccessibility(&event); + } #endif } } -- cgit v1.2.3 From c2e8db58413207315474232697f12ddceb8310e7 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 12 Mar 2012 19:43:03 +0100 Subject: Remove QAccessibleEvent child parameter. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes the api cleaner and generally the child should not be there. It is only sometimes more convenient not to create a QAccessibleInterface instance, so the functionallity is kept. Change-Id: I26018a6d3e0549f4d79856775b4167c5660e229d Reviewed-by: Jan-Arve Sæther --- src/widgets/dialogs/qdialog.cpp | 4 ++-- src/widgets/dialogs/qmessagebox.cpp | 2 +- src/widgets/graphicsview/qgraphicsscene.cpp | 2 +- src/widgets/itemviews/qabstractitemview.cpp | 2 +- src/widgets/itemviews/qlistview.cpp | 9 +++++--- src/widgets/itemviews/qtableview.cpp | 9 +++++--- src/widgets/itemviews/qtreeview.cpp | 32 ++++++----------------------- src/widgets/kernel/qwhatsthis.cpp | 4 ++-- src/widgets/kernel/qwidget.cpp | 16 +++++++-------- src/widgets/widgets/qabstractbutton.cpp | 4 ++-- src/widgets/widgets/qabstractslider.cpp | 2 +- src/widgets/widgets/qabstractspinbox.cpp | 4 ++-- src/widgets/widgets/qcombobox.cpp | 10 ++++----- src/widgets/widgets/qgroupbox.cpp | 2 +- src/widgets/widgets/qlabel.cpp | 2 +- src/widgets/widgets/qlineedit_p.cpp | 2 +- src/widgets/widgets/qmenu.cpp | 10 +++++---- src/widgets/widgets/qmenubar.cpp | 6 ++++-- src/widgets/widgets/qprogressbar.cpp | 2 +- src/widgets/widgets/qpushbutton.cpp | 2 +- src/widgets/widgets/qtabbar.cpp | 6 ++++-- src/widgets/widgets/qwidgetlinecontrol.cpp | 18 ++++++++-------- 22 files changed, 71 insertions(+), 79 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 5d36bc07e8..df76d0af0e 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -754,7 +754,7 @@ void QDialog::setVisible(bool visible) } #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::DialogStart, this); + QAccessibleEvent event(this, QAccessible::DialogStart); QAccessible::updateAccessibility(&event); #endif @@ -764,7 +764,7 @@ void QDialog::setVisible(bool visible) #ifndef QT_NO_ACCESSIBILITY if (isVisible()) { - QAccessibleEvent event(QAccessible::DialogEnd, this); + QAccessibleEvent event(this, QAccessible::DialogEnd); QAccessible::updateAccessibility(&event); } #endif diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 040f61dfc5..ec24f09b77 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1463,7 +1463,7 @@ void QMessageBox::showEvent(QShowEvent *e) d->updateSize(); #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::Alert, this); + QAccessibleEvent event(this, QAccessible::Alert); QAccessible::updateAccessibility(&event); #endif #ifdef Q_OS_WIN diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 752542c1ee..8d1795c3c2 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -843,7 +843,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item, #ifndef QT_NO_ACCESSIBILITY if (focusItem) { if (QGraphicsObject *focusObj = focusItem->toGraphicsObject()) { - QAccessibleEvent event(QAccessible::Focus, focusObj); + QAccessibleEvent event(focusObj, QAccessible::Focus); QAccessible::updateAccessibility(&event); } } diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 8992a3bdfe..2ff039595a 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1112,7 +1112,7 @@ void QAbstractItemView::reset() #ifdef Q_WS_X11 if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(this)->table2Interface()->modelReset(); - QAccessibleEvent event(QAccessible::TableModelChanged, this, 0); + QAccessibleEvent event(this, QAccessible::TableModelChanged); QAccessible::updateAccessibility(&event); } #endif diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 872798a8e9..4547dde6e1 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; - QAccessibleEvent event(QAccessible::Focus, this, entry); + QAccessibleEvent event(this, QAccessible::Focus); + event.setChild(entry); QAccessible::updateAccessibility(&event); } } @@ -3189,13 +3190,15 @@ void QListView::selectionChanged(const QItemSelection &selected, QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { int entry = visualIndex(sel) + 1; - QAccessibleEvent event(QAccessible::Selection, this, entry); + QAccessibleEvent event(this, QAccessible::Selection); + event.setChild(entry); QAccessible::updateAccessibility(&event); } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { int entry = visualIndex(desel) + 1; - QAccessibleEvent event(QAccessible::SelectionRemove, this, entry); + QAccessibleEvent event(this, QAccessible::SelectionRemove); + event.setChild(entry); QAccessible::updateAccessibility(&event); } } diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 55cf18d78c..e997f7e9d6 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -3182,7 +3182,8 @@ void QTableView::currentChanged(const QModelIndex ¤t, const QModelIndex &p if (current.isValid()) { Q_D(QTableView); int entry = d->accessibleTable2Index(current); - QAccessibleEvent event(QAccessible::Focus, this, entry); + QAccessibleEvent event(this, QAccessible::Focus); + event.setChild(entry); QAccessible::updateAccessibility(&event); } } @@ -3204,13 +3205,15 @@ void QTableView::selectionChanged(const QItemSelection &selected, QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { int entry = d->accessibleTable2Index(sel); - QAccessibleEvent event(QAccessible::Selection, this, entry); + QAccessibleEvent event(this, QAccessible::Selection); + event.setChild(entry); QAccessible::updateAccessibility(&event); } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { int entry = d->accessibleTable2Index(desel); - QAccessibleEvent event(QAccessible::SelectionRemove, this, entry); + QAccessibleEvent event(this, QAccessible::SelectionRemove); + event.setChild(entry); QAccessible::updateAccessibility(&event); } } diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 6166823754..acc485c371 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -2934,14 +2934,6 @@ void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem & for (int i = pos + count; i < viewItems.count(); i++) if (items[i].parentItem >= pos) items[i].parentItem += count; -#ifndef QT_NO_ACCESSIBILITY -#ifdef Q_OS_UNIX - if (QAccessible::isActive()) { - QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); - QAccessible::updateAccessibility(&event); - } -#endif -#endif } void QTreeViewPrivate::removeViewItems(int pos, int count) @@ -2953,14 +2945,6 @@ void QTreeViewPrivate::removeViewItems(int pos, int count) for (int i = pos; i < viewItems.count(); i++) if (items[i].parentItem >= pos) items[i].parentItem -= count; -#ifndef QT_NO_ACCESSIBILITY -#ifdef Q_OS_UNIX - if (QAccessible::isActive()) { - QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); - QAccessible::updateAccessibility(&event); - } -#endif -#endif } #if 0 @@ -3769,16 +3753,10 @@ void QTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr } #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive() && current.isValid()) { -#ifdef Q_OS_UNIX int entry = (visualIndex(current) + (header()?1:0))*current.model()->columnCount()+current.column() + 1; - QAccessibleEvent event(QAccessible::Focus, this, entry); + QAccessibleEvent event(this, QAccessible::Focus); + event.setChild(entry); QAccessible::updateAccessibility(&event); -#else - int entry = visualIndex(current) + 1; - if (header()) - ++entry; - QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus); -#endif } #endif } @@ -3797,14 +3775,16 @@ 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); - QAccessibleEvent event(QAccessible::Selection, this, entry); + QAccessibleEvent event(this, QAccessible::Selection); + event.setChild(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); - QAccessibleEvent event(QAccessible::SelectionRemove, this, entry); + QAccessibleEvent event(this, QAccessible::SelectionRemove); + event.setChild(entry); QAccessible::updateAccessibility(&event); } } diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 114cde59e9..88c41a5fba 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -412,7 +412,7 @@ QWhatsThisPrivate::QWhatsThisPrivate() #endif } #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::ContextHelpStart, this); + QAccessibleEvent event(this, QAccessible::ContextHelpStart); QAccessible::updateAccessibility(&event); #endif } @@ -425,7 +425,7 @@ QWhatsThisPrivate::~QWhatsThisPrivate() QApplication::restoreOverrideCursor(); #endif #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::ContextHelpEnd, this); + QAccessibleEvent event(this, QAccessible::ContextHelpEnd); QAccessible::updateAccessibility(&event); #endif instance = 0; diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 1bf3d3cff9..6418ba63e1 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5967,7 +5967,7 @@ void QWidget::setFocus(Qt::FocusReason reason) if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem"))) # endif { - QAccessibleEvent event(QAccessible::Focus, f); + QAccessibleEvent event(f, QAccessible::Focus); QAccessible::updateAccessibility(&event); } #endif @@ -6049,7 +6049,7 @@ void QWidget::clearFocus() #endif { #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::Focus, this); + QAccessibleEvent event(this, QAccessible::Focus); QAccessible::updateAccessibility(&event); #endif } @@ -7057,7 +7057,7 @@ void QWidgetPrivate::show_helper() #ifndef QT_NO_ACCESSIBILITY if (q->windowType() != Qt::ToolTip) { // Tooltips are read aloud twice in MS narrator. - QAccessibleEvent event(QAccessible::ObjectShow, q); + QAccessibleEvent event(q, QAccessible::ObjectShow); QAccessible::updateAccessibility(&event); } #endif @@ -7150,7 +7150,7 @@ void QWidgetPrivate::hide_helper() #ifndef QT_NO_ACCESSIBILITY if (wasVisible) { - QAccessibleEvent event(QAccessible::ObjectHide, q); + QAccessibleEvent event(q, QAccessible::ObjectHide); QAccessible::updateAccessibility(&event); } #endif @@ -7384,7 +7384,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous) qApp->d_func()->sendSyntheticEnterLeave(widget); #ifndef QT_NO_ACCESSIBILITY if (!spontaneous) { - QAccessibleEvent event(QAccessible::ObjectHide, widget); + QAccessibleEvent event(widget, QAccessible::ObjectHide); QAccessible::updateAccessibility(&event); } #endif @@ -8261,7 +8261,7 @@ void QWidget::changeEvent(QEvent * event) #ifndef QT_NO_ACCESSIBILITY QAccessible::State s; s.disabled = true; - QAccessibleStateChangeEvent event(s, this); + QAccessibleStateChangeEvent event(this, s); QAccessible::updateAccessibility(&event); #endif break; @@ -10403,7 +10403,7 @@ void QWidget::setAccessibleName(const QString &name) { Q_D(QWidget); d->accessibleName = name; - QAccessibleEvent event(QAccessible::NameChanged, this); + QAccessibleEvent event(this, QAccessible::NameChanged); QAccessible::updateAccessibility(&event); } @@ -10426,7 +10426,7 @@ void QWidget::setAccessibleDescription(const QString &description) { Q_D(QWidget); d->accessibleDescription = description; - QAccessibleEvent event(QAccessible::DescriptionChanged, this); + QAccessibleEvent event(this, QAccessible::DescriptionChanged); QAccessible::updateAccessibility(&event); } diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 0b24799a56..8c0bcc098f 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -644,7 +644,7 @@ void QAbstractButton::setText(const QString &text) update(); updateGeometry(); #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::NameChanged, this); + QAccessibleEvent event(this, QAccessible::NameChanged); QAccessible::updateAccessibility(&event); #endif } @@ -770,7 +770,7 @@ void QAbstractButton::setChecked(bool checked) #ifndef QT_NO_ACCESSIBILITY QAccessible::State s; s.checked = true; - QAccessibleStateChangeEvent event(s, this); + QAccessibleStateChangeEvent event(this, s); QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index 083b9303f4..c73da4e8c4 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -538,7 +538,7 @@ void QAbstractSlider::setValue(int value) emit sliderMoved((d->position = value)); } #ifndef QT_NO_ACCESSIBILITY - QAccessibleValueChangeEvent event(d->value, this); + QAccessibleValueChangeEvent event(this, d->value); QAccessible::updateAccessibility(&event); #endif sliderChange(SliderValueChange); diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 384fff7f7b..8bab6a9a1d 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -976,7 +976,7 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) } } #ifndef QT_NO_ACCESSIBILITY - QAccessibleValueChangeEvent event(d->value, this); + QAccessibleValueChangeEvent event(this, d->value); QAccessible::updateAccessibility(&event); #endif return; @@ -1596,7 +1596,7 @@ void QAbstractSpinBoxPrivate::updateState(bool up, bool fromKeyboard /* = false buttonState = (up ? Up : Down) | (fromKeyboard ? Keyboard : Mouse); q->stepBy(up ? 1 : -1); #ifndef QT_NO_ACCESSIBILITY - QAccessibleValueChangeEvent event(value, q); + QAccessibleValueChangeEvent event(q, value); QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 88c17ca704..dc1e0dbfab 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -983,7 +983,7 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn q->update(); } #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::NameChanged, q, 0); + QAccessibleEvent event(q, QAccessible::NameChanged); QAccessible::updateAccessibility(&event); #endif } @@ -1240,7 +1240,7 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index) emit q->currentIndexChanged(index.row()); emit q->currentIndexChanged(itemText(index)); #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::NameChanged, q, 0); + QAccessibleEvent event(q, QAccessible::NameChanged); QAccessible::updateAccessibility(&event); #endif } @@ -2589,7 +2589,7 @@ void QComboBox::clear() Q_D(QComboBox); d->model->removeRows(0, d->model->rowCount(d->root), d->root); #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessibleEvent event(this, QAccessible::NameChanged); QAccessible::updateAccessibility(&event); #endif } @@ -2609,7 +2609,7 @@ void QComboBox::clearEditText() if (d->lineEdit) d->lineEdit->clear(); #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessibleEvent event(this, QAccessible::NameChanged); QAccessible::updateAccessibility(&event); #endif } @@ -2623,7 +2623,7 @@ void QComboBox::setEditText(const QString &text) if (d->lineEdit) d->lineEdit->setText(text); #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessibleEvent event(this, QAccessible::NameChanged); QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp index 7186ddfccc..e9edea286f 100644 --- a/src/widgets/widgets/qgroupbox.cpp +++ b/src/widgets/widgets/qgroupbox.cpp @@ -249,7 +249,7 @@ void QGroupBox::setTitle(const QString &title) update(); updateGeometry(); #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessibleEvent event(this, QAccessible::NameChanged); QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index f36dea52dd..4450066df4 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -316,7 +316,7 @@ void QLabel::setText(const QString &text) #ifndef QT_NO_ACCESSIBILITY if (accessibleName().isEmpty()) { - QAccessibleEvent event(QAccessible::NameChanged, this, 0); + QAccessibleEvent event(this, QAccessible::NameChanged); QAccessible::updateAccessibility(&event); } #endif diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 36e394450b..6cee96e717 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -144,7 +144,7 @@ void QLineEditPrivate::_q_selectionChanged() emit q->selectionChanged(); #ifndef QT_NO_ACCESSIBILITY - QAccessibleTextSelectionEvent ev(control->selectionStart(), control->selectionEnd(), q); + QAccessibleTextSelectionEvent ev(q, control->selectionStart(), control->selectionEnd()); ev.setCursorPosition(control->cursorPosition()); QAccessible::updateAccessibility(&ev); #endif diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 7d4f7151a4..2abd4ceef7 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1076,9 +1076,11 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { int actionIndex = indexOf(action); - QAccessibleEvent focusEvent(QAccessible::Focus, q, actionIndex); + QAccessibleEvent focusEvent(q, QAccessible::Focus); + focusEvent.setChild(actionIndex); QAccessible::updateAccessibility(&focusEvent); - QAccessibleEvent selectionEvent(QAccessible::Selection, q, actionIndex); + QAccessibleEvent selectionEvent(q, QAccessible::Selection); + focusEvent.setChild(actionIndex); QAccessible::updateAccessibility(&selectionEvent); } #endif @@ -1972,7 +1974,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) } #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::PopupMenuStart, this ,0); + QAccessibleEvent event(this, QAccessible::PopupMenuStart); QAccessible::updateAccessibility(&event); #endif } @@ -2094,7 +2096,7 @@ void QMenu::hideEvent(QHideEvent *) d->eventLoop->exit(); d->setCurrentAction(0); #ifndef QT_NO_ACCESSIBILITY - QAccessibleEvent event(QAccessible::PopupMenuEnd, this); + QAccessibleEvent event(this, QAccessible::PopupMenuEnd); QAccessible::updateAccessibility(&event); #endif #ifndef QT_NO_MENUBAR diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 2712839103..5ec41b8ba6 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -531,9 +531,11 @@ void QMenuBarPrivate::_q_actionHovered() #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { int actionIndex = actions.indexOf(action); - QAccessibleEvent focusEvent(QAccessible::Focus, q, actionIndex); + QAccessibleEvent focusEvent(q, QAccessible::Focus); + focusEvent.setChild(actionIndex); QAccessible::updateAccessibility(&focusEvent); - QAccessibleEvent selectionEvent(QAccessible::Selection, q, actionIndex); + QAccessibleEvent selectionEvent(q, QAccessible::Selection); + selectionEvent.setChild(actionIndex); QAccessible::updateAccessibility(&selectionEvent); } #endif //QT_NO_ACCESSIBILITY diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp index 22b35d05a5..3e5b78fe2b 100644 --- a/src/widgets/widgets/qprogressbar.cpp +++ b/src/widgets/widgets/qprogressbar.cpp @@ -314,7 +314,7 @@ void QProgressBar::setValue(int value) d->value = value; emit valueChanged(value); #ifndef QT_NO_ACCESSIBILITY - QAccessibleValueChangeEvent event(value, this); + QAccessibleValueChangeEvent event(this, value); QAccessible::updateAccessibility(&event); #endif if (d->repaintRequired()) diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 5dae4e0b34..291e3548a2 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -378,7 +378,7 @@ void QPushButton::setDefault(bool enable) #ifndef QT_NO_ACCESSIBILITY QAccessible::State s; s.defaultButton = true; - QAccessibleStateChangeEvent event(s, this); + QAccessibleStateChangeEvent event(this, s); QAccessible::updateAccessibility(&event); #endif } diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 84c32e519b..8263bf8546 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -1185,9 +1185,11 @@ void QTabBar::setCurrentIndex(int index) d->layoutTab(index); #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive()) { - QAccessibleEvent focusEvent(QAccessible::Focus, this, index); + QAccessibleEvent focusEvent(this, QAccessible::Focus); + focusEvent.setChild(index); QAccessible::updateAccessibility(&focusEvent); - QAccessibleEvent selectionEvent(QAccessible::Selection, this, index); + QAccessibleEvent selectionEvent(this, QAccessible::Selection); + selectionEvent.setChild(index); QAccessible::updateAccessibility(&selectionEvent); } #endif diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 8806999355..7d97f6d295 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -769,15 +769,15 @@ void QWidgetLineControl::internalSetText(const QString &txt, int pos, bool edite #ifndef QT_NO_ACCESSIBILITY if (changed) { if (oldText.isEmpty()) { - QAccessibleTextInsertEvent event(0, txt, parent()); + QAccessibleTextInsertEvent event(parent(), 0, txt); event.setCursorPosition(m_cursor); QAccessible::updateAccessibility(&event); } else if (txt.isEmpty()) { - QAccessibleTextRemoveEvent event(0, oldText, parent()); + QAccessibleTextRemoveEvent event(parent(), 0, oldText); event.setCursorPosition(m_cursor); QAccessible::updateAccessibility(&event); } else { - QAccessibleTextUpdateEvent event(0, oldText, txt, parent()); + QAccessibleTextUpdateEvent event(parent(), 0, oldText, txt); event.setCursorPosition(m_cursor); QAccessible::updateAccessibility(&event); } @@ -828,7 +828,7 @@ void QWidgetLineControl::internalInsert(const QString &s) if (m_maskData) { QString ms = maskString(m_cursor, s); #ifndef QT_NO_ACCESSIBILITY - QAccessibleTextInsertEvent insertEvent(m_cursor, ms, parent()); + QAccessibleTextInsertEvent insertEvent(parent(), m_cursor, ms); QAccessible::updateAccessibility(&insertEvent); #endif for (int i = 0; i < (int) ms.length(); ++i) { @@ -840,14 +840,14 @@ void QWidgetLineControl::internalInsert(const QString &s) m_cursor = nextMaskBlank(m_cursor); m_textDirty = true; #ifndef QT_NO_ACCESSIBILITY - QAccessibleTextCursorEvent event(m_cursor, parent()); + QAccessibleTextCursorEvent event(parent(), m_cursor); QAccessible::updateAccessibility(&event); #endif } else { int remaining = m_maxLength - m_text.length(); if (remaining != 0) { #ifndef QT_NO_ACCESSIBILITY - QAccessibleTextInsertEvent insertEvent(m_cursor, s, parent()); + QAccessibleTextInsertEvent insertEvent(parent(), m_cursor, s); QAccessible::updateAccessibility(&insertEvent); #endif m_text.insert(m_cursor, s.left(remaining)); @@ -878,7 +878,7 @@ void QWidgetLineControl::internalDelete(bool wasBackspace) addCommand(Command((CommandType)((m_maskData ? 2 : 0) + (wasBackspace ? Remove : Delete)), m_cursor, m_text.at(m_cursor), -1, -1)); #ifndef QT_NO_ACCESSIBILITY - QAccessibleTextRemoveEvent event(m_cursor, m_text.at(m_cursor), parent()); + QAccessibleTextRemoveEvent event(parent(), m_cursor, m_text.at(m_cursor)); QAccessible::updateAccessibility(&event); #endif if (m_maskData) { @@ -919,7 +919,7 @@ void QWidgetLineControl::removeSelectedText() addCommand (Command(RemoveSelection, i, m_text.at(i), -1, -1)); } #ifndef QT_NO_ACCESSIBILITY - QAccessibleTextRemoveEvent event(m_selstart, m_text.mid(m_selstart, m_selend - m_selstart), parent()); + QAccessibleTextRemoveEvent event(parent(), m_selstart, m_text.mid(m_selstart, m_selend - m_selstart)); QAccessible::updateAccessibility(&event); #endif if (m_maskData) { @@ -1402,7 +1402,7 @@ void QWidgetLineControl::emitCursorPositionChanged() #ifndef QT_NO_ACCESSIBILITY // otherwise we send a selection update which includes the cursor if (!hasSelectedText()) { - QAccessibleTextCursorEvent event(m_cursor, parent()); + QAccessibleTextCursorEvent event(parent(), m_cursor); QAccessible::updateAccessibility(&event); } #endif -- cgit v1.2.3 From c4ac14fae1765cae9d5ab94c8af486e2d14dede7 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sat, 17 Mar 2012 19:46:33 +0100 Subject: Fix KDE palette. In QKdeTheme We want to load every color. Else, only the first color is loaded, and the rest of the palette is just black making the applications basicaly not usable. But KDE only put in its config files the colors that are different from the default colors. This is the reason why we need to resolve against the style's default palette. We need to make sure the resolve_mask is 0 for an empty palette, even before the application palette is set. This was not required in Qt4 because the system palette was initialized differently. I realize this will only work with QApplication (and not with a single QGuiApplication) but it was not working before either. Change-Id: Ifb3c2c1358ef6d83a1ca5aa8fac3d2d4ea712b94 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qapplication.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 348eb2f343..7441d55865 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -130,14 +130,17 @@ QApplicationPrivate *QApplicationPrivate::self = 0; static void initSystemPalette() { - if (!QApplicationPrivate::sys_pal) + if (!QApplicationPrivate::sys_pal) { + QPalette defaultPlatte; + if (QApplicationPrivate::app_style) + defaultPlatte = QApplicationPrivate::app_style->standardPalette(); if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette()) { - QApplicationPrivate::setSystemPalette(*themePalette); + QApplicationPrivate::setSystemPalette(themePalette->resolve(defaultPlatte)); QApplicationPrivate::initializeWidgetPaletteHash(); + } else { + QApplicationPrivate::setSystemPalette(defaultPlatte); } - - if (!QApplicationPrivate::sys_pal && QApplicationPrivate::app_style) - QApplicationPrivate::setSystemPalette(QApplicationPrivate::app_style->standardPalette()); + } } static void clearSystemPalette() -- cgit v1.2.3 From 07ff7fe52c25a1fde5f56b8a63f0d838f243b422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Thu, 15 Mar 2012 16:38:59 +0100 Subject: QHeaderView - minor fix to createSectionSpan I am unsure if this is only theoretic - but if/when we have added sections here - we must ensure that we recalculate startpositions. Change-Id: I70bf55209f1a1a885cb49748b65218879bc68776 Reviewed-by: Stephen Kelly --- src/widgets/itemviews/qheaderview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 425eb4cd95..4975e72260 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3172,8 +3172,10 @@ void QHeaderViewPrivate::resizeSections(QHeaderView::ResizeMode globalMode, bool void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeaderView::ResizeMode mode) { int sizePerSection = size / (end - start + 1); - if (end >= sectionSpans.count()) + if (end >= sectionSpans.count()) { sectionSpans.resize(end + 1); + sectionStartposRecalc = true; + } SectionSpan *sectiondata = sectionSpans.data(); for (int i = start; i <= end; ++i) { length += (sizePerSection - sectiondata[i].size); -- cgit v1.2.3 From fcc01e6c3736991db2191c151111f03016d2d80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Sat, 10 Mar 2012 16:47:02 +0100 Subject: QHeaderView - minor fix to setDefaultSectionSize This fixes a situation where we (wrongly) assume that a section with size 0 is hidden. However a hidden section should be one that we have called hideSection (or setSectionHidden) on. Change-Id: Ic14eded2666022f27434dc55927323a74910549c Reviewed-by: Stephen Kelly --- src/widgets/itemviews/qheaderview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 4975e72260..e82cd477c5 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3339,8 +3339,7 @@ void QHeaderViewPrivate::setDefaultSectionSize(int size) defaultSectionSize = size; for (int i = 0; i < sectionSpans.count(); ++i) { QHeaderViewPrivate::SectionSpan &span = sectionSpans[i]; - if (span.size > 0) { - //we resize it if it is not hidden (ie size > 0) + if (sectionHidden.isEmpty() || !sectionHidden.testBit(i)) { // resize on not hidden. const int newSize = size; if (newSize != span.size) { length += newSize - span.size; //the whole length is changed -- cgit v1.2.3 From a80d2c73c1ec98c5b3d3d9319a735d822d6b5dff Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Tue, 20 Mar 2012 18:52:50 +0200 Subject: Fix QWidgetTextController issue when used with QtQuick1 TextEdit Calling QInputMethod::invokeAction() was not checking for proper event type and was requiring context widget unnecessarily. Fixes some parts of QTBUG-24035 Change-Id: I51fe9ed02a018ced36319eb672a088503649b275 Reviewed-by: Andrew den Exter --- src/widgets/widgets/qwidgettextcontrol.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 9eeffc1231..86dfb30389 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -1829,7 +1829,7 @@ bool QWidgetTextControlPrivate::sendMouseEventToInputContext( #if !defined(QT_NO_IM) Q_Q(QWidgetTextControl); - if (contextWidget && isPreediting()) { + if (isPreediting()) { QTextLayout *layout = cursor.block().layout(); int cursorPos = q->hitTest(pos, Qt::FuzzyHit) - cursor.position(); @@ -1837,7 +1837,7 @@ bool QWidgetTextControlPrivate::sendMouseEventToInputContext( cursorPos = -1; if (cursorPos >= 0) { - if (e->type() == QEvent::MouseButtonRelease) + if (eventType == QEvent::MouseButtonRelease) qApp->inputMethod()->invokeAction(QInputMethod::Click, cursorPos); e->setAccepted(true); -- cgit v1.2.3 From 3ed12e4b26bab091821ee3827eb44f61d22f47d7 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 15 Mar 2012 15:16:43 +0100 Subject: Remove Q_WS_X11 The define is removed and only adds includes. Change-Id: Id6cc32aa22536f78bb5de10cb779a3168e79441a Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qwindowsstyle.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 295d46963e..99a78520d5 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -69,12 +69,6 @@ #include #include -#ifdef Q_WS_X11 -#include "qfileinfo.h" -#include "qdir.h" -#include -#endif - #include QT_BEGIN_NAMESPACE -- cgit v1.2.3 From 7e90df7bf5aafd09ea5ed8bcc370db6a8912d173 Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Thu, 1 Mar 2012 16:54:50 +0200 Subject: FocusAboutToChange event to be send before focus changes Focus change happen as: FocusAboutToChange event -> focus change -> FocusOut event -> FocusIn event. Input method need to have focus when calling commit(). Notification on focus about to be lost allows QWindow implementations to commit in time. Also changes QWidget documentation to match code reality. Change-Id: I17a8a374a33dd700909f79e370b42348869261a6 Reviewed-by: Gunnar Sletta --- src/widgets/kernel/qapplication.cpp | 19 ++++----- src/widgets/kernel/qwidget.cpp | 72 ++++++++++++++++++++++++-------- src/widgets/kernel/qwidget_p.h | 1 + src/widgets/kernel/qwidgetwindow_qpa.cpp | 9 ++++ 4 files changed, 72 insertions(+), 29 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 7441d55865..ce57e2868d 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1760,16 +1760,6 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) } QWidget *prev = focus_widget; focus_widget = focus; -#ifndef QT_NO_IM - if (prev && ((reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason - && prev->testAttribute(Qt::WA_InputMethodEnabled)) - // Do reset the input context, in case the new focus widget won't accept keyboard input - // or it is not created fully yet. - || (focus_widget && (!focus_widget->testAttribute(Qt::WA_InputMethodEnabled) - || !focus_widget->testAttribute(Qt::WA_WState_Created))))) { - qApp->inputMethod()->reset(); - } -#endif //QT_NO_IM if(focus_widget) focus_widget->d_func()->setFocus_sys(); @@ -1798,7 +1788,6 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason) QApplication::sendEvent(that->style(), &in); } emit qApp->focusChanged(prev, focus_widget); - emit qApp->focusObjectChanged(focus_widget); } } } @@ -2051,6 +2040,14 @@ void QApplication::setActiveWindow(QWidget* act) } } + if (QApplicationPrivate::focus_widget) { + if (QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled)) + qApp->inputMethod()->reset(); + + QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, Qt::ActiveWindowFocusReason); + QApplication::sendEvent(QApplicationPrivate::focus_widget, &focusAboutToChange); + } + QApplicationPrivate::active_window = window; if (QApplicationPrivate::active_window) { diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 6418ba63e1..63eb2540ff 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5875,9 +5875,10 @@ bool QWidget::hasFocus() const If the window is not active, the widget will be given the focus when the window becomes active. - First, a focus out event is sent to the focus widget (if any) to - tell it that it is about to lose the focus. Then a focus in event - is sent to this widget to tell it that it just received the focus. + First, a focus about to change event is sent to the focus widget (if any) to + tell it that it is about to lose the focus. Then focus is changed, a + focus out event is sent to the previous focus item and a focus in event is sent + to the new item to tell it that it just received the focus. (Nothing happens if the focus in and focus out widgets are the same.) @@ -5930,23 +5931,11 @@ void QWidget::setFocus(Qt::FocusReason reason) } #endif - QWidget *w = f; - if (isHidden()) { - while (w && w->isHidden()) { - w->d_func()->focus_child = f; - w = w->isWindow() ? 0 : w->parentWidget(); - } - } else { - while (w) { - w->d_func()->focus_child = f; - w = w->isWindow() ? 0 : w->parentWidget(); - } - } - #ifndef QT_NO_GRAPHICSVIEW // Update proxy state if (QWExtra *topData = window()->d_func()->extra) { if (topData->proxyWidget && !topData->proxyWidget->hasFocus()) { + f->d_func()->updateFocusChild(); topData->proxyWidget->d_func()->focusFromWidgetToProxy = 1; topData->proxyWidget->setFocus(reason); topData->proxyWidget->d_func()->focusFromWidgetToProxy = 0; @@ -5955,6 +5944,21 @@ void QWidget::setFocus(Qt::FocusReason reason) #endif if (f->isActiveWindow()) { + QWidget *prev = QApplicationPrivate::focus_widget; + if (prev) { + if (reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason + && prev->testAttribute(Qt::WA_InputMethodEnabled)) { + qApp->inputMethod()->reset(); + } + + if (reason != Qt::NoFocusReason) { + QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, reason); + QApplication::sendEvent(prev, &focusAboutToChange); + } + } + + f->d_func()->updateFocusChild(); + QApplicationPrivate::setFocusWidget(f, reason); #ifndef QT_NO_ACCESSIBILITY # ifdef Q_OS_WIN @@ -5999,6 +6003,30 @@ void QWidget::setFocus(Qt::FocusReason reason) } } #endif + } else { + f->d_func()->updateFocusChild(); + } + + if (QTLWExtra *extra = f->window()->d_func()->maybeTopData()) + emit extra->window->focusObjectChanged(f); +} + +// updates focus_child on parent widgets to point into this widget +void QWidgetPrivate::updateFocusChild() +{ + Q_Q(QWidget); + + QWidget *w = q; + if (q->isHidden()) { + while (w && w->isHidden()) { + w->d_func()->focus_child = q; + w = w->isWindow() ? 0 : w->parentWidget(); + } + } else { + while (w) { + w->d_func()->focus_child = q; + w = w->isWindow() ? 0 : w->parentWidget(); + } } } @@ -6015,8 +6043,8 @@ void QWidget::setFocus(Qt::FocusReason reason) Takes keyboard input focus from the widget. If the widget has active focus, a \link focusOutEvent() focus out - event\endlink is sent to this widget to tell it that it is about - to lose the focus. + event\endlink is sent to this widget to tell it that it has + lost the focus. This widget must enable focus setting in order to get the keyboard input focus, i.e. it must call setFocusPolicy(). @@ -6027,6 +6055,14 @@ void QWidget::setFocus(Qt::FocusReason reason) void QWidget::clearFocus() { + if (hasFocus()) { + if (testAttribute(Qt::WA_InputMethodEnabled)) + qApp->inputMethod()->reset(); + + QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange); + QApplication::sendEvent(this, &focusAboutToChange); + } + QWidget *w = this; while (w) { if (w->d_func()->focus_child == this) diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 38314c234b..8107b6ca74 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -336,6 +336,7 @@ public: void stackUnder_sys(QWidget *); void setFocus_sys(); + void updateFocusChild(); void updateFont(const QFont &); inline void setFont_helper(const QFont &font) { diff --git a/src/widgets/kernel/qwidgetwindow_qpa.cpp b/src/widgets/kernel/qwidgetwindow_qpa.cpp index f58dddb70f..7a13e2032e 100644 --- a/src/widgets/kernel/qwidgetwindow_qpa.cpp +++ b/src/widgets/kernel/qwidgetwindow_qpa.cpp @@ -99,6 +99,15 @@ bool QWidgetWindow::event(QEvent *event) case QEvent::FocusOut: return false; + case QEvent::FocusAboutToChange: + if (QApplicationPrivate::focus_widget) { + if (QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled)) + qApp->inputMethod()->commit(); + + QGuiApplication::sendSpontaneousEvent(QApplicationPrivate::focus_widget, event); + } + return true; + case QEvent::KeyPress: case QEvent::KeyRelease: handleKeyEvent(static_cast(event)); -- cgit v1.2.3 From 1a414cbc2664621431028593ea7b6de3e730d556 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 22 Mar 2012 15:00:56 +0100 Subject: Fix QSysInfo::WindowsVersion checking (QSysInfo::WV_NT_based is a mask) Manual merge of the original fix 1ef309e9 in the Qt 4.8 repo. Task-number: QTBUG-20480 Change-Id: Id08500c2dd16965af3942e65cff1f4afa24180b0 Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qwizard.cpp | 2 +- src/widgets/kernel/qwhatsthis.cpp | 2 +- src/widgets/styles/qstylefactory.cpp | 4 ++-- src/widgets/styles/qwindowsstyle.cpp | 8 ++++---- src/widgets/styles/qwindowsvistastyle.cpp | 2 +- src/widgets/styles/qwindowsxpstyle.cpp | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 8a75353c86..ac19ec8d22 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -573,7 +573,7 @@ public: } #if !defined(QT_NO_STYLE_WINDOWSVISTA) if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based) + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) vistaInitPending = true; #endif } diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 88c41a5fba..9d3493dc8a 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -291,7 +291,7 @@ void QWhatsThat::paintEvent(QPaintEvent*) bool drawShadow = true; #if defined(Q_WS_WIN) if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { BOOL shadow; SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0); diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index ef555fbdb1..9ed452b516 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -218,12 +218,12 @@ QStringList QStyleFactory::keys() #endif #ifndef QT_NO_STYLE_WINDOWSXP if (!list.contains(QLatin1String("WindowsXP")) && - (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) list << QLatin1String("WindowsXP"); #endif #ifndef QT_NO_STYLE_WINDOWSVISTA if (!list.contains(QLatin1String("WindowsVista")) && - (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) list << QLatin1String("WindowsVista"); #endif #ifndef QT_NO_STYLE_MOTIF diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 99a78520d5..1cd53c8073 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -121,7 +121,7 @@ QWindowsStylePrivate::QWindowsStylePrivate() { #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) { + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { QSystemLibrary shellLib(QLatin1String("shell32")); pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo"); } @@ -1045,7 +1045,7 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl case SP_VistaShield: { if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) && pSHGetStockIconInfo) { QPixmap pixmap; @@ -1187,7 +1187,7 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid case SH_LineEdit_PasswordCharacter: { #ifdef Q_OS_WIN - if (widget && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) { + if (widget && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { const QFontMetrics &fm = widget->fontMetrics(); if (fm.inFont(QChar(0x25CF))) ret = 0x25CF; @@ -3190,7 +3190,7 @@ QIcon QWindowsStyle::standardIconImplementation(StandardPixmap standardIcon, con case SP_VistaShield: { if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based + && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) && pSHGetStockIconInfo) { icon.addPixmap(proxy()->standardPixmap(SP_VistaShield, option, widget)); //fetches small icon diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index c18b2266b8..78d4e7b9ce 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -138,7 +138,7 @@ bool QWindowsVistaStylePrivate::useVista() { return (QWindowsVistaStylePrivate::useXP() && (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && - QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)); + (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))); } /*! diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 8b745ba114..f40bd22fca 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -866,7 +866,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa inspectData = (tmt_transparentcolor != 0 || tmt_borderonly || proporigin == PO_PART || proporigin == PO_STATE); // ### This is a vista-specific workaround for broken alpha in titlebar pixmaps - if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) { + if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { if (themeData.partId == WP_CAPTION || themeData.partId == WP_SMALLCAPTION) inspectData = false; } -- cgit v1.2.3 From 82c974f753e0081f8bedc356ea07a8cfa6fae583 Mon Sep 17 00:00:00 2001 From: Donald Carr Date: Tue, 20 Mar 2012 11:38:59 +0000 Subject: Deprecate QApplication::setGraphicsSystem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The QApplication::setGraphicsSystem() call is entirely vestigial after the QPA rearchitecting of Qt. Deprecate it to give people a heads up that their original intent no longer has any impact on their application. Change-Id: I21838431db1057f7f7858b4a434ae0eebd2317de Reviewed-by: Thiago Macieira Reviewed-by: Samuel Rødal Reviewed-by: Girish Ramakrishnan Reviewed-by: Lars Knoll --- src/widgets/kernel/qapplication.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index 55ed6998fa..3e11db0863 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -111,8 +111,9 @@ public: enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 }; static int colorSpec(); static void setColorSpec(int); - // ### Qt4 compatibility, remove? - static inline void setGraphicsSystem(const QString &) {} +#if QT_DEPRECATED_SINCE(5, 0) + QT_DEPRECATED static inline void setGraphicsSystem(const QString &) {} +#endif using QGuiApplication::palette; static QPalette palette(const QWidget *); -- cgit v1.2.3 From 337eedb316e94217d6d8b4bb6dc664d26ef3a741 Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Wed, 21 Mar 2012 16:23:33 +0200 Subject: Fixed QLineEdit to emit selectionChanged Was not emitted when removed by input method event. Change-Id: Ia2c0dcb09d42826188d4612f4c1705a41874a31d Reviewed-by: Andrew den Exter --- src/widgets/widgets/qwidgetlinecontrol.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 7d97f6d295..ca30c7eef8 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -552,6 +552,8 @@ void QWidgetLineControl::processInputMethodEvent(QInputMethodEvent *event) } selectionChange = true; } else { + if (m_selstart != m_selend) + selectionChange = true; m_selstart = m_selend = 0; } cursorPositionChanged = true; -- cgit v1.2.3