From d3ac51573fc4b3275a95176cf4af85e4597e9295 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 17 Jun 2015 11:29:41 +0200 Subject: doc: Fix error in QOpenGLShaderProgram example The addShader() function takes a pointer. Change-Id: Ibd6549ff06cb3bd86096e90ab2637845f032fc68 Reviewed-by: Venugopal Shivashankar --- src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp b/src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp index ab8ee67929..368a5085d4 100644 --- a/src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp +++ b/src/gui/doc/snippets/code/src_gui_qopenglshaderprogram.cpp @@ -43,7 +43,7 @@ QOpenGLShader shader(QOpenGLShader::Vertex); shader.compileSourceCode(code); QOpenGLShaderProgram program(context); -program.addShader(shader); +program.addShader(&shader); program.link(); program.bind(); -- cgit v1.2.3 From 5a3fe3e97aa6cae4c5db54b7b2958b82a94310c4 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 1 Jul 2015 08:56:44 +0200 Subject: Remove stray period in QGraphicsItem documentation. Change-Id: I2f66be1c54bb6b57b9ca41ba619e14d78443f81d Reviewed-by: Marc Mutz --- src/widgets/graphicsview/qgraphicsitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index cd30410097..c9a9cf9d79 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -428,7 +428,7 @@ \note If both this flag and ItemClipsChildrenToShape are set, the clip will be enforced. This is equivalent to just setting ItemClipsChildrenToShape. - . + This flag was introduced in Qt 5.4. */ -- cgit v1.2.3 From 04b9f865619770770899ba228b7b6503d990e2f1 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 26 Jun 2015 16:57:32 +0200 Subject: Doc: Give advice on foreach vs range-based for Task-number: QTBUG-41636 Change-Id: I28c1424e7f4c1c4da596bcae66283b60f471a8ee Reviewed-by: Martin Smith --- src/corelib/doc/src/containers.qdoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/doc/src/containers.qdoc b/src/corelib/doc/src/containers.qdoc index 1979c45e17..f8d0d3eb05 100644 --- a/src/corelib/doc/src/containers.qdoc +++ b/src/corelib/doc/src/containers.qdoc @@ -601,6 +601,13 @@ container. It only affects the copy, which is probably not what you want. + An alternative to Qt's \c foreach loop is the range-based \c for that is + part of C++ 11 and newer. However, keep in mind that the range-based + \c for might force a Qt container to \l{Implicit Sharing}{detach}, whereas + \c foreach would not. But using \c foreach always copies the container, + which is usually not cheap for STL containers. If in doubt, prefer + \c foreach for Qt containers, and range based \c for for STL ones. + In addition to \c foreach, Qt also provides a \c forever pseudo-keyword for infinite loops: -- cgit v1.2.3 From fdcea3a7cac159bb017d48eb6038bd72ebb920b4 Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Mon, 29 Jun 2015 11:43:08 +0200 Subject: Doc: Updated the footer in the online template Also fixed a broken facebook like image link in the footer. Change-Id: I51e9b46d3e90763c41a125bf26ee4dccd375e744 Reviewed-by: Martin Smith Reviewed-by: Leena Miettinen --- doc/global/html-footer-online.qdocconf | 3 ++- doc/global/template/style/online.css | 2 +- doc/global/template/style/theqtcompany.png | Bin 11748 -> 31759 bytes 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/global/html-footer-online.qdocconf b/doc/global/html-footer-online.qdocconf index 1937d97cbb..fca4d65808 100644 --- a/doc/global/html-footer-online.qdocconf +++ b/doc/global/html-footer-online.qdocconf @@ -58,6 +58,7 @@ HTML.footer += \ "
  • Professional
  • \n" \ "
  • Indie Mobile
  • \n" \ "
  • Community
  • \n" \ +"
  • Legal | Licensing FAQ
  • \n" \ "
  • Legal | Terms & Conditions
  • \n" \ "\n" \ "\n" \ @@ -65,7 +66,7 @@ HTML.footer += \ "\n" \ "
    \n" \ "
    \n" \ - " \n" \ + " \n" \ "
    \n" \ "
    \n" \ " \n" \ diff --git a/doc/global/template/style/online.css b/doc/global/template/style/online.css index 240a818798..8775719be6 100644 --- a/doc/global/template/style/online.css +++ b/doc/global/template/style/online.css @@ -770,7 +770,7 @@ body.qt-account #navbar .navbar-oneQt h2 { #footerbar .theqtcompany { background:url("theqtcompany.png") no-repeat; background-size:100%; - width:150px; + width:215px; height:68px; display:inline; float:right; diff --git a/doc/global/template/style/theqtcompany.png b/doc/global/template/style/theqtcompany.png index b9799f387c..fee3d26f3d 100644 Binary files a/doc/global/template/style/theqtcompany.png and b/doc/global/template/style/theqtcompany.png differ -- cgit v1.2.3 From a05d8c73ffd38414c22be801d6c9d27c1d34ab93 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Wed, 24 Jun 2015 08:49:13 +0100 Subject: Fix accidental fall through in QOpenGLTexture::set[Compressed]Data() Task-number: QTBUG-46826 Change-Id: Ie04e69cc5af05650ec6aa42f534f494049a54ee8 Reviewed-by: James Turner Reviewed-by: Mike Krus Reviewed-by: Giuseppe D'Angelo --- src/gui/opengl/qopengltexture.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index baa702a982..5edaddcd6a 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -1112,6 +1112,7 @@ void QOpenGLTexturePrivate::setData(int mipLevel, int layer, QOpenGLTexture::Cub mipLevelSize(mipLevel, dimensions[0]), 1, sourceFormat, sourceType, data, options); + break; case QOpenGLTexture::Target2D: Q_UNUSED(layer); @@ -1210,6 +1211,7 @@ void QOpenGLTexturePrivate::setCompressedData(int mipLevel, int layer, QOpenGLTe mipLevelSize(mipLevel, dimensions[0]), 1, format, dataSize, data, options); + break; case QOpenGLTexture::Target2D: Q_UNUSED(layer); -- cgit v1.2.3 From 47113a1f368a10ccafc41582b0f586c5c2277d36 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 2 Jul 2015 10:18:08 +0200 Subject: DirectWrite: Fix crash when loading QRawFont from data In Qt 4, we would create and destroy the DirectWrite factory for each time we load the font data from a QRawFont. This factory would then be passed to the font engine ctor. However, in Qt 5, some things have been refactored, and the font engine will now try to use the factory stored in the sharedFontData(). This would cause dereferencing a null pointer because we didn't initialize the data before constructing the font engine. [ChangeLog][Windows][Text] Fixed crash in DirectWrite engine when constructing a QRawFont from raw font data. Task-number: QTBUG-46963 Change-Id: I4813c7f818c9df5707c27f5b6ce507649d902270 Reviewed-by: Konstantin Ritt --- .../platforms/windows/qwindowsfontdatabase.cpp | 29 ++++++++++------------ 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index a544b9d81e..1c5b114efd 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1169,23 +1169,19 @@ QT_WARNING_POP CustomFontFileLoader fontFileLoader; fontFileLoader.addKey(this, fontData); - IDWriteFactory *factory = 0; - HRESULT hres = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, - __uuidof(IDWriteFactory), - reinterpret_cast(&factory)); - if (FAILED(hres)) { - qErrnoWarning(hres, "%s: DWriteCreateFactory failed", __FUNCTION__); + QSharedPointer fontEngineData = sharedFontData(); + if (!initDirectWrite(fontEngineData.data())) return 0; - } IDWriteFontFile *fontFile = 0; void *key = this; - hres = factory->CreateCustomFontFileReference(&key, sizeof(void *), - fontFileLoader.loader(), &fontFile); + HRESULT hres = fontEngineData->directWriteFactory->CreateCustomFontFileReference(&key, + sizeof(void *), + fontFileLoader.loader(), + &fontFile); if (FAILED(hres)) { qErrnoWarning(hres, "%s: CreateCustomFontFileReference failed", __FUNCTION__); - factory->Release(); return 0; } @@ -1196,30 +1192,31 @@ QT_WARNING_POP fontFile->Analyze(&isSupportedFontType, &fontFileType, &fontFaceType, &numberOfFaces); if (!isSupportedFontType) { fontFile->Release(); - factory->Release(); return 0; } IDWriteFontFace *directWriteFontFace = 0; - hres = factory->CreateFontFace(fontFaceType, 1, &fontFile, 0, DWRITE_FONT_SIMULATIONS_NONE, - &directWriteFontFace); + hres = fontEngineData->directWriteFactory->CreateFontFace(fontFaceType, + 1, + &fontFile, + 0, + DWRITE_FONT_SIMULATIONS_NONE, + &directWriteFontFace); if (FAILED(hres)) { qErrnoWarning(hres, "%s: CreateFontFace failed", __FUNCTION__); fontFile->Release(); - factory->Release(); return 0; } fontFile->Release(); fontEngine = new QWindowsFontEngineDirectWrite(directWriteFontFace, pixelSize, - sharedFontData()); + fontEngineData); // Get font family from font data fontEngine->fontDef.family = font.familyName(); directWriteFontFace->Release(); - factory->Release(); } #endif -- cgit v1.2.3 From 8a928783b942ac5cc53e16eda07e418a6ac7d61d Mon Sep 17 00:00:00 2001 From: Bjoern Breitmeyer Date: Wed, 18 Mar 2015 17:07:58 +0100 Subject: Added Mkspec for Toradex WEC2013 SDK Change-Id: I738c422ba5f1c1293ce54f53548af62458dda22b Reviewed-by: Maurice Kalinowski --- mkspecs/wince80colibri-armv7-msvc2012/qmake.conf | 47 ++++++++++++++++++++++ .../wince80colibri-armv7-msvc2012/qplatformdefs.h | 35 ++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 mkspecs/wince80colibri-armv7-msvc2012/qmake.conf create mode 100644 mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h diff --git a/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf b/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf new file mode 100644 index 0000000000..47c512bbda --- /dev/null +++ b/mkspecs/wince80colibri-armv7-msvc2012/qmake.conf @@ -0,0 +1,47 @@ +# qmake configuration for Windows Embedded Compact 2013 with VS2012 on ARM targets +# +# This is just a template for creating WEC2013 mkspecs for ARM targets +# Replace the SDK name with actual SDK name. + +include(../common/wince/qmake.conf) + +CE_SDK = Toradex_CE8_SDK # replace with actual SDK name +CE_ARCH = ARMV7 +QT_CONFIG -= accessibility + +DEFINES += QT_NO_CLIPBOARD QT_NO_ACCESSIBILITY QT_NO_NATIVE_GESTURES QT_NOSTANDARDSHELL_UI_MODEL _CRT_SECURE_NO_DEPRECATE _WIN32_WCE=0x800 $$CE_ARCH _AMRV7_ armv7 _ARM_ UNDER_CE WINCE ARM + +#QMAKE_CXXFLAGS += /P +QMAKE_CFLAGS_RELEASE += -O2 -MT +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi +QMAKE_CFLAGS_DEBUG += -Zi -MTd +QMAKE_CFLAGS_RELEASE -= -MD +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -MD +QMAKE_CFLAGS_DEBUG -= -MDd +QMAKE_CXXFLAGS_RELEASE -= -MD +QMAKE_CXXFLAGS_RELEASE += -MT +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += -MT +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -MD +QMAKE_CXXFLAGS_DEBUG -= -MDd +QMAKE_CXXFLAGS_DEBUG += -MTd +QMAKE_INCDIR_OPENGL_ES2 += $$(NV_WINCE_T2_PLAT)/include +QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM /ENTRY:mainCRTStartup +QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM +QMAKE_LFLAGS_DLL = /SUBSYSTEM:WINDOWSCE,8.00 /MACHINE:ARM /DLL /SAFESEH:NO +QMAKE_LIBFLAGS_RELEASE = /LTCG +QMAKE_LIBS = coredll.lib +QMAKE_LIBS_CORE = ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib +QMAKE_LIBS_GUI = ole32.lib $$QMAKE_LIBS_CORE +QMAKE_LIBS_NETWORK = ws2.lib $$QMAKE_LIBS_GUI +QMAKE_LIBS_OPENGL = +QMAKE_LIBS_COMPAT = +QMAKE_LIBS_OPENVG = +QMAKE_LIBS_OPENGL_ES2 = libEGL.lib libGLESv2.lib +QMAKE_LIBDIR_OPENGL_ES2 = $$(NV_WINCE_T2_PLAT)/lib/Test +QMAKE_INCDIR_EGL = $$(NV_WINCE_T2_PLAT)/include +QMAKE_LIBDIR_EGL = $$(NV_WINCE_T2_PLAT)/lib/Test + +QMAKE_RC = rc + +QMAKE_COMPILER_DEFINES -= _MSC_VER=1400 +QMAKE_COMPILER_DEFINES += _MSC_VER=1700 diff --git a/mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h b/mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h new file mode 100644 index 0000000000..e302bdab03 --- /dev/null +++ b/mkspecs/wince80colibri-armv7-msvc2012/qplatformdefs.h @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../common/wince/qplatformdefs.h" + -- cgit v1.2.3 From 6f244dc84d87f382f584187b8758f6fa918c211c Mon Sep 17 00:00:00 2001 From: Jian Liang Date: Sat, 4 Jul 2015 13:18:27 +0800 Subject: Fix memory leak in QJpegHandlerPrivate Since the introduction of jpeg auto transform, it is possible to read jpeg header after its state was changed from ReadHeaer to Ready which will lead to creating some resources again without releasing them. For example, if you call QImageReader::setAutoTransform(true) and then call QImageReader::read(), QJpegHandlerPrivate::readJpegHeader() will be called twice and it will allocate resource again without releasing the old one. This patch add a new state ReadingEnd to prevent the header from being read twice. Change-Id: If2497f6e3668958c0c792a66e1b77eb2773584a2 Reviewed-by: Allan Sandfeld Jensen --- src/gui/image/qjpeghandler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp index c0fda647aa..e29f9783a6 100644 --- a/src/gui/image/qjpeghandler.cpp +++ b/src/gui/image/qjpeghandler.cpp @@ -710,6 +710,7 @@ public: enum State { Ready, ReadHeader, + ReadingEnd, Error }; @@ -958,7 +959,7 @@ bool QJpegHandlerPrivate::read(QImage *image) for (int i = 0; i < readTexts.size()-1; i+=2) image->setText(readTexts.at(i), readTexts.at(i+1)); - state = Ready; + state = ReadingEnd; return true; } @@ -1006,7 +1007,7 @@ bool QJpegHandler::canRead() const if(d->state == QJpegHandlerPrivate::Ready && !canRead(device())) return false; - if (d->state != QJpegHandlerPrivate::Error) { + if (d->state != QJpegHandlerPrivate::Error && d->state != QJpegHandlerPrivate::ReadingEnd) { setFormat("jpeg"); return true; } -- cgit v1.2.3 From 0784a2c4aefb01668a4957f26134ed0230773d7b Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Sun, 5 Jul 2015 00:01:31 -0700 Subject: Fix typo in configure. The option is named securetransport, not secure-transport. Change-Id: I5efdde6d751cbc7e9717c6bfe0add93c5dbd2ec9 Reviewed-by: Giuseppe D'Angelo --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index bef47d29f1..314f780178 100755 --- a/configure +++ b/configure @@ -2697,7 +2697,7 @@ MacOS/iOS options: link tools against those frameworks. -no-framework ...... Do not build Qt as a series of frameworks. - -secure-transport .. Use SecureTransport instead of OpenSSL (requires -no-openssl) + -securetransport ... Use SecureTransport instead of OpenSSL (requires -no-openssl) -sdk ......... Build Qt using Apple provided SDK . The argument should be one of the available SDKs as listed by 'xcodebuild -showsdks'. -- cgit v1.2.3 From 219d99fb25fbe8d18d0bdb15c2465863a1915638 Mon Sep 17 00:00:00 2001 From: Alejandro Exojo Date: Sun, 5 Jul 2015 11:26:12 +0200 Subject: doc: Fix and improve QMetaMethod::tag Make the example and the explanations a bit more detailed about the purpose of the feature, and fix the example, as it was not calling metaObject() on the example object. Change-Id: Ibf3331ed85601274f43794e3a4143e0d6b86a479 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qmetaobject.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index e89b914227..bae8c1268b 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1880,13 +1880,14 @@ const char *QMetaMethod::typeName() const way in the function declaration: \code + // In the class MainWindow declaration #ifndef Q_MOC_RUN - // define the tag text - # define THISISTESTTAG + // define the tag text as empty, so the compiler doesn't see it + # define MY_CUSTOM_TAG #endif ... private slots: - THISISTESTTAG void testFunc(); + MY_CUSTOM_TAG void testFunc(); \endcode and the information can be accessed by using: @@ -1896,12 +1897,14 @@ const char *QMetaMethod::typeName() const win.show(); int functionIndex = win.metaObject()->indexOfSlot("testFunc()"); - QMetaMethod mm = metaObject()->method(functionIndex); - qDebug() << mm.tag(); // prints THISISTESTTAG + QMetaMethod mm = win.metaObject()->method(functionIndex); + qDebug() << mm.tag(); // prints MY_CUSTOM_TAG \endcode For the moment, \c moc will extract and record all tags, but it will not - handle any of them specially. + handle any of them specially. You can use the tags to annotate your methods + differently, and treat them according to the specific needs of your + application. \note Since Qt 5.0, \c moc expands preprocessor macros, so it is necessary to surround the definition with \c #ifndef \c Q_MOC_RUN, as shown in the -- cgit v1.2.3 From 99afd9dd4c6670f1010153a97efdcfa1014042a0 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 23 Jun 2015 13:40:54 +0200 Subject: Fix QAction::setAutoRepeat(false) When cleaning up the shortcut override code, in d7ca800a87a2291c94c6580f0cfe068bb2280caf passing on the autorepeat flags from the native event was accidentally dropped in the call to QWindowSystemInterface::tryHandleShortcutEvent. Task-number: QTBUG-46569 Change-Id: Ib053e11e582de630a1fc1b754f8d10d995c88026 Reviewed-by: Gabriel de Dietrich --- src/gui/kernel/qguiapplication.cpp | 2 +- src/plugins/platforms/cocoa/qnsview.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 6aa1d26c66..8ebddf33a6 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1884,7 +1884,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE #if !defined(Q_OS_OSX) // On OS X the shortcut override is checked earlier, see: QWindowSystemInterface::handleKeyEvent() const bool checkShortcut = e->keyType == QEvent::KeyPress && window != 0; - if (checkShortcut && QWindowSystemInterface::tryHandleShortcutEvent(window, e->timestamp, e->key, e->modifiers, e->unicode)) + if (checkShortcut && QWindowSystemInterface::tryHandleShortcutEvent(window, e->timestamp, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount)) return; #endif // Q_OS_OSX diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 355704ff37..456c9d8c68 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1431,7 +1431,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) if (eventType == QEvent::KeyPress) { if (m_composingText.isEmpty()) - m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutEvent(focusWindow, timestamp, keyCode, modifiers, text); + m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutEvent(focusWindow, timestamp, keyCode, modifiers, text, [nsevent isARepeat], 1); QObject *fo = QGuiApplication::focusObject(); if (m_sendKeyEvent && fo) { -- cgit v1.2.3 From 290e875fd99db4076b642ab2c53adecd32a8ced5 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 25 Jun 2015 18:09:27 +0200 Subject: Test QAction::autoRepeat Sending several key presses with repeat=true should trigger the action several times, unless autoRepeat is set to false. Change-Id: I6469bbd78a608a87852554882c1632ce34422662 Reviewed-by: Liang Qi --- tests/auto/widgets/kernel/qaction/tst_qaction.cpp | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index be1fed2be3..897128d40e 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp @@ -69,6 +69,7 @@ private slots: void task200823_tooltip(); void task229128TriggeredSignalWithoutActiongroup(); void task229128TriggeredSignalWhenInActiongroup(); + void repeat(); private: int m_lastEventType; @@ -380,5 +381,42 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup() QCOMPARE(actionSpy.count(), 1); } +void tst_QAction::repeat() +{ + QWidget *wid = m_tstWidget; + QAction act(wid); + wid->addAction(&act); + act.setShortcut(QKeySequence(Qt::Key_F)); + QSignalSpy spy(&act, SIGNAL(triggered())); + + act.setAutoRepeat(true); + QTest::keyPress(wid, Qt::Key_F); + QTest::keyRelease(wid, Qt::Key_F); + QCOMPARE(spy.count(), 1); + + spy.clear(); + QTest::keyPress(wid, Qt::Key_F); + // repeat event + QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::keyRelease(wid, Qt::Key_F); + QCOMPARE(spy.count(), 3); + + spy.clear(); + act.setAutoRepeat(false); + QTest::keyPress(wid, Qt::Key_F); + QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::keyRelease(wid, Qt::Key_F); + QCOMPARE(spy.count(), 1); + + spy.clear(); + act.setAutoRepeat(true); + QTest::keyPress(wid, Qt::Key_F); + QTest::simulateEvent(wid, true, Qt::Key_F, Qt::NoModifier, QString("f"), true); + QTest::keyRelease(wid, Qt::Key_F); + QCOMPARE(spy.count(), 2); +} + QTEST_MAIN(tst_QAction) #include "tst_qaction.moc" -- cgit v1.2.3 From 1e8a5c10832c2812ac7def1104700619b18503fb Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Thu, 2 Jul 2015 01:25:23 +0900 Subject: remove Build date from qt_core_boilerplate() db631a88a030d4d1263d7ae009086f3dd8637982 deprecated that. Change-Id: Id54dc1049004bdaed26925883250038516a6bcbf Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Thiago Macieira --- src/corelib/global/qlibraryinfo.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 2912e68580..0cfcc4e659 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -650,11 +650,9 @@ void qt_core_boilerplate() "Copyright (C) 2015 The Qt Company Ltd.\n" "Contact: http://www.qt.io/licensing/\n" "\n" - "Build date: %s\n" "Installation prefix: %s\n" "Library path: %s\n" "Include path: %s\n", - qt_configure_installation + 12, qt_configure_prefix_path_str + 12, qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::LibrariesPath - 1], qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::HeadersPath - 1]); -- cgit v1.2.3 From 1ac0c4a2f787607269c2b5511a0f9a410d2f5603 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Jun 2015 12:56:43 -0700 Subject: Make the Windows qt_msectime() function return 64-bit 32-bit integers overflow after 49.7 days. Task-number: QTBUG-43777 Change-Id: Ief8943bc86ba32e5a66b48604c583031af95ad42 Reviewed-by: Friedemann Kleint --- src/corelib/kernel/qeventdispatcher_win_p.h | 2 +- src/corelib/kernel/qeventdispatcher_winrt_p.h | 2 +- src/corelib/tools/qelapsedtimer_win.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index 6b4fb18f46..e59e29f1ff 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -58,7 +58,7 @@ class QEventDispatcherWin32Private; // forward declaration LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); -int qt_msectime(); +quint64 qt_msectime(); class Q_CORE_EXPORT QEventDispatcherWin32 : public QAbstractEventDispatcher { diff --git a/src/corelib/kernel/qeventdispatcher_winrt_p.h b/src/corelib/kernel/qeventdispatcher_winrt_p.h index e39746aeef..fd3d259c96 100644 --- a/src/corelib/kernel/qeventdispatcher_winrt_p.h +++ b/src/corelib/kernel/qeventdispatcher_winrt_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE -int qt_msectime(); +quint64 qt_msectime(); class QEventDispatcherWinRTPrivate; diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp index eab2f8ef6c..b80c23cf8f 100644 --- a/src/corelib/tools/qelapsedtimer_win.cpp +++ b/src/corelib/tools/qelapsedtimer_win.cpp @@ -117,7 +117,7 @@ static quint64 getTickCount() #endif // Q_OS_WINRT } -int qt_msectime() +quint64 qt_msectime() { return ticksToNanoseconds(getTickCount()) / 1000000; } -- cgit v1.2.3 From d01d08971a1ba4d66927a48577041abc5b7df8a2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Jun 2015 18:15:53 -0700 Subject: Fix the remainingTime() result after the first activation of a QTimer On Windows, t->timeout was updated only once, at creation time, so the timer would always show as "overdue" after the first activation. The timer is updated to indicate the full remaining time during the slot activation, which is the behavior of the Unix and Glib dispatchers. Task-number: QTBUG-46940 Change-Id: I255870833a024a36adf6ffff13ecadb021c4358c Reviewed-by: Oswald Buddenhagen Reviewed-by: Joerg Bornemann Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/corelib/kernel/qeventdispatcher_win.cpp | 21 ++++++--- tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp | 59 ++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 6 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index b55679f3d5..6da70cf0bd 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -561,6 +561,17 @@ static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatch return wnd; } +static void calculateNextTimeout(WinTimerInfo *t, quint64 currentTime) +{ + uint interval = t->interval; + if ((interval >= 20000u && t->timerType != Qt::PreciseTimer) || t->timerType == Qt::VeryCoarseTimer) { + // round the interval, VeryCoarseTimers only have full second accuracy + interval = ((interval + 500)) / 1000 * 1000; + } + t->interval = interval; + t->timeout = currentTime + interval; +} + void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t) { Q_ASSERT(internalHwnd); @@ -568,6 +579,7 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t) Q_Q(QEventDispatcherWin32); int ok = 0; + calculateNextTimeout(t, qt_msectime()); uint interval = t->interval; if (interval == 0u) { // optimization for single-shot-zero-timer @@ -576,17 +588,13 @@ void QEventDispatcherWin32Private::registerTimer(WinTimerInfo *t) } else if ((interval < 20u || t->timerType == Qt::PreciseTimer) && qtimeSetEvent) { ok = t->fastTimerId = qtimeSetEvent(interval, 1, qt_fast_timer_proc, (DWORD_PTR)t, TIME_CALLBACK_FUNCTION | TIME_PERIODIC | TIME_KILL_SYNCHRONOUS); - } else if (interval >= 20000u || t->timerType == Qt::VeryCoarseTimer) { - // round the interval, VeryCoarseTimers only have full second accuracy - interval = ((interval + 500)) / 1000 * 1000; } + if (ok == 0) { // user normal timers for (Very)CoarseTimers, or if no more multimedia timers available ok = SetTimer(internalHwnd, t->timerId, interval, 0); } - t->timeout = qt_msectime() + interval; - if (ok == 0) qErrnoWarning("QEventDispatcherWin32::registerTimer: Failed to create a timer"); } @@ -611,6 +619,9 @@ void QEventDispatcherWin32Private::sendTimerEvent(int timerId) // send event, but don't allow it to recurse t->inTimerEvent = true; + // recalculate next emission + calculateNextTimeout(t, qt_msectime()); + QTimerEvent e(t->timerId); QCoreApplication::sendEvent(t->obj, &e); diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index c7011dbc04..1d1432f600 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -54,6 +54,8 @@ private slots: void singleShotTimeout(); void timeout(); void remainingTime(); + void remainingTimeDuringActivation_data(); + void remainingTimeDuringActivation(); void livelock_data(); void livelock(); void timerInfiniteRecursion_data(); @@ -79,14 +81,16 @@ class TimerHelper : public QObject { Q_OBJECT public: - TimerHelper() : QObject(), count(0) + TimerHelper() : QObject(), count(0), remainingTime(-1) { } int count; + int remainingTime; public slots: void timeout(); + void fetchRemainingTime(); }; void TimerHelper::timeout() @@ -94,6 +98,12 @@ void TimerHelper::timeout() ++count; } +void TimerHelper::fetchRemainingTime() +{ + QTimer *timer = static_cast(sender()); + remainingTime = timer->remainingTime(); +} + void tst_QTimer::zeroTimer() { TimerHelper helper; @@ -158,6 +168,53 @@ void tst_QTimer::remainingTime() int remainingTime = timer.remainingTime(); QVERIFY2(qAbs(remainingTime - 150) < 50, qPrintable(QString::number(remainingTime))); + + // wait for the timer to actually fire now + connect(&timer, SIGNAL(timeout()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + QCOMPARE(helper.count, 1); + + // the timer is still active, so it should have a non-zero remaining time + remainingTime = timer.remainingTime(); + QVERIFY2(remainingTime > 150, qPrintable(QString::number(remainingTime))); +} + +void tst_QTimer::remainingTimeDuringActivation_data() +{ + QTest::addColumn("singleShot"); + QTest::newRow("repeating") << true; + QTest::newRow("single-shot") << true; +} + +void tst_QTimer::remainingTimeDuringActivation() +{ + QFETCH(bool, singleShot); + + TimerHelper helper; + QTimer timer; + + const int timeout = 20; // 20 ms is short enough and should not round down to 0 in any timer mode + + connect(&timer, SIGNAL(timeout()), &helper, SLOT(fetchRemainingTime())); + connect(&timer, SIGNAL(timeout()), &QTestEventLoop::instance(), SLOT(exitLoop())); + timer.start(timeout); + timer.setSingleShot(singleShot); + + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + if (singleShot) + QCOMPARE(helper.remainingTime, -1); // timer not running + else + QCOMPARE(helper.remainingTime, timeout); + + if (!singleShot) { + // do it again - see QTBUG-46940 + helper.remainingTime = -1; + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + QCOMPARE(helper.remainingTime, timeout); + } } void tst_QTimer::livelock_data() -- cgit v1.2.3 From 477721250dfc9d83a74bced6765dff19a1ceebf3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 6 Jul 2015 21:16:09 -0700 Subject: Remove the warning printed when QObject's destructor catches exceptions The warning is useless, since the application is about to terminate anyway. The user will be better informed by getting a proper backtrace of the throw point, instead of the rethrow point inside QObject's destructor. The application WILL terminate because C++11 destructors are noexcept and GCC 6 enforces it: qobject.cpp:909:13: error: throw will always call terminate() [- Werror=terminate] qobject.cpp:909:13: note: in C++11 destructors default to noexcept QT_RETHROW; ^ Change-Id: Ib056b47dde3341ef9a52ffff13ee8f01d874d224 Reviewed-by: Marc Mutz Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qobject.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 676a529dfe..cc6970eaeb 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -900,14 +900,7 @@ QObject::~QObject() } if (!d->isWidget && d->isSignalConnected(0)) { - QT_TRY { - emit destroyed(this); - } QT_CATCH(...) { - // all the signal/slots connections are still in place - if we don't - // quit now, we will crash pretty soon. - qWarning("Detected an unexpected exception in ~QObject while emitting destroyed()."); - QT_RETHROW; - } + emit destroyed(this); } if (d->declarativeData) { -- cgit v1.2.3 From 153b0e50b12c8fcf9ef8adf1efc4c50ebad9f98e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 1 Jun 2015 18:01:34 -0700 Subject: Fix ambiguous overload call on OS X Found by ICC: qtextengine.cpp(1259): error: more than one instance of constructor "QFixed::QFixed" matches the argument list: function "QFixed::QFixed(int)" function "QFixed::QFixed(long)" function "QFixed::QFixed(qreal={double})" argument types are: (uint) QFixed stretch = QFixed(actualFontEngine->fontDef.stretch) / QFixed(100); ^ Change-Id: I790fb4cae1abc692705253a7863291bc8743b832 Reviewed-by: Konstantin Ritt Reviewed-by: Jake Petroules --- src/gui/text/qtextengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 67a19804a3..29a633f350 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1256,7 +1256,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st // scaling the advances for this particular version if (actualFontEngine->fontDef.stretch != 100 && QSysInfo::MacintoshVersion != QSysInfo::MV_10_6) { - QFixed stretch = QFixed(actualFontEngine->fontDef.stretch) / QFixed(100); + QFixed stretch = QFixed(int(actualFontEngine->fontDef.stretch)) / QFixed(100); for (uint i = 0; i < num_glyphs; ++i) g.advances[i] *= stretch; } -- cgit v1.2.3 From 02ab210ea9bc5ee53fa4f1db2f068ce24272a6cd Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 3 Jul 2015 14:19:02 +0200 Subject: Fix compile error on big endian DestFormat is not defined here but should be Format_RGBX8888 Change-Id: Ie33989a6fc31650434281a6b7b0f4806524268af Reviewed-by: Konstantin Ritt Reviewed-by: Timo Jyrinki Reviewed-by: Simon Hausmann --- src/gui/image/qimage_conversions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index e0ca2c5331..02f32aa34b 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -1103,7 +1103,7 @@ static bool mask_alpha_converter_rgbx_inplace(QImageData *data, Qt::ImageConvers } rgb_data += pad; } - data->format = DestFormat; + data->format = QImage::Format_RGBX8888; return true; #endif } -- cgit v1.2.3 From 8db7bad6e1901718f5ababc7849a8fb6c4415370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 26 Jun 2015 10:57:02 +0100 Subject: QNX: Fix namespace Qt build Declare __progname outside the namespace Task-number: QTBUG-43569 Change-Id: I000c6fea2e24d9b1a3514ec5de93649baa3e33a8 Reviewed-by: Rafael Roquetto --- src/corelib/global/qlogging.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 88882bbe8f..0846d2a6db 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -87,6 +87,10 @@ # endif #endif +#if defined(QT_USE_SLOG2) +extern char *__progname; +#endif + #if defined(Q_OS_LINUX) && (defined(__GLIBC__) || __has_include()) # include static long qt_gettid() @@ -1173,8 +1177,6 @@ void QMessagePattern::setPattern(const QString &pattern) #define QT_LOG_CODE 9000 #endif -extern char *__progname; - static void slog2_default_handler(QtMsgType msgType, const char *message) { if (slog2_set_default_buffer((slog2_buffer_t)-1) == 0) { -- cgit v1.2.3 From 27bf6df294b30d0335c6e63ca84461f09ea32ac6 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Mon, 4 May 2015 22:41:01 +0300 Subject: xcb: Use _NET_FRAME_EXTENTS to get frame margins Some window managers don't reparent the client window into the frame, so the old method of calculating frame margins by the geometries of the window and it's frame window is not suitable for them. Use it only as a fallback. Change-Id: Ie4d62370425effef4dd91bf27d98e3746e8a375e Task-number: QTBUG-2280 Reviewed-by: Gatis Paeglis Reviewed-by: Uli Schlachter --- src/plugins/platforms/xcb/qxcbconnection.cpp | 1 + src/plugins/platforms/xcb/qxcbconnection.h | 1 + src/plugins/platforms/xcb/qxcbwindow.cpp | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index b8b665157b..4e558f9447 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1578,6 +1578,7 @@ static const char * xcb_atomnames = { "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" "_KDE_NET_WM_FRAME_STRUT\0" + "_NET_FRAME_EXTENTS\0" "_NET_STARTUP_INFO\0" "_NET_STARTUP_INFO_BEGIN\0" diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 291193612c..348af5f155 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -194,6 +194,7 @@ namespace QXcbAtom { _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, _KDE_NET_WM_FRAME_STRUT, + _NET_FRAME_EXTENTS, _NET_STARTUP_INFO, _NET_STARTUP_INFO_BEGIN, diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 6e021ced23..9c5609bb8d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -745,6 +745,22 @@ void QXcbWindow::setGeometry(const QRect &rect) QMargins QXcbWindow::frameMargins() const { if (m_dirtyFrameMargins) { + if (connection()->wmSupport()->isSupportedByWM(atom(QXcbAtom::_NET_FRAME_EXTENTS))) { + xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, m_window, + atom(QXcbAtom::_NET_FRAME_EXTENTS), XCB_ATOM_CARDINAL, 0, 4); + QScopedPointer reply( + xcb_get_property_reply(xcb_connection(), cookie, NULL)); + if (reply && reply->type == XCB_ATOM_CARDINAL && reply->format == 32 && reply->value_len == 4) { + quint32 *data = (quint32 *)xcb_get_property_value(reply.data()); + // _NET_FRAME_EXTENTS format is left, right, top, bottom + m_frameMargins = QMargins(data[0], data[2], data[1], data[3]); + m_dirtyFrameMargins = false; + return m_frameMargins; + } + } + + // _NET_FRAME_EXTENTS property is not available, so + // walk up the window tree to get the frame parent xcb_window_t window = m_window; xcb_window_t parent = m_window; @@ -2385,6 +2401,8 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev m_windowState = newState; } return; + } else if (event->atom == atom(QXcbAtom::_NET_FRAME_EXTENTS)) { + m_dirtyFrameMargins = true; } else if (event->atom == atom(QXcbAtom::_NET_WORKAREA) && xcbScreen() && event->window == xcbScreen()->root()) { xcbScreen()->updateGeometry(event->time); } -- cgit v1.2.3 From 61a0656eb4149fe793854d703521bf2df48f8f7a Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Mon, 25 May 2015 17:46:49 +0300 Subject: xcb: set SM_CLIENT_ID property SM_CLIENT_ID is required by kwin for proper session management. - move client leader initialization from screen to connection - add SM_CLIENT_ID property to client leader Change-Id: I19fb0d098811c865f6f13d5bc3e59a173c596a65 Task-number: QTBUG-46310 Reviewed-by: Alexander Volkov Reviewed-by: Uli Schlachter Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.cpp | 53 ++++++++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbconnection.h | 2 ++ src/plugins/platforms/xcb/qxcbscreen.cpp | 32 ----------------- src/plugins/platforms/xcb/qxcbscreen.h | 3 -- src/plugins/platforms/xcb/qxcbwindow.cpp | 4 +-- 5 files changed, 57 insertions(+), 37 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 4e558f9447..74f48b0136 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -454,6 +454,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra , has_xkb(false) , m_buttons(0) , m_focusWindow(0) + , m_clientLeader(0) , m_systemTrayTracker(0) , m_glIntegration(Q_NULLPTR) , m_xiGrab(false) @@ -1336,6 +1337,58 @@ xcb_window_t QXcbConnection::rootWindow() return s ? s->root() : 0; } +xcb_window_t QXcbConnection::clientLeader() +{ + if (m_clientLeader == 0) { + m_clientLeader = xcb_generate_id(xcb_connection()); + QXcbScreen *screen = primaryScreen(); + Q_XCB_CALL(xcb_create_window(xcb_connection(), + XCB_COPY_FROM_PARENT, + m_clientLeader, + screen->root(), + 0, 0, 1, 1, + 0, + XCB_WINDOW_CLASS_INPUT_OUTPUT, + screen->screen()->root_visual, + 0, 0)); +#ifndef QT_NO_DEBUG + QByteArray ba("Qt client leader window"); + Q_XCB_CALL(xcb_change_property(xcb_connection(), + XCB_PROP_MODE_REPLACE, + m_clientLeader, + atom(QXcbAtom::_NET_WM_NAME), + atom(QXcbAtom::UTF8_STRING), + 8, + ba.length(), + ba.constData())); +#endif + Q_XCB_CALL(xcb_change_property(xcb_connection(), + XCB_PROP_MODE_REPLACE, + m_clientLeader, + atom(QXcbAtom::WM_CLIENT_LEADER), + XCB_ATOM_WINDOW, + 32, + 1, + &m_clientLeader)); + +#if !defined(QT_NO_SESSIONMANAGER) && defined(XCB_USE_SM) + // If we are session managed, inform the window manager about it + QByteArray session = qGuiApp->sessionId().toLatin1(); + if (!session.isEmpty()) { + Q_XCB_CALL(xcb_change_property(xcb_connection(), + XCB_PROP_MODE_REPLACE, + m_clientLeader, + atom(QXcbAtom::SM_CLIENT_ID), + XCB_ATOM_STRING, + 8, + session.length(), + session.constData())); + } +#endif + } + return m_clientLeader; +} + #ifdef XCB_USE_XLIB void *QXcbConnection::xlib_display() const { diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 348af5f155..ee5ed8906a 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -403,6 +403,7 @@ public: QXcbWMSupport *wmSupport() const { return m_wmSupport.data(); } xcb_window_t rootWindow(); + xcb_window_t clientLeader(); bool hasDefaultVisualId() const { return m_defaultVisualId != UINT_MAX; } xcb_visualid_t defaultVisualId() const { return m_defaultVisualId; } @@ -640,6 +641,7 @@ private: QXcbWindow *m_focusWindow; + xcb_window_t m_clientLeader; QByteArray m_startupId; QXcbSystemTrayTracker *m_systemTrayTracker; QXcbGlIntegration *m_glIntegration; diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 040cea1cb2..c7f811491c 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -170,38 +170,6 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe else m_syncRequestSupported = true; - m_clientLeader = xcb_generate_id(xcb_connection()); - Q_XCB_CALL2(xcb_create_window(xcb_connection(), - XCB_COPY_FROM_PARENT, - m_clientLeader, - screen()->root, - 0, 0, 1, 1, - 0, - XCB_WINDOW_CLASS_INPUT_OUTPUT, - screen()->root_visual, - 0, 0), connection); -#ifndef QT_NO_DEBUG - QByteArray ba("Qt client leader window for screen "); - ba += m_outputName.toUtf8(); - Q_XCB_CALL2(xcb_change_property(xcb_connection(), - XCB_PROP_MODE_REPLACE, - m_clientLeader, - atom(QXcbAtom::_NET_WM_NAME), - atom(QXcbAtom::UTF8_STRING), - 8, - ba.length(), - ba.constData()), connection); -#endif - - Q_XCB_CALL2(xcb_change_property(xcb_connection(), - XCB_PROP_MODE_REPLACE, - m_clientLeader, - atom(QXcbAtom::WM_CLIENT_LEADER), - XCB_ATOM_WINDOW, - 32, - 1, - &m_clientLeader), connection); - xcb_depth_iterator_t depth_iterator = xcb_screen_allowed_depths_iterator(screen()); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 44519470e9..ccc30c0b84 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -116,8 +116,6 @@ public: xcb_randr_crtc_t crtc() const { return m_crtc; } xcb_randr_mode_t mode() const { return m_mode; } - xcb_window_t clientLeader() const { return m_clientLeader; } - void windowShown(QXcbWindow *window); QString windowManagerName() const { return m_windowManagerName; } bool syncRequestSupported() const { return m_syncRequestSupported; } @@ -173,7 +171,6 @@ private: Qt::ScreenOrientation m_orientation; QString m_windowManagerName; bool m_syncRequestSupported; - xcb_window_t m_clientLeader; QMap m_visuals; QMap m_visualDepths; QXcbCursor *m_cursor; diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 9c5609bb8d..af4a88b7bc 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -622,7 +622,7 @@ void QXcbWindow::create() xcb_set_wm_hints(xcb_connection(), m_window, &hints); - xcb_window_t leader = platformScreen->clientLeader(); + xcb_window_t leader = connection()->clientLeader(); Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, atom(QXcbAtom::WM_CLIENT_LEADER), XCB_ATOM_WINDOW, 32, 1, &leader)); @@ -874,7 +874,7 @@ void QXcbWindow::show() // Default to client leader if there is no transient parent, else modal dialogs can // be hidden by their parents. if (!transientXcbParent) - transientXcbParent = xcbScreen()->clientLeader(); + transientXcbParent = connection()->clientLeader(); if (transientXcbParent) { // ICCCM 4.1.2.6 Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32, -- cgit v1.2.3 From f61de80e1f11cea088faf946fc59999936090661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Mon, 15 Jun 2015 20:02:20 +0100 Subject: QVarLengthArray: Unit-test that clear() preserves capacity Change-Id: Ib2b798b93ce9a1b77bca09b2a8c27a568ebf8670 Reviewed-by: Marc Mutz --- .../tools/qvarlengtharray/tst_qvarlengtharray.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp index 5d12cd9804..94d81e0a5a 100644 --- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp +++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp @@ -54,6 +54,7 @@ private slots: void indexOf(); void lastIndexOf(); void contains(); + void clear(); void initializeListInt(); void initializeListMovable(); void initializeListComplex(); @@ -752,6 +753,21 @@ void tst_QVarLengthArray::contains() QVERIFY(myvec.contains(QLatin1String("I don't exist"))); } +void tst_QVarLengthArray::clear() +{ + QVarLengthArray myvec; + + for (int i = 0; i < 10; ++i) + myvec << "aaa"; + + QCOMPARE(myvec.size(), 10); + QVERIFY(myvec.capacity() >= myvec.size()); + const int oldCapacity = myvec.capacity(); + myvec.clear(); + QCOMPARE(myvec.size(), 0); + QCOMPARE(myvec.capacity(), oldCapacity); +} + void tst_QVarLengthArray::initializeListInt() { initializeList(); -- cgit v1.2.3 From 06fd8e5a50ac9a47ff350c09429911c186819c3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Mon, 15 Jun 2015 08:22:59 +0100 Subject: docs: QGraphicsWidget: Remove outdated statement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It might get new features, but it probably won't so don't create false expectations. Change-Id: Icbdae9242822798c681f75988c968fc9e6f0d081 Reviewed-by: Topi Reiniö --- src/widgets/doc/src/graphicsview.qdoc | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/widgets/doc/src/graphicsview.qdoc b/src/widgets/doc/src/graphicsview.qdoc index 6895466977..6f3bc68f98 100644 --- a/src/widgets/doc/src/graphicsview.qdoc +++ b/src/widgets/doc/src/graphicsview.qdoc @@ -493,9 +493,6 @@ but Graphics View currently doesn't support the Qt::Sheet and Qt::Drawer flags that are common on OS X. - The capabilities of QGraphicsWidget are expected to grow depending - on community feedback. - \section3 QGraphicsLayout QGraphicsLayout is part of a second-generation layout framework -- cgit v1.2.3 From b474decee308ef5633af9fffaf4bbe5940a66185 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 7 Jul 2015 13:51:10 +0200 Subject: Fix separate_debug_info with unversioned_libname Handle unversioned_libname like plugins. Task-number: QTBUG-47065 Change-Id: I98469589416beb13f5beeff7273e84417fdbbfd5 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/resolve_target.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/resolve_target.prf b/mkspecs/features/resolve_target.prf index fe5808940a..aa52e9d67e 100644 --- a/mkspecs/features/resolve_target.prf +++ b/mkspecs/features/resolve_target.prf @@ -55,7 +55,7 @@ win32 { equals(TEMPLATE, lib) { static { QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.a - } else:plugin { + } else: plugin|unversioned_libname { QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.so } else { TEMP_VERSION = $$VERSION -- cgit v1.2.3 From 32d646d0a6676f5749bc14a51c47838588a7d389 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 7 Jul 2015 15:41:43 +0200 Subject: Rcc: Do not output empty lines when listing .qrc contents Previously, directory nodes in the resource tree generated empty file names in the --list output. They do not add value. Change-Id: I04ac495ba5f57802de9796ec663c28facfee89f2 Reviewed-by: Oswald Buddenhagen Reviewed-by: Simon Warta --- src/tools/rcc/rcc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 71438726f7..7bd1ac0bc6 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -693,7 +693,8 @@ QStringList RCCResourceLibrary::dataFiles() const RCCFileInfo *child = it.value(); if (child->m_flags & RCCFileInfo::Directory) pending.push(child); - ret.append(child->m_fileInfo.filePath()); + else + ret.append(child->m_fileInfo.filePath()); } } return ret; -- cgit v1.2.3 From 1443cdcfe03fc07c7718e36b8fdd53ac4b33a5ff Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 2 Jul 2015 12:01:51 +0200 Subject: configure: Mention availability of linux-clang Change-Id: I2e99832b06a59b1587f98041a7d36ed69e22be94 Reviewed-by: Oswald Buddenhagen --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 314f780178..9a64b563e1 100755 --- a/configure +++ b/configure @@ -2842,7 +2842,7 @@ if [ -z "$PLATFORM" ]; then Linux:*) PLATFORM=linux-g++ PLATFORM_NOTES=" - - Also available for Linux: linux-kcc linux-icc linux-cxx + - Also available for Linux: linux-clang linux-kcc linux-icc linux-cxx " ;; SunOS:5*) -- cgit v1.2.3 From 3719744b395f78baafe5d68bd608745c2a10eb2f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 8 Jul 2015 16:16:38 +0200 Subject: Windows XP style: Pass widget to XPThemeData. Previously, 0 was passed which causes QWindowsXPStylePrivate::winId() to go on a hunt trying to find a window handle needlessly looping over top levels, slowing down painting. Task-number: QTBUG-42245 Change-Id: Ic702d9a73c4f749fd5988950280aef632a3308c4 Reviewed-by: Marko Kangas Reviewed-by: J-P Nurmi --- src/widgets/styles/qwindowsvistastyle.cpp | 4 ++-- src/widgets/styles/qwindowsxpstyle.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index daa8ab12a9..d3e7e457ea 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -396,7 +396,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt case PE_IndicatorBranch: { - XPThemeData theme(0, painter, QWindowsXPStylePrivate::TreeViewTheme); + XPThemeData theme(widget, painter, QWindowsXPStylePrivate::TreeViewTheme); static int decoration_size = 0; if (d->initTreeViewTheming() && theme.isValid() && !decoration_size) { XPThemeData themeSize = theme; @@ -710,7 +710,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt state = LISS_HOT; QPainter pixmapPainter(&pixmap); - XPThemeData theme(0, &pixmapPainter, + XPThemeData theme(widget, &pixmapPainter, QWindowsXPStylePrivate::TreeViewTheme, LVP_LISTITEM, state, QRect(0, 0, sectionSize.width(), sectionSize.height())); if (d->initTreeViewTheming() && theme.isValid()) { diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 54271c5ce8..7776773b87 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -1224,7 +1224,7 @@ void QWindowsXPStyle::polish(QWidget *widget) if (!d->hasInitColors) { // Get text color for group box labels COLORREF cref; - XPThemeData theme(0, 0, QWindowsXPStylePrivate::ButtonTheme, 0, 0); + XPThemeData theme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, 0, 0); QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &cref); d->groupBoxTextColor = qRgb(GetRValue(cref), GetGValue(cref), GetBValue(cref)); QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_DISABLED, TMT_TEXTCOLOR, &cref); @@ -1540,7 +1540,7 @@ case PE_Frame: return; themeNumber = QWindowsXPStylePrivate::ListViewTheme; partId = LVP_LISTGROUP; - XPThemeData theme(0, 0, themeNumber, partId, 0); + XPThemeData theme(widget, 0, themeNumber, partId, 0); if (!(flags & State_Enabled)) stateId = ETS_DISABLED; -- cgit v1.2.3 From 4018cd3529ded32f3434095a2da2568d52dfe16a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 8 Jul 2015 11:42:54 +0200 Subject: Add support for PNG to QWindowsMimeImage::convertFromMime(). GIMP asks for image data in PNG format when doing a "paste" which was previously handled only in convertToMime(). Add handling to convertFromMime() and register format. Task-number: QTBUG-46848 Change-Id: Ib11de27d301c8632869c7276e421e48e4f34e1d0 Reviewed-by: aavit --- src/plugins/platforms/windows/qwindowsmime.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index d8ccccdf45..f86ab9fee3 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -995,6 +995,7 @@ QVector QWindowsMimeImage::formatsForMime(const QString &mimeType, co if (!image.isNull() && image.hasAlphaChannel()) formatetcs += setCf(CF_DIBV5); formatetcs += setCf(CF_DIB); + formatetcs += setCf(CF_PNG); // QTBUG-86848, Paste into GIMP queries for PNG. } return formatetcs; } @@ -1025,13 +1026,15 @@ bool QWindowsMimeImage::canConvertFromMime(const FORMATETC &formatetc, const QMi return false; // QTBUG-11463, deny CF_DIB support for images with alpha to prevent loss of // transparency in conversion. - return cf == CF_DIBV5 || (cf == CF_DIB && !image.hasAlphaChannel()); + return cf == CF_DIBV5 + || (cf == CF_DIB && !image.hasAlphaChannel()) + || cf == int(CF_PNG); } bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const { int cf = getCf(formatetc); - if ((cf == CF_DIB || cf == CF_DIBV5) && mimeData->hasImage()) { + if ((cf == CF_DIB || cf == CF_DIBV5 || cf == int(CF_PNG)) && mimeData->hasImage()) { QImage img = qvariant_cast(mimeData->imageData()); if (img.isNull()) return false; @@ -1042,6 +1045,12 @@ bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeD const QByteArray ba = writeDib(img); if (!ba.isEmpty()) return setData(ba, pmedium); + } else if (cf == int(CF_PNG)) { + QBuffer buffer(&ba); + const bool written = buffer.open(QIODevice::WriteOnly) && img.save(&buffer, "PNG"); + buffer.close(); + if (written) + return setData(ba, pmedium); } else { QDataStream s(&ba, QIODevice::WriteOnly); s.setByteOrder(QDataStream::LittleEndian);// Intel byte order #### -- cgit v1.2.3 From 4b17bc34977329aa68fefdd1e2c9428adaa65356 Mon Sep 17 00:00:00 2001 From: Alejandro Exojo Date: Sun, 5 Jul 2015 16:02:18 +0200 Subject: doc: Correction in access(): signals are now public Change-Id: I7c3ea57103a3e68ec5fadd082c11fbc0db960b0b Reviewed-by: Thiago Macieira Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qmetaobject.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index bae8c1268b..fc161e6f89 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1964,8 +1964,9 @@ int QMetaMethod::revision() const Returns the access specification of this method (private, protected, or public). - Signals are always protected, meaning that you can only emit them - from the class or from a subclass. + \note Signals are always public, but you should regard that as an + implementation detail. It is almost always a bad idea to emit a signal from + outside its class. \sa methodType() */ -- cgit v1.2.3 From c9dd554ea600f5a3c23053a507c2ef1e4c124f4e Mon Sep 17 00:00:00 2001 From: Christoph Schleifenbaum Date: Sat, 4 Jul 2015 16:22:50 +0200 Subject: QComboBox: Fix compilation with QT_NO_COMPLETER MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie57b06ebbddaa0801e265e6908da1548fe02085a Task-number: QTBUG-46871 Reviewed-by: Marc Mutz Reviewed-by: André Hartmann --- src/widgets/widgets/qcombobox.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index ba19b63c12..cc4c3416f0 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -2092,8 +2092,10 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi) const QString newText = itemText(normalized); if (lineEdit->text() != newText) { lineEdit->setText(newText); +#ifndef QT_NO_COMPLETER if (lineEdit->completer()) lineEdit->completer()->setCompletionPrefix(newText); +#endif } updateLineEditGeometry(); } -- cgit v1.2.3 From 3ebbd5db7b96b8759119f7811bb40f5e1de45d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Mon, 13 Jul 2015 05:40:22 -0700 Subject: ssl: fix SecureTransport handling of remote host disconnect Currently when the remote server disconnects gracefully (for example upon returning an HTTP request with Connection: close) the call to SSLRead will return errSSLCloseGraceful which is incorrectly reported as QAbstractSocket::SslInternalError. This patch aligns the behavior with that of the OpenSSL backend and instead reports QAbstractSocket::RemoteHostClosedError. Change-Id: I8c6679280ac0c6fbd71d5f0d29b25f692eca5b24 Task-number: QTBUG-47154 Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslsocket_mac.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index 497cbf4c9b..10a9c0b7e9 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -387,7 +387,12 @@ void QSslSocketBackendPrivate::transmit() size_t readBytes = 0; data.resize(4096); const OSStatus err = SSLRead(context, data.data(), data.size(), &readBytes); - if (err != noErr && err != errSSLWouldBlock) { + if (err == errSSLClosedGraceful) { + shutdown = true; // the other side shut down, make sure we do not send shutdown ourselves + setError(QSslSocket::tr("The TLS/SSL connection has been closed"), + QAbstractSocket::RemoteHostClosedError); + break; + } else if (err != noErr && err != errSSLWouldBlock) { qWarning() << Q_FUNC_INFO << "SSLRead failed with:" << int(err); setError("SSL read failed", QAbstractSocket::SslInternalError); break; -- cgit v1.2.3 From f1f9489d08a52fd1f52fcf768d43c58c5cda4f25 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 10 Jul 2015 09:34:46 +0200 Subject: Windows: Fix crash when using wmain() and passing a fake argv. Return true from isArgvModified() when __argv is null (as is the case when using wmain()) indicating arguments are modified. Task-number: QTBUG-47023 Task-number: QTBUG-30330 Change-Id: I44329ed3369cd4db79ba1b7c19303895f67b1616 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcoreapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 8489afe5a7..8f58d1b7ad 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -393,7 +393,7 @@ static bool quitLockRefEnabled = true; // GUI apps or when using MinGW due to its globbing. static inline bool isArgvModified(int argc, char **argv) { - if (__argc != argc) + if (__argc != argc || !__argv /* wmain() */) return true; if (__argv == argv) return false; -- cgit v1.2.3 From 0d81316dcca0324b343def07a4a2bd5792c27fd5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Sun, 12 Jul 2015 23:47:20 +0200 Subject: Use QImageReader::setAutoTransform() in examples. Change-Id: If80616d680f1aa6c9d5cd1a4080710e5ad67d603 Reviewed-by: Rainer Keller Reviewed-by: Allan Sandfeld Jensen --- examples/widgets/doc/src/imageviewer.qdoc | 14 ++++++++++---- examples/widgets/gestures/imagegestures/imagewidget.cpp | 1 + examples/widgets/widgets/imageviewer/imageviewer.cpp | 4 +++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/widgets/doc/src/imageviewer.qdoc b/examples/widgets/doc/src/imageviewer.qdoc index 901d6fe76e..91ae56b5d7 100644 --- a/examples/widgets/doc/src/imageviewer.qdoc +++ b/examples/widgets/doc/src/imageviewer.qdoc @@ -124,10 +124,16 @@ \snippet widgets/imageviewer/imageviewer.cpp 2 - In the \c loadFile() function, we check if the file's - format is an image format by constructing a QImage which tries to - load the image from the file. If the constructor returns a null - image, we use a QMessageBox to alert the user. + In the \c loadFile() function, we instantiate a QImageReader + and enable automatic transformations by calling + QImageReader::setAutoTransform(). For files in JPEG format, + this ensures that portrait mode images of digital cameras are shown + correctly by applying the appropriate orientation read from the + EXIF meta data stored in the image file. + + We then load the image using QImageReader::read(). If this returns + a null image, indicating that the file is not an image file, + we use a QMessageBox to alert the user. The QMessageBox class provides a modal dialog with a short message, an icon, and some buttons. As with QFileDialog the diff --git a/examples/widgets/gestures/imagegestures/imagewidget.cpp b/examples/widgets/gestures/imagegestures/imagewidget.cpp index 3d0d7e7a93..440eb783c1 100644 --- a/examples/widgets/gestures/imagegestures/imagewidget.cpp +++ b/examples/widgets/gestures/imagegestures/imagewidget.cpp @@ -202,6 +202,7 @@ QImage ImageWidget::loadImage(const QString &fileName) { qDebug() << position << files << fileName; QImageReader reader(fileName); + reader.setAutoTransform(true); qCDebug(lcExample) << "loading" << QDir::toNativeSeparators(fileName) << position << '/' << files.size(); if (!reader.canRead()) { qCWarning(lcExample) << QDir::toNativeSeparators(fileName) << ": can't load image"; diff --git a/examples/widgets/widgets/imageviewer/imageviewer.cpp b/examples/widgets/widgets/imageviewer/imageviewer.cpp index 0b8513f090..93b88e9c18 100644 --- a/examples/widgets/widgets/imageviewer/imageviewer.cpp +++ b/examples/widgets/widgets/imageviewer/imageviewer.cpp @@ -69,7 +69,9 @@ ImageViewer::ImageViewer() bool ImageViewer::loadFile(const QString &fileName) { - QImage image(fileName); + QImageReader reader(fileName); + reader.setAutoTransform(true); + const QImage image = reader.read(); if (image.isNull()) { QMessageBox::information(this, QGuiApplication::applicationDisplayName(), tr("Cannot load %1.").arg(QDir::toNativeSeparators(fileName))); -- cgit v1.2.3 From 1dc96612c8c4e2a46ffe7db05e2fa95c945f0b5c Mon Sep 17 00:00:00 2001 From: Melanie Cappelaere Date: Fri, 19 Jun 2015 14:37:36 +0200 Subject: Mangle QNSApplication and methods into a namespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [OS X] Mangle the event handle related calls on QNSApplication, so that the events are passed through the correct QApplications when several Qt5's with different namespaces do UI in the same process. Change-Id: Ibb44246fbcf4a2bc3af5a93c48db0382a1380328 Reviewed-by: Christoph Schleifenbaum Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoaapplication.mm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm index 227ab05c25..d9919f1120 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplication.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm @@ -79,12 +79,12 @@ QT_USE_NAMESPACE - (void)QT_MANGLE_NAMESPACE(qt_setDockMenu):(NSMenu *)newMenu { - [[QCocoaApplicationDelegate sharedDelegate] setDockMenu:newMenu]; + [[QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate] setDockMenu:newMenu]; } - (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader) { - return [[QCocoaApplicationDelegate sharedDelegate] menuLoader]; + return [[QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate] menuLoader]; } - (int)QT_MANGLE_NAMESPACE(qt_validModesForFontPanel):(NSFontPanel *)fontPanel @@ -147,9 +147,9 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE @end -@implementation QNSApplication +@implementation QT_MANGLE_NAMESPACE(QNSApplication) -- (void)qt_sendEvent_original:(NSEvent *)event +- (void)QT_MANGLE_NAMESPACE(qt_sendEvent_original):(NSEvent *)event { Q_UNUSED(event); // This method will only be used as a signature @@ -157,14 +157,14 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE // containing the original [NSApplication sendEvent:] implementation } -- (void)qt_sendEvent_replacement:(NSEvent *)event +- (void)QT_MANGLE_NAMESPACE(qt_sendEvent_replacement):(NSEvent *)event { // This method (or its implementation to be precise) will // be called instead of sendEvent if redirection occurs. // 'self' will then be an instance of NSApplication // (and not QNSApplication) if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event]) - [self qt_sendEvent_original:event]; + [self QT_MANGLE_NAMESPACE(qt_sendEvent_original):event]; } - (void)sendEvent:(NSEvent *)event @@ -187,7 +187,7 @@ void qt_redirectNSApplicationSendEvent() // can be unloaded. return; - if ([NSApp isMemberOfClass:[QNSApplication class]]) { + if ([NSApp isMemberOfClass:[QT_MANGLE_NAMESPACE(QNSApplication) class]]) { // No need to change implementation since Qt // already controls a subclass of NSApplication return; @@ -200,9 +200,9 @@ void qt_redirectNSApplicationSendEvent() qt_cocoa_change_implementation( [NSApplication class], @selector(sendEvent:), - [QNSApplication class], - @selector(qt_sendEvent_replacement:), - @selector(qt_sendEvent_original:)); + [QT_MANGLE_NAMESPACE(QNSApplication) class], + @selector(QT_MANGLE_NAMESPACE(qt_sendEvent_replacement):), + @selector(QT_MANGLE_NAMESPACE(qt_sendEvent_original):)); } void qt_resetNSApplicationSendEvent() -- cgit v1.2.3 From a889faf0b86551f3cc463aeeae6f71698fa43d2a Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 13 Jul 2015 18:32:46 +0200 Subject: QDial: remove documentation for non-existent functions. f6dd3ab553a56d5e39da4bbb040b9136b88fa05b forgot to remove these. Change-Id: Ia10048d551b309ea3c49818ef51819c93a92c8d3 Reviewed-by: Marc Mutz --- src/widgets/widgets/qdial.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/widgets/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp index b6ec54997b..3f081e3a83 100644 --- a/src/widgets/widgets/qdial.cpp +++ b/src/widgets/widgets/qdial.cpp @@ -202,9 +202,8 @@ int QDialPrivate::valueFromPoint(const QPoint &p) const to draw every one, QDial will skip notches to try and draw a uniform set (e.g. by drawing every second or third notch). - Like the slider, the dial makes the QAbstractSlider functions - setValue(), addLine(), subtractLine(), addPage() and - subtractPage() available as slots. + Like the slider, the dial makes the QAbstractSlider function setValue() + available as a slot. The dial's keyboard interface is fairly simple: The \uicontrol{left}/\uicontrol{up} and \uicontrol{right}/\uicontrol{down} arrow keys adjust -- cgit v1.2.3 From c056e63cea1915667997c982f48296ce5acdcc80 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Tue, 2 Jun 2015 13:22:23 +1000 Subject: Make sure to report correct NetworkAccessibility Task-number: QTBUG-46323 Change-Id: Ibdeb3280091a97d785d4314340678a63e88fb219 Reviewed-by: Markus Goetz (Woboq GmbH) Reviewed-by: Alex Blasche --- src/network/access/qnetworkaccessmanager.cpp | 25 +++++++++++++++++-------- src/network/access/qnetworkaccessmanager_p.h | 2 ++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index e878feb2bf..84931cbb40 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -472,11 +472,11 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) // the QNetworkSession's signals connect(&d->networkConfigurationManager, SIGNAL(onlineStateChanged(bool)), SLOT(_q_onlineStateChanged(bool))); - // we would need all active configurations to check for - // d->networkConfigurationManager.isOnline(), which is asynchronous - // and potentially expensive. We can just check the configuration here - d->online = (d->networkConfiguration.state() & QNetworkConfiguration::Active); } + // we would need all active configurations to check for + // d->networkConfigurationManager.isOnline(), which is asynchronous + // and potentially expensive. We can just check the configuration here + d->online = (d->networkConfiguration.state() & QNetworkConfiguration::Active); #endif } @@ -946,6 +946,7 @@ QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const void QNetworkAccessManager::setNetworkAccessible(QNetworkAccessManager::NetworkAccessibility accessible) { Q_D(QNetworkAccessManager); + d->defaultAccessControl = false; if (d->networkAccessible != accessible) { NetworkAccessibility previous = networkAccessible(); @@ -964,7 +965,6 @@ void QNetworkAccessManager::setNetworkAccessible(QNetworkAccessManager::NetworkA QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccessible() const { Q_D(const QNetworkAccessManager); - if (d->networkSessionRequired) { QSharedPointer networkSession(d->getNetworkSession()); if (networkSession) { @@ -975,7 +975,13 @@ QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccess return NotAccessible; } else { // Network accessibility is either disabled or unknown. - return (d->networkAccessible == NotAccessible) ? NotAccessible : UnknownAccessibility; + if (d->defaultAccessControl) { + if (d->online) + return d->networkAccessible; + else + return NotAccessible; + } + return (d->networkAccessible); } } else { if (d->online) @@ -1568,7 +1574,7 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co if (!networkSessionStrongRef) { online = false; - if (networkAccessible == QNetworkAccessManager::NotAccessible) + if (networkAccessible == QNetworkAccessManager::NotAccessible || !online) emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible); else emit q->networkAccessibleChanged(QNetworkAccessManager::UnknownAccessibility); @@ -1616,11 +1622,14 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession if (online) { if (state != QNetworkSession::Connected && state != QNetworkSession::Roaming) { online = false; - emit q->networkAccessibleChanged(QNetworkAccessManager::NotAccessible); + networkAccessible = QNetworkAccessManager::NotAccessible; + emit q->networkAccessibleChanged(networkAccessible); } } else { if (state == QNetworkSession::Connected || state == QNetworkSession::Roaming) { online = true; + if (defaultAccessControl) + networkAccessible = QNetworkAccessManager::Accessible; emit q->networkAccessibleChanged(networkAccessible); } } diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index f513324461..c715da00c1 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -84,6 +84,7 @@ public: initializeSession(true), #endif cookieJarCreated(false), + defaultAccessControl(true), authenticationManager(QSharedPointer::create()) { } ~QNetworkAccessManagerPrivate(); @@ -164,6 +165,7 @@ public: #endif bool cookieJarCreated; + bool defaultAccessControl; // The cache with authorization data: QSharedPointer authenticationManager; -- cgit v1.2.3 From 7839979c07e6f9e1a9c2e038f031f2cceb13fec6 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Sat, 11 Jul 2015 11:42:47 +0900 Subject: fix running libQtCore.so failure It fails when "program interpreter:" is translated. ./lib/libQt5Core.so: cannot execute binary file: Exec format error Change-Id: I5154decb0401eeb1ba38b286b660b830c6136c22 Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- src/corelib/global/global.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index bc11c77d88..6a8104bee2 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -41,7 +41,7 @@ LIBS_PRIVATE += $$QMAKE_LIBS_EXECINFO if(linux*|hurd*):!cross_compile:!static:!*-armcc* { QMAKE_LFLAGS += -Wl,-e,qt_core_boilerplate prog=$$quote(if (/program interpreter: (.*)]/) { print $1; }) - DEFINES += ELF_INTERPRETER=\\\"$$system(readelf -l /bin/ls | perl -n -e \'$$prog\')\\\" + DEFINES += ELF_INTERPRETER=\\\"$$system(LC_ALL=C readelf -l /bin/ls | perl -n -e \'$$prog\')\\\" } slog2 { -- cgit v1.2.3 From ca60311a60677f1133b0d4c50343f1644e184fa5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 9 Jul 2015 05:08:34 +0000 Subject: Fix build on FreeBSD: kinfo_getproc is in libutil I can't find the function for NetBSD and OpenBSD. There's a good chance QtCore simply fails to compile. Change-Id: Ib056b47dde3341ef9a52ffff13efaff642bd7bb9 Link: http://www.freebsd.org/cgi/man.cgi?query=kinfo_getproc Reviewed-by: Joerg Bornemann Reviewed-by: Thiago Macieira --- src/corelib/io/io.pri | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index 207de2a85b..f496d037d8 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -147,6 +147,7 @@ win32 { SOURCES += io/qsettings_mac.cpp OBJECTIVE_SOURCES += io/qurl_mac.mm } + freebsd: LIBS_PRIVATE += -lutil # qlockfile_unix.cpp requires this mac { osx { OBJECTIVE_SOURCES += io/qfilesystemwatcher_fsevents.mm -- cgit v1.2.3 From 02418d1aaa6760e08d55f0f6213d02d56b057fd2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 19 May 2015 17:51:15 -0700 Subject: Set the state of QTemporaryFileEngine properly prior to reopening QTemporaryFileEngine does not store the pattern, so it needs to get it again from QTemporaryFilePrivate prior to reopening the file. It's possible to lose the pattern when remove() is called on the object. Task-number: QTBUG-46156 Change-Id: I66a35ce5f88941f29aa6ffff13dfc7f83d4fa3a2 Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: David Faure --- src/corelib/io/qsavefile.cpp | 3 ++- src/corelib/io/qtemporaryfile.cpp | 25 ++++++++++++++++++---- src/corelib/io/qtemporaryfile_p.h | 14 +++++------- .../io/qtemporaryfile/tst_qtemporaryfile.cpp | 1 + 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/corelib/io/qsavefile.cpp b/src/corelib/io/qsavefile.cpp index ffa6ad1c55..5a325f8e2c 100644 --- a/src/corelib/io/qsavefile.cpp +++ b/src/corelib/io/qsavefile.cpp @@ -215,7 +215,8 @@ bool QSaveFile::open(OpenMode mode) d->finalFileName = existingFile.filePath(); } - d->fileEngine = new QTemporaryFileEngine(d->finalFileName, 0666); + d->fileEngine = new QTemporaryFileEngine; + static_cast(d->fileEngine)->initialize(d->finalFileName, 0666); // Same as in QFile: QIODevice provides the buffering, so there's no need to request it from the file engine. if (!d->fileEngine->open(mode | QIODevice::Unbuffered)) { QFileDevice::FileError err = d->fileEngine->error(); diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 556bc6e760..68ac85fffd 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -409,14 +409,24 @@ QTemporaryFilePrivate::~QTemporaryFilePrivate() QAbstractFileEngine *QTemporaryFilePrivate::engine() const { if (!fileEngine) { - if (fileName.isEmpty()) - fileEngine = new QTemporaryFileEngine(templateName, 0600); - else - fileEngine = new QTemporaryFileEngine(fileName, 0600, false); + fileEngine = new QTemporaryFileEngine; + resetFileEngine(); } return fileEngine; } +void QTemporaryFilePrivate::resetFileEngine() const +{ + if (!fileEngine) + return; + + QTemporaryFileEngine *tef = static_cast(fileEngine); + if (fileName.isEmpty()) + tef->initialize(templateName, 0600); + else + tef->initialize(fileName, 0600, false); +} + QString QTemporaryFilePrivate::defaultTemplateName() { QString baseName; @@ -769,6 +779,13 @@ bool QTemporaryFile::open(OpenMode flags) } } + // reset the engine state so it creates a new, unique file name from the template; + // equivalent to: + // delete d->fileEngine; + // d->fileEngine = 0; + // d->engine(); + d->resetFileEngine(); + if (QFile::open(flags)) { d->fileName = d->fileEngine->fileName(QAbstractFileEngine::DefaultName); return true; diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h index 475298f264..2d4468fcf8 100644 --- a/src/corelib/io/qtemporaryfile_p.h +++ b/src/corelib/io/qtemporaryfile_p.h @@ -64,6 +64,7 @@ protected: ~QTemporaryFilePrivate(); QAbstractFileEngine *engine() const; + void resetFileEngine() const; bool autoRemove; QString templateName; @@ -77,22 +78,17 @@ class QTemporaryFileEngine : public QFSFileEngine { Q_DECLARE_PRIVATE(QFSFileEngine) public: - - QTemporaryFileEngine(const QString &file, - quint32 fileMode, - bool fileIsTemplate = true) : - QFSFileEngine(), - fileMode(fileMode), - filePathIsTemplate(fileIsTemplate), - filePathWasTemplate(fileIsTemplate) + void initialize(const QString &file, quint32 mode, bool nameIsTemplate = true) { Q_D(QFSFileEngine); + Q_ASSERT(!isReallyOpen()); + fileMode = mode; + filePathIsTemplate = filePathWasTemplate = nameIsTemplate; d->fileEntry = QFileSystemEntry(file); if (!filePathIsTemplate) QFSFileEngine::setFileName(file); } - ~QTemporaryFileEngine(); bool isReallyOpen(); diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index e7325d2b8e..94e6bbaade 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -353,6 +353,7 @@ void tst_QTemporaryFile::removeAndReOpen() QVERIFY(!QFile::exists(fileName)); QVERIFY(file.open()); + QCOMPARE(QFileInfo(file.fileName()).path(), QFileInfo(fileName).path()); fileName = file.fileName(); QVERIFY(QFile::exists(fileName)); } -- cgit v1.2.3 From c84625f0d565d12038c72528d1af9bee1a7100bc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 8 Jul 2015 19:01:44 -0700 Subject: Fix compilation with GCC 4.9.2 and up in debug mode Somehow the const int is no longer understood to be an immediate. GCC 4.8 still compiles this fine. qstring.cpp:316:34: error: the fifth argument must be an 8-bit immediate Change-Id: Ib056b47dde3341ef9a52ffff13ef24d541833abc Reviewed-by: Marc Mutz Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qstring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index bbb5647eea..d63982d1f5 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -274,9 +274,9 @@ static inline __m128i mergeQuestionMarks(__m128i chunk) // that they are doing the right thing. Inverting the arguments in the // instruction does cause a bunch of test failures. - const int mode = _SIDD_UWORD_OPS | _SIDD_CMP_RANGES | _SIDD_UNIT_MASK; const __m128i rangeMatch = _mm_cvtsi32_si128(0xffff0100); - const __m128i offLimitMask = _mm_cmpestrm(rangeMatch, 2, chunk, 8, mode); + const __m128i offLimitMask = _mm_cmpestrm(rangeMatch, 2, chunk, 8, + _SIDD_UWORD_OPS | _SIDD_CMP_RANGES | _SIDD_UNIT_MASK); // replace the non-Latin 1 characters in the chunk with question marks chunk = _mm_blendv_epi8(chunk, questionMark, offLimitMask); -- cgit v1.2.3 From 86a79260ca77dddc25e6dc2023d24c070afb2831 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 25 Jun 2015 08:48:09 -0700 Subject: Fix change-of-sign warning with ICC strlen returns size_t, but -1 is obviously negative. qglobal.cpp(2261): warning #68: integer conversion resulted in a change of sign Change-Id: I255870833a024a36adf6ffff13eb05ce5b2b2595 Reviewed-by: Caroline Chao Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 9e19dd7f0f..0c3d309277 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -2261,7 +2261,8 @@ static bool readEtcRedHatRelease(QUnixOSVersion &v) int releaseIndex = line.indexOf(keyword); v.productType = QString::fromLatin1(line.mid(0, releaseIndex)).remove(QLatin1Char(' ')); int spaceIndex = line.indexOf(' ', releaseIndex + strlen(keyword)); - v.productVersion = QString::fromLatin1(line.mid(releaseIndex + strlen(keyword), spaceIndex > -1 ? spaceIndex - releaseIndex - strlen(keyword) : -1)); + v.productVersion = QString::fromLatin1(line.mid(releaseIndex + strlen(keyword), + spaceIndex > -1 ? spaceIndex - releaseIndex - int(strlen(keyword)) : -1)); return true; } -- cgit v1.2.3 From 6388b30e79e315262aef95c9825eaaffdfdd9d54 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 30 Jun 2015 19:32:22 -0700 Subject: Fix the printing of the ms-since-boot in %{time boot} Commit 5d366f7e was not correct. The time displayed would always be the same (the start time of the application). [ChangeLog][QtCore][Logging framework] Fixed a bug that would cause a "%{time boot}" field in the logging framework's pattern to always display the same value, instead of the time since boot. Change-Id: I255870833a024a36adf6ffff13ecb1dca4a688ed Reviewed-by: Friedemann Kleint Reviewed-by: Kai Koehne --- src/corelib/global/qlogging.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 0846d2a6db..fca8656f9b 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1359,8 +1359,9 @@ QString qFormatLogMessage(QtMsgType type, const QMessageLogContext &context, con } else if (pattern->timeFormat == QLatin1String("boot")) { // just print the milliseconds since the elapsed timer reference // like the Linux kernel does - pattern->timer.elapsed(); - uint ms = pattern->timer.msecsSinceReference(); + QElapsedTimer now; + now.start(); + uint ms = now.msecsSinceReference(); message.append(QString::asprintf("%6d.%03d", uint(ms / 1000), uint(ms % 1000))); } else if (pattern->timeFormat.isEmpty()) { message.append(QDateTime::currentDateTime().toString(Qt::ISODate)); -- cgit v1.2.3 From 7833f4852ab4c44a1fae75cfb1221e19a7b3256c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 8 Jul 2015 15:01:54 -0700 Subject: Fix alignment of 64-bit atomics on iOS The ldrexd and strexd instructions require 64-bit alignment, but Clang for iOS aligns those types on 32-bit boundaries inside structures. We can't use Q_ALIGNOF because it returns the alignment for the type inside a structure. Task-number: QTBUG-46949 Change-Id: Ib056b47dde3341ef9a52ffff13ef17bede0846f2 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/arch/qatomic_armv6.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/corelib/arch/qatomic_armv6.h b/src/corelib/arch/qatomic_armv6.h index b14ab3d636..b2ea85ada2 100644 --- a/src/corelib/arch/qatomic_armv6.h +++ b/src/corelib/arch/qatomic_armv6.h @@ -90,7 +90,10 @@ private: template struct QAtomicOps : QBasicAtomicOps { - typedef T Type; + // this is GCC or GCC-like, so we can use extensions: + // force the alignment to be the size of the type, as on some ABIs the alignment + // of 64-bit types is 32-bit. We need proper alignment for LDREX / STREX. + typedef __attribute__((__aligned__(sizeof(T)))) T Type; }; #ifndef Q_CC_RVCT -- cgit v1.2.3 From f0f6d1634550f347d03c95c4cdd60a54860aa4bf Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 14 Jul 2015 15:45:36 +0200 Subject: QWindowsVistaStyle: Don't use new style background on Controls ComboBox We use menus to implement the ComboBox popup in QtQuick Controls, and therefore, all the items are actual menu items. If that's the case, we can skip the new style background. Task-number: QTBUG-47084 Change-Id: If46ebf8115b36f45b4b5e6068ddc0d61afe307b8 Reviewed-by: J-P Nurmi Reviewed-by: Friedemann Kleint --- src/widgets/styles/qwindowsvistastyle.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index d3e7e457ea..b8ed82fee3 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -657,6 +657,8 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt newStyle = !qobject_cast(view); selectionBehavior = view->selectionBehavior(); selectionMode = view->selectionMode(); + } else if (!widget) { + newStyle = !QStyleHelper::hasAncestor(option->styleObject, QAccessible::MenuItem) ; } if (newStyle && (vopt = qstyleoption_cast(option))) { -- cgit v1.2.3 From bf36986f5060c0e8b0151b49e416ba6a18ec4a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Mon, 13 Jul 2015 06:55:41 -0700 Subject: ssl: improve SecureTransport error logging This improves SecureTransport logging consistency: - include error code in SSL error when a native backend call fails - use qt.network.ssl category for debug / warning messages - do not use duplicate qWarning when error is already reported via QSslError Change-Id: I52d457b11f0cef2cc3579305e457663b61b92f3f Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslsocket_mac.cpp | 87 ++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 42 deletions(-) diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index 10a9c0b7e9..b83e56c29e 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -33,6 +33,7 @@ #include "qsslsocket.h" +#include "qssl_p.h" #include "qsslsocket_mac_p.h" #include "qasn1element_p.h" #include "qsslcertificate_p.h" @@ -93,7 +94,7 @@ static OSStatus _q_SSLRead(QTcpSocket *plainSocket, char *data, size_t *dataLeng const qint64 bytes = plainSocket->read(data, *dataLength); #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "read" << bytes; + qCDebug(lcSsl) << plainSocket << "read" << bytes; #endif if (bytes < 0) { *dataLength = 0; @@ -114,7 +115,7 @@ static OSStatus _q_SSLWrite(QTcpSocket *plainSocket, const char *data, size_t *d const qint64 bytes = plainSocket->write(data, *dataLength); #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "write" << bytes; + qCDebug(lcSsl) << plainSocket << "write" << bytes; #endif if (bytes < 0) { *dataLength = 0; @@ -166,7 +167,7 @@ void QSslSocketPrivate::ensureInitialized() if (!s_loadRootCertsOnDemand) setDefaultCaCertificates(systemCaCertificates()); } else { - qWarning() << Q_FUNC_INFO << "SSLCreateContext failed"; + qCWarning(lcSsl) << "SSLCreateContext failed"; s_loadedCiphersAndCerts = false; } @@ -225,7 +226,7 @@ QList QSslSocketPrivate::systemCaCertificates() } } else { // no detailed error handling here - qWarning("could not retrieve system CA certificates"); + qCWarning(lcSsl) << "SecTrustSettingsCopyCertificates failed:" << status; } #endif return systemCerts; @@ -244,7 +245,7 @@ QSslSocketBackendPrivate::~QSslSocketBackendPrivate() void QSslSocketBackendPrivate::continueHandshake() { #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "connection encrypted"; + qCDebug(lcSsl) << plainSocket << "connection encrypted"; #endif Q_Q(QSslSocket); connectionEncrypted = true; @@ -291,8 +292,7 @@ QSsl::SslProtocol QSslSocketBackendPrivate::sessionProtocol() const SSLProtocol protocol = kSSLProtocolUnknown; const OSStatus err = SSLGetNegotiatedProtocolVersion(context, &protocol); if (err != noErr) { - qWarning() << Q_FUNC_INFO << "SSLGetNegotiatedProtocolVersion failed:" - << int(err); + qCWarning(lcSsl) << "SSLGetNegotiatedProtocolVersion failed:" << err; return QSsl::UnknownProtocol; } @@ -356,9 +356,12 @@ void QSslSocketBackendPrivate::transmit() const size_t nextDataBlockSize = writeBuffer.nextDataBlockSize(); size_t writtenBytes = 0; const OSStatus err = SSLWrite(context, writeBuffer.readPointer(), nextDataBlockSize, &writtenBytes); +#ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "SSLWrite returned" << err; +#endif if (err != noErr && err != errSSLWouldBlock) { - qWarning() << Q_FUNC_INFO << "SSL write failed with error:" << int(err); - setError("SSL write failed", QAbstractSocket::SslInternalError); + setError(QStringLiteral("SSLWrite failed: %1").arg(err), + QAbstractSocket::SslInternalError); break; } @@ -387,14 +390,17 @@ void QSslSocketBackendPrivate::transmit() size_t readBytes = 0; data.resize(4096); const OSStatus err = SSLRead(context, data.data(), data.size(), &readBytes); +#ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "SSLRead returned" << err; +#endif if (err == errSSLClosedGraceful) { shutdown = true; // the other side shut down, make sure we do not send shutdown ourselves setError(QSslSocket::tr("The TLS/SSL connection has been closed"), QAbstractSocket::RemoteHostClosedError); break; } else if (err != noErr && err != errSSLWouldBlock) { - qWarning() << Q_FUNC_INFO << "SSLRead failed with:" << int(err); - setError("SSL read failed", QAbstractSocket::SslInternalError); + setError(QStringLiteral("SSLRead failed: %1").arg(err), + QAbstractSocket::SslInternalError); break; } @@ -601,7 +607,7 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui } else if (ciph.d->name.startsWith("ECDH-") || ciph.d->name.startsWith("ECDHE-")) { ciph.d->keyExchangeMethod = QLatin1String("ECDH"); } else { - qWarning() << Q_FUNC_INFO << "Unknown Kx" << ciph.d->name; + qCWarning(lcSsl) << "Unknown Kx" << ciph.d->name; } if (bits.size() == 2 || bits.size() == 3) { @@ -611,7 +617,7 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui } else if (ciph.d->name.contains("-RSA-")) { ciph.d->authenticationMethod = QLatin1String("RSA"); } else { - qWarning() << Q_FUNC_INFO << "Unknown Au" << ciph.d->name; + qCWarning(lcSsl) << "Unknown Au" << ciph.d->name; } if (ciph.d->name.contains("RC4-")) { @@ -633,7 +639,7 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSLCipherSuite(SSLCipherSui } else if (ciph.d->name.contains("NULL-")) { ciph.d->encryptionMethod = QLatin1String("NULL"); } else { - qWarning() << Q_FUNC_INFO << "Unknown Enc" << ciph.d->name; + qCWarning(lcSsl) << "Unknown Enc" << ciph.d->name; } } return ciph; @@ -652,7 +658,6 @@ bool QSslSocketBackendPrivate::initSslContext() context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType); if (!context) { - qWarning() << Q_FUNC_INFO << "SSLCreateContext failed"; setError("SSLCreateContext failed", QAbstractSocket::SslInternalError); return false; } @@ -660,9 +665,9 @@ bool QSslSocketBackendPrivate::initSslContext() const OSStatus err = SSLSetIOFuncs(context, reinterpret_cast(&_q_SSLRead), reinterpret_cast(&_q_SSLWrite)); if (err != noErr) { - qWarning() << Q_FUNC_INFO << "SSLSetIOFuncs failed with error " << int(err); destroySslContext(); - setError("SSLSetIOFuncs failed", QAbstractSocket::SslInternalError); + setError(QStringLiteral("SSLSetIOFuncs failed: %1").arg(err), + QAbstractSocket::SslInternalError); return false; } @@ -680,7 +685,6 @@ bool QSslSocketBackendPrivate::initSslContext() } if (!setSessionProtocol()) { - qWarning() << Q_FUNC_INFO << "failed to set protocol version"; destroySslContext(); setError("Failed to set protocol version", QAbstractSocket::SslInternalError); return false; @@ -693,7 +697,6 @@ bool QSslSocketBackendPrivate::initSslContext() // But for OS X versions below 10.8 we have to do it explicitly: const OSStatus err = SSLSetEnableCertVerify(context, false); if (err != noErr) { - qWarning() << Q_FUNC_INFO << "SSLSetEnableCertVerify failed:" << int(err); destroySslContext(); setError(QStringLiteral("SSLSetEnableCertVerify failed: %1").arg(err), QSslSocket::SslInternalError); @@ -716,7 +719,6 @@ bool QSslSocketBackendPrivate::initSslContext() err = SSLSetSessionOption(context, kSSLSessionOptionBreakOnCertRequested, true); if (err != noErr) { - qWarning() << Q_FUNC_INFO << "SSLSetSessionOption failed:" << int(err); destroySslContext(); setError(QStringLiteral("SSLSetSessionOption failed: %1").arg(err), QSslSocket::SslInternalError); @@ -734,7 +736,6 @@ bool QSslSocketBackendPrivate::initSslContext() } if (err != noErr) { - qWarning() << Q_FUNC_INFO << "failed to set SSL context option in server mode"; destroySslContext(); setError(QStringLiteral("failed to set SSL context option in server mode: %1").arg(err), QAbstractSocket::SslInternalError); @@ -786,7 +787,7 @@ bool QSslSocketBackendPrivate::setSessionCertificate(QString &errorDescription, OSStatus err = SecPKCS12Import(pkcs12, options, &items); if (err != noErr) { #ifdef QSSLSOCKET_DEBUG - qWarning() << Q_FUNC_INFO << plainSocket + qCWarning(lcSsl) << plainSocket << QStringLiteral("SecPKCS12Import failed: %1").arg(err); #endif errorCode = QAbstractSocket::SslInvalidUserDataError; @@ -796,7 +797,7 @@ bool QSslSocketBackendPrivate::setSessionCertificate(QString &errorDescription, if (!CFArrayGetCount(items)) { #ifdef QSSLSOCKET_DEBUG - qWarning() << Q_FUNC_INFO << plainSocket << "SecPKCS12Import returned no items"; + qCWarning(lcSsl) << plainSocket << "SecPKCS12Import returned no items"; #endif errorCode = QAbstractSocket::SslInvalidUserDataError; errorDescription = QStringLiteral("SecPKCS12Import returned no items"); @@ -807,7 +808,7 @@ bool QSslSocketBackendPrivate::setSessionCertificate(QString &errorDescription, SecIdentityRef identity = (SecIdentityRef)CFDictionaryGetValue(import, kSecImportItemIdentity); if (!identity) { #ifdef QSSLSOCKET_DEBUG - qWarning() << Q_FUNC_INFO << plainSocket << "SecPKCS12Import returned no identity"; + qCWarning(lcSsl) << plainSocket << "SecPKCS12Import returned no identity"; #endif errorCode = QAbstractSocket::SslInvalidUserDataError; errorDescription = QStringLiteral("SecPKCS12Import returned no identity"); @@ -832,7 +833,7 @@ bool QSslSocketBackendPrivate::setSessionCertificate(QString &errorDescription, err = SSLSetCertificate(context, certs); if (err != noErr) { #ifdef QSSLSOCKET_DEBUG - qWarning() << Q_FUNC_INFO << plainSocket + qCWarning(lcSsl) << plainSocket << QStringLiteral("Cannot set certificate and key: %1").arg(err); #endif errorCode = QAbstractSocket::SslInvalidUserDataError; @@ -856,41 +857,41 @@ bool QSslSocketBackendPrivate::setSessionProtocol() // return errSSLIllegalParam; // where MINIMUM_STREAM_VERSION is SSL_Version_3_0, MAXIMUM_STREAM_VERSION is TLS_Version_1_2. if (configuration.protocol == QSsl::SslV2) { - qDebug() << Q_FUNC_INFO << "protocol QSsl::SslV2 is disabled"; + qCDebug(lcSsl) << "protocol QSsl::SslV2 is disabled"; return false; } if (configuration.protocol == QSsl::SslV3) { #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "requesting : SSLv3"; + qCDebug(lcSsl) << plainSocket << "requesting : SSLv3"; #endif err = SSLSetProtocolVersionMin(context, kSSLProtocol3); if (err == noErr) err = SSLSetProtocolVersionMax(context, kSSLProtocol3); } else if (configuration.protocol == QSsl::TlsV1_0) { #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1.0"; + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.0"; #endif err = SSLSetProtocolVersionMin(context, kTLSProtocol1); if (err == noErr) err = SSLSetProtocolVersionMax(context, kTLSProtocol1); } else if (configuration.protocol == QSsl::TlsV1_1) { #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1.1"; + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1"; #endif err = SSLSetProtocolVersionMin(context, kTLSProtocol11); if (err == noErr) err = SSLSetProtocolVersionMax(context, kTLSProtocol11); } else if (configuration.protocol == QSsl::TlsV1_2) { #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1.2"; + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2"; #endif err = SSLSetProtocolVersionMin(context, kTLSProtocol12); if (err == noErr) err = SSLSetProtocolVersionMax(context, kTLSProtocol12); } else if (configuration.protocol == QSsl::AnyProtocol) { #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "requesting : any"; + qCDebug(lcSsl) << plainSocket << "requesting : any"; #endif // kSSLProtocol3, since kSSLProtocol2 is disabled: err = SSLSetProtocolVersionMin(context, kSSLProtocol3); @@ -898,41 +899,43 @@ bool QSslSocketBackendPrivate::setSessionProtocol() err = SSLSetProtocolVersionMax(context, kTLSProtocol12); } else if (configuration.protocol == QSsl::TlsV1SslV3) { #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "requesting : SSLv3 - TLSv1.2"; + qCDebug(lcSsl) << plainSocket << "requesting : SSLv3 - TLSv1.2"; #endif err = SSLSetProtocolVersionMin(context, kSSLProtocol3); if (err == noErr) err = SSLSetProtocolVersionMax(context, kTLSProtocol12); } else if (configuration.protocol == QSsl::SecureProtocols) { #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1 - TLSv1.2"; + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2"; #endif err = SSLSetProtocolVersionMin(context, kTLSProtocol1); if (err == noErr) err = SSLSetProtocolVersionMax(context, kTLSProtocol12); } else if (configuration.protocol == QSsl::TlsV1_0OrLater) { #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1 - TLSv1.2"; + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2"; #endif err = SSLSetProtocolVersionMin(context, kTLSProtocol1); if (err == noErr) err = SSLSetProtocolVersionMax(context, kTLSProtocol12); } else if (configuration.protocol == QSsl::TlsV1_1OrLater) { #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1.1 - TLSv1.2"; + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1 - TLSv1.2"; #endif err = SSLSetProtocolVersionMin(context, kTLSProtocol11); if (err == noErr) err = SSLSetProtocolVersionMax(context, kTLSProtocol12); } else if (configuration.protocol == QSsl::TlsV1_2OrLater) { #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "requesting : TLSv1.2"; + qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2"; #endif err = SSLSetProtocolVersionMin(context, kTLSProtocol12); if (err == noErr) err = SSLSetProtocolVersionMax(context, kTLSProtocol12); } else { - qDebug() << Q_FUNC_INFO << "no protocol version found in the configuration"; +#ifdef QSSLSOCKET_DEBUG + qCDebug(lcSsl) << plainSocket << "no protocol version found in the configuration"; +#endif return false; } @@ -1002,7 +1005,8 @@ bool QSslSocketBackendPrivate::verifyPeerTrust() if (err != noErr) { // We can not ignore this, it's not even about trust verification // probably ... - setError("SecTrustEvaluate failed", QAbstractSocket::SslHandshakeFailedError); + setError(QStringLiteral("SecTrustEvaluate failed: %1").arg(err), + QAbstractSocket::SslHandshakeFailedError); plainSocket->disconnectFromHost(); return false; } @@ -1137,7 +1141,7 @@ bool QSslSocketBackendPrivate::startHandshake() OSStatus err = SSLHandshake(context); #ifdef QSSLSOCKET_DEBUG - qDebug() << Q_FUNC_INFO << plainSocket << "SSLHandhake returned" << err; + qCDebug(lcSsl) << plainSocket << "SSLHandhake returned" << err; #endif if (err == errSSLWouldBlock) { @@ -1158,7 +1162,6 @@ bool QSslSocketBackendPrivate::startHandshake() // setSessionCertificate does not fail if we have no certificate. // Failure means a real error (invalid certificate, no private key, etc). if (!setSessionCertificate(errorDescription, errorCode)) { - qWarning() << Q_FUNC_INFO << "Failed to provide a client certificate"; setError(errorDescription, errorCode); return false; } else { @@ -1174,7 +1177,7 @@ bool QSslSocketBackendPrivate::startHandshake() return startHandshake(); } - setError(QStringLiteral("Error during SSL handshake: %1").arg(err), + setError(QStringLiteral("SSLHandshake failed: %1").arg(err), QAbstractSocket::SslHandshakeFailedError); plainSocket->disconnectFromHost(); return false; @@ -1182,7 +1185,7 @@ bool QSslSocketBackendPrivate::startHandshake() // Connection aborted during handshake phase. if (q->state() != QAbstractSocket::ConnectedState) { - qDebug() << Q_FUNC_INFO << "connection aborted"; + qCDebug(lcSsl) << "connection aborted"; return false; } -- cgit v1.2.3 From f2634c3a48ead400867566a20c2e03b2ec901983 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Sat, 11 Jul 2015 09:56:35 +0100 Subject: Fix crash in QOpenGLTexture Any function using the non-dsa helpers and glTextureParameterf() would crash as this code path failed to initialize the function pointers. Task-number: QTBUG-47133 Change-Id: I8970c9693ec471a96b135ae5728ab6407ee06a6f Reviewed-by: Mike Krus Reviewed-by: Giuseppe D'Angelo --- src/gui/opengl/qopengltexturehelper.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp index 440fdad081..bf8b514449 100644 --- a/src/gui/opengl/qopengltexturehelper.cpp +++ b/src/gui/opengl/qopengltexturehelper.cpp @@ -101,6 +101,8 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) // Use our own DSA emulation TextureParameteri = &QOpenGLTextureHelper::qt_TextureParameteri; TextureParameteriv = &QOpenGLTextureHelper::qt_TextureParameteriv; + TextureParameterf = &QOpenGLTextureHelper::qt_TextureParameterf; + TextureParameterfv = &QOpenGLTextureHelper::qt_TextureParameterfv; GenerateTextureMipmap = &QOpenGLTextureHelper::qt_GenerateTextureMipmap; TextureStorage3D = &QOpenGLTextureHelper::qt_TextureStorage3D; TextureStorage2D = &QOpenGLTextureHelper::qt_TextureStorage2D; -- cgit v1.2.3 From 0dd14aaaf15181731bb79f9f7f925560482a60c5 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 1 Jul 2015 14:08:07 +0200 Subject: Define friend functions of QSslEllipticCurve outside of class Define both qHash() and operator==() outside of the class, like it is already done for operator!=(). Defining it inside the class limits it to argument-dependent lookup, which in turn means that the lookup rules for operator!= and operator== were slightly different (e.g. if one would compare variables of a type that is implicitly convertible to QSslEllipticCurve). As a side-effect, this also fixes a qdoc warning. Change-Id: I40ab2f8cd2b6b5f42481dd254229a88b678f3f15 Reviewed-by: Marc Mutz --- src/network/ssl/qsslellipticcurve.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/network/ssl/qsslellipticcurve.h b/src/network/ssl/qsslellipticcurve.h index 63ab2f3c37..a991881b93 100644 --- a/src/network/ssl/qsslellipticcurve.h +++ b/src/network/ssl/qsslellipticcurve.h @@ -68,10 +68,8 @@ public: private: int id; - friend Q_DECL_CONSTEXPR bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW - { return lhs.id == rhs.id; } - friend Q_DECL_CONSTEXPR uint qHash(QSslEllipticCurve curve, uint seed) Q_DECL_NOTHROW - { return qHash(curve.id, seed); } + friend Q_DECL_CONSTEXPR bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW; + friend Q_DECL_CONSTEXPR uint qHash(QSslEllipticCurve curve, uint seed) Q_DECL_NOTHROW; friend class QSslSocketPrivate; friend class QSslSocketBackendPrivate; @@ -79,6 +77,12 @@ private: Q_DECLARE_TYPEINFO(QSslEllipticCurve, Q_PRIMITIVE_TYPE); +Q_DECL_CONSTEXPR inline uint qHash(QSslEllipticCurve curve, uint seed) Q_DECL_NOTHROW +{ return qHash(curve.id, seed); } + +Q_DECL_CONSTEXPR inline bool operator==(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW +{ return lhs.id == rhs.id; } + Q_DECL_CONSTEXPR inline bool operator!=(QSslEllipticCurve lhs, QSslEllipticCurve rhs) Q_DECL_NOTHROW { return !operator==(lhs, rhs); } -- cgit v1.2.3 From fa22138afd8c9f3c97735b61f72f61580fa94091 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Fri, 10 Jul 2015 14:44:48 +0900 Subject: Add warning for malformed logging rule Change-Id: I58ccbb77e5ab62e4114a271f199797dd1307a676 Reviewed-by: Kai Koehne --- src/corelib/io/qloggingregistry.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 7f2ce319ee..11fe32529f 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -210,20 +210,23 @@ void QLoggingSettingsParser::setContent(QTextStream &stream) if (_section == QLatin1String("Rules")) { int equalPos = line.indexOf(QLatin1Char('=')); - if ((equalPos != -1) - && (line.lastIndexOf(QLatin1Char('=')) == equalPos)) { - const QStringRef pattern = line.leftRef(equalPos); - const QStringRef valueStr = line.midRef(equalPos + 1); - int value = -1; - if (valueStr == QLatin1String("true")) - value = 1; - else if (valueStr == QLatin1String("false")) - value = 0; - QLoggingRule rule(pattern, (value == 1)); - if (rule.flags != 0 && (value != -1)) - _rules.append(rule); - else + if (equalPos != -1) { + if (line.lastIndexOf(QLatin1Char('=')) == equalPos) { + const QStringRef pattern = line.leftRef(equalPos); + const QStringRef valueStr = line.midRef(equalPos + 1); + int value = -1; + if (valueStr == QLatin1String("true")) + value = 1; + else if (valueStr == QLatin1String("false")) + value = 0; + QLoggingRule rule(pattern, (value == 1)); + if (rule.flags != 0 && (value != -1)) + _rules.append(rule); + else + warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData()); + } else { warnMsg("Ignoring malformed logging rule: '%s'", line.toUtf8().constData()); + } } } } -- cgit v1.2.3 From 1e2cc518cc28760517a6633af5023546c73ffe75 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 26 Jun 2015 10:00:06 +0200 Subject: Fix broken gpu blacklist matching in the windows plugin Task-number: QTBUG-46868 Change-Id: I70db75291d17dbb2c4db4cfed6c31dc48ab398d7 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsopengltester.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index 2e6a43f596..810fddbca7 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -224,7 +224,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c #elif defined(Q_OS_WINCE) return QWindowsOpenGLTester::Gles; #else - QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.deviceId, gpu.vendorId, gpu.driverVersion); + QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.vendorId, gpu.deviceId, gpu.driverVersion); SupportedRenderersCache *srCache = supportedRenderersCache(); SupportedRenderersCache::const_iterator it = srCache->find(qgpu); if (it != srCache->cend()) -- cgit v1.2.3 From 11ed83640348da7f88095db0f00343388449ac17 Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Tue, 7 Jul 2015 16:12:41 +0200 Subject: Doc: Updated online template with the latest footer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib3d074b21012e6a7dcc8fba7ed5ce2bfefd31681 Reviewed-by: Leena Miettinen Reviewed-by: Topi Reiniö --- doc/global/html-footer-online.qdocconf | 63 +++++++++++++++++----------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/doc/global/html-footer-online.qdocconf b/doc/global/html-footer-online.qdocconf index fca4d65808..18022cabff 100644 --- a/doc/global/html-footer-online.qdocconf +++ b/doc/global/html-footer-online.qdocconf @@ -11,55 +11,54 @@ HTML.footer += \ "
    \n" \ "
    \n" \ " \n" \ -- cgit v1.2.3 From 3aa5ef2ea92ccede193b89acc2ba7194a04df17d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Jul 2015 11:30:21 -0700 Subject: Disable thread-safe statics for MSVC 2015: they're broken An object that throws in its constructor cannot be reentered. This violates both C++11 and C++98. It's also a regression from MSVC 2013. The unit test is renamed to indicate what it really does, as opposed to a misleading name that was probably a "thinko" on my part. Task-number: QTBUG-47224 Change-Id: Ib306f8f647014b399b87ffff13f132436d0578ef Reviewed-by: Friedemann Kleint --- src/corelib/global/qcompilerdetection.h | 3 ++- tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 060af29b03..48cef863c5 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -890,7 +890,8 @@ # define Q_COMPILER_RANGE_FOR # define Q_COMPILER_REF_QUALIFIERS # define Q_COMPILER_THREAD_LOCAL -# define Q_COMPILER_THREADSAFE_STATICS +// Broken, see QTBUG-47224 and https://connect.microsoft.com/VisualStudio/feedback/details/1549785 +//# define Q_COMPILER_THREADSAFE_STATICS # define Q_COMPILER_UDL # define Q_COMPILER_UNICODE_STRINGS // Uniform initialization is not working yet -- build errors with QUuid diff --git a/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp b/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp index e6b2f8a116..a1cfff7e85 100644 --- a/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp +++ b/tests/auto/corelib/global/qglobalstatic/tst_qglobalstatic.cpp @@ -50,7 +50,7 @@ private Q_SLOTS: void api(); void constVolatile(); void exception(); - void threadedException(); + void catchExceptionAndRetry(); void threadStressTest(); void afterDestruction(); }; @@ -142,7 +142,7 @@ void tst_QGlobalStatic::exception() QBasicAtomicInt exceptionControlVar = Q_BASIC_ATOMIC_INITIALIZER(1); Q_GLOBAL_STATIC_WITH_ARGS(ThrowingType, exceptionGS, (exceptionControlVar)) -void tst_QGlobalStatic::threadedException() +void tst_QGlobalStatic::catchExceptionAndRetry() { if (exceptionControlVar.load() != 1) QSKIP("This test cannot be run more than once"); -- cgit v1.2.3 From cf3a639f9d7f6325f3d0606b7f90cbc3c4450d96 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Jul 2015 13:35:28 -0700 Subject: Improve ICC compatibility with older MSVC versions (up to 2010) Like on OS X and Linux, ICC uses the native compiler's standard library headers, so the C++11 features that depend on headers need special attention. * is missing with MSVC 2012. It is present on 2010 for some reason and it appears to work * ICC disables Unicode string support prior to MSVC 2015, probably because MSVC Standard Library headers have a typedef for char16_t std::nullptr and std::move should have come with MSVC 2010, but I'm not keeping compatibility with MSVC 2008. It's been deprecated since ICC 14.0 (Composer XE 2013 SP1, released in 2013) and support was removed in 15.0 (Composer XE 2015, released in 2014). ICC hasn't supported MSVC 2005 since ICC 13.0 (Composer XE 2013). Task-number: QTBUG-47119 Change-Id: Ib306f8f647014b399b87ffff13f139174aeeafff Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Rafael Roquetto --- src/corelib/global/qcompilerdetection.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 48cef863c5..84afea0960 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -564,6 +564,16 @@ # endif # define Q_COMPILER_UDL # endif +# ifdef _MSC_VER +# if _MSC_VER == 1700 +// is missing with MSVC 2012 (it's present in 2010, 2013 and up) +# undef Q_COMPILER_INITIALIZER_LISTS +# endif +# if _MSC_VER < 1900 +// ICC disables unicode string support when compatibility mode with MSVC 2013 or lower is active +# undef Q_COMPILER_UNICODE_STRINGS +# endif +# endif # endif #endif -- cgit v1.2.3 From 7714ef7406c89a3257a49567b3cda15786c032d6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Jul 2015 14:10:07 -0700 Subject: Set Q_CC_INTEL to the ICC version when in MSVC compat mode Commit ffcad3244ff6e2429da1bf985d6d1116c251c2ec did that for the GCC- compat mode, but I forgot the MSVC one. Change-Id: Ib1d49f003062638b4e27e5ead4554e25f539c373 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/global/qcompilerdetection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 84afea0960..c582b1f238 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -97,7 +97,7 @@ /* Intel C++ disguising as Visual C++: the `using' keyword avoids warnings */ # if defined(__INTEL_COMPILER) # define Q_DECL_VARIABLE_DEPRECATED -# define Q_CC_INTEL +# define Q_CC_INTEL __INTEL_COMPILER # endif /* only defined for MSVC since that's the only compiler that actually optimizes for this */ -- cgit v1.2.3 From a847c2cb61dc58e35e6dbcce7067aa1ae10291fc Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 10 Jul 2015 15:06:42 +0200 Subject: Stabilize tst_QTouchEvent::touchBeginWithGraphicsWidget(). The test sends touch events to the root item at the top left corner which fails if the views starts to scroll. Make the view sufficiently large to prevent scrolling and align at top left. FAIL! : tst_QTouchEvent::touchBeginWithGraphicsWidget() Compared values are not the same Actual (((root->touchBeginCounter))): 0 Expected (1) : 1 Loc: [/work/build/qt/qtbase/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp(1471)] Change-Id: I357322ccc809ddb5cb587febf3c75cbe497e59d8 Reviewed-by: Simon Hausmann --- tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index aa1f573aa9..fd3cfd55ff 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -170,7 +170,10 @@ public: } QRectF boundingRect() const Q_DECL_OVERRIDE { return QRectF(0, 0, 10, 10); } - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE { } + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE + { + painter->fillRect(QRectF(QPointF(0, 0), boundingRect().size()), Qt::yellow); + } bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE { @@ -1446,6 +1449,7 @@ void tst_QTouchEvent::touchBeginWithGraphicsWidget() { QGraphicsScene scene; QGraphicsView view(&scene); + view.setWindowTitle(QTest::currentTestFunction()); QScopedPointer root(new tst_QTouchEventGraphicsItem); root->setAcceptTouchEvents(true); scene.addItem(root.data()); @@ -1454,10 +1458,13 @@ void tst_QTouchEvent::touchBeginWithGraphicsWidget() glassWidget->setMinimumSize(100, 100); scene.addItem(glassWidget.data()); - view.resize(200, 200); + view.setAlignment(Qt::AlignLeft | Qt::AlignTop); + const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry(); + view.resize(availableGeometry.size() - QSize(100, 100)); + view.move(availableGeometry.topLeft() + QPoint(50, 50)); + view.fitInView(scene.sceneRect()); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - view.fitInView(scene.sceneRect()); QTest::touchEvent(&view, touchScreenDevice) .press(0, view.mapFromScene(root->mapToScene(3,3)), view.viewport()); -- cgit v1.2.3 From 2a289d19472b196b267d8747dcb23b20b82e1997 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 10 Jul 2015 15:27:27 +0200 Subject: Stabilize tst_QApplication::touchEventPropagation(). The test checks whether a child window receives mouse events synthesizes from touch. Enlarge the child window so that it fully covers the parent and move the touch point a bit inside so that it is not affected by window manager positioning issues. Use QTRY_VERIFY. FAIL! : tst_QApplication::touchEventPropagation() 'widget.seenMouseEvent' returned FALSE. () Loc: [/work/build/qt/qtbase/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp(2107)] Change-Id: Ic08e68b1e547cc7148cd8994464fdc2a14ac507b Reviewed-by: Simon Hausmann --- tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 15532bf4fd..84956d0a02 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -2088,11 +2088,12 @@ void tst_QApplication::touchEventPropagation() window.resize(200, 200); window.setObjectName("2. window"); TouchEventPropagationTestWidget widget(&window); + widget.resize(200, 200); widget.setObjectName("2. widget"); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - pressedTouchPoints[0].setScreenPos(window.mapToGlobal(QPoint(0, 0))); - releasedTouchPoints[0].setScreenPos(window.mapToGlobal(QPoint(0, 0))); + pressedTouchPoints[0].setScreenPos(window.mapToGlobal(QPoint(50, 50))); + releasedTouchPoints[0].setScreenPos(window.mapToGlobal(QPoint(50, 50))); QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, @@ -2102,9 +2103,8 @@ void tst_QApplication::touchEventPropagation() 0, device, touchPointList(releasedTouchPoints)); - QCoreApplication::processEvents(); + QTRY_VERIFY(widget.seenMouseEvent); QVERIFY(!widget.seenTouchEvent); - QVERIFY(widget.seenMouseEvent); QVERIFY(!window.seenTouchEvent); QVERIFY(window.seenMouseEvent); -- cgit v1.2.3 From 769047fbc7efd2794a6feda7f32bda33e14cc62d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 16 Jul 2015 01:16:30 -0700 Subject: configure: properly quote the test name containing spaces Such as "OpenGL ES 2.0" Change-Id: Ib306f8f647014b399b87ffff13f15f58c84a12ae Reviewed-by: Oswald Buddenhagen --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 9a64b563e1..c59072ee4c 100755 --- a/configure +++ b/configure @@ -4236,7 +4236,7 @@ compileTestWithPkgConfig() libdir_mod=`echo $libdir_raw | sed -e 's,^-L,,g' -e 's, -L, ,g'` has_used_pkg_config="yes" fi - if compileTest $configtest $configtest_name $libdir_raw $incdir_raw $libs $cflags "$@"; then + if compileTest $configtest "$configtest_name" $libdir_raw $incdir_raw $libs $cflags "$@"; then if [ "$has_used_pkg_config" = "yes" ] && [ -n "$qmake_postfix" ]; then QMakeVar set QMAKE_INCDIR_$qmake_postfix "`shellArgumentListToQMakeList $incdir_mod`" QMakeVar set QMAKE_LIBDIR_$qmake_postfix "`shellArgumentListToQMakeList $libdir_mod`" -- cgit v1.2.3 From d0813bfa6a9ed33ac7f9887e6e979bcde1ed5817 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 30 Nov 2014 21:26:31 -0800 Subject: Update the list of compilers we are free of warnings with MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I've tested with GCC 5, Clang 3.5 and 3.6 on Linux. Change-Id: Ia0aac2f09e9245339951ffff13c87198f2e8aa35 Reviewed-by: Sérgio Martins Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- mkspecs/features/qt_common.prf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf index 5861941848..55f65b5526 100644 --- a/mkspecs/features/qt_common.prf +++ b/mkspecs/features/qt_common.prf @@ -48,10 +48,10 @@ warnings_are_errors:warning_clean { # compiler. clang { # Apple clang 4.0-4.2,5.0-5.1 - # Regular clang 3.3 & 3.4 + # Regular clang 3.3-3.6 apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION} reg_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION} - contains(apple_ver, "4\\.[012]|5\\.[01]")|contains(reg_ver, "3\\.[34]") { + contains(apple_ver, "4\\.[012]|5\\.[01]")|contains(reg_ver, "3\\.[3-6]") { QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=\\$${LITERAL_HASH}warnings -Wno-error=deprecated-declarations $$WERROR } } else:intel_icc:linux { @@ -67,9 +67,9 @@ warnings_are_errors:warning_clean { QMAKE_CXXFLAGS_WARN_ON += -Werror -ww177,1224,1478,1881 $$WERROR } } else:gcc:!clang:!intel_icc { - # GCC 4.6-4.9 + # GCC 4.6-4.9, 5.x ver = $${QT_GCC_MAJOR_VERSION}.$${QT_GCC_MINOR_VERSION} - contains(ver, "4\\.[6789]") { + contains(ver, "(4\\.[6789]|5\\..)") { QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=cpp -Wno-error=deprecated-declarations $$WERROR # GCC prints this bogus warning, after it has inlined a lot of code -- cgit v1.2.3 From 78d8759b0470477942ce8a4b0b44db950ff6d036 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 13 Mar 2015 16:38:02 -0700 Subject: configure: Initialize variables for the EGLFS backends Otherwise the information is missing from configure's output summary: EGLFS ................ no EGLFS i.MX6....... . EGLFS KMS .......... no EGLFS Mali ......... EGLFS Raspberry Pi . EGLFS X11 .......... no Change-Id: Iee8cbc07c4434ce9b560ffff13cb331778c70261 Reviewed-by: Laszlo Agocs Reviewed-by: Oswald Buddenhagen --- configure | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure b/configure index c59072ee4c..cea62fbc0c 100755 --- a/configure +++ b/configure @@ -682,6 +682,9 @@ CFG_XCB=auto CFG_XCB_XLIB=auto CFG_XCB_GLX=no CFG_EGLFS=auto +CFG_EGLFS_BRCM=no +CFG_EGLFS_MALI=no +CFG_EGLFS_VIV=no CFG_DIRECTFB=auto CFG_LINUXFB=auto CFG_KMS=auto -- cgit v1.2.3 From 0d9db5821c9894d415a12ce204b4e0020dbbc487 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Jul 2015 15:44:49 -0700 Subject: configure.bat: Search for icl.exe before cl.exe The Intel compiler's compilervars.bat also puts the MSVC compiler in PATH, so cl.exe was always being found first. Change-Id: I72e524da10fb0e221c4530a3e5c1a4a347c3f878 Reviewed-by: Oswald Buddenhagen --- configure.bat | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/configure.bat b/configure.bat index 0f0638b3db..8c0819aeb5 100644 --- a/configure.bat +++ b/configure.bat @@ -60,16 +60,16 @@ if errorlevel 1 goto exit echo #### Generated by configure.bat - DO NOT EDIT! ####> Makefile echo/>> Makefile for /f "tokens=3 usebackq" %%V in (`findstr QT_VERSION_STR %QTSRC%src\corelib\global\qglobal.h`) do @echo QTVERSION = %%~V>> Makefile -if not "%cl.exe%" == "" ( - echo CXX = cl>>Makefile - echo EXTRA_CXXFLAGS =>>Makefile +if not "%icl.exe%" == "" ( + echo CXX = icl>>Makefile + echo EXTRA_CXXFLAGS = /Zc:forScope>>Makefile rem This must have a trailing space. echo QTSRC = %QTSRC% >> Makefile set tmpl=win32 set make=nmake -) else if not "%icl.exe%" == "" ( - echo CXX = icl>>Makefile - echo EXTRA_CXXFLAGS = /Zc:forScope>>Makefile +) else if not "%cl.exe%" == "" ( + echo CXX = cl>>Makefile + echo EXTRA_CXXFLAGS =>>Makefile rem This must have a trailing space. echo QTSRC = %QTSRC% >> Makefile set tmpl=win32 -- cgit v1.2.3 From 8485fe9af8582e1f1a8b83f5865ccaaf409eb103 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 7 Jul 2015 16:43:05 -0700 Subject: Don't complain about non-matching Qt versions in qwidget.cpp Commit 5bf67f5f41ab110eb41ab74f2a87e649735af435 did it for qobject.cpp, but I missed qwidget.cpp (I hadn't realized the test existed there too). Change-Id: Ib056b47dde3341ef9a52ffff13eeceafcfc64893 Reviewed-by: Friedemann Kleint Reviewed-by: Marc Mutz Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/kernel/qwidget.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index bd77e7f616..b40d2fef5d 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -289,8 +289,15 @@ QWidgetPrivate::QWidgetPrivate(int version) return; } +#ifdef QT_BUILD_INTERNAL + // Don't check the version parameter in internal builds. + // This allows incompatible versions to be loaded, possibly for testing. + Q_UNUSED(version); +#else if (version != QObjectPrivateVersion) - qFatal("Cannot mix incompatible Qt libraries"); + qFatal("Cannot mix incompatible Qt library (version 0x%x) with this library (version 0x%x)", + version, QObjectPrivateVersion); +#endif isWidget = true; memset(high_attributes, 0, sizeof(high_attributes)); -- cgit v1.2.3 From 2dbe90c248cead9181188fae018773b1ab6eafca Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 7 Mar 2015 10:29:54 -0800 Subject: forkfd: update the API to add a reading and closing function Right now the two functions being added are just wrappers, but this will allow us in the future to support FreeBSD and Linux's system calls that do the equivalent of forkfd, but have slightly different semantics in the actual getting of the information from the file descriptor. See-Also: https://lkml.org/lkml/2015/3/12/1044 See-Also: http://www.freebsd.org/cgi/man.cgi?query=pdfork Change-Id: Ia0aac2f09e9245339951ffff13c94acb5f4ff204 Reviewed-by: Oswald Buddenhagen Reviewed-by: Rafael Roquetto Reviewed-by: Thiago Macieira --- src/3rdparty/forkfd/forkfd.c | 97 +++++++++++++++++++++++++++++----------- src/3rdparty/forkfd/forkfd.h | 10 ++++- src/corelib/io/qprocess_unix.cpp | 15 +++---- 3 files changed, 87 insertions(+), 35 deletions(-) diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c index 8d08f403ec..86e109358c 100644 --- a/src/3rdparty/forkfd/forkfd.c +++ b/src/3rdparty/forkfd/forkfd.c @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Intel Corporation +** Copyright (C) 2015 Intel Corporation ** Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com ** ** Permission is hereby granted, free of charge, to any person obtaining a copy @@ -31,6 +31,8 @@ #include "forkfd.h" #include +#include +#include #include #include #include @@ -38,6 +40,7 @@ #include #include #include +#include #include #ifdef __linux__ @@ -79,6 +82,12 @@ ret = call; \ } while (ret == -1 && errno == EINTR) +struct pipe_payload +{ + struct forkfd_info info; + struct rusage rusage; +}; + typedef struct process_info { ffd_atomic_int pid; @@ -179,33 +188,43 @@ static int isChildReady(pid_t pid, siginfo_t *info) } #endif -static int tryReaping(pid_t pid, siginfo_t *info) +static int tryReaping(pid_t pid, struct pipe_payload *payload) { /* reap the child */ #ifdef HAVE_WAITID if (waitid_works) { // we have waitid(2), which fills in siginfo_t for us - info->si_pid = 0; - return waitid(P_PID, pid, info, WEXITED | WNOHANG) == 0 && info->si_pid == pid; + siginfo_t info; + info.si_pid = 0; + int ret = waitid(P_PID, pid, &info, WEXITED | WNOHANG) == 0 && info.si_pid == pid; + if (!ret) + return ret; + + payload->info.code = info.si_code; + payload->info.status = info.si_status; +# ifdef __linux__ + payload->rusage.ru_utime.tv_sec = info.si_utime / CLOCKS_PER_SEC; + payload->rusage.ru_utime.tv_usec = info.si_utime % CLOCKS_PER_SEC; + payload->rusage.ru_stime.tv_sec = info.si_stime / CLOCKS_PER_SEC; + payload->rusage.ru_stime.tv_usec = info.si_stime % CLOCKS_PER_SEC; +# endif + return 1; } #endif - int status; if (waitpid(pid, &status, WNOHANG) <= 0) return 0; // child did not change state - info->si_signo = SIGCHLD; - info->si_pid = pid; if (WIFEXITED(status)) { - info->si_code = CLD_EXITED; - info->si_status = WEXITSTATUS(status); + payload->info.code = CLD_EXITED; + payload->info.status = WEXITSTATUS(status); } else if (WIFSIGNALED(status)) { - info->si_code = CLD_KILLED; + payload->info.code = CLD_KILLED; # ifdef WCOREDUMP if (WCOREDUMP(status)) - info->si_code = CLD_DUMPED; + payload->info.code = CLD_DUMPED; # endif - info->si_status = WTERMSIG(status); + payload->info.status = WTERMSIG(status); } return 1; @@ -220,10 +239,11 @@ static void freeInfo(Header *header, ProcessInfo *entry) assert(header->busyCount >= 0); } -static void notifyAndFreeInfo(Header *header, ProcessInfo *entry, siginfo_t *info) +static void notifyAndFreeInfo(Header *header, ProcessInfo *entry, + const struct pipe_payload *payload) { ssize_t ret; - EINTR_LOOP(ret, write(entry->deathPipe, info, sizeof(*info))); + EINTR_LOOP(ret, write(entry->deathPipe, payload, sizeof(*payload))); EINTR_LOOP(ret, close(entry->deathPipe)); freeInfo(header, entry); @@ -243,9 +263,11 @@ static void sigchld_handler(int signum) /* is this one of our children? */ BigArray *array; siginfo_t info; + struct pipe_payload payload; int i; memset(&info, 0, sizeof info); + memset(&payload, 0, sizeof payload); #ifdef HAVE_WAITID if (!waitid_works) @@ -275,8 +297,8 @@ search_next_child: FFD_ATOMIC_ACQUIRE, FFD_ATOMIC_RELAXED)) { /* this is our child, send notification and free up this entry */ /* ### FIXME: what if tryReaping returns false? */ - if (tryReaping(pid, &info)) - notifyAndFreeInfo(&children.header, &children.entries[i], &info); + if (tryReaping(pid, &payload)) + notifyAndFreeInfo(&children.header, &children.entries[i], &payload); goto search_next_child; } } @@ -290,8 +312,8 @@ search_next_child: FFD_ATOMIC_ACQUIRE, FFD_ATOMIC_RELAXED)) { /* this is our child, send notification and free up this entry */ /* ### FIXME: what if tryReaping returns false? */ - if (tryReaping(pid, &info)) - notifyAndFreeInfo(&array->header, &array->entries[i], &info); + if (tryReaping(pid, &payload)) + notifyAndFreeInfo(&array->header, &array->entries[i], &payload); goto search_next_child; } } @@ -321,9 +343,9 @@ search_arrays: continue; } #endif - if (tryReaping(pid, &info)) { + if (tryReaping(pid, &payload)) { /* this is our child, send notification and free up this entry */ - notifyAndFreeInfo(&children.header, &children.entries[i], &info); + notifyAndFreeInfo(&children.header, &children.entries[i], &payload); } } @@ -344,9 +366,9 @@ search_arrays: continue; } #endif - if (tryReaping(pid, &info)) { + if (tryReaping(pid, &payload)) { /* this is our child, send notification and free up this entry */ - notifyAndFreeInfo(&array->header, &array->entries[i], &info); + notifyAndFreeInfo(&array->header, &array->entries[i], &payload); } } @@ -626,7 +648,7 @@ int spawnfd(int flags, pid_t *ppid, const char *path, const posix_spawn_file_act { Header *header; ProcessInfo *info; - siginfo_t si; + struct pipe_payload payload; pid_t pid; int death_pipe[2]; int ret = -1; @@ -664,8 +686,8 @@ int spawnfd(int flags, pid_t *ppid, const char *path, const posix_spawn_file_act ffd_atomic_store(&info->pid, pid, FFD_ATOMIC_RELEASE); /* check if the child has already exited */ - if (tryReaping(pid, &si)) - notifyAndFreeInfo(header, info, &si); + if (tryReaping(pid, &payload)) + notifyAndFreeInfo(header, info, &payload); ret = death_pipe[0]; return ret; @@ -682,3 +704,28 @@ out: return -1; } #endif // _POSIX_SPAWN && !FORKFD_NO_SPAWNFD + + +int forkfd_wait(int ffd, forkfd_info *info, struct rusage *rusage) +{ + struct pipe_payload payload; + int ret; + + ret = read(ffd, &payload, sizeof(payload)); + if (ret == -1) + return ret; /* pass errno, probably EINTR, EBADF or EWOULDBLOCK */ + + assert(ret == sizeof(payload)); + if (info) + *info = payload.info; + if (rusage) + *rusage = payload.rusage; + + return 0; /* success */ +} + + +int forkfd_close(int ffd) +{ + return close(ffd); +} diff --git a/src/3rdparty/forkfd/forkfd.h b/src/3rdparty/forkfd/forkfd.h index b3ffe2bff3..dcb36f9f33 100644 --- a/src/3rdparty/forkfd/forkfd.h +++ b/src/3rdparty/forkfd/forkfd.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Intel Corporation +** Copyright (C) 2015 Intel Corporation ** ** Permission is hereby granted, free of charge, to any person obtaining a copy ** of this software and associated documentation files (the "Software"), to deal @@ -26,6 +26,7 @@ #define FORKFD_H #include +#include #include // to get the POSIX flags #ifdef _POSIX_SPAWN @@ -41,7 +42,14 @@ extern "C" { #define FFD_CHILD_PROCESS (-2) +struct forkfd_info { + int32_t code; + int32_t status; +}; + int forkfd(int flags, pid_t *ppid); +int forkfd_wait(int ffd, forkfd_info *info, struct rusage *rusage); +int forkfd_close(int ffd); #ifdef _POSIX_SPAWN /* only for spawnfd: */ diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 0fc9464f52..7b6da90b04 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -1091,20 +1091,17 @@ bool QProcessPrivate::waitForDeadChild() return true; // child has already exited // read the process information from our fd - siginfo_t info; - qint64 ret = qt_safe_read(forkfd, &info, sizeof info); - Q_ASSERT(ret == sizeof info); - Q_UNUSED(ret); + forkfd_info info; + int ret; + EINTR_LOOP(ret, forkfd_wait(forkfd, &info, Q_NULLPTR)); - Q_ASSERT(info.si_pid == pid_t(pid)); - - exitCode = info.si_status; - crashed = info.si_code != CLD_EXITED; + exitCode = info.status; + crashed = info.code != CLD_EXITED; delete deathNotifier; deathNotifier = 0; - qt_safe_close(forkfd); + EINTR_LOOP(ret, forkfd_close(forkfd)); forkfd = -1; // Child is dead, don't try to kill it anymore #if defined QPROCESS_DEBUG -- cgit v1.2.3 From d6553d2cd8a2bd84520363ee0c2b9c5c803b5543 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 16 Jul 2015 15:24:22 +0200 Subject: Stabilize tst_QListView::batchedMode(). The test showed failures on OS X: FAIL! : tst_QListView::batchedMode() Compared values are not the same Actual (ba.size()): 2 Expected (3) : 3 Loc: [tst_qlistview.cpp(848)] Use QTRY_COMPARE() to count the number of visible indexes with a helper function instead of using hard-coded timeouts. Item 3 appears with a little delay on OS X. Change-Id: I2fb2ff5ebdf9dbe85bdc79401375ad6f47b7b12b Reviewed-by: Simon Hausmann --- .../widgets/itemviews/qlistview/tst_qlistview.cpp | 55 +++++++++------------- 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 32ca5ea7b7..244af1316a 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -304,6 +304,7 @@ void tst_QListView::init() void tst_QListView::cleanup() { + QVERIFY(QApplication::topLevelWidgets().isEmpty()); } @@ -789,14 +790,31 @@ void tst_QListView::hideFirstRow() QTest::qWait(10); } +static int modelIndexCount(const QAbstractItemView *view) +{ + QBitArray ba; + for (int y = 0, height = view->height(); y < height; ++y) { + const QModelIndex idx = view->indexAt( QPoint(1, y) ); + if (!idx.isValid()) + break; + if (idx.row() >= ba.size()) + ba.resize(idx.row() + 1); + ba.setBit(idx.row(), true); + } + return ba.size(); +} + void tst_QListView::batchedMode() { + const int rowCount = 3; + QStringList items; - for (int i=0; i <3; ++i) - items << "item"; + for (int i = 0; i < rowCount; ++i) + items << QLatin1String("item ") + QString::number(i); QStringListModel model(items); QListView view; + view.setWindowTitle(QTest::currentTestFunction()); view.setModel(&model); view.setUniformItemSizes(true); view.setViewMode(QListView::ListMode); @@ -805,22 +823,8 @@ void tst_QListView::batchedMode() view.resize(200,400); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTest::qWait(100); - -#if defined(Q_OS_WINCE) - QTest::qWait(2000); -#endif - QBitArray ba; - for (int y = 0; y < view.height(); ++y) { - QModelIndex idx = view.indexAt( QPoint(1, y) ); - if (!idx.isValid()) - break; - if (idx.row() >= ba.size()) - ba.resize(idx.row() + 1); - ba.setBit(idx.row(), true); - } - QCOMPARE(ba.size(), 3); + QTRY_COMPARE(modelIndexCount(&view), rowCount); // Test the dynamic listview too. view.setViewMode(QListView::IconMode); @@ -828,22 +832,7 @@ void tst_QListView::batchedMode() view.setFlow(QListView::TopToBottom); view.setBatchSize(2); -#if !defined(Q_OS_WINCE) - QTest::qWait(100); -#else - QTest::qWait(2000); -#endif - - ba.clear(); - for (int y = 0; y < view.height(); ++y) { - QModelIndex idx = view.indexAt( QPoint(1, y) ); - if (!idx.isValid()) - break; - if (idx.row() >= ba.size()) - ba.resize(idx.row() + 1); - ba.setBit(idx.row(), true); - } - QCOMPARE(ba.size(), 3); + QTRY_COMPARE(modelIndexCount(&view), rowCount); } void tst_QListView::setCurrentIndex() -- cgit v1.2.3 From 26bcc0565f49c731a4f288f93f04056ca20136a5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 14 Jul 2015 09:29:58 +0200 Subject: QDir::removeRecursively(): Retry file deletion with write permission set. On Windows, having read-only files in a directory can cause removal to fail. When file deletion fails, check on the permissions, set write permissions and retry. Split apart code paths by OS in tst_QDir::removeRecursivelyFailure(); deletion of the read-only directory on UNIX should still fail. Change-Id: I36e54be5229a7b552e90fd5f42722b868fa0b6ee Reviewed-by: David Faure --- src/corelib/io/qdir.cpp | 16 ++++++++++++---- tests/auto/corelib/io/qdir/tst_qdir.cpp | 15 ++++++++------- .../auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp | 2 ++ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 6687ff846c..f6e132708e 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -1503,11 +1503,19 @@ bool QDir::removeRecursively() while (di.hasNext()) { di.next(); const QFileInfo& fi = di.fileInfo(); + const QString &filePath = di.filePath(); bool ok; - if (fi.isDir() && !fi.isSymLink()) - ok = QDir(di.filePath()).removeRecursively(); // recursive - else - ok = QFile::remove(di.filePath()); + if (fi.isDir() && !fi.isSymLink()) { + ok = QDir(filePath).removeRecursively(); // recursive + } else { + ok = QFile::remove(filePath); + if (!ok) { // Read-only files prevent directory deletion on Windows, retry with Write permission. + const QFile::Permissions permissions = QFile::permissions(filePath); + if (!(permissions & QFile::WriteUser)) + ok = QFile::setPermissions(filePath, permissions | QFile::WriteUser) + && QFile::remove(filePath); + } + } if (!ok) success = false; } diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 45289df398..72d036c2ae 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -470,21 +470,22 @@ void tst_QDir::removeRecursivelyFailure() #ifdef Q_OS_UNIX QFile dirAsFile(path); // yay, I have to use QFile to change a dir's permissions... QVERIFY(dirAsFile.setPermissions(QFile::Permissions(0))); // no permissions -#else - QVERIFY(file.setPermissions(QFile::ReadOwner)); -#endif + QVERIFY(!QDir().rmdir(path)); QDir dir(path); QVERIFY(!dir.removeRecursively()); // didn't work QVERIFY(dir.exists()); // still exists -#ifdef Q_OS_UNIX QVERIFY(dirAsFile.setPermissions(QFile::Permissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner))); -#else - QVERIFY(file.setPermissions(QFile::ReadOwner | QFile::WriteOwner)); -#endif QVERIFY(dir.removeRecursively()); QVERIFY(!dir.exists()); +#else // Q_OS_UNIX + QVERIFY(file.setPermissions(QFile::ReadOwner)); + QVERIFY(!QDir().rmdir(path)); + QDir dir(path); + QVERIFY(dir.removeRecursively()); + QVERIFY(!dir.exists()); +#endif // !Q_OS_UNIX } void tst_QDir::removeRecursivelySymlink() diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp index e144e32c77..3e98a369ce 100644 --- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp +++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp @@ -215,6 +215,8 @@ void tst_QTemporaryDir::autoRemove() QFile file(dirName + "/dir1/file"); QVERIFY(file.open(QIODevice::WriteOnly)); QCOMPARE(file.write("Hello"), 5LL); + file.close(); + QVERIFY(file.setPermissions(QFile::ReadUser)); } #ifdef Q_OS_WIN QTRY_VERIFY(!QDir(dirName).exists()); -- cgit v1.2.3 From 756266d01560157b7274e466b9ffc1b0e2ef9a1f Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 29 Jun 2015 15:17:40 +0200 Subject: Map Shift+Tab to Shift+Backtab in evdevkeyboard This mapping has to be done manually, like we do on Windows for example. libinput maps through xkbcommon, like xcb, so it is already correct. Task-number: QTBUG-46845 Change-Id: I61f3f1160e2581aae2ef43cc260f191f6d344fec Reviewed-by: Louai Al-Khanji --- .../input/evdevkeyboard/qevdevkeyboardhandler.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp index 16cb94dded..06751de0ef 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp @@ -379,17 +379,20 @@ QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint } if (!skip) { - qCDebug(qLcEvdevKeyMap, "Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode & ~modmask, (qtcode & modmask)); - //If NumLockOff and keypad key pressed remap event sent - if (!m_locks[1] && - (qtcode & Qt::KeypadModifier) && + // Up until now qtcode contained both the key and modifiers. Split it. + Qt::KeyboardModifiers qtmods = Qt::KeyboardModifiers(qtcode & modmask); + qtcode &= ~modmask; + + qCDebug(qLcEvdevKeyMap, "Processing: uni=%04x, qt=%08x, qtmod=%08x", unicode, qtcode, int(qtmods)); + + // If NumLockOff and keypad key pressed remap event sent + if (!m_locks[1] && (qtmods & Qt::KeypadModifier) && keycode >= 71 && keycode <= 83 && keycode != 74 && keycode != 78) { unicode = 0xffff; - int oldMask = (qtcode & modmask); switch (keycode) { case 71: //7 --> Home qtcode = Qt::Key_Home; @@ -425,11 +428,14 @@ QEvdevKeyboardHandler::KeycodeAction QEvdevKeyboardHandler::processKeycode(quint qtcode = Qt::Key_Delete; break; } - qtcode ^= oldMask; } - // send the result to the server - processKeyEvent(keycode, unicode, qtcode & ~modmask, Qt::KeyboardModifiers(qtcode & modmask), pressed, autorepeat); + // Map SHIFT + Tab to SHIFT + Backtab, QShortcutMap knows about this translation + if (qtcode == Qt::Key_Tab && (qtmods & Qt::ShiftModifier) == Qt::ShiftModifier) + qtcode = Qt::Key_Backtab; + + // Generate the QPA event. + processKeyEvent(keycode, unicode, qtcode, qtmods, pressed, autorepeat); } } return result; -- cgit v1.2.3