diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-03-17 16:02:26 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2018-03-17 16:43:37 +0000 |
commit | 833a9fa9da8f419c4a2932601658d5e214583612 (patch) | |
tree | fe971c49f0b84c5f7d2f1fa99216c9cb1e6a69d7 /src | |
parent | 9cf9832e7095748ed6b4fba17c04c242fad198c4 (diff) | |
parent | 533b4158199f6d346af9a823ff5908a7fae9fed4 (diff) |
Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qipaddress.cpp | 5 | ||||
-rw-r--r-- | src/plugins/platformthemes/gtk3/qgtk3menu.cpp | 6 | ||||
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 8 | ||||
-rw-r--r-- | src/widgets/widgets/qmenu.cpp | 7 | ||||
-rw-r--r-- | src/xml/dom/qdom.cpp | 2 |
5 files changed, 19 insertions, 9 deletions
diff --git a/src/corelib/io/qipaddress.cpp b/src/corelib/io/qipaddress.cpp index 02b12f635a..039e291b43 100644 --- a/src/corelib/io/qipaddress.cpp +++ b/src/corelib/io/qipaddress.cpp @@ -216,7 +216,10 @@ const QChar *parseIp6(IPv6Address &address, const QChar *begin, const QChar *end quint64 ll = qstrtoull(ptr, &endptr, 16, &ok); quint16 x = ll; - if (!ok || ll != x) + // Reject malformed fields: + // - failed to parse + // - too many hex digits + if (!ok || endptr > ptr + 4) return begin + (ptr - buffer.data()); if (*endptr == '.') { diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp index 1bbd463119..4f0bd9d9a0 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp @@ -426,9 +426,9 @@ QPoint QGtk3Menu::targetPos() const void QGtk3Menu::showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) { - int index = m_items.indexOf(static_cast<QGtk3MenuItem *>(const_cast<QPlatformMenuItem *>(item))); - if (index != -1) - gtk_menu_set_active(GTK_MENU(m_menu), index); + const QGtk3MenuItem *menuItem = static_cast<const QGtk3MenuItem *>(item); + if (menuItem) + gtk_menu_shell_select_item(GTK_MENU_SHELL(m_menu), menuItem->handle()); m_targetPos = QPoint(targetRect.x(), targetRect.y() + targetRect.height()); diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 6873ca876e..0c6825cb36 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -778,8 +778,8 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem, } else if (checkbox->state & State_On) { qreal penWidth = QStyleHelper::dpiScaled(1.5); - penWidth = qMax(penWidth , 0.13 * rect.height()); - penWidth = qMin(penWidth , 0.20 * rect.height()); + penWidth = qMax<qreal>(penWidth, 0.13 * rect.height()); + penWidth = qMin<qreal>(penWidth, 0.20 * rect.height()); QPen checkPen = QPen(checkMarkColor, penWidth); checkMarkColor.setAlpha(210); painter->translate(dpiScaled(-0.8), dpiScaled(0.5)); @@ -1562,8 +1562,8 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio bool ignoreCheckMark = false; const int checkColHOffset = windowsItemHMargin + windowsItemFrame - 1; - int checkcol = qMax(menuItem->rect.height() * 0.79, - qMax(menuItem->maxIconWidth * 1.0, dpiScaled(21))); // icon checkbox's highlihgt column width + int checkcol = qMax<int>(menuItem->rect.height() * 0.79, + qMax<int>(menuItem->maxIconWidth, dpiScaled(21))); // icon checkbox's highlight column width if ( #if QT_CONFIG(combobox) qobject_cast<const QComboBox*>(widget) || diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 024f9a75a1..363647aee0 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -3641,6 +3641,13 @@ void QMenu::internalDelayedPopup() if (subMenuPos.x() > screen.right()) subMenuPos.setX(QCursor::pos().x()); + const auto &subMenuActions = d->activeMenu->actions(); + if (!subMenuActions.isEmpty()) { + // Offset by the submenu's 1st action position to align with the current action + const auto subMenuActionRect = d->activeMenu->actionGeometry(subMenuActions.first()); + subMenuPos.ry() -= subMenuActionRect.top(); + } + d->activeMenu->popup(subMenuPos); d->sloppyState.setSubMenuPopup(actionRect, d->currentAction, d->activeMenu); diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index df2d7c3ce8..17f87804e9 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -2544,7 +2544,7 @@ QDomNode QDomNode::insertAfter(const QDomNode& newChild, const QDomNode& refChil If \a newChild is a QDomDocumentFragment, then \a oldChild is replaced by all of the children of the fragment. - Returns a new reference to \a oldChild on success or a \l{isNull()}{null node} an failure. + Returns a new reference to \a oldChild on success or a \l{isNull()}{null node} on failure. \sa insertBefore(), insertAfter(), removeChild(), appendChild() */ |