From f1033567aa4295d5e0122f01c7781a8b23d0d781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Mon, 9 Oct 2017 14:08:23 +0200 Subject: QDockWidget - improve resize On high DPI (e.g Apple Retina) user resizes of QDockWidgets (with custom titlebars) could fail. There was a cursor position check in mouse move event bailing out if the cursor pos was not within the widget. The problem was that we could be on the edge (or maybe even cross it?). Furthermore there is (/was) no similar check when setting the cursor to be a resize cursor, so users will obviously expect the resize to occur. This solves a part of QTBUG-63526 [ChangeLog][QtWidgets][QDockWidget] Fixed an issue in QDockWidgets where the widget would not resize despite showing a resize cursor. Task-number: QTBUG-63526 Change-Id: Ifa842a109071552506da3a82822d903dc252c8cd Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Andy Shaw --- src/widgets/widgets/qwidgetresizehandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp index 5bd87ac91c..09c5e52219 100644 --- a/src/widgets/widgets/qwidgetresizehandler.cpp +++ b/src/widgets/widgets/qwidgetresizehandler.cpp @@ -118,7 +118,9 @@ bool QWidgetResizeHandler::eventFilter(QObject *o, QEvent *ee) QMouseEvent *e = static_cast(ee); if (w->isMaximized()) break; - if (!widget->rect().contains(widget->mapFromGlobal(e->globalPos()))) + const QRect widgetRect = widget->rect().marginsAdded(QMargins(range, range, range, range)); + const QPoint cursorPoint = widget->mapFromGlobal(e->globalPos()); + if (!widgetRect.contains(cursorPoint) || mode == Center || mode == Nowhere) return false; if (e->button() == Qt::LeftButton) { #if 0 // Used to be included in Qt4 for Q_WS_X11 -- cgit v1.2.3 From 2d4fe257cad8b10f284de7a0b10a1a297026e86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Thu, 12 Oct 2017 16:32:07 +0200 Subject: Remove some unused, local variables Change-Id: I453162d2d396bb3427064d3b1593bb6c71376605 Reviewed-by: Friedemann Kleint --- src/widgets/effects/qpixmapfilter.cpp | 1 - src/widgets/styles/qstylehelper.cpp | 1 - 2 files changed, 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp index 9d70825b0e..211c09ee71 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -925,7 +925,6 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap scaledRadius /= scale; QImage srcImage; - QImage destImage; if (srcRect == src.rect()) { srcImage = src.toImage(); diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index 24d90fc0ba..141b731b65 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -278,7 +278,6 @@ void drawDial(const QStyleOptionSlider *option, QPainter *painter) buttonColor.setHsv(buttonColor .hue(), qMin(140, buttonColor .saturation()), qMax(180, buttonColor.value())); - QColor shadowColor(0, 0, 0, 20); if (enabled) { // Drop shadow -- cgit v1.2.3 From e00b295344e23bf2110c744b057225a24d589757 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 16 Oct 2017 10:29:01 +0200 Subject: QSystemTrayIcon/Windows: Fix position of context menu with High DPI scaling Apply scale factor of screen. Task-number: QTBUG-63781 Change-Id: I1b5630edbdf6bb356955a7d70458a885af441953 Reviewed-by: Joerg Bornemann --- src/widgets/util/qsystemtrayicon_win.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp index d110cb8be4..3f007f24c1 100644 --- a/src/widgets/util/qsystemtrayicon_win.cpp +++ b/src/widgets/util/qsystemtrayicon_win.cpp @@ -49,7 +49,9 @@ #include #include +#include #include +#include #include #include #include @@ -335,6 +337,13 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result ) Q_ASSERT(q_uNOTIFYICONID == HIWORD(m->lParam)); message = LOWORD(m->lParam); gpos = QPoint(GET_X_LPARAM(m->wParam), GET_Y_LPARAM(m->wParam)); + // Drop this chunk when merging to 5.10; code has been moved to Windows QPA. + if (const QScreen *primaryScreen = QGuiApplication::primaryScreen()) { + if (const QPlatformScreen *screen = primaryScreen->handle()->screenForPosition(gpos)) { + gpos = QHighDpi::fromNative(gpos, QHighDpiScaling::factor(screen), + screen->geometry().topLeft()); + } + } } else { Q_ASSERT(q_uNOTIFYICONID == m->wParam); message = m->lParam; -- cgit v1.2.3 From 198225983df9f402bb368b449f1abeea95ff0dce Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 11 Oct 2017 18:42:32 -0700 Subject: QShortcut: Fall back to cross platform code in absence of QPA menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On macOS, absence of a QPA menu means that we should be using our own internal logic since there's no entity on the QCocoaMenuDelegate to take care of the shortcuts. Change-Id: I35ed8f0b55445f61d0528709d4debb636a502002 Task-number: QTBUG-61039 Reviewed-by: Tor Arne Vestbø Reviewed-by: Shawn Rutledge --- src/widgets/kernel/qshortcut.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index 0585a59e89..f944a7097b 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -289,8 +289,10 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge // not the QMenu.) Since we can also reach this code by climbing the menu // hierarchy (see below), or when the shortcut is not a key-equivalent, we // need to check whether the QPA menu is actually disabled. + // When there is no QPA menu, there will be no QCocoaMenuDelegate checking + // for the actual shortcuts. We can then fallback to our own logic. QPlatformMenu *pm = menu->platformMenu(); - if (!pm || !pm->isEnabled()) + if (pm && !pm->isEnabled()) continue; #endif QAction *a = menu->menuAction(); -- cgit v1.2.3 From 6889626164b743d991e8b1681bbaa56949c0ca74 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 12 Oct 2017 14:40:29 +0200 Subject: Doc: replace screenshot widgets tutorial with more updated version Change-Id: I2b4fcd02c13fcd6569ebf035197da361aba40afd Reviewed-by: Venugopal Shivashankar --- src/widgets/doc/images/widgets-tutorial-toplevel.png | Bin 6087 -> 2496 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/doc/images/widgets-tutorial-toplevel.png b/src/widgets/doc/images/widgets-tutorial-toplevel.png index a80d13c50d..bf7879f5aa 100644 Binary files a/src/widgets/doc/images/widgets-tutorial-toplevel.png and b/src/widgets/doc/images/widgets-tutorial-toplevel.png differ -- cgit v1.2.3 From a92cf24f9c56833b14915a0f7d34c6d565fa03d4 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 12 Oct 2017 13:12:56 +0200 Subject: Doc: correct filename png files qpushbutton.h:55: warning: Missing image: windows-pushbutton.jpg widgets.qdoc:28: warning: Missing image: windowsvista-treeview.png Change-Id: I2ebf2aa809f8d532f597624f6ed2f9d636e860a6 Reviewed-by: Venugopal Shivashankar --- src/widgets/doc/src/widgets-and-layouts/widgets.qdoc | 2 +- src/widgets/widgets/qpushbutton.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc b/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc index 700a4479fd..3b134a3f96 100644 --- a/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/widgets.qdoc @@ -62,7 +62,7 @@ \table \row - \li \image windowsvista-treeview.png + \li \image windows-treeview.png \li \image fusion-calendarwidget.png \li \image qundoview.png \endtable diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index caf175e6ff..8187b8f35c 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE \ingroup basicwidgets \inmodule QtWidgets - \image windows-pushbutton.jpg + \image windows-pushbutton.png The push button, or command button, is perhaps the most commonly used widget in any graphical user interface. Push (click) a button -- cgit v1.2.3 From 19ae653f7f774d62480915dc1a7bd26e1757e8f3 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 12 Oct 2017 12:40:02 +0200 Subject: Doc: qtwidgets index page: wrong name for image file windowsvista-treeview.png --> windows-treeview.png Change-Id: I19ccec1ff5fadf2107ad47109d65f170df4b0505 Reviewed-by: Venugopal Shivashankar --- src/widgets/doc/src/qtwidgets-index.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/doc/src/qtwidgets-index.qdoc b/src/widgets/doc/src/qtwidgets-index.qdoc index c05b16a0a0..7cd1c8d735 100644 --- a/src/widgets/doc/src/qtwidgets-index.qdoc +++ b/src/widgets/doc/src/qtwidgets-index.qdoc @@ -118,7 +118,7 @@ interfaces which use lists and tables are structured to separate the data and view using models, views, and delegates. - \image windowsvista-treeview.png + \image windows-treeview.png \section1 Graphics View -- cgit v1.2.3 From a1c985c10bf2212e911777568c6e344456293a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Thu, 12 Oct 2017 10:58:06 +0200 Subject: QAbstractItemView: Make it easier to drop above and below items Before this patch a very accurate drop position below or above an index was needed. Therefore it was not that easy to do. This patch increases the above/below area to be about 18% of the item (still leaving the most space for the item). An average user will likely be 2-3x faster with dropping below or above (while not losing much when dropping on items). [ChangeLog][QtWidgets][ItemViews] Made it easier to drop above and below items. Change-Id: I47f0f80c76878c17ebf3f93d0a0cc82755971c2a Reviewed-by: Andy Shaw Reviewed-by: Richard Moe Gustavsen --- src/widgets/itemviews/qabstractitemview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 15e6b0eb99..23e727e670 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2194,7 +2194,7 @@ QAbstractItemViewPrivate::position(const QPoint &pos, const QRect &rect, const Q { QAbstractItemView::DropIndicatorPosition r = QAbstractItemView::OnViewport; if (!overwrite) { - const int margin = 2; + const int margin = qBound(2, qRound(qreal(rect.height()) / 5.5), 12); if (pos.y() - rect.top() < margin) { r = QAbstractItemView::AboveItem; } else if (rect.bottom() - pos.y() < margin) { -- cgit v1.2.3 From d57a7c41712f8627a462d893329dc3f0dbb52d32 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 28 Sep 2017 23:54:32 +0300 Subject: MinGW: Globally define WINVER and _WIN32_WINNT to enable Windows 7 API Change-Id: I637b33ba6d05f40486d8da927ae5cc5148299348 Reviewed-by: Oswald Buddenhagen --- src/widgets/kernel/win.pri | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/win.pri b/src/widgets/kernel/win.pri index 7cef2d14a8..f6877b02db 100644 --- a/src/widgets/kernel/win.pri +++ b/src/widgets/kernel/win.pri @@ -3,5 +3,3 @@ INCLUDEPATH += ../3rdparty/wintab !winrt: LIBS_PRIVATE *= -lshell32 -luxtheme -ldwmapi -# Override MinGW's definition in _mingw.h -mingw: DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600 -- cgit v1.2.3 From 88e6f8cff2974c46b1262f3a1a61e1440c664e0c Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Tue, 3 Oct 2017 10:47:38 +0700 Subject: Fix implementation of spell check underline styles The QTextCharFormat documentation said that the used style is based on QStyle::SH_SpellCheckUnderlineStyle style hint, however in fact the implementation (drawTextItemDecoration in qpainter.cpp) uses themeHint(QPlatformTheme::SpellCheckUnderlineStyle) instead since Qt 5 (see commit 1f9ae50457a3750f). Make the documentation match that behavior, and update QPlatformTheme to use the correct default value. Also, switch Cocoa theme to use DotLine, as that is what native macOS applications use. Change-Id: I2a6bb3da6c7b0686dca87ed2c251b6abc006123c Task-number: QTBUG-50499 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qstyle.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 0350d5e1a5..faa5f1e67e 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -1840,9 +1840,8 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \value SH_UnderlineShortcut Whether shortcuts are underlined. - \value SH_SpellCheckUnderlineStyle A - QTextCharFormat::UnderlineStyle value that specifies the way - misspelled words should be underlined. + \value SH_SpellCheckUnderlineStyle Obsolete. Use SpellCheckUnderlineStyle + hint in QPlatformTheme instead. \value SH_SpinBox_AnimateButton Animate a click when up or down is pressed in a spin box. -- cgit v1.2.3