From b92267cd4c4a7c88aab950ad519943d85add1da2 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 6 May 2017 10:49:12 +0200 Subject: Remove some more register keywords They're deprecated since C++11 and removed in C++17. Change-Id: Ia2acd9312707bfee96838743645a04ae1780e5dd Reviewed-by: Thiago Macieira --- src/corelib/kernel/qeventdispatcher_win.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 40db5020ab..0952464f53 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -860,7 +860,7 @@ bool QEventDispatcherWin32::unregisterTimers(QObject *object) Q_D(QEventDispatcherWin32); if (d->timerVec.isEmpty()) return false; - register WinTimerInfo *t; + WinTimerInfo *t; for (int i=0; itimerVec.size(); i++) { t = d->timerVec.at(i); if (t && t->obj == object) { // object found @@ -957,7 +957,7 @@ int QEventDispatcherWin32::remainingTime(int timerId) quint64 currentTime = qt_msectime(); - register WinTimerInfo *t; + WinTimerInfo *t; for (int i=0; itimerVec.size(); i++) { t = d->timerVec.at(i); if (t && t->timerId == timerId) { // timer found -- cgit v1.2.3 From 225a35a2ab3eeecab693ee83a2b856f2dabe9092 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 5 May 2017 10:20:47 -0700 Subject: Use QNetworkReply::ProtocolFailure in HTTP/2 failures ProtocolInvalidOperationError are meant for actual replies from the server indicating that the operation is not valid (HTTP 400 Bad Request). Change-Id: I9ad33fff8b634979bdbafffd14bbc57e4b21d6bf Reviewed-by: Timur Pocheptsov --- src/network/access/qhttp2protocolhandler.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp index 555f1ba0ef..44ab637da8 100644 --- a/src/network/access/qhttp2protocolhandler.cpp +++ b/src/network/access/qhttp2protocolhandler.cpp @@ -528,7 +528,7 @@ void QHttp2ProtocolHandler::handleDATA() auto &stream = activeStreams[streamID]; if (qint32(inboundFrame.payloadSize()) > stream.recvWindow) { - finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError, + finishStreamWithError(stream, QNetworkReply::ProtocolFailure, QLatin1String("flow control error")); sendRST_STREAM(streamID, FLOW_CONTROL_ERROR); markAsReset(streamID); @@ -834,7 +834,7 @@ void QHttp2ProtocolHandler::handleWINDOW_UPDATE() } auto &stream = activeStreams[streamID]; if (!valid || sum_will_overflow(stream.sendWindow, delta)) { - finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError, + finishStreamWithError(stream, QNetworkReply::ProtocolFailure, QLatin1String("invalid WINDOW_UPDATE delta")); sendRST_STREAM(streamID, PROTOCOL_ERROR); markAsReset(streamID); @@ -888,7 +888,7 @@ void QHttp2ProtocolHandler::handleContinuedHEADERS() // We can receive HEADERS on streams initiated by our requests // (these streams are in halfClosedLocal state) or remote-reserved // streams from a server's PUSH_PROMISE. - finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError, + finishStreamWithError(stream, QNetworkReply::ProtocolFailure, QLatin1String("HEADERS on invalid stream")); sendRST_STREAM(streamID, CANCEL); markAsReset(streamID); @@ -977,7 +977,7 @@ bool QHttp2ProtocolHandler::acceptSetting(Http2::Settings identifier, quint32 ne for (auto id : brokenStreams) { auto &stream = activeStreams[id]; - finishStreamWithError(stream, QNetworkReply::ProtocolInvalidOperationError, + finishStreamWithError(stream, QNetworkReply::ProtocolFailure, QLatin1String("SETTINGS window overflow")); sendRST_STREAM(id, PROTOCOL_ERROR); markAsReset(id); -- cgit v1.2.3 From f12e4903c7b7c06ad3068e4ac195ff0bbe857e28 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Thu, 4 May 2017 19:36:34 +0200 Subject: Warn if files are not found because of features.filesystemiterator Change-Id: Ife3197aa1c56ba3ab6e7f530fbcbcf761f223b16 Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- src/corelib/io/qdiriterator.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index 5fd9edc552..b1d920c6ee 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -204,6 +204,8 @@ void QDirIteratorPrivate::pushDirectory(const QFileInfo &fileInfo) QFileSystemIterator *it = new QFileSystemIterator(fileInfo.d_ptr->fileEntry, filters, nameFilters, iteratorFlags); nativeIterators << it; +#else + qWarning("Qt was built with -no-feature-filesystemiterator: no files/plugins will be found!"); #endif } } -- cgit v1.2.3 From b97a70361308b10431222a0e95f3befa15fdcc71 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 2 May 2017 13:54:43 +0200 Subject: Windows QPA: Call InvalidateRect() for GL windows when Aero is off MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some AMD cards have been reported to not update otherwise. Task-number: QTBUG-60527 Change-Id: I84d57a57eb2b76fb31255ae42b79b96ab7b257c9 Reviewed-by: Kimmo Leppälä Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowswindow.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 2875463e62..d4effde52d 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1616,6 +1616,16 @@ static inline bool dwmIsCompositionEnabled() return SUCCEEDED(DwmIsCompositionEnabled(&dWmCompositionEnabled)) && dWmCompositionEnabled == TRUE; } +static inline bool isSoftwareGl() +{ +#if QT_CONFIG(dynamicgl) + return QOpenGLStaticContext::opengl32.moduleIsNotOpengl32() + && QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL; +#else + return false; +#endif // dynamicgl +} + bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, WPARAM, LPARAM) { @@ -1627,15 +1637,10 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, return false; PAINTSTRUCT ps; -#if QT_CONFIG(dynamicgl) - // QTBUG-58178: GL software rendering needs InvalidateRect() to suppress - // artifacts while resizing. - if (testFlag(OpenGLSurface) - && QOpenGLStaticContext::opengl32.moduleIsNotOpengl32() - && QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { + // GL software rendering (QTBUG-58178) and Windows 7/Aero off with some AMD cards + // (QTBUG-60527) need InvalidateRect() to suppress artifacts while resizing. + if (testFlag(OpenGLSurface) && (isSoftwareGl() || !dwmIsCompositionEnabled())) InvalidateRect(hwnd, 0, false); - } -#endif // dynamicgl BeginPaint(hwnd, &ps); -- cgit v1.2.3 From ce3a77eed580cdd4e2367216b3b5ede50c4be516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 20 Apr 2017 18:24:12 +0200 Subject: macOS: Add a few more platform window checks in QNSView And unify all of them to use regular pointer check syntax, to stay consistent with other uses of non-smart pointers. Change-Id: Ic55d7a16f2010120aaa8eac5b2df8189490671a2 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qnsview.mm | 60 +++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 6494dd3386..72e90a5363 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -237,7 +237,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)viewDidMoveToSuperview { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; if (!(m_platformWindow->m_viewIsToBeEmbedded)) @@ -260,7 +260,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (QWindow *)topLevelWindow { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return nullptr; QWindow *focusWindow = m_platformWindow->window(); @@ -278,7 +278,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)updateGeometry { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; QRect geometry; @@ -437,8 +437,11 @@ static bool _q_dontOverrideCtrlLMB = false; } } -- (void) drawRect:(NSRect)dirtyRect +- (void)drawRect:(NSRect)dirtyRect { + if (!m_platformWindow) + return; + qCDebug(lcQpaCocoaWindow) << "[QNSView drawRect:]" << m_platformWindow->window() << QRectF::fromCGRect(NSRectToCGRect(dirtyRect)); #ifndef QT_NO_OPENGL @@ -627,7 +630,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)handleMouseEvent:(NSEvent *)theEvent { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; // Tablet events may come in via the mouse event handlers, @@ -644,7 +647,7 @@ static bool _q_dontOverrideCtrlLMB = false; else m_platformWindow->m_forwardWindow.clear(); } - if (targetView->m_platformWindow.isNull()) + if (!targetView.platformWindow) return; // Popups implicitly grap mouse events; forward to the active popup if there is one @@ -670,7 +673,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; // get m_buttons in sync @@ -955,7 +958,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)mouseMovedImpl:(NSEvent *)theEvent { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; if ([self isTransparentForUserInput]) @@ -989,7 +992,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)mouseEnteredImpl:(NSEvent *)theEvent { Q_UNUSED(theEvent) - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; m_platformWindow->m_windowUnderMouse = true; @@ -1011,7 +1014,7 @@ static bool _q_dontOverrideCtrlLMB = false; - (void)mouseExitedImpl:(NSEvent *)theEvent { Q_UNUSED(theEvent); - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; m_platformWindow->m_windowUnderMouse = false; @@ -1040,7 +1043,7 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash) - (bool)handleTabletEvent: (NSEvent *)theEvent { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return false; NSEventType eventType = [theEvent type]; @@ -1200,7 +1203,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (bool)shouldSendSingleTouch { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return true; // QtWidgets expects single-point touch events, QtDeclarative does not. @@ -1210,7 +1213,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)touchesBeganWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; const NSTimeInterval timestamp = [event timestamp]; @@ -1221,7 +1224,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)touchesMovedWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; const NSTimeInterval timestamp = [event timestamp]; @@ -1232,7 +1235,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)touchesEndedWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; const NSTimeInterval timestamp = [event timestamp]; @@ -1243,7 +1246,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)touchesCancelledWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; const NSTimeInterval timestamp = [event timestamp]; @@ -1273,7 +1276,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } - (void)magnifyWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; if ([self handleGestureAsBeginEnd:event]) @@ -1290,7 +1293,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)smartMagnifyWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; static bool zoomIn = true; @@ -1306,7 +1309,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)rotateWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; if ([self handleGestureAsBeginEnd:event]) @@ -1322,7 +1325,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)swipeWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; qCDebug(lcQpaGestures) << "swipeWithEvent" << [event deltaX] << [event deltaY]; @@ -1347,7 +1350,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)beginGestureWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; const NSTimeInterval timestamp = [event timestamp]; @@ -1361,7 +1364,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void)endGestureWithEvent:(NSEvent *)event { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; qCDebug(lcQpaGestures) << "endGestureWithEvent"; @@ -1377,7 +1380,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) #ifndef QT_NO_WHEELEVENT - (void)scrollWheel:(NSEvent *)theEvent { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; if ([self isTransparentForUserInput]) @@ -1879,6 +1882,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (NSArray*)validAttributesForMarkedText { + if (!m_platformWindow) + return nil; + if (m_platformWindow->window() != QGuiApplication::focusWindow()) return nil; @@ -2050,7 +2056,7 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin // Sends drag update to Qt, return the action - (NSDragOperation)handleDrag:(id )sender { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return NSDragOperationNone; NSPoint windowPoint = [self convertPoint: [sender draggingLocation] fromView: nil]; @@ -2080,7 +2086,7 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin - (void)draggingExited:(id )sender { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; QWindow *target = findEventTargetWindow(m_platformWindow->window()); @@ -2097,7 +2103,7 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin // called on drop, send the drop to Qt and return if it was accepted. - (BOOL)performDragOperation:(id )sender { - if (m_platformWindow.isNull()) + if (!m_platformWindow) return false; QWindow *target = findEventTargetWindow(m_platformWindow->window()); @@ -2131,7 +2137,7 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin Q_UNUSED(session); Q_UNUSED(operation); - if (m_platformWindow.isNull()) + if (!m_platformWindow) return; QWindow *target = findEventTargetWindow(m_platformWindow->window()); -- cgit v1.2.3 From be0a221ae491b8426b3a4cdf0d5863701e922c1f Mon Sep 17 00:00:00 2001 From: Filippo Cucchetto Date: Wed, 26 Apr 2017 12:49:36 +0200 Subject: Fix missing handling of columns when merging selection ranges This commit fixes two bugs: 1) Two ranges should not be merged if they are of different columns. The old code would have merged (0,0) with (1, 1). Tranforming a selection of just two indexes in a rectangle of four indexes. 2) The QItemSelectionRange appended had wrong column and worked only for indexes of the first column. For example if 'tl' was (0, 1) than br was (0, 1) so the QItemSelectionRange would have be ((0,1), (0, 1-1)) so ((0,1), (0,0)). This QItemSelectionRange is invalid because topLeft columns is greater than bottomRight column. The fix take in consideration the bottomRight column. Task-number: QTBUG-58871 Change-Id: I591ef0bcc63926f24a7b1ced002af9b7737a4b6e Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Qt CI Bot --- src/corelib/itemmodels/qitemselectionmodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index 6c7101d41f..7714aa5e46 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -942,13 +942,14 @@ static QItemSelection mergeRowLengths(const QVector