From 6c7a348cf82665f7f09bc3e0cfe03256f1462744 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 20 Oct 2014 16:25:47 +0200 Subject: Set correct transient parent in q_createNativeChildrenAndSetParent(). Fix warning: void QWindow::setTransientParent(QWindow*) ... must be a top level window. which occurred for example when parenting a QMenu onto a native child widget. Task-number: QTBUG-41898 Change-Id: Icc25fb2108bd68b2d9c0e551949b90fc7a82d358 Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qwidget.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 5529f8f72c..2d12674c29 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1362,11 +1362,11 @@ void q_createNativeChildrenAndSetParent(const QWidget *parentWidget) if (!childWidget->internalWinId()) childWidget->winId(); if (childWidget->windowHandle()) { - QWindow *parentWindow = childWidget->nativeParentWidget()->windowHandle(); - if (childWidget->isWindow()) - childWidget->windowHandle()->setTransientParent(parentWindow); - else - childWidget->windowHandle()->setParent(parentWindow); + if (childWidget->isWindow()) { + childWidget->windowHandle()->setTransientParent(parentWidget->window()->windowHandle()); + } else { + childWidget->windowHandle()->setParent(childWidget->nativeParentWidget()->windowHandle()); + } } } else { q_createNativeChildrenAndSetParent(childWidget); -- cgit v1.2.3 From dc267036e31f9193bad76c803ee162df5ec2d40d Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 20 Oct 2014 11:28:38 +0200 Subject: OS X: Retina displays and blurry QToolButton MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Checkable QToolButton has a special pixmap in the background, painted with a 'smooth pixmaps' hint. This hint also affects how an icon on a toolbutton itself is painted later. The difference can be quite visible on a Retina display, so this patch makes the toolbutton's image always look the same in checked/unchecked state. Task-number: QTBUG-35162 Change-Id: I2adc8006371fa10d89d4b77da6b3aa168aa5abc8 Reviewed-by: Morten Johan Sørvig --- src/widgets/styles/qmacstyle_mac.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 620ba660e0..d909e13f9a 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -6005,8 +6005,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex p->fillPath(path, brush); } else if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) { static QPixmap pm(QLatin1String(":/qt-project.org/mac/style/images/leopard-unified-toolbar-on.png")); + p->save(); p->setRenderHint(QPainter::SmoothPixmapTransform); QStyleHelper::drawBorderPixmap(pm, p, tb->rect, 2, 2, 2, 2); + p->restore(); } else { QPen oldPen = p->pen(); p->setPen(QColor(0, 0, 0, 0x3a)); -- cgit v1.2.3 From 90a4c69b2520bfa30364828bda2498e08004c00f Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 20 Oct 2014 13:35:16 +0200 Subject: Produce more correct clip path for QGraphicsShapeItem If no pen is set on the item, we can completely ignore the pen for the creation of the items shape. This both speeds up the creation of the shape and applying it as a clip mask as well as creating more correct results. Task-number: QTBUG-32846 Change-Id: I5f6f690256c71309713d8f746e67599af3088dd7 Reviewed-by: Laszlo Agocs --- src/widgets/graphicsview/qgraphicsitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 114c45dc0f..67d135271c 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -797,7 +797,7 @@ static QPainterPath qt_graphicsItem_shapeFromPath(const QPainterPath &path, cons // if we pass a value of 0.0 to QPainterPathStroker::setWidth() const qreal penWidthZero = qreal(0.00000001); - if (path == QPainterPath()) + if (path == QPainterPath() || pen == Qt::NoPen) return path; QPainterPathStroker ps; ps.setCapStyle(pen.capStyle()); -- cgit v1.2.3 From ab556d6b321bb02cec2a0c0705b1212377fde095 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 20 Oct 2014 15:04:24 +0200 Subject: Fix height of combo popup when the list view has non-zero spacing. QListView::spacing() is the space around the item (layout margin), so the effective spacing is twice as big. This differs conceptionally from QTableView, which has a spacing of 1 and a line on top/bottom. Split up QComboBoxPrivateContainer::spacing() into functions return spacing and top/bottom margins to reflect this. Task-number: QTBUG-37865 Change-Id: I1ff812e7856e00a53f1119ef3304956cbb7cbfca Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/widgets/widgets/qcombobox.cpp | 26 +++++++++++++++++++++----- src/widgets/widgets/qcombobox_p.h | 2 ++ 2 files changed, 23 insertions(+), 5 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 44e22555db..89dc8bf178 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -479,9 +479,9 @@ void QComboBoxPrivateContainer::updateScrollers() view->verticalScrollBar()->minimum() < view->verticalScrollBar()->maximum()) { bool needTop = view->verticalScrollBar()->value() - > (view->verticalScrollBar()->minimum() + spacing()); + > (view->verticalScrollBar()->minimum() + topMargin()); bool needBottom = view->verticalScrollBar()->value() - < (view->verticalScrollBar()->maximum() - spacing()*2); + < (view->verticalScrollBar()->maximum() - bottomMargin() - topMargin()); if (needTop) top->show(); else @@ -571,6 +571,20 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView) this, SLOT(viewDestroyed())); } +/*! + Returns the top/bottom vertical margin of the view. +*/ +int QComboBoxPrivateContainer::topMargin() const +{ + if (const QListView *lview = qobject_cast(view)) + return lview->spacing(); +#ifndef QT_NO_TABLEVIEW + if (const QTableView *tview = qobject_cast(view)) + return tview->showGrid() ? 1 : 0; +#endif + return 0; +} + /*! Returns the spacing between the items in the view. */ @@ -578,7 +592,7 @@ int QComboBoxPrivateContainer::spacing() const { QListView *lview = qobject_cast(view); if (lview) - return lview->spacing(); + return 2 * lview->spacing(); // QListView::spacing is the padding around the item. #ifndef QT_NO_TABLEVIEW QTableView *tview = qobject_cast(view); if (tview) @@ -2528,7 +2542,7 @@ void QComboBox::showPopup() QModelIndex idx = d->model->index(i, d->modelColumn, parent); if (!idx.isValid()) continue; - listHeight += view()->visualRect(idx).height() + container->spacing(); + listHeight += view()->visualRect(idx).height(); #ifndef QT_NO_TREEVIEW if (d->model->hasChildren(idx) && treeView && treeView->isExpanded(idx)) toCheck.push(idx); @@ -2540,12 +2554,14 @@ void QComboBox::showPopup() } } } + if (count > 1) + listHeight += (count - 1) * container->spacing(); listRect.setHeight(listHeight); } { // add the spacing for the grid on the top and the bottom; - int heightMargin = 2*container->spacing(); + int heightMargin = container->topMargin() + container->bottomMargin(); // add the frame of the container int marginTop, marginBottom; diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index becdde55ae..67b1aa6943 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -214,6 +214,8 @@ public: QAbstractItemView *itemView() const; void setItemView(QAbstractItemView *itemView); int spacing() const; + int topMargin() const; + int bottomMargin() const { return topMargin(); } void updateTopBottomMargin(); QTimer blockMouseReleaseTimer; -- cgit v1.2.3 From 7614d734c46feb6f74aa0651ae18f850a324e381 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 21 Oct 2014 14:44:08 +0200 Subject: Windows: Implement Qt::WA_ShowWithoutActivating. Set dynamic property for all platforms and query it in QWindowsWindow::show_sys(). Task-number: QTBUG-19194 Task-number: QTBUG-34504 Change-Id: I4199a2ed835d3de928405d470a81c54da93cc768 Reviewed-by: Joerg Bornemann --- src/widgets/kernel/qwidget.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 2d12674c29..455d195159 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1403,10 +1403,8 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO win->setProperty(propertyName, q->property(propertyName)); } -#ifdef Q_OS_OSX if (q->testAttribute(Qt::WA_ShowWithoutActivating)) win->setProperty("_q_showWithoutActivating", QVariant(true)); -#endif win->setFlags(data.window_flags); fixPosIncludesFrame(); if (q->testAttribute(Qt::WA_Moved) -- cgit v1.2.3 From 963037d86b6298fd314450f933376fe589b309e6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 16 Oct 2014 11:45:56 +0200 Subject: Fix helper function call in QWindowsVistaStyle::pixelMetric(). Task-number: QTBUG-41944 Task-number: QTBUG-40277 Change-Id: I1da9ffddce8edfcaa87d27058ed73ac7ec63d081 Reviewed-by: Adam Light Reviewed-by: Alessandro Portale --- 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 a6eb2c0bc6..044394747c 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -2285,7 +2285,7 @@ int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *opti if (!QWindowsVistaStylePrivate::useVista()) return QWindowsStyle::pixelMetric(metric, option, widget); - int ret = QWindowsStylePrivate::fixedPixelMetric(metric); + int ret = QWindowsVistaStylePrivate::fixedPixelMetric(metric); if (ret != QWindowsStylePrivate::InvalidMetric) return int(QStyleHelper::dpiScaled(ret)); -- cgit v1.2.3 From c5bc66df2fd976f4e055c579f6918138d3accd87 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 21 Oct 2014 10:49:54 +0200 Subject: Respect minimum size of heightForWidth layouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we cannot support heightForWidth constraints on toplevel windows, it is impossible to solve this perfectly: if the window is resizable at all, the user will be able to resize it too small. Our old solution was just to give up and allow completely free resizing, even down to 0x0. This makes very little sense. It is clearly better to use the minimum size that we have already computed, even though it is not perfect. This reverts a behavior change introduced in commit 36e9516f85fbb9c9a236f5ca034d5a0126d86c12 (September 9th, 2002) [ChangeLog][QtWidgets][QLayout] Widgets and dialogs containing layouts with heightForWidth (such as a label with word wrap) will no longer get a minimum size of 0x0. Task-number: QTBUG-37673 Change-Id: If26b7ef9c80edbf9d54c6519b36646df408b7652 Reviewed-by: Jan Arve Sæther --- src/widgets/kernel/qlayout.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 3900444df4..46cab90ab4 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -1106,15 +1106,6 @@ bool QLayout::activate() ms.setWidth(mw->minimumSize().width()); if (heightSet) ms.setHeight(mw->minimumSize().height()); - if ((!heightSet || !widthSet) && hasHeightForWidth()) { - int h = minimumHeightForWidth(ms.width()); - if (h > ms.height()) { - if (!heightSet) - ms.setHeight(0); - if (!widthSet) - ms.setWidth(0); - } - } mw->setMinimumSize(ms); } else if (!widthSet || !heightSet) { QSize ms = mw->minimumSize(); -- cgit v1.2.3 From bd4a19963e102f4a89fdc1f17349909605324519 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 10 Sep 2014 08:31:35 +0200 Subject: Respect contents margins when calculating the size hint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this part of the calendar widget get cut off when put in a layout and the contentsMargins are non zero. Task-number: QTBUG-40352 Change-Id: I9ce90476c59c270d92e876a5dc81ea8ce325848c Reviewed-by: Lars Knoll Reviewed-by: Shawn Rutledge Reviewed-by: Jan Arve Sæther --- src/widgets/widgets/qcalendarwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp index d6704c20d2..fa3dbc1f32 100644 --- a/src/widgets/widgets/qcalendarwidget.cpp +++ b/src/widgets/widgets/qcalendarwidget.cpp @@ -2247,6 +2247,9 @@ QSize QCalendarWidget::minimumSizeHint() const w *= cols; w = qMax(headerSize.width(), w); h = (h * rows) + headerSize.height(); + QMargins cm = contentsMargins(); + w += cm.left() + cm.right(); + h += cm.top() + cm.bottom(); d->cachedSizeHint = QSize(w, h); return d->cachedSizeHint; } -- cgit v1.2.3 From 763a48fe1af5b0482f929a79ded05ea21456a916 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 15 Oct 2014 14:05:24 +0200 Subject: Windows XP style: Fix size calculation of QScrollBar's grip. Factor out function to calculate the geometry for the styles >= XP. Task-number: QTBUG-41944 Task-number: QTBUG-40277 Change-Id: Ifad1519b99fd587158c790dd241cb3e4bac3bfc3 Reviewed-by: Kai Koehne --- src/widgets/styles/qwindowsvistastyle.cpp | 20 +------------------ src/widgets/styles/qwindowsxpstyle.cpp | 33 ++++++++++++++----------------- src/widgets/styles/qwindowsxpstyle_p_p.h | 1 + 3 files changed, 17 insertions(+), 37 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 044394747c..007952192a 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -1756,26 +1756,8 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle theme.stateId = stateId; d->drawBackground(theme); - // Calculate rect of gripper - const int swidth = theme.rect.width(); - const int sheight = theme.rect.height(); - - const QMargins contentsMargin = theme.margins(theme.rect, TMT_SIZINGMARGINS) - / QWindowsXPStylePrivate::devicePixelRatio(widget); - - theme.partId = flags & State_Horizontal ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT; - const QSize size = theme.size() / QWindowsXPStylePrivate::devicePixelRatio(widget); - if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8) { - QPoint gripperBoundsPos(0, 0); - if ((flags & State_Horizontal - && swidth - contentsMargin.left() - contentsMargin.right() > size.width()) - || sheight - contentsMargin.top() - contentsMargin.bottom() > size.height()) { - gripperBoundsPos = QPoint(theme.rect.left() + (swidth - size.width()) / 2, - theme.rect.top() + (sheight - size.height()) / 2); - } - const QRect gripperBounds(gripperBoundsPos, size); - + const QRect gripperBounds = QWindowsXPStylePrivate::scrollBarGripperBounds(flags, widget, &theme); // Draw gripper if there is enough space if (!gripperBounds.isEmpty() && flags & State_Enabled) { painter->save(); diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 624023f627..c18bbb3431 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -2529,6 +2529,20 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op d->drawBackground(theme); } +QRect QWindowsXPStylePrivate::scrollBarGripperBounds(QStyle::State flags, const QWidget *widget, XPThemeData *theme) +{ + const bool horizontal = flags & QStyle::State_Horizontal; + const QMargins contentsMargin = theme->margins(theme->rect, TMT_SIZINGMARGINS) + / QWindowsStylePrivate::devicePixelRatio(widget); + theme->partId = horizontal ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT; + const QSize size = theme->size() / QWindowsStylePrivate::devicePixelRatio(widget); + + const int hSpace = theme->rect.width() - size.width(); + const int vSpace = theme->rect.height() - size.height(); + const bool sufficientSpace = horizontal && hSpace > (contentsMargin.left() + contentsMargin.right()) + || vSpace > contentsMargin.top() + contentsMargin.bottom(); + return sufficientSpace ? QRect(theme->rect.topLeft() + QPoint(hSpace, vSpace) / 2, size) : QRect(); +} /*! \reimp @@ -2754,24 +2768,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo theme.stateId = stateId; d->drawBackground(theme); - // Calculate rect of gripper - const int swidth = theme.rect.width(); - const int sheight = theme.rect.height(); - - const QMargins contentsMargin = theme.margins(theme.rect, TMT_SIZINGMARGINS) - / QWindowsStylePrivate::devicePixelRatio(widget); - - theme.partId = flags & State_Horizontal ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT; - const QSize size = theme.size() / QWindowsStylePrivate::devicePixelRatio(widget); - QPoint gripperBoundsPos(0, 0); - if ((flags & State_Horizontal - && swidth - contentsMargin.left() - contentsMargin.right() > size.width()) - || sheight - contentsMargin.top() - contentsMargin.bottom() > size.height()) { - gripperBoundsPos = QPoint(theme.rect.left() + (swidth - size.width()) / 2, - theme.rect.top() + (sheight - size.height()) /2); - } - const QRect gripperBounds(gripperBoundsPos, size); - + const QRect gripperBounds = QWindowsXPStylePrivate::scrollBarGripperBounds(flags, widget, &theme); // Draw gripper if there is enough space if (!gripperBounds.isEmpty()) { p->save(); diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index 4f42b60681..5027588c93 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -392,6 +392,7 @@ public: static bool resolveSymbols(); static bool useXP(bool update = false); + static QRect scrollBarGripperBounds(QStyle::State flags, const QWidget *widget, XPThemeData *theme); bool isTransparent(XPThemeData &themeData); QRegion region(XPThemeData &themeData); -- cgit v1.2.3 From b5bbfad0a4e11a5db7ed04caf4dba43bcee7ae8d Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 22 Sep 2014 13:03:21 +0400 Subject: Doc: Fix obsoleteness of some QStyle::PixelMetric enum items The enum items PM_ScrollView_ScrollBarSpacing, PM_ScrollView_ScrollBarOverlap and PM_SubMenuOverlap were mistakenly put together with obsolete enum items. Move them up to fix it. Change-Id: I90bd3a8ab68c99db27134d976fe69df56c9af2b8 Reviewed-by: Sean Harmer Reviewed-by: Martin Smith --- src/widgets/styles/qstyle.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 52a794a03a..6cf61a691e 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -1463,6 +1463,12 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \value PM_TabCloseIndicatorWidth The default width of a close button on a tab in a tab bar. \value PM_TabCloseIndicatorHeight The default height of a close button on a tab in a tab bar. + \value PM_ScrollView_ScrollBarSpacing Distance between frame and scrollbar + with SH_ScrollView_FrameOnlyAroundContents set. + \value PM_ScrollView_ScrollBarOverlap Overlap between scroll bars and scroll content + + \value PM_SubMenuOverlap The horizontal overlap between a submenu and its parent. + \value PM_TreeViewIndentation The indentation of items in a tree view. This enum value has been introduced in Qt 5.4. @@ -1483,12 +1489,6 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, and PM_LayoutVerticalSpacing instead. - \value PM_ScrollView_ScrollBarSpacing Distance between frame and scrollbar - with SH_ScrollView_FrameOnlyAroundContents set. - \value PM_ScrollView_ScrollBarOverlap Overlap between scroll bars and scroll content - - \value PM_SubMenuOverlap The horizontal overlap between a submenu and its parent. - \sa pixelMetric() */ -- cgit v1.2.3 From ed0245e1452f94918853b7d4066c1e5749b74f5d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 21 Oct 2014 12:24:52 +0200 Subject: Fix QWidget::mapTo/FromGlobal() when embedded in QGraphicsView. Map the positions via QGraphicsScene and the first QGraphicsView (as is done in existing code). Fall back to the previous code path when no QGraphicsView exists, which is hit in the tests. Change-Id: I0754765d05cded6bc1b64045f2513fef8afde337 Task-number: QTBUG-41135 Reviewed-by: Frederik Gladhorn --- src/widgets/kernel/qwidget.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 455d195159..b421d5debc 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -12250,6 +12250,17 @@ QPaintEngine *QWidget::paintEngine() const */ QPoint QWidget::mapToGlobal(const QPoint &pos) const { +#ifndef QT_NO_GRAPHICSVIEW + Q_D(const QWidget); + if (d->extra && d->extra->proxyWidget) { + const QList views = d->extra->proxyWidget->scene()->views(); + if (!views.isEmpty()) { + const QPointF scenePos = d->extra->proxyWidget->mapToScene(pos); + const QPoint viewPortPos = views.first()->mapFromScene(scenePos); + return views.first()->viewport()->mapToGlobal(viewPortPos); + } + } +#endif // !QT_NO_GRAPHICSVIEW int x = pos.x(), y = pos.y(); const QWidget *w = this; while (w) { @@ -12274,6 +12285,17 @@ QPoint QWidget::mapToGlobal(const QPoint &pos) const */ QPoint QWidget::mapFromGlobal(const QPoint &pos) const { +#ifndef QT_NO_GRAPHICSVIEW + Q_D(const QWidget); + if (d->extra && d->extra->proxyWidget) { + const QList views = d->extra->proxyWidget->scene()->views(); + if (!views.isEmpty()) { + const QPoint viewPortPos = views.first()->viewport()->mapFromGlobal(pos); + const QPointF scenePos = views.first()->mapToScene(viewPortPos); + return d->extra->proxyWidget->mapFromScene(scenePos).toPoint(); + } + } +#endif // !QT_NO_GRAPHICSVIEW int x = pos.x(), y = pos.y(); const QWidget *w = this; while (w) { -- cgit v1.2.3 From c30ccb0ecdfa08fbadfa8bd40a67a0efb6eaadde Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 15 Oct 2014 14:57:45 +0200 Subject: Fix title font of Vista-style wizards. Reverse invalid check. Task-number: QTBUG-41878 Change-Id: I05015407e5cfad94aca65594962b897a1d0a0cbd Reviewed-by: Alessandro Portale --- src/widgets/dialogs/qwizard_win.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 6a09f9c273..69761473fc 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -653,10 +653,7 @@ HFONT QVistaHelper::getCaptionFont(HANDLE hTheme) { LOGFONT lf = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { 0 } }; - if (!hTheme) - pGetThemeSysFont(hTheme, WIZ_TMT_CAPTIONFONT, &lf); - else - { + if (!hTheme || FAILED(pGetThemeSysFont(hTheme, WIZ_TMT_CAPTIONFONT, &lf))) { NONCLIENTMETRICS ncm; ncm.cbSize = sizeof(NONCLIENTMETRICS); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, false); -- cgit v1.2.3 From bf200fc948d89e1a735a8bcca879654028f944d2 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Mon, 20 Oct 2014 15:40:18 +0200 Subject: Adjust the layout if a QGraphicsWidget is explicitly hidden Since layout items can now be hidden, this also makes sure we respect the QSizePolicy::retainSizeWhenHidden Task-number: QTBUG-20132 Change-Id: Iab59fc9b61d4ca1bb2208c479a027da6eb0283a9 Reviewed-by: Paul Olav Tvete --- .../graphicsview/qgraphicsgridlayoutengine.cpp | 20 ++++++++++++++++++++ .../graphicsview/qgraphicsgridlayoutengine_p.h | 4 ++++ src/widgets/graphicsview/qgraphicswidget.cpp | 4 ++++ 3 files changed, 28 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp b/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp index 3d9c5d6de5..c9b2ecd62c 100644 --- a/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp +++ b/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp @@ -38,9 +38,29 @@ #include "qgraphicslayoutitem_p.h" #include "qgraphicslayout_p.h" #include "qgraphicswidget.h" +#include QT_BEGIN_NAMESPACE +bool QGraphicsGridLayoutEngineItem::isHidden() const +{ + if (QGraphicsItem *item = q_layoutItem->graphicsItem()) + return QGraphicsItemPrivate::get(item)->explicitlyHidden; + return false; +} + +/*! + \internal + + If this returns true, the layout will arrange just as if the item was never added to the layout. + (Note that this shouldn't lead to a "double spacing" where the item was hidden) + ### Qt6: Move to QGraphicsLayoutItem and make virtual +*/ +bool QGraphicsGridLayoutEngineItem::isIgnored() const +{ + return isHidden() && !q_layoutItem->sizePolicy().retainSizeWhenHidden(); +} + /* returns \c true if the size policy returns \c true for either hasHeightForWidth() or hasWidthForHeight() diff --git a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h index 4d6bdfce0a..07486514f8 100644 --- a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h +++ b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h @@ -82,6 +82,10 @@ public: return q_layoutItem->effectiveSizeHint(which, constraint); } + bool isHidden() const; + + virtual bool isIgnored() const Q_DECL_OVERRIDE; + virtual void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE { q_layoutItem->setGeometry(rect); diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 4a9c3b098e..5bd563e535 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -1137,6 +1137,10 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant & setAttribute(Qt::WA_Resized, false); } } + + // layout size hint only changes if an item changes from/to explicitly hidden state + if (value.toBool() || d->explicitlyHidden) + updateGeometry(); break; case ItemVisibleHasChanged: if (!value.toBool()) { -- cgit v1.2.3 From 3056b825bd22ddf17deee03c5c43117ad6aa545e Mon Sep 17 00:00:00 2001 From: Marko Kangas Date: Mon, 20 Oct 2014 17:51:02 +0300 Subject: Fix styled vertical dockwidget title cut off bug and elide text if long Change common stylesheet to elide text correctly for both direction. Change-Id: I045f6f74733ca8fa67b3e4fbb9d3845a1bea777d Task-number: QTBUG-41466 Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qstylesheetstyle.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index a6c7f5dde2..a9e13bad49 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -4047,26 +4047,28 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q } if (!dwOpt->title.isEmpty()) { - QRect r = opt->rect; + QRect r = subElementRect(SE_DockWidgetTitleBarText, opt, w); if (dwOpt->verticalTitleBar) { QSize s = r.size(); s.transpose(); r.setSize(s); - p->save(); p->translate(r.left(), r.top() + r.width()); p->rotate(-90); p->translate(-r.left(), -r.top()); } + r = subRule.contentsRect(r); Qt::Alignment alignment = 0; if (subRule.hasPosition()) alignment = subRule.position()->textAlignment; if (alignment == 0) alignment = Qt::AlignLeft; - drawItemText(p, subRule.contentsRect(opt->rect), + + QString titleText = p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, r.width()); + drawItemText(p, r, alignment | Qt::TextShowMnemonic, dwOpt->palette, - dwOpt->state & State_Enabled, dwOpt->title, + dwOpt->state & State_Enabled, titleText, QPalette::WindowText); if (dwOpt->verticalTitleBar) -- cgit v1.2.3 From 88057e3407aa16d0a9dc9dcc6d0ea6174dce693b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 21 Oct 2014 17:31:55 +0200 Subject: QSwipeGestureRecognizer: Fix gesture cancel on direction change. Task-number: QTBUG-12736 Change-Id: I6d8d09843b45df17cb9158070f63b3397c5b4c07 Reviewed-by: Lars Knoll Reviewed-by: Frederik Gladhorn --- src/widgets/kernel/qstandardgestures.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp index 78a2c65060..0822c04033 100644 --- a/src/widgets/kernel/qstandardgestures.cpp +++ b/src/widgets/kernel/qstandardgestures.cpp @@ -341,10 +341,10 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state, if (d->horizontalDirection == QSwipeGesture::NoDirection) d->horizontalDirection = horizontal; if (d->verticalDirection != vertical || d->horizontalDirection != horizontal) { - // the user has changed the direction! result = QGestureRecognizer::CancelGesture; + } else { + result = QGestureRecognizer::TriggerGesture; } - result = QGestureRecognizer::TriggerGesture; } else { if (q->state() != Qt::NoGesture) result = QGestureRecognizer::TriggerGesture; -- cgit v1.2.3 From 77339e6bbf8baec5c15b604adbc03ab41cb37595 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 20 Oct 2014 13:41:21 +0200 Subject: Doc: warn about preserving input method hints Task-number: QTBUG-41252 Change-Id: I8ea2094c440b3c78b4bc78a69a5f6b18533e4927 Reviewed-by: Venugopal Shivashankar --- src/widgets/kernel/qwidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index b421d5debc..7533cacbdc 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -9663,6 +9663,10 @@ QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const is set, the input method may change its visual components to reflect that only numbers can be entered. + \warning Some widgets require certain flags in order to work as + intended. To set a flag, do \c{w->setInputMethodHints(w->inputMethodHints()|f)} + instead of \c{w->setInputMethodHints(f)}. + \note The flags are only hints, so the particular input method implementation is free to ignore them. If you want to be sure that a certain type of characters are entered, -- cgit v1.2.3 From 2bfee10f3ab8e8e33b2169d735baedcdd9f2b584 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 22 Oct 2014 13:47:55 +0200 Subject: QMainWindow: respect the maximum size of the central widget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure the dock widgets get the available space when the central widget cannot expand any more. [ChangeLog][QtWidgets][QMainWindow] Dock widgets will now be resized properly when the central widget has a fixed size. Task-number: QTBUG-40410 Change-Id: Id06c07b79aa3102aa41212fa2c621f5fa426fe02 Reviewed-by: Friedemann Kleint Reviewed-by: Jan Arve Sæther --- src/widgets/widgets/qdockarealayout.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index 7ac2791112..702cd8bac9 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -2575,12 +2575,14 @@ void QDockAreaLayout::getGrid(QVector *_ver_struct_list, { QSize center_hint(0, 0); QSize center_min(0, 0); + QSize center_max(0, 0); const bool have_central = centralWidgetItem != 0 && !centralWidgetItem->isEmpty(); if (have_central) { center_hint = centralWidgetRect.size(); if (!center_hint.isValid()) center_hint = centralWidgetItem->sizeHint(); center_min = centralWidgetItem->minimumSize(); + center_max = centralWidgetItem->maximumSize(); } QRect center_rect = rect; @@ -2656,7 +2658,7 @@ void QDockAreaLayout::getGrid(QVector *_ver_struct_list, left = (tl_significant && bl_significant) ? left_min.height() : 0; right = (tr_significant && br_significant) ? right_min.height() : 0; ver_struct_list[1].minimumSize = qMax(left, center_min.height(), right); - ver_struct_list[1].maximumSize = have_central ? QWIDGETSIZE_MAX : 0; + ver_struct_list[1].maximumSize = center_max.height(); ver_struct_list[1].expansive = have_central; ver_struct_list[1].empty = docks[QInternal::LeftDock].isEmpty() && !have_central @@ -2717,7 +2719,7 @@ void QDockAreaLayout::getGrid(QVector *_ver_struct_list, bottom = (bl_significant && br_significant) ? bottom_min.width() : 0; hor_struct_list[1].minimumSize = qMax(top, center_min.width(), bottom); - hor_struct_list[1].maximumSize = have_central ? QWIDGETSIZE_MAX : 0; + hor_struct_list[1].maximumSize = center_max.width(); hor_struct_list[1].expansive = have_central; hor_struct_list[1].empty = !have_central; hor_struct_list[1].pos = center_rect.left(); -- cgit v1.2.3 From 29d3b9745b4ba57cd79c95a96659f97c85c3b4ee Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 20 Oct 2014 14:01:58 +0200 Subject: Item view: Update item positions when delegate changes In QComboBox, when you set editable to true on the QComboBox, the delegates will change from QComboBoxMenuDelegate to QComboBoxDelegate. In some styles, such as Fusion, the size of the delegates will be different. So when the delegate is updated, we need to redo the list view layout, otherwise the items will be positioned based on the size of the old delegates, but the popup for the combo box will be sized for the new. This caused the popup to be too small for its items and display a scroll bar. [ChangeLog][QComboBox] Fixed positions of items when QComboBox is set as editable in Fusion style. Change-Id: Ia43ef96efbeee4d6d596c0674bf3898ef94f89a1 Task-number: QTBUG-33537 Reviewed-by: Mitch Curtis Reviewed-by: Friedemann Kleint --- src/widgets/itemviews/qabstractitemview.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 88b16db93b..1d8be6398c 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -837,6 +837,7 @@ void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *delegate) } d->itemDelegate = delegate; viewport()->update(); + d->doDelayedItemsLayout(); } /*! -- cgit v1.2.3 From c4430ed02301c456dd591c88049ee22bc7dd9725 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 21 Oct 2014 10:01:58 +0200 Subject: Correctly update QComboBox appearance on editable change The updateDelegate() function checks isEditable() which in turn checks if d->lineEdit != 0, so we need to make the call after the lineEdit has actually been set/unset, otherwise the change to the delegate will not come until the next time you update the delegate. [ChangeLog][QComboBox] Fixed updating appearance of popup menu when changing the editable state of the combo box. Change-Id: Ib32f36cabd53c2c30d6256484a1eae131419960a Task-number: QTBUG-33537 Reviewed-by: Friedemann Kleint Reviewed-by: Mitch Curtis --- src/widgets/widgets/qcombobox.cpp | 3 +-- src/widgets/widgets/qcombobox_p.h | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 89dc8bf178..fda37c49de 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -1704,8 +1704,6 @@ void QComboBox::setEditable(bool editable) if (isEditable() == editable) return; - d->updateDelegate(); - QStyleOptionComboBox opt; initStyleOption(&opt); if (editable) { @@ -1726,6 +1724,7 @@ void QComboBox::setEditable(bool editable) d->lineEdit = 0; } + d->updateDelegate(); d->updateFocusPolicy(); d->viewContainer()->updateTopBottomMargin(); diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index 67b1aa6943..4e1b4125ab 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -254,7 +254,7 @@ private: friend class QComboBox; }; -class QComboMenuDelegate : public QAbstractItemDelegate +class Q_AUTOTEST_EXPORT QComboMenuDelegate : public QAbstractItemDelegate { Q_OBJECT public: QComboMenuDelegate(QObject *parent, QComboBox *cmb) : QAbstractItemDelegate(parent), mCombo(cmb) {} @@ -283,7 +283,7 @@ private: // Note that this class is intentionally not using QStyledItemDelegate // Vista does not use the new theme for combo boxes and there might // be other side effects from using the new class -class QComboBoxDelegate : public QItemDelegate +class Q_AUTOTEST_EXPORT QComboBoxDelegate : public QItemDelegate { Q_OBJECT public: QComboBoxDelegate(QObject *parent, QComboBox *cmb) : QItemDelegate(parent), mCombo(cmb) {} -- cgit v1.2.3 From 929509ea03b116588bdae38391377ec1ec976845 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Mon, 20 Oct 2014 18:44:13 +0200 Subject: QStyleSheetStyle: Don't interfere with QFontDialog The sample lineedit in Qt's own font dialog shouldn't have its font affected by stylesheets. Not only does this hampers the ability to preview the font, it actually overrides the font selection as that one is taken directly from the widget. Task-number: QTBUG-41513 Change-Id: I11d0bef8c7bf7bdae4cc08b6b9276d0fc14a75fb Reviewed-by: Olivier Goffart Reviewed-by: Frederik Gladhorn --- src/widgets/dialogs/qfontdialog.cpp | 1 + src/widgets/styles/qstylesheetstyle.cpp | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index 109b726880..d12b109d9f 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -322,6 +322,7 @@ void QFontDialogPrivate::init() familyList->setFocus(); retranslateStrings(); + sampleEdit->setObjectName(QLatin1String("qt_fontDialog_sampleEdit")); } /*! diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index a9e13bad49..e9f20de842 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -5828,6 +5828,10 @@ bool QStyleSheetStyle::event(QEvent *e) void QStyleSheetStyle::updateStyleSheetFont(QWidget* w) const { + // Qt's fontDialog relies on the font of the sample edit for its selection, + // we should never override it. + if (w->objectName() == QLatin1String("qt_fontDialog_sampleEdit")) + return; QWidget *container = containerWidget(w); QRenderRule rule = renderRule(container, PseudoElement_None, PseudoClass_Active | PseudoClass_Enabled | extendedPseudoClass(container)); -- cgit v1.2.3 From 9911550fa7fa58cfef66a33ccd8b1d0c531f848e Mon Sep 17 00:00:00 2001 From: aavit Date: Mon, 20 Oct 2014 14:09:58 +0200 Subject: Fix rubberband selection in rotated GraphicsView MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Selection rectangle was incorrectly mapped to scene space when the view was rotated. It became a rotated rectangle instead of the correct polygon (rhombus). Task-number: QTBUG-42008 Change-Id: Ib7b366bec7e1f83109e03c434268ad6897138f30 Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/graphicsview/qgraphicsview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 88d5e52204..5484ecb96e 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -765,7 +765,7 @@ void QGraphicsViewPrivate::updateRubberBand(const QMouseEvent *event) } // Set the new selection area QPainterPath selectionArea; - selectionArea.addPolygon(mapToScene(rubberBandRect)); + selectionArea.addPolygon(q->mapToScene(rubberBandRect)); selectionArea.closeSubpath(); if (scene) scene->setSelectionArea(selectionArea, rubberBandSelectionMode, q->viewportTransform()); -- cgit v1.2.3 From 6841dd6eccda88f08ad4c424fc9d5f9e400aaf43 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 21 Oct 2014 12:21:06 +0200 Subject: QGraphicsScene: stabilize stacking order of toplevel items Removing and adding toplevel items could result in invalid stacking order (not corresponding to insertion order). Task-number: QTBUG-19316 Change-Id: Ia8646784a2181cfa936b101e2adaf7e7e73bb83d Reviewed-by: Andreas Aardal Hanssen --- src/widgets/graphicsview/qgraphicsscene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index ae3eb1eee7..988152da9d 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -392,7 +392,7 @@ void QGraphicsScenePrivate::_q_emitUpdated() */ void QGraphicsScenePrivate::registerTopLevelItem(QGraphicsItem *item) { - item->d_ptr->ensureSequentialSiblingIndex(); + ensureSequentialTopLevelSiblingIndexes(); needSortTopLevelItems = true; // ### maybe false item->d_ptr->siblingIndex = topLevelItems.size(); topLevelItems.append(item); -- cgit v1.2.3 From 0f3323ce0194b271024d423bec861d51dc55063f Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Fri, 24 Oct 2014 13:19:08 +0400 Subject: Doc: Fix CustomStyle snippet Add missing semicolon, include QtWidgets instead of QtGui and use cast for a const pointer because the example with casting relates to the code above where 'widget' is const. Task-number: QTBUG-31736 Change-Id: I5cb6d33ec692deaf41e9a1be9e36e752a8da8739 Reviewed-by: Venugopal Shivashankar --- src/widgets/doc/snippets/customstyle/customstyle.cpp | 2 +- src/widgets/doc/snippets/customstyle/customstyle.h | 2 +- src/widgets/doc/snippets/customstyle/customstyle.pro | 1 + src/widgets/doc/snippets/customstyle/main.cpp | 2 +- src/widgets/doc/snippets/customviewstyle.cpp | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/doc/snippets/customstyle/customstyle.cpp b/src/widgets/doc/snippets/customstyle/customstyle.cpp index b5d44ebecd..16715929a8 100644 --- a/src/widgets/doc/snippets/customstyle/customstyle.cpp +++ b/src/widgets/doc/snippets/customstyle/customstyle.cpp @@ -45,7 +45,7 @@ CustomStyle::CustomStyle() { //! [0] - QSpinBox *spinBox = qobject_cast(widget); + const QSpinBox *spinBox = qobject_cast(widget); if (spinBox) { //! [0] //! [1] } diff --git a/src/widgets/doc/snippets/customstyle/customstyle.h b/src/widgets/doc/snippets/customstyle/customstyle.h index 0f23efc922..0782bdc09c 100644 --- a/src/widgets/doc/snippets/customstyle/customstyle.h +++ b/src/widgets/doc/snippets/customstyle/customstyle.h @@ -49,7 +49,7 @@ class CustomStyle : public QProxyStyle Q_OBJECT public: - CustomStyle() + CustomStyle(); ~CustomStyle() {} void drawPrimitive(PrimitiveElement element, const QStyleOption *option, diff --git a/src/widgets/doc/snippets/customstyle/customstyle.pro b/src/widgets/doc/snippets/customstyle/customstyle.pro index af0ee4e141..02b9b2791d 100644 --- a/src/widgets/doc/snippets/customstyle/customstyle.pro +++ b/src/widgets/doc/snippets/customstyle/customstyle.pro @@ -1,2 +1,3 @@ +QT += widgets HEADERS += customstyle.h SOURCES += customstyle.cpp main.cpp diff --git a/src/widgets/doc/snippets/customstyle/main.cpp b/src/widgets/doc/snippets/customstyle/main.cpp index 19fb6b2be9..8164a1e877 100644 --- a/src/widgets/doc/snippets/customstyle/main.cpp +++ b/src/widgets/doc/snippets/customstyle/main.cpp @@ -39,7 +39,7 @@ ****************************************************************************/ //! [using a custom style] -#include +#include #include "customstyle.h" diff --git a/src/widgets/doc/snippets/customviewstyle.cpp b/src/widgets/doc/snippets/customviewstyle.cpp index cdb4ed1d77..0e641653aa 100644 --- a/src/widgets/doc/snippets/customviewstyle.cpp +++ b/src/widgets/doc/snippets/customviewstyle.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include +#include #include "customviewstyle.h" -- cgit v1.2.3 From 3f9dbc0ec82e1c7c823707668fcd326d8a1dd82b Mon Sep 17 00:00:00 2001 From: Samuel Nevala Date: Wed, 22 Oct 2014 14:49:33 +0300 Subject: Android: Keyboard doesn't hide from done button QLineEdit commits and hides QInputMethod on enter key press. When Qt::ImhMultiLine input method hint is set, virtual keyboard is not hidden. Task-number: QTBUG-37850 Change-Id: I018351caa18bd2116665771e5f024a57182a01b9 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/widgets/widgets/qwidgetlinecontrol.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 90fbfc1639..a82dd99591 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -1607,6 +1607,13 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { if (hasAcceptableInput() || fixup()) { + + QInputMethod *inputMethod = QApplication::inputMethod(); + inputMethod->commit(); + QWidget *lineEdit = qobject_cast(parent()); + if (!(lineEdit && lineEdit->inputMethodHints() & Qt::ImhMultiLine)) + inputMethod->hide(); + emit accepted(); emit editingFinished(); } -- cgit v1.2.3