diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dialogs/qfiledialog.cpp | 34 | ||||
-rw-r--r-- | src/widgets/dialogs/qmessagebox.cpp | 2 | ||||
-rw-r--r-- | src/widgets/doc/snippets/macmainwindow.mm | 53 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsview.cpp | 4 | ||||
-rw-r--r-- | src/widgets/kernel/qaction.cpp | 27 | ||||
-rw-r--r-- | src/widgets/kernel/qaction.h | 4 | ||||
-rw-r--r-- | src/widgets/kernel/qdesktopwidget.qdoc | 5 | ||||
-rw-r--r-- | src/widgets/kernel/qshortcut.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwindowcontainer.cpp | 11 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsvistastyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 20 | ||||
-rw-r--r-- | src/widgets/widgets/qdockarealayout.cpp | 8 | ||||
-rw-r--r-- | src/widgets/widgets/qmenu.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qmenu_mac.mm | 8 | ||||
-rw-r--r-- | src/widgets/widgets/qscrollbar.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qtoolbutton.cpp | 12 |
16 files changed, 87 insertions, 113 deletions
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/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) "<p>Qt and the Qt logo are trademarks of The Qt Company Ltd.</p>" "<p>Qt is The Qt Company Ltd product developed as an open source " "project. See <a href=\"http://%3/\">%3</a> for more information.</p>" - ).arg(QStringLiteral("2015"), + ).arg(QStringLiteral("2016"), QStringLiteral("qt.io/licensing"), QStringLiteral("qt.io")); QMessageBox *msgBox = new QMessageBox(parent); 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 <Carbon/Carbon.h> -#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<WId>(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); 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/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 <private/qshortcutmap_p.h> #include <private/qapplication_p.h> #include <private/qmenu_p.h> +#include <private/qdebug_p.h> #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<const void *>(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 <QtWidgets/qactiongroup.h> QT_END_INCLUDE_NAMESPACE 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 */ 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/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: 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; 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<const QHoverEvent *>(event)) - d->updateHoverControl(he->pos()); + if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event)) + d->updateHoverControl(he->pos()); break; case QEvent::ShortcutOverride: if (d->lineEdit) 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<QDockWidget*> 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); 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<QMenu*>(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); } } 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) 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<const QHoverEvent *>(event)) - d_func()->updateHoverControl(he->pos()); + if (const QHoverEvent *he = static_cast<const QHoverEvent *>(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 69432761e6..f866fe8bda 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 @@ -961,8 +961,8 @@ bool QToolButton::event(QEvent *event) case QEvent::HoverEnter: case QEvent::HoverLeave: case QEvent::HoverMove: - if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event)) - d_func()->updateHoverControl(he->pos()); + if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event)) + d_func()->updateHoverControl(he->pos()); break; default: break; |