From e3808072d9b6919d24a0be6e2a4f76afe2b4486d Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 18 May 2015 14:57:03 +0200 Subject: add QDebug operator for QAction Change-Id: Ie2554323a619ef1c3f9579862eff8fe704079ba5 Reviewed-by: Friedemann Kleint --- src/widgets/kernel/qaction.cpp | 27 ++++++++++++++++++++++++++- src/widgets/kernel/qaction.h | 4 ++++ 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 2c4e4d3125..1ef9e4ef98 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -39,10 +39,10 @@ #include "qapplication.h" #include "qevent.h" #include "qlist.h" -#include "qdebug.h" #include #include #include +#include #define QAPP_CHECK(functionName) \ if (!qApp) { \ @@ -1296,6 +1296,31 @@ bool QAction::isIconVisibleInMenu() const return d->iconVisibleInMenu; } +#ifndef QT_NO_DEBUG_STREAM +Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QAction *action) +{ + QDebugStateSaver saver(d); + d.nospace(); + d << "QAction(" << static_cast(action); + if (action) { + d << " text=" << action->text(); + if (!action->toolTip().isEmpty()) + d << " toolTip=" << action->toolTip(); + if (action->isCheckable()) + d << " checked=" << action->isChecked(); + if (!action->shortcut().isEmpty()) + d << " shortcut=" << action->shortcut(); + d << " menuRole="; + QtDebugUtils::formatQEnum(d, action->menuRole()); + d << " visible=" << action->isVisible(); + } else { + d << '0'; + } + d << ')'; + return d; +} +#endif // QT_NO_DEBUG_STREAM + QT_END_NAMESPACE #include "moc_qaction.cpp" diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h index 8ef26b60bf..0eb2c60c70 100644 --- a/src/widgets/kernel/qaction.h +++ b/src/widgets/kernel/qaction.h @@ -203,6 +203,10 @@ private: #endif }; +#ifndef QT_NO_DEBUG_STREAM +Q_WIDGETS_EXPORT QDebug operator<<(QDebug, const QAction *); +#endif + QT_BEGIN_INCLUDE_NAMESPACE #include QT_END_INCLUDE_NAMESPACE -- cgit v1.2.1 From ed70a645aac345cfbe46abe69046de8805c9c985 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 26 Jan 2016 01:29:26 +0100 Subject: QWindowsVistaStyle: Reorder the if statement so the variable is checked first Since the likelyhood that decoration_size is greater than 0 then we can save time with explicitly ensuring that it does not call the functions. Change-Id: Iaf991a6c77bbc4908c459307ca7e645cf3b3ca20 Reviewed-by: Friedemann Kleint --- src/widgets/styles/qwindowsvistastyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 083b1d1707..3fa0fc899d 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -398,7 +398,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt { XPThemeData theme(widget, painter, QWindowsXPStylePrivate::TreeViewTheme); static int decoration_size = 0; - if (d->initTreeViewTheming() && theme.isValid() && !decoration_size) { + if (!decoration_size && d->initTreeViewTheming() && theme.isValid()) { XPThemeData themeSize = theme; themeSize.partId = TVP_HOTGLYPH; themeSize.stateId = GLPS_OPENED; -- cgit v1.2.1 From 33bdb93ae1b1a19eb46d924a31a58237850fbfa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 26 Jan 2016 14:11:29 +0100 Subject: Remove some old QT_MAC_USE_COCOA cruft MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib9cb57563274c722023084e94f2cd439088366a8 Reviewed-by: Tor Arne Vestbø --- src/widgets/doc/snippets/macmainwindow.mm | 53 ------------------------------- 1 file changed, 53 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/doc/snippets/macmainwindow.mm b/src/widgets/doc/snippets/macmainwindow.mm index d0d74631ab..3e1ee7ca51 100644 --- a/src/widgets/doc/snippets/macmainwindow.mm +++ b/src/widgets/doc/snippets/macmainwindow.mm @@ -39,8 +39,6 @@ #include -#ifdef QT_MAC_USE_COCOA - //![0] SearchWidget::SearchWidget(QWidget *parent) : QMacCocoaViewContainer(0, parent) @@ -76,57 +74,6 @@ QSize SearchWidget::sizeHint() const return QSize(150, 40); } -#else - -// The SearchWidget class wraps a native HISearchField. -SearchWidget::SearchWidget(QWidget *parent) - :QWidget(parent) -{ - - // Create a native search field and pass its window id to QWidget::create. - searchFieldText = CFStringCreateWithCString(0, "search", 0); - HISearchFieldCreate(NULL/*bounds*/, kHISearchFieldAttributesSearchIcon | kHISearchFieldAttributesCancel, - NULL/*menu ref*/, searchFieldText, &searchField); - create(reinterpret_cast(searchField)); - - // Use a Qt menu for the search field menu. - QMenu *searchMenu = createMenu(this); - MenuRef menuRef = searchMenu->macMenu(0); - HISearchFieldSetSearchMenu(searchField, menuRef); - setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); -} - -SearchWidget::~SearchWidget() -{ - CFRelease(searchField); - CFRelease(searchFieldText); -} - -// Get the size hint from the search field. -QSize SearchWidget::sizeHint() const -{ - EventRef event; - HIRect optimalBounds; - CreateEvent(0, kEventClassControl, - kEventControlGetOptimalBounds, - GetCurrentEventTime(), - kEventAttributeUserEvent, &event); - - SendEventToEventTargetWithOptions(event, - HIObjectGetEventTarget(HIObjectRef(winId())), - kEventTargetDontPropagate); - - GetEventParameter(event, - kEventParamControlOptimalBounds, typeHIRect, - 0, sizeof(HIRect), 0, &optimalBounds); - - ReleaseEvent(event); - return QSize(optimalBounds.size.width + 100, // make it a bit wider. - optimalBounds.size.height); -} - -#endif - QMenu *createMenu(QWidget *parent) { QMenu *searchMenu = new QMenu(parent); -- cgit v1.2.1 From 58f8dd4f92e0e647ed530554d7edf3d1a901f552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Fri, 15 Jan 2016 02:29:57 +0100 Subject: QtWidgets: Allow to cover up the window container by another widget When the window container already has a window handle, allow embedded windows to use this handle as a parent. This change will allow proper window stacking and clipping. Task-number: QTBUG-50477 Change-Id: I8d656ecb99e0c42ae7a7ac461e5e5b5d801f5493 Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qwindowcontainer.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 3885431b05..e8c4a763ee 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -84,6 +84,11 @@ public: if (usesNativeWidgets || window->parent() == 0) return; Q_Q(QWindowContainer); + if (q->internalWinId()) { + // Allow use native widgets if the window container is already a native widget + usesNativeWidgets = true; + return; + } QWidget *p = q->parentWidget(); while (p) { if ( @@ -147,8 +152,10 @@ public: as a child of a QAbstractScrollArea or QMdiArea, it will create a \l {Native Widgets vs Alien Widgets} {native window} for every widget in its parent chain to allow for proper stacking and - clipping in this use case. Applications with many native child - windows may suffer from performance issues. + clipping in this use case. Creating a native window for the window + container also allows for proper stacking and clipping. This must + be done before showing the window container. Applications with + many native child windows may suffer from performance issues. The window container has a number of known limitations: -- cgit v1.2.1 From 8c843712da2510beb7f510c1885df819edbdf058 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 14 Dec 2015 14:47:01 +0100 Subject: Doc: a QScreen can be a placeholder if there are no screens attached MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of change a094af001795c9651b299d700a992150d1aba33a, X11 now joins other platforms in having a fake screen if no physical screens are attached, rather than ever allowing QGuiApplication::screens() to return an empty list or QGuiApplication::primaryScreen() to return null. This is more consistent across platforms and helps to prevent bugs in applications which want to use QScreen in some context but fail to check whether it exists. [ChangeLog][X11] In case there are no physical screens attached, QGuiApplication::screens() and QGuiApplication::primaryScreen() will return a placeholder QScreen object. Task-number: QTBUG-42985 Change-Id: I0f58afbfe2a034fb9e872a5d1dbdabad2c7dbf9e Reviewed-by: Błażej Szczygieł Reviewed-by: Paul Olav Tvete --- src/widgets/kernel/qdesktopwidget.qdoc | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc index d1a6ecabd6..abdbd35f5b 100644 --- a/src/widgets/kernel/qdesktopwidget.qdoc +++ b/src/widgets/kernel/qdesktopwidget.qdoc @@ -238,11 +238,6 @@ \property QDesktopWidget::screenCount \brief the number of screens currently available on the system. - Note that on some platforms, screenCount will be zero if there are actually - no screens connected. Applications which were running at the time the - screenCount went to zero will stop rendering graphics until one or more - screens are restored. - \since 4.6 */ -- cgit v1.2.1 From e536523dbd882e63363dd2a7eaac3870b35a9b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bonnier?= Date: Fri, 29 Jan 2016 00:54:33 +0000 Subject: Doc: Remove Qt3 compatibility functions from QToolButton MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QToolButton's detailed description mentioned setToggleButton and setPopupDelay which have been removed in Qt5. Removed typo dependant > dependent Task-number: QTBUG-50761 Change-Id: I9a2ff79a512127982c7961dee79fe2751f12cf43 Reviewed-by: Topi Reiniö --- src/widgets/widgets/qtoolbutton.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index 69432761e6..f25a96f0c1 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -120,7 +120,7 @@ bool QToolButtonPrivate::hasMenu() const One classic use of a tool button is to select tools; for example, the "pen" tool in a drawing program. This would be implemented - by using a QToolButton as a toggle button (see setToggleButton()). + by using a QToolButton as a toggle button (see setCheckable()). QToolButton supports auto-raising. In auto-raise mode, the button draws a 3D frame only when the mouse points at it. The feature is @@ -147,8 +147,8 @@ bool QToolButtonPrivate::hasMenu() const menu set. The default mode is DelayedPopupMode which is sometimes used with the "Back" button in a web browser. After pressing and holding the button down for a while, a menu pops up showing a list - of possible pages to jump to. The default delay is 600 ms; you can - adjust it with setPopupDelay(). + of possible pages to jump to. The timeout is style dependent, + see QStyle::SH_ToolButton_PopupDelay. \table 100% \row \li \inlineimage assistant-toolbar.png Qt Assistant's toolbar with tool buttons @@ -820,7 +820,7 @@ void QToolButtonPrivate::_q_menuTriggered(QAction *action) a menu set or contains a list of actions. \value DelayedPopup After pressing and holding the tool button - down for a certain amount of time (the timeout is style dependant, + down for a certain amount of time (the timeout is style dependent, see QStyle::SH_ToolButton_PopupDelay), the menu is displayed. A typical application example is the "back" button in some web browsers's tool bars. If the user clicks it, the browser simply -- cgit v1.2.1 From 7c797b4905cd80a863bbdf635d5e2306ac6b57ef Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 21 Jan 2016 16:35:22 +0100 Subject: Bump copyright year to 2016 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bump copyright year in tool output and user visible strings to 2016. Task-number: QTBUG-50578 Change-Id: I2f4aa9089c6672726f554cba7e6009b425d27683 Reviewed-by: Liang Qi Reviewed-by: Topi Reiniö Reviewed-by: Martin Smith --- src/widgets/dialogs/qmessagebox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 8a48100ea7..8375624f71 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1903,7 +1903,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) "

