summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-02-02 15:57:44 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-02-02 15:57:44 +0100
commitd3e6e732c70ebc2340d6376d727b3c623be23810 (patch)
tree18d469f02ac36edd04b87a9bfa4886ceef0490f0 /src/widgets
parentfdfd63053ae6b10af06553be3c1b15de274bebf7 (diff)
parentba8d3430029d8c4342e9a47c110ee8c9879818f4 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: config.tests/unix/compile.test src/plugins/platforms/cocoa/qcocoahelpers.mm src/tools/qlalr/cppgenerator.cpp Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp34
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp2
-rw-r--r--src/widgets/doc/snippets/macmainwindow.mm53
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp4
-rw-r--r--src/widgets/kernel/qaction.cpp27
-rw-r--r--src/widgets/kernel/qaction.h4
-rw-r--r--src/widgets/kernel/qdesktopwidget.qdoc5
-rw-r--r--src/widgets/kernel/qshortcut.cpp2
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp11
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.cpp20
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp8
-rw-r--r--src/widgets/widgets/qmenu.cpp4
-rw-r--r--src/widgets/widgets/qmenu_mac.mm8
-rw-r--r--src/widgets/widgets/qscrollbar.cpp4
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp12
16 files changed, 87 insertions, 113 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 7b59f96f30..288922d740 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -3407,27 +3407,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 cd5643660d..207b6e3919 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 cfa7271bbd..f74f8453c7 100644
--- a/src/widgets/doc/snippets/macmainwindow.mm
+++ b/src/widgets/doc/snippets/macmainwindow.mm
@@ -45,8 +45,6 @@
#include <Carbon/Carbon.h>
-#ifdef QT_MAC_USE_COCOA
-
//![0]
SearchWidget::SearchWidget(QWidget *parent)
: QMacCocoaViewContainer(0, parent)
@@ -82,57 +80,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 ef70a39a2c..e1b835e727 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -1181,8 +1181,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 dbec689efa..72d6fffefd 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -45,10 +45,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 (Q_UNLIKELY(!qApp)) { \
@@ -1302,6 +1302,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 6caf37c80f..abfa2cdd42 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -209,6 +209,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 55f733045e..77efaf1632 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -335,7 +335,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 dab49f2f11..462a41ce5d 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -90,6 +90,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 (
@@ -153,8 +158,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 2467040f29..3136118cdd 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -404,7 +404,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 2c32acf701..46507e3e3c 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -1317,8 +1317,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
}
@@ -2838,8 +2838,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
}
@@ -2852,8 +2852,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
}
@@ -2866,8 +2866,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
}
@@ -3012,8 +3012,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 030472f757..69be43a51e 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -1950,12 +1950,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 02215c4129..ae20159473 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -590,7 +590,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 3cc572cb37..c24779d61f 100644
--- a/src/widgets/widgets/qmenu_mac.mm
+++ b/src/widgets/widgets/qmenu_mac.mm
@@ -104,15 +104,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 89f8ba46cf..7399601c2e 100644
--- a/src/widgets/widgets/qscrollbar.cpp
+++ b/src/widgets/widgets/qscrollbar.cpp
@@ -485,8 +485,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 d5bbe14b25..664aec9a53 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -126,7 +126,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
@@ -153,8 +153,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
@@ -826,7 +826,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
@@ -967,8 +967,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;