From 2a15ec72c0d088a5dca344df163fac73c24caa1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Fri, 12 Jul 2019 10:26:35 +0200 Subject: QHttpSocketEngine: The 'Connection' options are case insensitive As noted in RFC7230 Section 6.1 the 'Connection' options are case insensitive. https://tools.ietf.org/html/rfc7230#section-6.1 Change-Id: I80b98d82eaa5572d38a6c3f99383bc059ec91c54 Fixes: QTBUG-76990 Reviewed-by: Timur Pocheptsov --- src/network/socket/qhttpsocketengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index 9427c3b00d..4cfc8e3555 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -627,7 +627,7 @@ void QHttpSocketEngine::slotSocketReadNotification() // from http spec is also allowed. if (proxyConnectionHeader.isEmpty()) proxyConnectionHeader = d->reply->headerField("Connection"); - if (proxyConnectionHeader.compare("close", Qt::CaseSensitive) == 0) { + if (proxyConnectionHeader.compare("close", Qt::CaseInsensitive) == 0) { willClose = true; } else if (proxyConnectionHeader.compare("keep-alive", Qt::CaseInsensitive) == 0) { willClose = false; -- cgit v1.2.3 From 7a61cb46e69a3997e935d46f0c01d5cd36946245 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 15 Jul 2019 16:11:31 +0200 Subject: tst_http2::flowControlServerSide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix the bloody test for good - the idea to have a shared QNAM (shared by test cases in this test) was somewhat wrong to start with. Fixes: QTBUG-77053 Change-Id: I5755e96ec988e2dd546f527f3f902fc43914b0b7 Reviewed-by: Mårten Nordheim --- tests/auto/network/access/http2/tst_http2.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp index 76eb431af6..579eb89c0a 100644 --- a/tests/auto/network/access/http2/tst_http2.cpp +++ b/tests/auto/network/access/http2/tst_http2.cpp @@ -70,6 +70,8 @@ class tst_Http2 : public QObject public: tst_Http2(); ~tst_Http2(); +public slots: + void init(); private slots: // Tests: void singleRequest_data(); @@ -173,6 +175,11 @@ tst_Http2::~tst_Http2() } } +void tst_Http2::init() +{ + manager.clearConnectionCache(); +} + void tst_Http2::singleRequest_data() { QTest::addColumn("h2Attribute"); -- cgit v1.2.3 From 4f26f05869e0de9e1e1b3f324b666f5b44193f60 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Tue, 16 Jul 2019 08:05:05 +0200 Subject: Doc: Add trailing "." to all \brief commands in QLineEdit Minor housekeeping. Task-number: QTBUG-77063 Change-Id: I9c04dd4220c0c2ad2afa51f88df197f5992752ff Reviewed-by: Andy Shaw --- src/widgets/widgets/qlineedit.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 7515f866fe..ac7820ac09 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -293,7 +293,7 @@ QLineEdit::~QLineEdit() /*! \property QLineEdit::text - \brief the line edit's text + \brief the line edit's text. Setting this property clears the selection, clears the undo/redo history, moves the cursor to the end of the line and resets the @@ -322,7 +322,7 @@ void QLineEdit::setText(const QString& text) \since 4.7 \property QLineEdit::placeholderText - \brief the line edit's placeholder text + \brief the line edit's placeholder text. Setting this property makes the line edit display a grayed-out placeholder text as long as the line edit is empty. @@ -354,7 +354,7 @@ void QLineEdit::setPlaceholderText(const QString& placeholderText) /*! \property QLineEdit::displayText - \brief the displayed text + \brief the displayed text. If \l echoMode is \l Normal this returns the same as text(); if \l EchoMode is \l Password or \l PasswordEchoOnEdit it returns a string of @@ -375,7 +375,7 @@ QString QLineEdit::displayText() const /*! \property QLineEdit::maxLength - \brief the maximum permitted length of the text + \brief the maximum permitted length of the text. If the text is too long, it is truncated at the limit. @@ -405,7 +405,7 @@ void QLineEdit::setMaxLength(int maxLength) /*! \property QLineEdit::frame - \brief whether the line edit draws itself with a frame + \brief whether the line edit draws itself with a frame. If enabled (the default) the line edit draws itself inside a frame, otherwise the line edit draws itself without any frame. @@ -544,7 +544,7 @@ void QLineEdit::setFrame(bool enable) /*! \property QLineEdit::echoMode - \brief the line edit's echo mode + \brief the line edit's echo mode. The echo mode determines how the text entered in the line edit is displayed (or echoed) to the user. @@ -723,7 +723,7 @@ QSize QLineEdit::minimumSizeHint() const /*! \property QLineEdit::cursorPosition - \brief the current cursor position for this line edit + \brief the current cursor position for this line edit. Setting the cursor position causes a repaint when appropriate. @@ -756,7 +756,7 @@ int QLineEdit::cursorPositionAt(const QPoint &pos) /*! \property QLineEdit::alignment - \brief the alignment of the line edit + \brief the alignment of the line edit. Both horizontal and vertical alignment is allowed here, Qt::AlignJustify will map to Qt::AlignLeft. @@ -894,7 +894,7 @@ void QLineEdit::end(bool mark) /*! \property QLineEdit::modified - \brief whether the line edit's contents has been modified by the user + \brief whether the line edit's contents has been modified by the user. The modified flag is never read by QLineEdit; it has a default value of false and is changed to true whenever the user changes the line @@ -924,7 +924,7 @@ void QLineEdit::setModified(bool modified) /*! \property QLineEdit::hasSelectedText - \brief whether there is any text selected + \brief whether there is any text selected. hasSelectedText() returns \c true if some or all of the text has been selected by the user; otherwise returns \c false. @@ -943,7 +943,7 @@ bool QLineEdit::hasSelectedText() const /*! \property QLineEdit::selectedText - \brief the selected text + \brief the selected text. If there is no selected text this property's value is an empty string. @@ -1030,7 +1030,7 @@ void QLineEdit::setSelection(int start, int length) /*! \property QLineEdit::undoAvailable - \brief whether undo is available + \brief whether undo is available. Undo becomes available once the user has modified the text in the line edit. @@ -1045,7 +1045,7 @@ bool QLineEdit::isUndoAvailable() const /*! \property QLineEdit::redoAvailable - \brief whether redo is available + \brief whether redo is available. Redo becomes available once the user has performed one or more undo operations on text in the line edit. @@ -1062,7 +1062,7 @@ bool QLineEdit::isRedoAvailable() const /*! \property QLineEdit::dragEnabled \brief whether the lineedit starts a drag if the user presses and - moves the mouse on some selected text + moves the mouse on some selected text. Dragging is disabled by default. */ @@ -1081,7 +1081,7 @@ void QLineEdit::setDragEnabled(bool b) /*! \property QLineEdit::cursorMoveStyle - \brief the movement style of cursor in this line edit + \brief the movement style of cursor in this line edit. \since 4.8 When this property is set to Qt::VisualMoveStyle, the line edit will use visual @@ -1184,7 +1184,7 @@ QMargins QLineEdit::textMargins() const /*! \property QLineEdit::inputMask - \brief The validation input mask + \brief The validation input mask. If no mask is set, inputMask() returns an empty string. -- cgit v1.2.3 From 05bb156aaad8b539e9b28a6c7577e48319e281ba Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 12 Jul 2019 15:28:14 +0200 Subject: Windows QPA: Fix emitting of QScreen's changed signals When changing the primary screen, the various changed signals of QScreen were out of order. Most notably, the wrong DPI value was emitted since QGuiApplicationPrivate::processScreenGeometryChange() checks and emits DPI and orientation as well. Rearrange the code to assign new the values and emit DPI first. Task-number: QTBUG-76902 Change-Id: If4037108391c36ab3a8bfcb9b2989d5bea41202f Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowsscreen.cpp | 31 ++++++++++++++---------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index cc0f3c1a6e..4137a4bd9a 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -303,23 +303,28 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData) m_data.hMonitor = newData.hMonitor; } - if (m_data.geometry != newData.geometry || m_data.availableGeometry != newData.availableGeometry) { - m_data.geometry = newData.geometry; - m_data.availableGeometry = newData.availableGeometry; - QWindowSystemInterface::handleScreenGeometryChange(screen(), - newData.geometry, newData.availableGeometry); - } - if (!qFuzzyCompare(m_data.dpi.first, newData.dpi.first) - || !qFuzzyCompare(m_data.dpi.second, newData.dpi.second)) { - m_data.dpi = newData.dpi; + // QGuiApplicationPrivate::processScreenGeometryChange() checks and emits + // DPI and orientation as well, so, assign new values and emit DPI first. + const bool geometryChanged = m_data.geometry != newData.geometry + || m_data.availableGeometry != newData.availableGeometry; + const bool dpiChanged = !qFuzzyCompare(m_data.dpi.first, newData.dpi.first) + || !qFuzzyCompare(m_data.dpi.second, newData.dpi.second); + const bool orientationChanged = m_data.orientation != newData.orientation; + m_data.dpi = newData.dpi; + m_data.orientation = newData.orientation; + m_data.geometry = newData.geometry; + m_data.availableGeometry = newData.availableGeometry; + + if (dpiChanged) { QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), newData.dpi.first, newData.dpi.second); } - if (m_data.orientation != newData.orientation) { - m_data.orientation = newData.orientation; - QWindowSystemInterface::handleScreenOrientationChange(screen(), - newData.orientation); + if (orientationChanged) + QWindowSystemInterface::handleScreenOrientationChange(screen(), newData.orientation); + if (geometryChanged) { + QWindowSystemInterface::handleScreenGeometryChange(screen(), + newData.geometry, newData.availableGeometry); } } -- cgit v1.2.3 From 8abbbb4c482c32cd5342f5f8576cee8cbacc3737 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 15 Jul 2019 15:28:47 -0700 Subject: Fix regression causing QVector::fill w/ same size to not detach Caused by commit 01301b0b340df736dd1b0a54b3026e00b49c5ea3, which made vector.resize(vector.size()) not to detach, which was used by fill() and assumed that detaching happened. The test does not test the resize() behavior, only that fill() is not broken anymore. [ChangeLog][QtCore][QVector] Fixed a regression that caused fill() not to detach, corrupting shared copies. Fixes: QTBUG-77058 Change-Id: I6aed4df6a12e43c3ac8efffd15b1b527a8007bf3 Reviewed-by: Marc Mutz --- src/corelib/tools/qvector.h | 2 +- tests/auto/corelib/tools/qvector/tst_qvector.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 988d5a9e1b..57cf6e51ce 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -416,7 +416,7 @@ template void QVector::resize(int asize) { if (asize == d->size) - return; + return detach(); if (asize > int(d->alloc) || !isDetached()) { // there is not enough space QArrayData::AllocationOptions opt = asize > int(d->alloc) ? QArrayData::Grow : QArrayData::Default; realloc(qMax(int(d->alloc), asize), opt); diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index a7faeb5ca5..383318979d 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -250,6 +250,7 @@ private slots: void fillInt() const; void fillMovable() const; void fillCustom() const; + void fillDetaches() const; void first() const; void fromListInt() const; void fromListMovable() const; @@ -1272,6 +1273,16 @@ void tst_QVector::fillCustom() const QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } +void tst_QVector::fillDetaches() const +{ + QVector test = { 1, 2, 3 }; + QVector copy = test; + copy.fill(42); + + QCOMPARE(test, QVector({1, 2, 3})); + QCOMPARE(copy, QVector({42, 42, 42})); +} + void tst_QVector::first() const { QVector myvec; -- cgit v1.2.3 From 6bd35e47080b3ddfe14543f805e744846e245c2f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 May 2019 07:48:49 -0700 Subject: Work around Apple Clang's -Wshadow warning Well, yeah, it technically does... qcborstream.h:245:15: warning: declaration shadows a typedef in the global namespace [-Wshadow] /usr/include/libkern/OSTypes.h:36:26: note: previous declaration is here Fixes: QTBUG-75825 Change-Id: Idce141629dd34287808bfffd159ee2a75428bf12 Reviewed-by: Volker Hilsheimer --- src/corelib/serialization/qcborstream.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/serialization/qcborstream.h b/src/corelib/serialization/qcborstream.h index 3b13a309ab..7a451e63ac 100644 --- a/src/corelib/serialization/qcborstream.h +++ b/src/corelib/serialization/qcborstream.h @@ -242,8 +242,8 @@ private: template FP _toFloatingPoint() const noexcept { - using UInt = typename QIntegerForSizeof::Unsigned; - UInt u = UInt(value64); + using UIntFP = typename QIntegerForSizeof::Unsigned; + UIntFP u = UIntFP(value64); FP f; memcpy(static_cast(&f), &u, sizeof(f)); return f; -- cgit v1.2.3 From e0a486c77d49f4410820aa6f4139ff00d7668a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 16 Jul 2019 23:18:09 +0200 Subject: Tie QPlatformOpenGLContext to its QOpenGLContext before initializing So that the context can be referenced during initialization. Change-Id: I9ec69b2431ba1ac6256cb2e969a76f515497e247 Reviewed-by: Timur Pocheptsov --- src/gui/kernel/qopenglcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 9a6f879431..499d16c109 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -612,8 +612,8 @@ bool QOpenGLContext::create() d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this); if (!d->platformGLContext) return false; - d->platformGLContext->initialize(); d->platformGLContext->setContext(this); + d->platformGLContext->initialize(); if (!d->platformGLContext->isSharing()) d->shareContext = 0; d->shareGroup = d->shareContext ? d->shareContext->shareGroup() : new QOpenGLContextGroup; -- cgit v1.2.3 From 7a7fe9dbb3be042b42a559e734df40ffdea7ebbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 16 Jul 2019 23:19:19 +0200 Subject: macOS: Move QCocoaGLContext initialization into dedicated method Change-Id: I9dc2c400c3d26e9fcfaac04b61c1503229f59dba Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoaglcontext.h | 2 ++ src/plugins/platforms/cocoa/qcocoaglcontext.mm | 16 ++++++++++++---- src/plugins/platforms/cocoa/qcocoaintegration.mm | 4 +--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index c1041ac2da..bb309c0713 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -56,6 +56,8 @@ public: QCocoaGLContext(QOpenGLContext *context); ~QCocoaGLContext(); + void initialize() override; + bool makeCurrent(QPlatformSurface *surface) override; void swapBuffers(QPlatformSurface *surface) override; void doneCurrent() override; diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index d0100d0410..c0579c7c1e 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -76,9 +76,14 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcQpaOpenGLContext, "qt.qpa.openglcontext", QtWarningMsg); QCocoaGLContext::QCocoaGLContext(QOpenGLContext *context) - : QPlatformOpenGLContext(), m_format(context->format()) + : QPlatformOpenGLContext() + , m_format(context->format()) { - QVariant nativeHandle = context->nativeHandle(); +} + +void QCocoaGLContext::initialize() +{ + QVariant nativeHandle = context()->nativeHandle(); if (!nativeHandle.isNull()) { if (!nativeHandle.canConvert()) { qCWarning(lcQpaOpenGLContext, "QOpenGLContext native handle must be a QCocoaNativeContext"); @@ -95,7 +100,7 @@ QCocoaGLContext::QCocoaGLContext(QOpenGLContext *context) // Note: We have no way of knowing whether the NSOpenGLContext was created with the // share context as reported by the QOpenGLContext, but we just have to trust that // it was. It's okey, as the only thing we're using it for is to report isShared(). - if (QPlatformOpenGLContext *shareContext = context->shareHandle()) + if (QPlatformOpenGLContext *shareContext = context()->shareHandle()) m_shareContext = static_cast(shareContext)->nativeContext(); updateSurfaceFormat(); @@ -110,7 +115,7 @@ QCocoaGLContext::QCocoaGLContext(QOpenGLContext *context) if (m_format.renderableType() != QSurfaceFormat::OpenGL) return; - if (QPlatformOpenGLContext *shareContext = context->shareHandle()) { + if (QPlatformOpenGLContext *shareContext = context()->shareHandle()) { m_shareContext = static_cast(shareContext)->nativeContext(); // Allow sharing between 3.2 Core and 4.1 Core profile versions in @@ -150,6 +155,9 @@ QCocoaGLContext::QCocoaGLContext(QOpenGLContext *context) return; } + // The native handle should reflect the underlying context, even if we created it + context()->setNativeHandle(QVariant::fromValue(m_context)); + // --------------------- Set NSOpenGLContext properties --------------------- const GLint interval = m_format.swapInterval() >= 0 ? m_format.swapInterval() : 1; diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index b5d63f8331..dd2d1ba0f1 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -418,9 +418,7 @@ QPlatformOffscreenSurface *QCocoaIntegration::createPlatformOffscreenSurface(QOf #ifndef QT_NO_OPENGL QPlatformOpenGLContext *QCocoaIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { - QCocoaGLContext *glContext = new QCocoaGLContext(context); - context->setNativeHandle(QVariant::fromValue(glContext->nativeContext())); - return glContext; + return new QCocoaGLContext(context); } #endif -- cgit v1.2.3 From d2e4bde5d09816ebedb1a5cc9ec7c0af20fd1242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 16 Jul 2019 23:43:35 +0200 Subject: macOS: Use lambdas instead of Obj-C categories for GL helper functions Allows us to reference captured variables and keeps the function local to where it's used. Change-Id: I609892888720202021862d26a74ceb50e232f356 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 46 +++++++++++--------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index c0579c7c1e..c5f0762ac2 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -53,24 +53,6 @@ static inline QByteArray getGlString(GLenum param) return QByteArray(); } -@implementation NSOpenGLPixelFormat (QtHelpers) -- (GLint)qt_getAttribute:(NSOpenGLPixelFormatAttribute)attribute -{ - int value = 0; - [self getValues:&value forAttribute:attribute forVirtualScreen:0]; - return value; -} -@end - -@implementation NSOpenGLContext (QtHelpers) -- (GLint)qt_getParameter:(NSOpenGLContextParameter)parameter -{ - int value = 0; - [self getValues:&value forParameter:parameter]; - return value; -} -@end - QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcQpaOpenGLContext, "qt.qpa.openglcontext", QtWarningMsg); @@ -293,7 +275,13 @@ void QCocoaGLContext::updateSurfaceFormat() NSOpenGLPixelFormat *pixelFormat = m_context.pixelFormat; - int colorSize = [pixelFormat qt_getAttribute:NSOpenGLPFAColorSize]; + auto pixelFormatAttribute = [&](NSOpenGLPixelFormatAttribute attribute) { + int value = 0; + [pixelFormat getValues:&value forAttribute:attribute forVirtualScreen:0]; + return value; + }; + + int colorSize = pixelFormatAttribute(NSOpenGLPFAColorSize); colorSize /= 4; // The attribute includes the alpha component m_format.setRedBufferSize(colorSize); m_format.setGreenBufferSize(colorSize); @@ -305,22 +293,28 @@ void QCocoaGLContext::updateSurfaceFormat() // size, as that will make the user believe the alpha channel can be used for // something useful, when in reality it can't, due to the surface being opaque. if (m_format.alphaBufferSize() > 0) - m_format.setAlphaBufferSize([pixelFormat qt_getAttribute:NSOpenGLPFAAlphaSize]); + m_format.setAlphaBufferSize(pixelFormatAttribute(NSOpenGLPFAAlphaSize)); - m_format.setDepthBufferSize([pixelFormat qt_getAttribute:NSOpenGLPFADepthSize]); - m_format.setStencilBufferSize([pixelFormat qt_getAttribute:NSOpenGLPFAStencilSize]); - m_format.setSamples([pixelFormat qt_getAttribute:NSOpenGLPFASamples]); + m_format.setDepthBufferSize(pixelFormatAttribute(NSOpenGLPFADepthSize)); + m_format.setStencilBufferSize(pixelFormatAttribute(NSOpenGLPFAStencilSize)); + m_format.setSamples(pixelFormatAttribute(NSOpenGLPFASamples)); - if ([pixelFormat qt_getAttribute:NSOpenGLPFATripleBuffer]) + if (pixelFormatAttribute(NSOpenGLPFATripleBuffer)) m_format.setSwapBehavior(QSurfaceFormat::TripleBuffer); - else if ([pixelFormat qt_getAttribute:NSOpenGLPFADoubleBuffer]) + else if (pixelFormatAttribute(NSOpenGLPFADoubleBuffer)) m_format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); else m_format.setSwapBehavior(QSurfaceFormat::SingleBuffer); // ------------------- Query the context ------------------- - m_format.setSwapInterval([m_context qt_getParameter:NSOpenGLCPSwapInterval]); + auto glContextParameter = [&](NSOpenGLContextParameter parameter) { + int value = 0; + [m_context getValues:&value forParameter:parameter]; + return value; + }; + + m_format.setSwapInterval(glContextParameter(NSOpenGLCPSwapInterval)); if (oldContext) [oldContext makeCurrentContext]; -- cgit v1.2.3 From d224c762bc9530236d255cc5cb851112fcc7cee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 16 Jul 2019 23:45:48 +0200 Subject: macOS: Use correct virtual screen when resolving GL surface format Change-Id: I8288db85c8e99bf9fccfcfbca7f9e3594d00fa48 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index c5f0762ac2..e45ea7efd3 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -40,6 +40,8 @@ #include "qcocoaglcontext.h" #include "qcocoawindow.h" #include "qcocoahelpers.h" +#include "qcocoascreen.h" + #include #include #include @@ -275,9 +277,28 @@ void QCocoaGLContext::updateSurfaceFormat() NSOpenGLPixelFormat *pixelFormat = m_context.pixelFormat; + GLint virtualScreen = [&, this]() { + auto *platformScreen = static_cast(context()->screen()->handle()); + auto displayId = platformScreen->nativeScreen().qt_displayId; + auto requestedDisplay = CGDisplayIDToOpenGLDisplayMask(displayId); + for (int i = 0; i < pixelFormat.numberOfVirtualScreens; ++i) { + GLint supportedDisplays; + [pixelFormat getValues:&supportedDisplays forAttribute:NSOpenGLPFAScreenMask forVirtualScreen:i]; + // Note: The mask returned for NSOpenGLPFAScreenMask is a bit mask of + // physical displays that the renderer can drive, while the one returned + // from CGDisplayIDToOpenGLDisplayMask has a single bit set, representing + // that particular display. + if (requestedDisplay & supportedDisplays) + return i; + } + qCWarning(lcQpaOpenGLContext) << "Could not find virtual screen for" + << platformScreen << "with displayId" << displayId; + return 0; + }(); + auto pixelFormatAttribute = [&](NSOpenGLPixelFormatAttribute attribute) { int value = 0; - [pixelFormat getValues:&value forAttribute:attribute forVirtualScreen:0]; + [pixelFormat getValues:&value forAttribute:attribute forVirtualScreen:virtualScreen]; return value; }; -- cgit v1.2.3 From 1d8c9978fa1baafa17c95713bd5d04f245eeb76f Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 15 Jul 2019 14:45:01 +0200 Subject: QDateTime docs: don't encourage use of deprecated textdate functions The textdate API methods are deprecated in favor of QLocale; so suggest use of QLocale in place of them. Don't credit the deprecated methods as being used where they aren't. Change-Id: I0abcb1f69729760ae1b86cb8088e4158c0ad6010 Reviewed-by: Paul Wicking Reviewed-by: Tasuku Suzuki --- src/corelib/tools/qdatetime.cpp | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 9b0ed18742..8536743cee 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -338,11 +338,10 @@ static int fromOffsetString(const QStringRef &offsetString, bool *valid) Q_DECL_ setDate(). The fromString() function returns a QDate given a string and a date format which is used to interpret the date within the string. - The year(), month(), and day() functions provide access to the - year, month, and day numbers. Also, dayOfWeek() and dayOfYear() - functions are provided. The same information is provided in - textual format by the toString(), shortDayName(), longDayName(), - shortMonthName(), and longMonthName() functions. + The year(), month(), and day() functions provide access to the year, month, + and day numbers. Also, dayOfWeek() and dayOfYear() functions are + provided. The same information is provided in textual format by + toString(). The day and month numbers can be mapped to names using QLocal. QDate provides a full set of operators to compare two QDate objects where smaller means earlier, and larger means later. @@ -807,11 +806,10 @@ static QString toStringIsoDate(qint64 jd) Returns the date as a string. The \a format parameter determines the format of the string. - If the \a format is Qt::TextDate, the string is formatted in - the default way. QDate::shortDayName() and QDate::shortMonthName() - are used to generate the string, so the day and month names will - be localized names using the system locale, i.e. QLocale::system(). An - example of this formatting is "Sat May 20 1995". + If the \a format is Qt::TextDate, the string is formatted in the default + way. The day and month names will be localized names using the system + locale, i.e. QLocale::system(). An example of this formatting + is "Sat May 20 1995". If the \a format is Qt::ISODate, the string format corresponds to the ISO 8601 extended specification for representations of @@ -843,7 +841,7 @@ static QString toStringIsoDate(qint64 jd) range 0 to 9999. This restriction may apply to locale-aware formats as well, depending on the locale settings. - \sa fromString(), shortDayName(), shortMonthName(), QLocale::toString() + \sa fromString(), QLocale::toString() */ QString QDate::toString(Qt::DateFormat format) const { @@ -3802,12 +3800,10 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC) Returns the datetime as a string in the \a format given. - If the \a format is Qt::TextDate, the string is formatted in - the default way. QDate::shortDayName(), QDate::shortMonthName(), - and QTime::toString() are used to generate the string, so the - day and month names will be localized names using the system locale, - i.e. QLocale::system(). An example of this formatting is - "Wed May 20 03:40:13 1998". + If the \a format is Qt::TextDate, the string is formatted in the default + way. The day and month names will be localized names using the system + locale, i.e. QLocale::system(). An example of this formatting is "Wed May 20 + 03:40:13 1998". If the \a format is Qt::ISODate, the string format corresponds to the ISO 8601 extended specification for representations of @@ -4983,18 +4979,14 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) \row \li dd \li the day as number with a leading zero (01 to 31) \row \li ddd \li the abbreviated localized day name (e.g. 'Mon' to 'Sun'). - Uses QDate::shortDayName(). \row \li dddd \li the long localized day name (e.g. 'Monday' to 'Sunday'). - Uses QDate::longDayName(). \row \li M \li the month as number without a leading zero (1-12) \row \li MM \li the month as number with a leading zero (01-12) \row \li MMM \li the abbreviated localized month name (e.g. 'Jan' to 'Dec'). - Uses QDate::shortMonthName(). \row \li MMMM \li the long localized month name (e.g. 'January' to 'December'). - Uses QDate::longMonthName(). \row \li yy \li the year as two digit number (00-99) \row \li yyyy \li the year as four digit number \endtable -- cgit v1.2.3 From 69ef6e821287d324459336dd1292d19d272386b8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 6 Jul 2019 09:46:00 -0300 Subject: QStandardPaths: update docs to what $HOME is on iOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's not (any more, or was ever). Fixes: QTBUG-76911 Change-Id: I6aed4df6a12e43c3ac8efffd15aed22128862c23 Reviewed-by: Tor Arne Vestbø --- src/corelib/io/qstandardpaths.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp index dbf650d5f6..f56fef7f8e 100644 --- a/src/corelib/io/qstandardpaths.cpp +++ b/src/corelib/io/qstandardpaths.cpp @@ -297,7 +297,7 @@ QT_BEGIN_NAMESPACE \li "/tmp" \row \li HomeLocation \li "/files" - \li "" (not writable) + \li system defined \row \li DataLocation \li "/files", "//files" \li "/Library/Application Support" -- cgit v1.2.3