Qt and the Qt logo are trademarks of The Qt Company Ltd.

" "

Qt is The Qt Company Ltd product developed as an open source " "project. See %3 for more information.

" - ).arg(QStringLiteral("2015"), + ).arg(QStringLiteral("2016"), QStringLiteral("qt.io/licensing"), QStringLiteral("qt.io")); QMessageBox *msgBox = new QMessageBox(parent); -- cgit v1.2.1 From 6dafafeff1678f5984a71d2218fd2d73b0cae1a7 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sat, 10 Oct 2015 10:50:41 +0800 Subject: Doc: Properly document old platform-specific functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qt_mac_set_dock_menu() needs a \relates command to show up properly. "\since 5.2" produces "This function was introduced in Qt 5.2", which is wrong; the function existed in Qt 4. qt_set_sequence_auto_mnemonic() is referenced by the QShortcut class ref, but the page that hosted it in qtdoc.git is being removed. Thus, its description is now transferred here. Change-Id: If009a45f1d04541787925cf230ed7b59c7db0b39 Reviewed-by: Alejandro Exojo Piqueras Reviewed-by: Topi Reiniö --- src/widgets/kernel/qshortcut.cpp | 2 +- src/widgets/widgets/qmenu_mac.mm | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index c08c4eeb32..ce728e0330 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -329,7 +329,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge shown and the character will be underlined. On Windows, shortcuts are normally not displayed until the user presses the \uicontrol Alt key, but this is a setting the user can change. On Mac, shortcuts - are disabled by default. Call qt_set_sequence_auto_mnemonic() to + are disabled by default. Call \l qt_set_sequence_auto_mnemonic() to enable them. However, because mnemonic shortcuts do not fit in with Aqua's guidelines, Qt will not show the shortcut character underlined. diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm index 8b29011178..5322a8f3f5 100644 --- a/src/widgets/widgets/qmenu_mac.mm +++ b/src/widgets/widgets/qmenu_mac.mm @@ -98,15 +98,13 @@ void QMenu::setAsDockMenu() /*! \fn void qt_mac_set_dock_menu(QMenu *menu) - \since 5.2 + \relates QMenu \deprecated - Set this menu to be the dock menu available by option-clicking + Sets this \a menu to be the dock menu available by option-clicking on the application dock icon. Available on OS X only. - Deprecated; use QMenu:setAsDockMenu() instead. - - \sa QMenu:setAsDockMenu() + Deprecated; use \l QMenu::setAsDockMenu() instead. */ void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem* item) -- cgit v1.2.1 From 4c71db756741d35ccb32dc4c32aa1823264c85df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 12 Mar 2015 14:00:52 +0100 Subject: QWindow::destroy(): only reset QGuiApp::focus_window and friends as a last resort MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resetting focus_window and other internal QGuiApplication variables before calling setVisible(false) and destroying the platform window means that the platform window can't reason about whether or not it was the focus window unless it can resolve that using native APIs. We should let the platform window take care of resetting the focus window and related states, and only execute our fallback logic if the plugin doesn't do the right thing. We also use QPA to update the state instead of modifying the internal QGuiApplication variables directly, so that events and signals are emitted as a result of the reset. The QLineEdit test gets two added calls to processEvents(), since assuming that activateWindow() is synchronous is not correct, and would result in the QMenu resetting the focus window to 0 on destroy. Task-number: QTBUG-46414 Change-Id: I562788393ed0ffd77d7a4be2279862322f721c1a Reviewed-by: Błażej Szczygieł Reviewed-by: Tor Arne Vestbø --- src/widgets/accessible/qaccessiblewidgetfactory.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index 4fa7c89482..00e21da34d 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #ifndef QT_NO_ACCESSIBILITY @@ -53,7 +54,15 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje QAccessibleInterface *iface = 0; if (!object || !object->isWidgetType()) return iface; + + // QWidget emits destroyed() from its destructor instead of letting the QObject + // destructor do it, which means the QWidget is unregistered from the accessibillity + // cache. But QWidget destruction also emits enter and leave events, which may end + // up here, so we have to ensure that we don't fill the cache with an entry of + // a widget that is going away. QWidget *widget = static_cast(object); + if (QWidgetPrivate::get(widget)->data.in_destructor) + return iface; if (false) { #ifndef QT_NO_LINEEDIT -- cgit v1.2.1 From 157445e64a277098b309b2bdfeda769f443b659d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 3 Jan 2016 13:00:13 -0200 Subject: Fix GCC 6 valid warnings about misleading indendations It's currently producing a lot of false positives, but a few are actually valid. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69029, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69122 and some others. Change-Id: I24a735698d3c4a719fc9ffff1425f29d7b5a3458 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/dialogs/qfiledialog.cpp | 34 +++++++++++++++--------------- src/widgets/graphicsview/qgraphicsview.cpp | 4 ++-- src/widgets/widgets/qcombobox.cpp | 20 +++++++++--------- src/widgets/widgets/qscrollbar.cpp | 4 ++-- src/widgets/widgets/qtoolbutton.cpp | 4 ++-- 5 files changed, 33 insertions(+), 33 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 06102ec1d6..3f3a6e7c65 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -3400,27 +3400,27 @@ void QFileDialogPrivate::_q_deleteCurrent() if (!index.isValid()) continue; - QString fileName = index.data(QFileSystemModel::FileNameRole).toString(); - QString filePath = index.data(QFileSystemModel::FilePathRole).toString(); - bool isDir = model->isDir(index); + QString fileName = index.data(QFileSystemModel::FileNameRole).toString(); + QString filePath = index.data(QFileSystemModel::FilePathRole).toString(); + bool isDir = model->isDir(index); - QFile::Permissions p(index.parent().data(QFileSystemModel::FilePermissions).toInt()); + QFile::Permissions p(index.parent().data(QFileSystemModel::FilePermissions).toInt()); #ifndef QT_NO_MESSAGEBOX - Q_Q(QFileDialog); - if (!(p & QFile::WriteUser) && (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), - QFileDialog::tr("'%1' is write protected.\nDo you want to delete it anyway?") - .arg(fileName), - QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)) - return; - else if (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), - QFileDialog::tr("Are you sure you want to delete '%1'?") - .arg(fileName), - QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) - return; + Q_Q(QFileDialog); + if (!(p & QFile::WriteUser) && (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), + QFileDialog::tr("'%1' is write protected.\nDo you want to delete it anyway?") + .arg(fileName), + QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No)) + return; + else if (QMessageBox::warning(q_func(), QFileDialog::tr("Delete"), + QFileDialog::tr("Are you sure you want to delete '%1'?") + .arg(fileName), + QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) + return; #else - if (!(p & QFile::WriteUser)) - return; + if (!(p & QFile::WriteUser)) + return; #endif // QT_NO_MESSAGEBOX // the event loop has run, we can NOT reuse index because the model might have removed it. diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index ac8cd45f9e..1c5c541628 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -1173,8 +1173,8 @@ void QGraphicsViewPrivate::updateInputMethodSensitivity() if (!proxy) { q->setInputMethodHints(focusItem->inputMethodHints()); } else if (QWidget *widget = proxy->widget()) { - if (QWidget *fw = widget->focusWidget()) - widget = fw; + if (QWidget *fw = widget->focusWidget()) + widget = fw; q->setInputMethodHints(widget->inputMethodHints()); } else { q->setInputMethodHints(0); diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 35c54f102f..4a5ae6578a 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -1311,8 +1311,8 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index) if (!lineEdit) emit q->currentTextChanged(text); #ifndef QT_NO_ACCESSIBILITY - QAccessibleValueChangeEvent event(q, text); - QAccessible::updateAccessibility(&event); + QAccessibleValueChangeEvent event(q, text); + QAccessible::updateAccessibility(&event); #endif } @@ -2830,8 +2830,8 @@ void QComboBox::clear() Q_D(QComboBox); d->model->removeRows(0, d->model->rowCount(d->root), d->root); #ifndef QT_NO_ACCESSIBILITY - QAccessibleValueChangeEvent event(this, QString()); - QAccessible::updateAccessibility(&event); + QAccessibleValueChangeEvent event(this, QString()); + QAccessible::updateAccessibility(&event); #endif } @@ -2844,8 +2844,8 @@ void QComboBox::clearEditText() if (d->lineEdit) d->lineEdit->clear(); #ifndef QT_NO_ACCESSIBILITY - QAccessibleValueChangeEvent event(this, QString()); - QAccessible::updateAccessibility(&event); + QAccessibleValueChangeEvent event(this, QString()); + QAccessible::updateAccessibility(&event); #endif } @@ -2858,8 +2858,8 @@ void QComboBox::setEditText(const QString &text) if (d->lineEdit) d->lineEdit->setText(text); #ifndef QT_NO_ACCESSIBILITY - QAccessibleValueChangeEvent event(this, text); - QAccessible::updateAccessibility(&event); + QAccessibleValueChangeEvent event(this, text); + QAccessible::updateAccessibility(&event); #endif } @@ -3004,8 +3004,8 @@ bool QComboBox::event(QEvent *event) case QEvent::HoverEnter: case QEvent::HoverLeave: case QEvent::HoverMove: - if (const QHoverEvent *he = static_cast(event)) - d->updateHoverControl(he->pos()); + if (const QHoverEvent *he = static_cast(event)) + d->updateHoverControl(he->pos()); break; case QEvent::ShortcutOverride: if (d->lineEdit) diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index 0d4c6b25c4..46f903fa1e 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -479,8 +479,8 @@ bool QScrollBar::event(QEvent *event) case QEvent::HoverEnter: case QEvent::HoverLeave: case QEvent::HoverMove: - if (const QHoverEvent *he = static_cast(event)) - d_func()->updateHoverControl(he->pos()); + if (const QHoverEvent *he = static_cast(event)) + d_func()->updateHoverControl(he->pos()); break; case QEvent::StyleChange: d_func()->setTransient(style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, this)); diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index f25a96f0c1..f866fe8bda 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -961,8 +961,8 @@ bool QToolButton::event(QEvent *event) case QEvent::HoverEnter: case QEvent::HoverLeave: case QEvent::HoverMove: - if (const QHoverEvent *he = static_cast(event)) - d_func()->updateHoverControl(he->pos()); + if (const QHoverEvent *he = static_cast(event)) + d_func()->updateHoverControl(he->pos()); break; default: break; -- cgit v1.2.1 From c7c7a22bb41227ca2c379429d5750da0f0b5458d Mon Sep 17 00:00:00 2001 From: Michal Policht Date: Wed, 23 Sep 2015 19:13:10 +0200 Subject: Fix flickering status tips in submenus. Changed setCurrentAction() function so that it reselects parent menu action only if mouse is over a menu and parent menu is not already selected. Task-number: QTBUG-47987 Change-Id: Id077d6ce1de1335ba2709180c8480af5d1720de0 Reviewed-by: Friedemann Kleint Reviewed-by: Michal Policht Reviewed-by: Shawn Rutledge --- src/widgets/widgets/qmenu.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index ea3e4c4488..744fecb3f3 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -584,7 +584,9 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason if (reason != SelectedFromKeyboard) { if (QMenu *menu = qobject_cast(causedPopup.widget)) { if (causedPopup.action && menu->d_func()->activeMenu == q) - menu->d_func()->setCurrentAction(causedPopup.action, 0, reason, false); + // Reselect parent menu action only if mouse is over a menu and parent menu action is not already selected (QTBUG-47987) + if (hasReceievedEnter && menu->d_func()->currentAction != causedPopup.action) + menu->d_func()->setCurrentAction(causedPopup.action, 0, reason, false); } } -- cgit v1.2.1 From d10bfff89ae103d84a2438d9b8bc6e55ba3b122d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 1 Feb 2016 01:23:54 +0100 Subject: Revert "QWindow::destroy(): only reset QGuiApp::focus_window and friends as a last resort" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4c71db756741d35ccb32dc4c32aa1823264c85df. It's too risky for 5.6, we should let it cook in dev for a while and backport when ready. Change-Id: I91e677e65d967f29c84a254cd3dffc8bb847b263 Reviewed-by: Tor Arne Vestbø --- src/widgets/accessible/qaccessiblewidgetfactory.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index 00e21da34d..4fa7c89482 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #ifndef QT_NO_ACCESSIBILITY @@ -54,15 +53,7 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje QAccessibleInterface *iface = 0; if (!object || !object->isWidgetType()) return iface; - - // QWidget emits destroyed() from its destructor instead of letting the QObject - // destructor do it, which means the QWidget is unregistered from the accessibillity - // cache. But QWidget destruction also emits enter and leave events, which may end - // up here, so we have to ensure that we don't fill the cache with an entry of - // a widget that is going away. QWidget *widget = static_cast(object); - if (QWidgetPrivate::get(widget)->data.in_destructor) - return iface; if (false) { #ifndef QT_NO_LINEEDIT -- cgit v1.2.1 From 0c019d7bd2fff4eba39afc3a4db63d71d13988da Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 29 Jan 2016 22:29:58 +0100 Subject: QDockWidget: Restore using setGeometry since the geometry is used for the state This solves an instance where restoreState() was used when the dockwidget was already floating and the saved state was also for a floating dockwidget. Change-Id: I1fe764ae2a6b0351ae26e33ffec682ad37c944d7 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qdockarealayout.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index 8c79425e44..df26db57ae 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -1944,12 +1944,8 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList qt_mac_set_drawer_preferred_edge(widget, toDockWidgetArea(dockPos)); } else #endif - if (!testing) { - QRect r(x, y, w, h); - r = QDockAreaLayout::constrainedRect(r, widget); - widget->move(r.topLeft()); - widget->resize(r.size()); - } + if (!testing) + widget->setGeometry(QDockAreaLayout::constrainedRect(QRect(x, y, w, h), widget)); if (!testing) { widget->setVisible(flags & StateFlagVisible); -- cgit v1.2.1