From 105da329a34a59eb46eea5ee9ed46bd20e83dc58 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 14 Nov 2013 08:59:30 +0100 Subject: [PATCH 01/59] Skip tst_QGraphicsItem::ensureUpdateOnTextItem() on OSX 10.7 Change-Id: Iedb8ed3ac797d11c47f08b92507401e2e1e96c14 Reviewed-by: Iikka Eklund --- .../graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index b45ce88c834..6c26ddb2938 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -6458,6 +6458,12 @@ public: void tst_QGraphicsItem::ensureUpdateOnTextItem() { +#ifdef Q_OS_MAC + if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_7) { + QSKIP("This test is unstable on 10.7 in CI"); + } +#endif + QGraphicsScene scene; QGraphicsView view(&scene); view.show(); From f1053d94f59f053ce4acad9320df14f1fbe4faac Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 11 Nov 2013 14:27:40 +0100 Subject: [PATCH 02/59] Fully expand entities to ensure deep or widely nested ones fail parsing With 46a8885ae486e238a39efa5119c2714f328b08e4, we failed when parsing entities whose partially expanded size was greater than 1024 characters. That was not enough, so now we fully expand all entities. Amends 46a8885ae486e238a39efa5119c2714f328b08e4. Change-Id: Ie80720d7e04d825eb4eebf528140eb94806c02b1 Reviewed-by: Richard J. Moore Reviewed-by: Lars Knoll --- src/xml/sax/qxml.cpp | 62 +++++++++++-------- .../qxmlsimplereader/tst_qxmlsimplereader.cpp | 2 +- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index e6d78d34348..f3a1e479f25 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -426,7 +426,9 @@ private: // The limit to the amount of times the DTD parsing functions can be called // for the DTD currently being parsed. - int dtdRecursionLimit; + static const int dtdRecursionLimit = 2; + // The maximum amount of characters an entity value may contain, after expansion. + static const int entityCharacterLimit = 1024; const QString &string(); void stringClear(); @@ -497,7 +499,7 @@ private: void parseFailed(ParseFunction where, int state); void pushParseState(ParseFunction function, int state); - bool isPartiallyExpandedEntityValueTooLarge(QString *errorMessage); + bool isExpandedEntityValueTooLarge(QString *errorMessage); Q_DECLARE_PUBLIC(QXmlSimpleReader) QXmlSimpleReader *q_ptr; @@ -2763,8 +2765,6 @@ QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate(QXmlSimpleReader *reader) useNamespacePrefixes = false; reportWhitespaceCharData = true; reportEntities = false; - - dtdRecursionLimit = 2; } QXmlSimpleReaderPrivate::~QXmlSimpleReaderPrivate() @@ -6657,30 +6657,43 @@ bool QXmlSimpleReaderPrivate::parseChoiceSeq() return false; } -bool QXmlSimpleReaderPrivate::isPartiallyExpandedEntityValueTooLarge(QString *errorMessage) +bool QXmlSimpleReaderPrivate::isExpandedEntityValueTooLarge(QString *errorMessage) { - const QString value = string(); - QMap referencedEntityCounts; - foreach (QString entityName, entities.keys()) { - for (int i = 0; i < value.size() && i != -1; ) { - i = value.indexOf(entityName, i); - if (i != -1) { - // The entityName we're currently trying to find - // was matched in this string; increase our count. - ++referencedEntityCounts[entityName]; - i += entityName.size(); + QMap literalEntitySizes; + // The entity at (QMap) times. + QMap > referencesToOtherEntities; + QMap expandedSizes; + + // For every entity, check how many times all entity names were referenced in its value. + foreach (QString toSearch, entities.keys()) { + // The amount of characters that weren't entity names, but literals, like 'X'. + QString leftOvers = entities.value(toSearch); + // How many times was entityName referenced by toSearch? + foreach (QString entityName, entities.keys()) { + for (int i = 0; i < leftOvers.size() && i != -1; ) { + i = leftOvers.indexOf(QString::fromLatin1("&%1;").arg(entityName), i); + if (i != -1) { + leftOvers.remove(i, entityName.size() + 2); + // The entityName we're currently trying to find was matched in this string; increase our count. + ++referencesToOtherEntities[toSearch][entityName]; + } } } + literalEntitySizes[toSearch] = leftOvers.size(); } - foreach (QString entityName, referencedEntityCounts.keys()) { - const int timesReferenced = referencedEntityCounts[entityName]; - const QString entityValue = entities[entityName]; - if (entityValue.size() * timesReferenced > 1024) { + foreach (QString entity, referencesToOtherEntities.keys()) { + expandedSizes[entity] = literalEntitySizes[entity]; + foreach (QString referenceTo, referencesToOtherEntities.value(entity).keys()) { + const int references = referencesToOtherEntities.value(entity).value(referenceTo); + // The total size of an entity's value is the expanded size of all of its referenced entities, plus its literal size. + expandedSizes[entity] += expandedSizes[referenceTo] * references + literalEntitySizes[referenceTo] * references; + } + + if (expandedSizes[entity] > entityCharacterLimit) { if (errorMessage) { - *errorMessage = QString::fromLatin1("The XML entity \"%1\"" - "expands too a string that is too large to process when " - "referencing \"%2\" %3 times.").arg(entityName).arg(entityName).arg(timesReferenced); + *errorMessage = QString::fromLatin1("The XML entity \"%1\" expands too a string that is too large to process (%2 characters > %3)."); + *errorMessage = (*errorMessage).arg(entity).arg(expandedSizes[entity]).arg(entityCharacterLimit); } return true; } @@ -6783,10 +6796,7 @@ bool QXmlSimpleReaderPrivate::parseEntityDecl() case EValue: if ( !entityExist(name())) { QString errorMessage; - if (isPartiallyExpandedEntityValueTooLarge(&errorMessage)) { - // The entity at entityName is entityValue.size() characters - // long in its unexpanded form, and was mentioned timesReferenced times, - // resulting in a string that would be greater than 1024 characters. + if (isExpandedEntityValueTooLarge(&errorMessage)) { reportParseError(errorMessage); return false; } diff --git a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp index 57d078ba65d..ed909946e67 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp @@ -809,7 +809,7 @@ void tst_QXmlSimpleReader::dtdRecursionLimit() xmlReader.setDeclHandler(&handler); xmlReader.setErrorHandler(&handler); QVERIFY(!xmlReader.parse(source)); - QVERIFY(handler.recursionCount == 1); + QCOMPARE(handler.recursionCount, 2); } } From 06af925286e4b397f9cd34b606aa1152e7c9d964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Mon, 11 Nov 2013 12:03:12 +0100 Subject: [PATCH 03/59] Check for existence of QML import paths. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Filter out module QML import paths that point to nonexistent file system paths. Change-Id: I897ef50593eeb46c6c9eaec27313ec12e6113cb6 Reviewed-by: Tor Arne Vestbø --- mkspecs/features/qt.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 71b99825ecf..83a87786543 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -83,7 +83,7 @@ contains(qt_module_deps, qml): \ qtPrepareTool(QMLIMPORTSCANNER, qmlimportscanner) for (MODULE, QT_MODULES) { PATH = $$eval(QT.$${MODULE}.qml) - !isEmpty(PATH): QMLPATHS += $$PATH + !isEmpty(PATH):exists($$PATH): QMLPATHS += $$PATH } QMLPATHS = $$unique(QMLPATHS) for (QMLPATH, QMLPATHS): \ From 08d7bacacc46debef2df695996b5408e2039ce7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 11 Nov 2013 16:46:31 +0100 Subject: [PATCH 04/59] configure: Document that -sdk only applies to the target mkspec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie4a9e7c9d2888f92aa891ba8fcc034ea49b22de2 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Morten Johan Sørvig --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index 81e2a93c28a..116df1477bb 100755 --- a/configure +++ b/configure @@ -3758,6 +3758,8 @@ Qt/Mac only: -sdk ......... Build Qt using Apple provided SDK . The argument should be one of the available SDKs as listed by 'xcodebuild -showsdks'. + Note that the argument applies only to Qt libraries and applications built + using the target mkspec - not host tools such as qmake, moc, rcc, etc. EOF fi From e6eadd6f61ae38a49a6bb355c02532cad2aacf4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 11 Nov 2013 15:38:43 +0100 Subject: [PATCH 05/59] iOS: Flesh out device-pixel-ratio handling in QIOSWindow We don't need to cache the device-pixel-ratio, as we can ask the UIView directly. We do need to set it though, as the default behavior of matching the screen scale does not apply for EAGL-backed views, but the ratio needs to match the current screen the view is on. Change-Id: I29e4a4fa4f4b767d86265ec899fb43a355b5c3a3 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.h | 1 - src/plugins/platforms/ios/qioswindow.mm | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index b60290e4799..9ab9a3a45e8 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -87,7 +87,6 @@ private: QRect m_normalGeometry; int m_windowLevel; - qreal m_devicePixelRatio; void raiseOrLower(bool raise); void updateWindowLevel(); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index f46616db1d1..6d7b793f0bc 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -127,6 +127,16 @@ return self; } +- (void)willMoveToWindow:(UIWindow *)newWindow +{ + // UIKIt will normally set the scale factor of a view to match the corresponding + // screen scale factor, but views backed by CAEAGLLayers need to do this manually. + self.contentScaleFactor = newWindow && newWindow.screen ? + newWindow.screen.scale : [[UIScreen mainScreen] scale]; + + // FIXME: Allow the scale factor to be customized through QSurfaceFormat. +} + - (void)layoutSubviews { // This method is the de facto way to know that view has been resized, @@ -331,19 +341,9 @@ QIOSWindow::QIOSWindow(QWindow *window) , m_view([[QUIView alloc] initWithQIOSWindow:this]) , m_normalGeometry(QPlatformWindow::geometry()) , m_windowLevel(0) - , m_devicePixelRatio(1.0) { setParent(parent()); setWindowState(window->windowState()); - - // Retina support: get screen scale factor and set it in the content view. - // This will make framebufferObject() create a 2x frame buffer on retina - // displays. Also set m_devicePixelRatio which is used for scaling the - // paint device. - if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] == YES) { - m_devicePixelRatio = [[UIScreen mainScreen] scale]; - [m_view setContentScaleFactor: m_devicePixelRatio]; - } } QIOSWindow::~QIOSWindow() @@ -522,7 +522,7 @@ void QIOSWindow::handleContentOrientationChange(Qt::ScreenOrientation orientatio qreal QIOSWindow::devicePixelRatio() const { - return m_devicePixelRatio; + return m_view.contentScaleFactor; } QT_END_NAMESPACE From 18182a6275bb353dfb67ebc1562649e7624ccb0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 11 Nov 2013 16:33:21 +0100 Subject: [PATCH 06/59] iOS: Handle key window as part of QWindow activation The default UIWindow may not be the only UIWindow around in a multi screen setup. Change-Id: Ia7243190321a1416e577634bf5e010dd67d482e6 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosapplicationdelegate.mm | 2 +- src/plugins/platforms/ios/qioswindow.mm | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index e06d2b8840b..def6d2ff047 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -64,7 +64,7 @@ self.window.backgroundColor = [UIColor cyanColor]; #endif - [self.window makeKeyAndVisible]; + self.window.hidden = NO; return YES; } diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 6d7b793f0bc..23e6ad82b50 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -456,6 +456,8 @@ void QIOSWindow::requestActivateWindow() if (!window()->isTopLevel() || blockedByModal()) return; + [m_view.window makeKeyWindow]; + raise(); QPlatformInputContext *context = QGuiApplicationPrivate::platformIntegration()->inputContext(); static_cast(context)->focusViewChanged(m_view); From bb1225f5ba6f4bc5d7b8c2878d8f4ac492631c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 11 Nov 2013 15:17:56 +0100 Subject: [PATCH 07/59] iOS: Tie QIOSContext FBOs to corresponding QPlatformWindow, not QWindow A QWindow may be created() and destroyed() multiple times in the lifetime of the window, each time resulting in a new platform window (QIOSWindow) being created. This QIOSWindow is backed by a new UIView each time, hence it needs a new FBO and renderbuffer-mapping, since the previous renderbuffer was mapped to the old UIView. This fixes a bug where a QWindow would not render after a destroy() unless it was resized (which triggered new FBO/renderbuffers). We need to inherit QObject so that we can watch the destroyed() signal. Change-Id: I93172dd6280b86b49755bf7abddf061d7e6b66f1 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioscontext.h | 4 +++- src/plugins/platforms/ios/qioscontext.mm | 9 ++++----- src/plugins/platforms/ios/qioswindow.h | 4 +++- src/plugins/platforms/ios/qioswindow.mm | 4 +++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/plugins/platforms/ios/qioscontext.h b/src/plugins/platforms/ios/qioscontext.h index 961661c5d33..c48a0251a9a 100644 --- a/src/plugins/platforms/ios/qioscontext.h +++ b/src/plugins/platforms/ios/qioscontext.h @@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE +class QIOSWindow; + class QIOSContext : public QObject, public QPlatformOpenGLContext { Q_OBJECT @@ -87,7 +89,7 @@ private: static void deleteBuffers(const FramebufferObject &framebufferObject); - mutable QHash m_framebufferObjects; + mutable QHash m_framebufferObjects; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qioscontext.mm b/src/plugins/platforms/ios/qioscontext.mm index d7b9314ae0c..7310d2904f8 100644 --- a/src/plugins/platforms/ios/qioscontext.mm +++ b/src/plugins/platforms/ios/qioscontext.mm @@ -113,7 +113,7 @@ void QIOSContext::swapBuffers(QPlatformSurface *surface) { Q_ASSERT(surface && surface->surface()->surfaceType() == QSurface::OpenGLSurface); Q_ASSERT(surface->surface()->surfaceClass() == QSurface::Window); - QWindow *window = static_cast(surface->surface()); + QIOSWindow *window = static_cast(surface); Q_ASSERT(m_framebufferObjects.contains(window)); [EAGLContext setCurrentContext:m_eaglContext]; @@ -124,7 +124,7 @@ void QIOSContext::swapBuffers(QPlatformSurface *surface) GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const { Q_ASSERT(surface && surface->surface()->surfaceClass() == QSurface::Window); - QWindow *window = static_cast(surface->surface()); + QIOSWindow *window = static_cast(surface); FramebufferObject &framebufferObject = m_framebufferObjects[window]; @@ -155,8 +155,7 @@ GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const } // Ensure that the FBO's buffers match the size of the layer - QIOSWindow *platformWindow = static_cast(surface); - UIView *view = reinterpret_cast(platformWindow->winId()); + UIView *view = reinterpret_cast(window->winId()); CAEAGLLayer *layer = static_cast(view.layer); if (framebufferObject.renderbufferWidth != (layer.frame.size.width * layer.contentsScale) || framebufferObject.renderbufferHeight != (layer.frame.size.height * layer.contentsScale)) { @@ -191,7 +190,7 @@ GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const void QIOSContext::windowDestroyed(QObject *object) { - QWindow *window = static_cast(object); + QIOSWindow *window = static_cast(object); if (m_framebufferObjects.contains(window)) { EAGLContext *originalContext = [EAGLContext currentContext]; [EAGLContext setCurrentContext:m_eaglContext]; diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index 9ab9a3a45e8..5ded5892054 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -58,8 +58,10 @@ QT_BEGIN_NAMESPACE @class QUIView; -class QIOSWindow : public QPlatformWindow +class QIOSWindow : public QObject, public QPlatformWindow { + Q_OBJECT + public: explicit QIOSWindow(QWindow *window); ~QIOSWindow(); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 23e6ad82b50..215f5905956 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -342,7 +342,7 @@ QIOSWindow::QIOSWindow(QWindow *window) , m_normalGeometry(QPlatformWindow::geometry()) , m_windowLevel(0) { - setParent(parent()); + setParent(QPlatformWindow::parent()); setWindowState(window->windowState()); } @@ -527,4 +527,6 @@ qreal QIOSWindow::devicePixelRatio() const return m_view.contentScaleFactor; } +#include "moc_qioswindow.cpp" + QT_END_NAMESPACE From 2afbd92274446359d278b5a1025067e20dd11df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 8 Nov 2013 09:26:37 +0100 Subject: [PATCH 08/59] iOS: Get rid of separate release pool for QIOSScreen We don't use separate pools anwyhere else, and this was copied straight from the UIKit plugin. Unless there's a good reason for having it in this particular place we should keep things consistent. Change-Id: I9a3f83bcc5894a2cdfd9af7818b46d6c0f8448da Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.mm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index c28d8881bf7..d57e6788107 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -123,8 +123,6 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) , m_uiScreen([[UIScreen screens] objectAtIndex:qMin(NSUInteger(screenIndex), [[UIScreen screens] count] - 1)]) , m_orientationListener(0) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - QString deviceIdentifier = deviceModelIdentifier(); if (deviceIdentifier == QStringLiteral("iPhone2,1") /* iPhone 3GS */ @@ -153,8 +151,6 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) // When in a non-mixed environment, let QScreen follow the current interface orientation: setPrimaryOrientation(toQtScreenOrientation(UIDeviceOrientation(qiosViewController().interfaceOrientation))); } - - [pool release]; } QIOSScreen::~QIOSScreen() From 3a7104420cc8f8eb11b3596cef310f52c350bbd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 12 Nov 2013 15:28:07 +0100 Subject: [PATCH 09/59] iOS: Remove background color for UIWindow and UIViewController's root view They were handy while debugging the iOS platform plugin, but should not affect users who link against debug libraries, so let's just remove them. Change-Id: I61b157e81130e5d951c22892e00f71e593082b1d Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosapplicationdelegate.mm | 4 ---- src/plugins/platforms/ios/qiosviewcontroller.mm | 8 -------- 2 files changed, 12 deletions(-) diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index def6d2ff047..4d88faba756 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -60,10 +60,6 @@ self.qiosViewController = [[[QIOSViewController alloc] init] autorelease]; self.window.rootViewController = self.qiosViewController; -#ifdef QT_DEBUG - self.window.backgroundColor = [UIColor cyanColor]; -#endif - self.window.hidden = NO; return YES; diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index d315b497761..656a86027d0 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -48,14 +48,6 @@ @implementation QIOSViewController -- (void)viewDidLoad -{ -#ifdef QT_DEBUG - if (!self.nibName) - self.view.backgroundColor = [UIColor magentaColor]; -#endif -} - -(BOOL)shouldAutorotate { // Until a proper orientation and rotation API is in place, we always auto rotate. From d160f195077af1d06fd8ac1da30fd7044f6bb3bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 12 Nov 2013 16:25:25 +0100 Subject: [PATCH 10/59] iOS: Enable clipping of subviews when QWindow has child windows QWindow::setParent() is documented to imply that the geometry of the window is in the parent's coordinate system and that the window is clipped to the parent. Instead of always enabling clipping of subviews for our UIView subclass we dynamically detect if we have QWindow children and enable/disable it on the fly. Change-Id: If83de94c55cbd19de401ab835e86bb7be5999d71 Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qioswindow.mm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 215f5905956..e02f570634a 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -137,6 +137,22 @@ // FIXME: Allow the scale factor to be customized through QSurfaceFormat. } +- (void)didAddSubview:(UIView *)subview +{ + if ([subview isKindOfClass:[QUIView class]]) + self.clipsToBounds = YES; +} + +- (void)willRemoveSubview:(UIView *)subview +{ + for (UIView *view in self.subviews) { + if (view != subview && [view isKindOfClass:[QUIView class]]) + return; + } + + self.clipsToBounds = NO; +} + - (void)layoutSubviews { // This method is the de facto way to know that view has been resized, From 3ebcbdd322c070c9bada31eceea1ea3c6ac2c0de Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 11 Nov 2013 14:40:50 +0100 Subject: [PATCH 11/59] Android: fix crash on exit Let's not try to dereference the null pointer. Task-number: QTBUG-34746 Change-Id: Iee79b711bd81614e36af4ab3612f9a87053a39f2 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/src/androidjnimenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/android/src/androidjnimenu.cpp b/src/plugins/platforms/android/src/androidjnimenu.cpp index 866acd3c7e7..293af2b9cd4 100644 --- a/src/plugins/platforms/android/src/androidjnimenu.cpp +++ b/src/plugins/platforms/android/src/androidjnimenu.cpp @@ -142,7 +142,7 @@ namespace QtAndroidMenu void setActiveTopLevelWindow(QWindow *window) { - Qt::WindowFlags flags = window->flags(); + Qt::WindowFlags flags = window ? window->flags() : Qt::WindowFlags(); bool isNonRegularWindow = flags & (Qt::Desktop | Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window; if (isNonRegularWindow) return; From 4abf5fd3ea21501f8caf06ff7e3fcd01084e1d2e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:35:54 +0100 Subject: [PATCH 12/59] QOpenGLPixelTransferOptions: declare as shared, add move assignment operator A move constructor cannot be added because the class uses a smart pointer to hold its pImpl, so the move ctor would have to be out-of-line, destroying BC between C++11 and C++98 versions of Qt. Member-swap is required for Q_DECLARED_SHARED, which in turn enables efficient use of the class in Qt containers by marking it movable. Change-Id: I1aaa5bf3343a92e621d9464d8e4352f4e5ceff1f Reviewed-by: Sean Harmer --- src/gui/opengl/qopenglpixeltransferoptions.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/opengl/qopenglpixeltransferoptions.h b/src/gui/opengl/qopenglpixeltransferoptions.h index 1a5d3f00e27..c150e8aff41 100644 --- a/src/gui/opengl/qopenglpixeltransferoptions.h +++ b/src/gui/opengl/qopenglpixeltransferoptions.h @@ -60,6 +60,14 @@ public: QOpenGLPixelTransferOptions &operator=(const QOpenGLPixelTransferOptions &); ~QOpenGLPixelTransferOptions(); +#ifdef Q_COMPILER_RVALUE_REFS + QOpenGLPixelTransferOptions &operator=(QOpenGLPixelTransferOptions &&other) + { swap(other); return *this; } +#endif + + void swap(QOpenGLPixelTransferOptions &other) + { data.swap(other.data); } + void setAlignment(int alignment); int alignment() const; @@ -88,6 +96,8 @@ private: QSharedDataPointer data; }; +Q_DECLARE_SHARED(QOpenGLPixelTransferOptions) + QT_END_NAMESPACE #endif // QT_NO_OPENGL From a256c8459a8eee06833d59b0292c67150e856e8d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:36:58 +0100 Subject: [PATCH 13/59] QOpenGLTexture: mark (Target) ctor explicit Disables implicit conversions from Target to QOpenGLTexture. Change-Id: I2edd2dc4528a311577f0b7df4f6ce22696336a88 Reviewed-by: Sean Harmer --- src/gui/opengl/qopengltexture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h index e06cf26f60e..b761d63775a 100644 --- a/src/gui/opengl/qopengltexture.h +++ b/src/gui/opengl/qopengltexture.h @@ -96,7 +96,7 @@ public: DontResetTextureUnit }; - QOpenGLTexture(Target target); + explicit QOpenGLTexture(Target target); QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps); ~QOpenGLTexture(); From c887fbd79503824882df08365e39d27580164ac9 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:37:20 +0100 Subject: [PATCH 14/59] QOpenGLTexture: mark (QImage) ctor explicit Disables implicit conversions from QImage to QOpenGLTexture. Change-Id: I09b4d236dde8eae5258e6a954f4e02b4451990bd Reviewed-by: Sean Harmer --- src/gui/opengl/qopengltexture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h index b761d63775a..3428f0d74a5 100644 --- a/src/gui/opengl/qopengltexture.h +++ b/src/gui/opengl/qopengltexture.h @@ -97,7 +97,7 @@ public: }; explicit QOpenGLTexture(Target target); - QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps); + explicit QOpenGLTexture(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps); ~QOpenGLTexture(); // Creation and destruction From cad65f2632ab887184f33d9b6ccb4b60fa54f481 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Mon, 11 Nov 2013 16:47:54 +0100 Subject: [PATCH 15/59] Detect architecture before auto detection Some compile checks may depend on the architecture, e.g., NEON is only available for ARM, so it makes no sense to check it for this architecture. Therefore we need to run the architecture check before we auto detect settings. Task-number: QTBUG-34743 Change-Id: I53208d25b0ae0fd93cccc7394307b8ee286576a2 Reviewed-by: Joerg Bornemann Reviewed-by: Oswald Buddenhagen --- tools/configure/configureapp.cpp | 3 +++ tools/configure/main.cpp | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index c67b2452287..67333457a73 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2212,6 +2212,9 @@ void Configure::autoDetection() { cout << "Running configuration tests..." << endl; + // Auto-detect CPU architectures. + detectArch(); + if (dictionary["C++11"] == "auto") { if (!dictionary["QMAKESPEC"].contains("msvc")) dictionary["C++11"] = tryCompileProject("common/c++11") ? "yes" : "no"; diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp index fb815b287e0..1e6aa3f2986 100644 --- a/tools/configure/main.cpp +++ b/tools/configure/main.cpp @@ -94,9 +94,6 @@ int runConfigure( int argc, char** argv ) // Auto-detect modules and settings. app.autoDetection(); - // ... and the CPU architectures. - app.detectArch(); - // After reading all command-line arguments, and doing all the // auto-detection, it's time to do some last minute validation. // If the validation fails, we cannot continue. From 6ac1636c7148821726e2024711d828768d7ab87b Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Mon, 11 Nov 2013 16:48:33 +0100 Subject: [PATCH 16/59] Autodetect Neon support under Windows This is done to autodetect Neon support for QNX. It might make sense for other platforms as well, so enable the compile check for all target platforms. Task-number: QTBUG-34743 Change-Id: I1d149d1942ce0caa288cb56491e4a0ba455dda7d Reviewed-by: Joerg Bornemann Reviewed-by: Oswald Buddenhagen --- tools/configure/configureapp.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 67333457a73..b751338355b 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -183,7 +183,7 @@ Configure::Configure(int& argc, char** argv) dictionary[ "PLUGIN_MANIFESTS" ] = "yes"; dictionary[ "DIRECTWRITE" ] = "no"; dictionary[ "NIS" ] = "no"; - dictionary[ "NEON" ] = "no"; + dictionary[ "NEON" ] = "auto"; dictionary[ "LARGE_FILE" ] = "yes"; dictionary[ "FONT_CONFIG" ] = "no"; dictionary[ "POSIX_IPC" ] = "no"; @@ -2200,6 +2200,8 @@ bool Configure::checkAvailability(const QString &part) available = (platform() == QNX || platform() == BLACKBERRY) && compilerSupportsFlag("qcc -fstack-protector-strong"); } else if (part == "SLOG2") { available = tryCompileProject("unix/slog2"); + } else if (part == "NEON") { + available = (dictionary["QT_ARCH"] == "arm") && tryCompileProject("unix/neon"); } return available; @@ -2298,6 +2300,8 @@ void Configure::autoDetection() dictionary["AVX2"] = checkAvailability("AVX2") ? "yes" : "no"; if (dictionary["IWMMXT"] == "auto") dictionary["IWMMXT"] = checkAvailability("IWMMXT") ? "yes" : "no"; + if (dictionary["NEON"] == "auto") + dictionary["NEON"] = checkAvailability("NEON") ? "yes" : "no"; if (dictionary["OPENSSL"] == "auto") dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no"; if (dictionary["DBUS"] == "auto") From 98a83d1549ca1c5c4b734a218390441754cf7590 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Mon, 11 Nov 2013 16:51:09 +0100 Subject: [PATCH 17/59] Autodetect Fontconfig for QNX Task-number: QTBUG-34743 Change-Id: Ib9bba874137b1ef081cb7e8450746abbe983ebc9 Reviewed-by: Joerg Bornemann Reviewed-by: Konstantin Ritt Reviewed-by: Oswald Buddenhagen --- tools/configure/configureapp.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index b751338355b..62a39cdfd57 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1641,6 +1641,7 @@ void Configure::applySpecSpecifics() dictionary[ "QT_CUPS" ] = "no"; dictionary[ "QT_GLIB" ] = "no"; dictionary[ "QT_ICONV" ] = "no"; + dictionary[ "FONT_CONFIG" ] = "auto"; dictionary["DECORATIONS"] = "default windows styled"; } else if ((platform() == QNX) || (platform() == BLACKBERRY)) { @@ -1648,6 +1649,7 @@ void Configure::applySpecSpecifics() dictionary["SLOG2"] = "auto"; dictionary["QT_XKBCOMMON"] = "no"; dictionary[ "ANGLE" ] = "no"; + dictionary[ "FONT_CONFIG" ] = "auto"; } else if (platform() == ANDROID) { dictionary[ "REDUCE_EXPORTS" ] = "yes"; dictionary[ "BUILD" ] = "release"; @@ -2202,6 +2204,8 @@ bool Configure::checkAvailability(const QString &part) available = tryCompileProject("unix/slog2"); } else if (part == "NEON") { available = (dictionary["QT_ARCH"] == "arm") && tryCompileProject("unix/neon"); + } else if (part == "FONT_CONFIG") { + available = tryCompileProject("unix/fontconfig"); } return available; @@ -2346,6 +2350,9 @@ void Configure::autoDetection() if (dictionary["QT_EVENTFD"] == "auto") dictionary["QT_EVENTFD"] = checkAvailability("QT_EVENTFD") ? "yes" : "no"; + if (dictionary["FONT_CONFIG"] == "auto") + dictionary["FONT_CONFIG"] = checkAvailability("FONT_CONFIG") ? "yes" : "no"; + // Mark all unknown "auto" to the default value.. for (QMap::iterator i = dictionary.begin(); i != dictionary.end(); ++i) { if (i.value() == "auto") @@ -3529,6 +3536,7 @@ void Configure::displayConfig() sout << " JPEG support............" << dictionary[ "JPEG" ] << endl; sout << " PNG support............." << dictionary[ "PNG" ] << endl; sout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl; + sout << " Fontconfig support......" << dictionary[ "FONT_CONFIG" ] << endl; sout << " HarfBuzz-NG support....." << dictionary[ "HARFBUZZ" ] << endl; sout << " PCRE support............" << dictionary[ "PCRE" ] << endl; sout << " ICU support............." << dictionary[ "ICU" ] << endl; From 9c999dcc63e67031c5e5c12b513970f58c89f308 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Mon, 11 Nov 2013 16:49:31 +0100 Subject: [PATCH 18/59] Use compile check instead of searching header for ICU The findFile would need to look though all include paths the compiler is supporting, which can be very hard to support for multiply compilers. It is way easier to use a compile check to catch all include paths the compiler supports. This fix is needed to find correctly ICU under QNX. Task-number: QTBUG-34743 Change-Id: I4f755042a76882b304b058355cf54e37b25df61d Reviewed-by: Joerg Bornemann Reviewed-by: Oswald Buddenhagen --- config.tests/unix/icu/icu.pro | 16 ++++++++++++++-- tools/configure/configureapp.cpp | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/config.tests/unix/icu/icu.pro b/config.tests/unix/icu/icu.pro index 002c4840d57..2c1b431f929 100644 --- a/config.tests/unix/icu/icu.pro +++ b/config.tests/unix/icu/icu.pro @@ -1,4 +1,16 @@ SOURCES = icu.cpp +CONFIG += console CONFIG -= qt dylib -unix:LIBS += -licuuc -licui18n -win32:LIBS += -licuin +win32 { + CONFIG(static, static|shared) { + CONFIG(debug, debug|release) { + LIBS += -lsicuind -lsicuucd -lsicudtd + } else { + LIBS += -lsicuin -lsicuuc -lsicudt + } + } else { + LIBS += -licuin -licuuc + } +} else { + LIBS += -licui18n -licuuc +} diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 62a39cdfd57..ff7d8d93bc1 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2098,7 +2098,7 @@ bool Configure::checkAvailability(const QString &part) available = findFile("pcre.h"); else if (part == "ICU") - available = findFile("unicode/utypes.h") && findFile("unicode/ucol.h") && findFile("unicode/ustring.h"); + available = tryCompileProject("unix/icu"); else if (part == "ANGLE") { available = checkAngleAvailability(); From 72075656cfeac570ce002c517a22b1c5d7bc0dd0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 7 Nov 2013 20:41:20 +0100 Subject: [PATCH 19/59] clean superfile and cachefile paths upon creation otherwise, if the output dir is the root, the path would be denormalized. the code for finding existing files already does that. Change-Id: I56d70477e9c9ffcd936325068624a84df10ffd87 Reviewed-by: Joerg Bornemann --- qmake/library/qmakebuiltins.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 9cefbc85727..39ade6d4f60 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -1722,14 +1722,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( QString fn; if (super) { if (m_superfile.isEmpty()) { - m_superfile = m_outputDir + QLatin1String("/.qmake.super"); + m_superfile = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.super")); printf("Info: creating super cache file %s\n", qPrintable(m_superfile)); valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile); } fn = m_superfile; } else { if (m_cachefile.isEmpty()) { - m_cachefile = m_outputDir + QLatin1String("/.qmake.cache"); + m_cachefile = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.cache")); printf("Info: creating cache file %s\n", qPrintable(m_cachefile)); valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile); // We could update m_{source,build}Root and m_featureRoots here, or even From ff31d87cc883dcf17ab459a15eac04e074d9614a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 7 Nov 2013 20:40:00 +0100 Subject: [PATCH 20/59] support a cache that is really just a cache unlike .qmake.cache & co., the presence of this file has no magic effects on where mkspecs, modules and other things are searched. as the obvious name "cache" is of course already taken, we call it "stash". the file is searched up to the super cache (if present), otherwise up to the normal cache/conf (if present), otherwise up to the root. if it's not found, it is created next to the super cache (if present), otherwise next to the cache/conf (if present), otherwise in the current output directory. note that the cache really should be created and populated by the top-level project if there are subprojects: otherwise, if there is an "anchor" (super/cache/conf), subprojects would race for updating the cache and make a mess. without an "anchor", each subproject would just create its own cache, kind of defeating its purpose. this is no different from the existing "cache", but it's worth mentioning that removing the "anchoring" function does not remove the "nesting order" constraint. Task-number: QTBUG-31340 Change-Id: I786d40cef40d14582a0dd4a9407863001bec4c98 Reviewed-by: Joerg Bornemann --- qmake/doc/src/qmake-manual.qdoc | 2 +- qmake/library/qmakebuiltins.cpp | 54 +++++++++++++++++++------------- qmake/library/qmakeevaluator.cpp | 30 +++++++++++++++--- qmake/library/qmakeevaluator.h | 1 + qmake/library/qmakeglobals.h | 3 +- 5 files changed, 62 insertions(+), 28 deletions(-) diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index d7624c2dc34..2eaf2cfc54d 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -2773,7 +2773,7 @@ Basic test functions are implemented as built-in functions. - \section2 cache(variablename, [set|add|sub] [transient] [super], [source variablename]) + \section2 cache(variablename, [set|add|sub] [transient] [super|stash], [source variablename]) This is an internal function that you will typically not need. diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 39ade6d4f60..96de34fd145 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -1590,11 +1590,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } case T_CACHE: { if (args.count() > 3) { - evalError(fL1S("cache(var, [set|add|sub] [transient] [super], [srcvar]) requires one to three arguments.")); + evalError(fL1S("cache(var, [set|add|sub] [transient] [super|stash], [srcvar]) requires one to three arguments.")); return ReturnFalse; } bool persist = true; - bool super = false; + enum { TargetStash, TargetCache, TargetSuper } target = TargetCache; enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet; ProKey srcvar; if (args.count() >= 2) { @@ -1603,7 +1603,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( if (m_tmp3 == QLatin1String("transient")) { persist = false; } else if (m_tmp3 == QLatin1String("super")) { - super = true; + target = TargetSuper; + } else if (m_tmp3 == QLatin1String("stash")) { + target = TargetStash; } else if (m_tmp3 == QLatin1String("set")) { mode = CacheSet; } else if (m_tmp3 == QLatin1String("add")) { @@ -1642,7 +1644,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( m_option->mutex.lock(); #endif QMakeBaseEnv *baseEnv = - m_option->baseEnvs.value(QMakeBaseKey(m_buildRoot, hostBuild)); + m_option->baseEnvs.value(QMakeBaseKey(m_buildRoot, m_stashfile, hostBuild)); #ifdef PROEVALUATOR_THREAD_SAFE // It's ok to unlock this before locking baseEnv, // as we have no intention to initialize the env. @@ -1675,21 +1677,23 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( removeEach(&newval, diffval); } if (oldval != newval) { - baseEval->valuesRef(dstvar) = newval; - if (super) { - do { - if (dstvar == QLatin1String("QMAKEPATH")) { - baseEval->m_qmakepath = newval.toQStringList(); - baseEval->updateMkspecPaths(); - } else if (dstvar == QLatin1String("QMAKEFEATURES")) { - baseEval->m_qmakefeatures = newval.toQStringList(); - } else { - break; - } - baseEval->updateFeaturePaths(); - if (hostBuild == m_hostBuild) - m_featureRoots = baseEval->m_featureRoots; - } while (false); + if (target != TargetStash || !m_stashfile.isEmpty()) { + baseEval->valuesRef(dstvar) = newval; + if (target == TargetSuper) { + do { + if (dstvar == QLatin1String("QMAKEPATH")) { + baseEval->m_qmakepath = newval.toQStringList(); + baseEval->updateMkspecPaths(); + } else if (dstvar == QLatin1String("QMAKEFEATURES")) { + baseEval->m_qmakefeatures = newval.toQStringList(); + } else { + break; + } + baseEval->updateFeaturePaths(); + if (hostBuild == m_hostBuild) + m_featureRoots = baseEval->m_featureRoots; + } while (false); + } } changed = true; } @@ -1720,14 +1724,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( varstr += QLatin1Char('\n'); } QString fn; - if (super) { + if (target == TargetSuper) { if (m_superfile.isEmpty()) { m_superfile = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.super")); printf("Info: creating super cache file %s\n", qPrintable(m_superfile)); valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile); } fn = m_superfile; - } else { + } else if (target == TargetCache) { if (m_cachefile.isEmpty()) { m_cachefile = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.cache")); printf("Info: creating cache file %s\n", qPrintable(m_cachefile)); @@ -1739,6 +1743,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( // The sub-projects will find the new cache all by themselves. } fn = m_cachefile; + } else { + fn = m_stashfile; + if (fn.isEmpty()) + fn = QDir::cleanPath(m_outputDir + QLatin1String("/.qmake.stash")); + if (!m_vfs->exists(fn)) { + printf("Info: creating stash file %s\n", qPrintable(fn)); + valuesRef(ProKey("_QMAKE_STASH_")) << ProString(fn); + } } return writeFile(fL1S("cache "), fn, QIODevice::Append, varstr); } diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index 3415724c5ef..f46eb756708 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -79,19 +79,19 @@ QT_BEGIN_NAMESPACE #define fL1S(s) QString::fromLatin1(s) -QMakeBaseKey::QMakeBaseKey(const QString &_root, bool _hostBuild) - : root(_root), hostBuild(_hostBuild) +QMakeBaseKey::QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild) + : root(_root), stash(_stash), hostBuild(_hostBuild) { } uint qHash(const QMakeBaseKey &key) { - return qHash(key.root) ^ (uint)key.hostBuild; + return qHash(key.root) ^ qHash(key.stash) ^ (uint)key.hostBuild; } bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two) { - return one.root == two.root && one.hostBuild == two.hostBuild; + return one.root == two.root && one.stash == two.stash && one.hostBuild == two.hostBuild; } QMakeBaseEnv::QMakeBaseEnv() @@ -1139,6 +1139,19 @@ bool QMakeEvaluator::prepareProject(const QString &inDir) dir = qdfi.path(); } + dir = m_outputDir; + forever { + QString stashfile = dir + QLatin1String("/.qmake.stash"); + if (dir == (!superdir.isEmpty() ? superdir : m_buildRoot) || m_vfs->exists(stashfile)) { + m_stashfile = QDir::cleanPath(stashfile); + break; + } + QFileInfo qdfi(dir); + if (qdfi.isRoot()) + break; + dir = qdfi.path(); + } + return true; } @@ -1253,6 +1266,12 @@ bool QMakeEvaluator::loadSpec() m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) return false; } + if (!m_stashfile.isEmpty() && m_vfs->exists(m_stashfile)) { + valuesRef(ProKey("_QMAKE_STASH_")) << ProString(m_stashfile); + if (evaluateFile( + m_stashfile, QMakeHandler::EvalConfigFile, LoadProOnly) != ReturnTrue) + return false; + } return true; } @@ -1330,7 +1349,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( #ifdef PROEVALUATOR_THREAD_SAFE m_option->mutex.lock(); #endif - QMakeBaseEnv **baseEnvPtr = &m_option->baseEnvs[QMakeBaseKey(m_buildRoot, m_hostBuild)]; + QMakeBaseEnv **baseEnvPtr = &m_option->baseEnvs[QMakeBaseKey(m_buildRoot, m_stashfile, m_hostBuild)]; if (!*baseEnvPtr) *baseEnvPtr = new QMakeBaseEnv; QMakeBaseEnv *baseEnv = *baseEnvPtr; @@ -1357,6 +1376,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile( baseEval->m_superfile = m_superfile; baseEval->m_conffile = m_conffile; baseEval->m_cachefile = m_cachefile; + baseEval->m_stashfile = m_stashfile; baseEval->m_sourceRoot = m_sourceRoot; baseEval->m_buildRoot = m_buildRoot; baseEval->m_hostBuild = m_hostBuild; diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h index c1e7037762c..de130334811 100644 --- a/qmake/library/qmakeevaluator.h +++ b/qmake/library/qmakeevaluator.h @@ -298,6 +298,7 @@ public: QString m_superfile; QString m_conffile; QString m_cachefile; + QString m_stashfile; QString m_sourceRoot; QString m_buildRoot; QStringList m_qmakepath; diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h index e9ba95b5a3c..1f217138b49 100644 --- a/qmake/library/qmakeglobals.h +++ b/qmake/library/qmakeglobals.h @@ -66,9 +66,10 @@ class QMakeEvaluator; class QMakeBaseKey { public: - QMakeBaseKey(const QString &_root, bool _hostBuild); + QMakeBaseKey(const QString &_root, const QString &_stash, bool _hostBuild); QString root; + QString stash; bool hostBuild; }; From 53280989fb66cbaaa07c25fc0f23ec07dd00d734 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 31 Oct 2013 20:27:54 +0100 Subject: [PATCH 21/59] use the new "stash" instead of the (anything but) "regular" cache as this new cache category comes without side effects, we can unconditionally create a cache whereever we are. this allows us to be performant without explicit user action. Task-number: QTBUG-31340 Change-Id: I6b88b20b61e8351aa8cbf94ad3eec65adac6e1d6 Reviewed-by: Joerg Bornemann --- mkspecs/features/mac/default_post.prf | 9 ++------- mkspecs/features/mac/sdk.prf | 6 +++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf index 5d0fdb092f8..c3addf93195 100644 --- a/mkspecs/features/mac/default_post.prf +++ b/mkspecs/features/mac/default_post.prf @@ -19,13 +19,8 @@ qt:!isEmpty(QT_CONFIG) { contains(QT_CONFIG, static):contains(QT_CONFIG, c++11): CONFIG += c++11 } -isEmpty(_QMAKE_CACHE_) { - warning("No .qmake.cache is present. This significantly slows down qmake with this makespec.") - warning("Call 'cache()' in the top-level project file to rectify this problem.") -} else { - cache(QMAKE_XCODE_DEVELOPER_PATH) - cache(QMAKE_XCODE_VERSION) -} +cache(QMAKE_XCODE_DEVELOPER_PATH, stash) +cache(QMAKE_XCODE_VERSION, stash) QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix() diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index 788fa5b3622..5b5186a14b9 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -8,7 +8,7 @@ contains(QMAKE_MAC_SDK, .*/.*): \ isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path) { QMAKE_MAC_SDK_PATH = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version Path 2>/dev/null") isEmpty(QMAKE_MAC_SDK_PATH): error("Could not resolve SDK path for \'$$QMAKE_MAC_SDK\'") - !isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path, set, QMAKE_MAC_SDK_PATH) + cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path, set stash, QMAKE_MAC_SDK_PATH) } else { QMAKE_MAC_SDK_PATH = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.path) } @@ -41,7 +41,7 @@ for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_ isEmpty(sysrooted): next() $$tool = $$sysrooted $$member(value, 1, -1) - !isEmpty(_QMAKE_CACHE_): cache($$tool_variable, set, $$tool) + cache($$tool_variable, set stash, $$tool) } isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) { @@ -52,7 +52,7 @@ isEmpty(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) { "sed 's/.*Value: \\(.*\\)/\\1/'") isEmpty(QMAKE_MAC_PLATFORM_NAME): error("Could not resolve platform name for SDK '$$QMAKE_MAC_SDK'") - !isEmpty(_QMAKE_CACHE_): cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name, set, QMAKE_MAC_PLATFORM_NAME) + cache(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name, set stash, QMAKE_MAC_PLATFORM_NAME) } else { QMAKE_MAC_PLATFORM_NAME = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.platform_name) } From bcf5dbc8a02a42dbb300805c9a380debc3a6f2d3 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 14 Nov 2013 12:17:09 +0100 Subject: [PATCH 22/59] Fix jerky animations in Qt Quick for iOS. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will make Qt Quick use consistent timing which prepares animation frames for the time they go to screen, rather than the current time at the time of the animation tick, which can be quite jerky in many situations. Change-Id: I1bbd4394db0c757553ee406d416fccb3ef937db8 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosintegration.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 393a9f317d5..44ac7494549 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -101,6 +101,8 @@ QIOSIntegration::~QIOSIntegration() bool QIOSIntegration::hasCapability(Capability cap) const { switch (cap) { + case BufferQueueingOpenGL: + return true; case OpenGL: case ThreadedOpenGL: return true; From 2828072d509fd052aaae18fee59d9b4f5d079717 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 12 Nov 2013 10:45:26 +0200 Subject: [PATCH 23/59] Android: Initialize mWindowState Use the same variable in QAndroidPlatformWindow. Task-number: QTBUG-34764 Change-Id: Idf33707e81cf7306663196f3c17735d8dc1dde5d Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/platformsupport/fbconvenience/qfbwindow.cpp | 2 +- .../android/src/raster/qandroidplatformwindow.cpp | 8 +++----- .../platforms/android/src/raster/qandroidplatformwindow.h | 3 --- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/platformsupport/fbconvenience/qfbwindow.cpp b/src/platformsupport/fbconvenience/qfbwindow.cpp index b489ed351c1..98c16e61c8f 100644 --- a/src/platformsupport/fbconvenience/qfbwindow.cpp +++ b/src/platformsupport/fbconvenience/qfbwindow.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE QFbWindow::QFbWindow(QWindow *window) - : QPlatformWindow(window), mBackingStore(0) + : QPlatformWindow(window), mBackingStore(0), mWindowState(Qt::WindowNoState) { static QAtomicInt winIdGenerator(1); mWindowId = winIdGenerator.fetchAndAddRelaxed(1); diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp index 2dedc770277..7ff18526d96 100644 --- a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp +++ b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.cpp @@ -46,7 +46,6 @@ QAndroidPlatformWindow::QAndroidPlatformWindow(QWindow *window) : QFbWindow(window) - , m_state(Qt::WindowNoState) { } @@ -65,9 +64,9 @@ void QAndroidPlatformWindow::updateStatusBarVisibility() Qt::WindowFlags flags = window()->flags(); bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window; if (!isNonRegularWindow) { - if (m_state & Qt::WindowFullScreen) + if (mWindowState & Qt::WindowFullScreen) QtAndroid::hideStatusBar(); - else if (m_state & Qt::WindowMaximized) + else if (mWindowState & Qt::WindowMaximized) QtAndroid::showStatusBar(); } } @@ -80,10 +79,9 @@ void QAndroidPlatformWindow::raise() void QAndroidPlatformWindow::setWindowState(Qt::WindowState state) { - if (m_state == state) + if (mWindowState == state) return; - m_state = state; if (window()->isVisible()) updateStatusBarVisibility(); diff --git a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h index 87626b982a7..9e3f2032014 100644 --- a/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h +++ b/src/plugins/platforms/android/src/raster/qandroidplatformwindow.h @@ -59,9 +59,6 @@ public: public slots: void setGeometry(const QRect &rect); - -private: - Qt::WindowState m_state; }; #endif // ANDROIDPLATFORMWINDOW_H From 4577026397ac15bead5ddcbda4b0a57bae831acb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:01:48 +0100 Subject: [PATCH 24/59] QTimeZone: add member-swap This is customary for Qt value types these days. Change-Id: If5374c2595a904337eaef4afc08cdc993229ac25 Reviewed-by: John Layt Reviewed-by: Lars Knoll --- src/corelib/tools/qtimezone.cpp | 7 +++++++ src/corelib/tools/qtimezone.h | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index b6196d99e5b..6fe42ab45ed 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -422,6 +422,13 @@ QTimeZone &QTimeZone::operator=(const QTimeZone &other) return *this; } +/* + \fn void QTimeZone::swap(QTimeZone &other) + + Swaps this timezone with \a other. This function is very fast and + never fails. +*/ + /*! \fn QTimeZone &QTimeZone::operator=(QTimeZone &&other) diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h index 1a6a923cf43..7fb4a885ef6 100644 --- a/src/corelib/tools/qtimezone.h +++ b/src/corelib/tools/qtimezone.h @@ -87,9 +87,12 @@ public: QTimeZone &operator=(const QTimeZone &other); #ifdef Q_COMPILER_RVALUE_REFS - QTimeZone &operator=(QTimeZone &&other) { std::swap(d, other.d); return *this; } + QTimeZone &operator=(QTimeZone &&other) { swap(other); return *this; } #endif + void swap(QTimeZone &other) + { d.swap(other.d); } + bool operator==(const QTimeZone &other) const; bool operator!=(const QTimeZone &other) const; From b8c93d4592837f3a4d30a543d461d432f2cd59eb Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 14 Nov 2013 15:39:28 +0100 Subject: [PATCH 25/59] Android: work around input method cursor position bug Since the Qt input method queries only give us information on the position within the block, moving to the same position in a different block will be interpreted as not moving. The quick fix is to send a fake position before the real one in this case. Task-number: QTBUG-34845 Change-Id: I5d62bdffc283e41d0384c60a0b69c01811caa629 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: BogDan Vatra --- .../platforms/android/src/androidjniinput.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/plugins/platforms/android/src/androidjniinput.cpp b/src/plugins/platforms/android/src/androidjniinput.cpp index 27d29129f8f..8ce95532d3e 100644 --- a/src/plugins/platforms/android/src/androidjniinput.cpp +++ b/src/plugins/platforms/android/src/androidjniinput.cpp @@ -67,12 +67,32 @@ namespace QtAndroidInput static QPointer m_mouseGrabber; + static int m_lastCursorPos = -1; + void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd) { AttachedJNIEnv env; if (!env.jniEnv) return; +#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL + qDebug() << ">>> UPDATESELECTION" << selStart << selEnd << candidatesStart << candidatesEnd; +#endif + if (candidatesStart == -1 && candidatesEnd == -1 && selStart == selEnd) { + // Qt only gives us position inside the block, so if we move to the + // same position in another block, the Android keyboard will believe + // we have not changed position, and be terribly confused. + if (selStart == m_lastCursorPos) { +#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL + qDebug() << ">>> FAKEUPDATESELECTION" << selStart+1; +#endif + env.jniEnv->CallStaticVoidMethod(applicationClass(), m_updateSelectionMethodID, + selStart+1, selEnd+1, candidatesStart, candidatesEnd); + } + m_lastCursorPos = selStart; + } else { + m_lastCursorPos = -1; + } env.jniEnv->CallStaticVoidMethod(applicationClass(), m_updateSelectionMethodID, selStart, selEnd, candidatesStart, candidatesEnd); } From 81ef7f685710dc83bc42c4eb81d71140e89bea40 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:03:07 +0100 Subject: [PATCH 26/59] QTimeZone: declare as shared This enables specialisations of (std and q) swap using member-swap and declares the types movable for efficient use in Qt containers, and QList in particular. This is a binary-incompatible change, so cannot wait for 5.2.1. Change-Id: I431315e148b95f82dc3d4471c57ef729539dca9f Reviewed-by: John Layt Reviewed-by: Lars Knoll --- src/corelib/tools/qtimezone.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h index 7fb4a885ef6..3f0d1ee9e7b 100644 --- a/src/corelib/tools/qtimezone.h +++ b/src/corelib/tools/qtimezone.h @@ -152,6 +152,7 @@ private: }; Q_DECLARE_TYPEINFO(QTimeZone::OffsetData, Q_MOVABLE_TYPE); +Q_DECLARE_SHARED(QTimeZone) #ifndef QT_NO_DATASTREAM Q_CORE_EXPORT QDataStream &operator<<(QDataStream &ds, const QTimeZone &tz); From 9e78ab458714cb143703ded378be9e84380c2c98 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:03:44 +0100 Subject: [PATCH 27/59] Doc: remove superfluous \since 5.2 The whole QTimeZone class is \since 5.2. Change-Id: I681b924b534f2f75315b2eaf506aaa7d9590efa1 Reviewed-by: John Layt Reviewed-by: Lars Knoll --- src/corelib/tools/qtimezone.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index 6fe42ab45ed..9288dc77565 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -434,8 +434,6 @@ QTimeZone &QTimeZone::operator=(const QTimeZone &other) Move-assigns \a other to this QTimeZone instance, transferring the ownership of the managed pointer to this instance. - - \since 5.2 */ /*! From 6128f4efb42dec892ce057d92832adc820114c60 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 12:07:08 +0100 Subject: [PATCH 28/59] QTimeZone: mark ctors as explicit An int is not a proper representation for a QTimeZone, so don't provide an implicit conversion from it. OTOH, {QByteArray, int, QString, QString} _does_ nicely represent a QTimeZone, so explicitly state the implicitness of that constructor so {}-init continues to work in C++11. Change-Id: I865a6b38b8ab3c577625b7b08efbfc98914abfbe Reviewed-by: John Layt Reviewed-by: Lars Knoll --- src/corelib/tools/qtimezone.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qtimezone.h b/src/corelib/tools/qtimezone.h index 3f0d1ee9e7b..cbc4f3e4adc 100644 --- a/src/corelib/tools/qtimezone.h +++ b/src/corelib/tools/qtimezone.h @@ -78,8 +78,8 @@ public: QTimeZone(); explicit QTimeZone(const QByteArray &olsenId); - QTimeZone(int offsetSeconds); - QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name, + explicit QTimeZone(int offsetSeconds); + /*implicit*/ QTimeZone(const QByteArray &zoneId, int offsetSeconds, const QString &name, const QString &abbreviation, QLocale::Country country = QLocale::AnyCountry, const QString &comment = QString()); QTimeZone(const QTimeZone &other); From 20981e2953adc8ad64735806e8564fc258d21900 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 14 Nov 2013 12:09:19 +0100 Subject: [PATCH 29/59] REG: Fix changing input method parameters on Android After b7440536c788b04861591187edd071bf2c2ec137, we no longer restart the input method when the keyboard is shown, even if the parameters for the input method has changed. The effect was that if you had opened a keyboard with, say, digits only, then all keyboards would be digits only forever, regardless of the settings on text input. This patch tries to be conservative, so it only adds back the restartInput() logic when any of parameters have actually been changed. Tested the code the original patch was made to fix and it still works as before. Task-number: QTBUG-34827 Change-Id: Icaee6026d5c3e95b605bb76485acf4fd651f81bd Reviewed-by: Paul Olav Tvete Reviewed-by: BogDan Vatra --- .../org/qtproject/qt5/android/QtActivityDelegate.java | 5 +++++ .../jar/src/org/qtproject/qt5/android/QtEditText.java | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index da2f6163ead..3dcffeb07d0 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -192,6 +192,7 @@ public class QtActivityDelegate @Override public void run() { m_imm.restartInput(m_editText); + m_editText.m_optionsChanged = false; } }, 5); } @@ -279,6 +280,10 @@ public class QtActivityDelegate } } }); + if (m_editText.m_optionsChanged) { + m_imm.restartInput(m_editText); + m_editText.m_optionsChanged = false; + } } }, 15); } diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java b/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java index 7e3ebb539ad..593746aac99 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtEditText.java @@ -53,22 +53,32 @@ public class QtEditText extends View int m_initialCapsMode = 0; int m_imeOptions = 0; int m_inputType = InputType.TYPE_CLASS_TEXT; + boolean m_optionsChanged = false; QtActivityDelegate m_activityDelegate; public void setImeOptions(int m_imeOptions) { + if (m_imeOptions == this.m_imeOptions) + return; this.m_imeOptions = m_imeOptions; + m_optionsChanged = true; } public void setInitialCapsMode(int m_initialCapsMode) { + if (m_initialCapsMode == this.m_initialCapsMode) + return; this.m_initialCapsMode = m_initialCapsMode; + m_optionsChanged = true; } public void setInputType(int m_inputType) { + if (m_inputType == this.m_inputType) + return; this.m_inputType = m_inputType; + m_optionsChanged = true; } public QtEditText(Context context, QtActivityDelegate activityDelegate) From 038b0dae83c8fde5f3b20b92eb51cbc3534a037b Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Mon, 4 Nov 2013 15:59:55 +0000 Subject: [PATCH 30/59] Update QSurfaceFormat when creating a GL context in the cocoa qpa Task-number: QTBUG-34471 Change-Id: I99f643280b8a4aaa8d63329232c0c3f4b2faed4b Reviewed-by: Gunnar Sletta --- src/plugins/platforms/cocoa/qcocoaglcontext.h | 1 + .../platforms/cocoa/qcocoaglcontext.mm | 139 ++++++++++++++++++ 2 files changed, 140 insertions(+) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index 29affb0e4af..e1d4b602c9a 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -77,6 +77,7 @@ public: private: void setActiveWindow(QWindow *window); + void updateSurfaceFormat(); NSOpenGLContext *m_context; NSOpenGLContext *m_shareContext; diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index f709c94c6dd..b3695c26358 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -48,6 +48,74 @@ #import +static inline QByteArray getGlString(GLenum param) +{ + if (const GLubyte *s = glGetString(param)) + return QByteArray(reinterpret_cast(s)); + return QByteArray(); +} + +#if !defined(GL_CONTEXT_FLAGS) +#define GL_CONTEXT_FLAGS 0x821E +#endif + +#if !defined(GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 +#endif + +#if !defined(GL_CONTEXT_PROFILE_MASK) +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#endif + +#if !defined(GL_CONTEXT_CORE_PROFILE_BIT) +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#endif + +#if !defined(GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#endif + +static void updateFormatFromContext(QSurfaceFormat *format) +{ + Q_ASSERT(format); + + // Update the version, profile, and context bit of the format + int major = 0, minor = 0; + QByteArray versionString(getGlString(GL_VERSION)); + if (QPlatformOpenGLContext::parseOpenGLVersion(versionString, major, minor)) { + format->setMajorVersion(major); + format->setMinorVersion(minor); + } + + format->setProfile(QSurfaceFormat::NoProfile); + + Q_ASSERT(format->renderableType() == QSurfaceFormat::OpenGL); + if (format->version() < qMakePair(3, 0)) { + format->setOption(QSurfaceFormat::DeprecatedFunctions); + return; + } + + // Version 3.0 onwards - check if it includes deprecated functionality + GLint value = 0; + glGetIntegerv(GL_CONTEXT_FLAGS, &value); + if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)) + format->setOption(QSurfaceFormat::DeprecatedFunctions); + + // Debug context option not supported on OS X + + if (format->version() < qMakePair(3, 2)) + return; + + // Version 3.2 and newer have a profile + value = 0; + glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value); + + if (value & GL_CONTEXT_CORE_PROFILE_BIT) + format->setProfile(QSurfaceFormat::CoreProfile); + else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) + format->setProfile(QSurfaceFormat::CompatibilityProfile); +} + QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share) : m_context(nil), m_shareContext(nil), @@ -82,6 +150,8 @@ QCocoaGLContext::QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLCo int zeroOpacity = 0; [m_context setValues:&zeroOpacity forParameter:NSOpenGLCPSurfaceOpacity]; } + + updateSurfaceFormat(); } QCocoaGLContext::~QCocoaGLContext() @@ -137,6 +207,75 @@ void QCocoaGLContext::setActiveWindow(QWindow *window) [(QNSView *) cocoaWindow->contentView() setQCocoaGLContext:this]; } +void QCocoaGLContext::updateSurfaceFormat() +{ + // At present it is impossible to turn an option off on a QSurfaceFormat (see + // https://codereview.qt-project.org/#change,70599). So we have to populate + // the actual surface format from scratch + QSurfaceFormat requestedFormat = m_format; + m_format = QSurfaceFormat(); + m_format.setRenderableType(QSurfaceFormat::OpenGL); + + // CoreGL doesn't require a drawable to make the context current + CGLContextObj oldContext = CGLGetCurrentContext(); + CGLContextObj ctx = static_cast([m_context CGLContextObj]); + CGLSetCurrentContext(ctx); + + // Get the data that OpenGL provides + updateFormatFromContext(&m_format); + + // Get the data contained within the pixel format + CGLPixelFormatObj cglPixelFormat = static_cast(CGLGetPixelFormat(ctx)); + NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithCGLPixelFormatObj:cglPixelFormat]; + + int colorSize = -1; + [pixelFormat getValues:&colorSize forAttribute:NSOpenGLPFAColorSize forVirtualScreen:0]; + if (colorSize > 0) { + // This seems to return the total color buffer depth, including alpha + m_format.setRedBufferSize(colorSize / 4); + m_format.setGreenBufferSize(colorSize / 4); + m_format.setBlueBufferSize(colorSize / 4); + } + + // The pixel format always seems to return 8 for alpha. However, the framebuffer only + // seems to have alpha enabled if we requested it explicitly. I can't find any other + // attribute to check explicitly for this so we use our best guess for alpha. + int alphaSize = -1; + [pixelFormat getValues:&alphaSize forAttribute:NSOpenGLPFAAlphaSize forVirtualScreen:0]; + qDebug() << "alphaSize =" << alphaSize; + if (alphaSize > 0 && requestedFormat.alphaBufferSize() > 0) + m_format.setAlphaBufferSize(alphaSize); + + int depthSize = -1; + [pixelFormat getValues:&depthSize forAttribute:NSOpenGLPFADepthSize forVirtualScreen:0]; + if (depthSize > 0) + m_format.setDepthBufferSize(depthSize); + + int stencilSize = -1; + [pixelFormat getValues:&stencilSize forAttribute:NSOpenGLPFAStencilSize forVirtualScreen:0]; + if (stencilSize > 0) + m_format.setStencilBufferSize(stencilSize); + + int samples = -1; + [pixelFormat getValues:&samples forAttribute:NSOpenGLPFASamples forVirtualScreen:0]; + if (samples > 0) + m_format.setSamples(samples); + + int doubleBuffered = -1; + [pixelFormat getValues:&doubleBuffered forAttribute:NSOpenGLPFADoubleBuffer forVirtualScreen:0]; + m_format.setSwapBehavior(doubleBuffered == 1 ? QSurfaceFormat::DoubleBuffer : QSurfaceFormat::SingleBuffer); + + int steroBuffers = -1; + [pixelFormat getValues:&steroBuffers forAttribute:NSOpenGLPFAStereo forVirtualScreen:0]; + if (steroBuffers == 1) + m_format.setOption(QSurfaceFormat::StereoBuffers); + + [pixelFormat release]; + + // Restore the original context + CGLSetCurrentContext(oldContext); +} + void QCocoaGLContext::doneCurrent() { if (m_currentWindow && m_currentWindow.data()->handle()) From 9f75292a602ba22b1a3a46f8a161020d2f847565 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Tue, 12 Nov 2013 13:43:37 +0000 Subject: [PATCH 31/59] Remove side effects of QGLXContext::queryDummyContext() Task-number: QTBUG-34782 Change-Id: I411c89238b3002a118b1750af0157ccff5c78712 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/xcb/qglxintegration.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 4ac4cf21abb..d05de63c8fc 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -431,6 +431,11 @@ void QGLXContext::queryDummyContext() if (skip) return; + QOpenGLContext *oldContext = QOpenGLContext::currentContext(); + QSurface *oldSurface = 0; + if (oldContext) + oldSurface = oldContext->surface(); + QOffscreenSurface surface; surface.create(); QOpenGLContext context; @@ -446,6 +451,9 @@ void QGLXContext::queryDummyContext() break; } } + + if (oldContext && oldSurface) + oldContext->makeCurrent(oldSurface); } bool QGLXContext::supportsThreading() From f3f25b14693b7211467ae39279b01c580ef8e5b4 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 12 Nov 2013 15:37:57 +0100 Subject: [PATCH 32/59] Avoid using GLX pbuffers on fglrx Task-number: QTBUG-34427 Change-Id: Ief4fe2fe2ab099d4ec61b6bfb2272724dfb2a800 Reviewed-by: Gunnar Sletta Reviewed-by: Sean Harmer --- src/plugins/platforms/xcb/qglxintegration.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index d05de63c8fc..e6fa8fc898e 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -436,11 +436,23 @@ void QGLXContext::queryDummyContext() if (oldContext) oldSurface = oldContext->surface(); - QOffscreenSurface surface; - surface.create(); + QScopedPointer surface; + const char *vendor = glXGetClientString(glXGetCurrentDisplay(), GLX_VENDOR); + if (vendor && !strcmp(vendor, "ATI")) { + QWindow *window = new QWindow; + window->resize(64, 64); + window->setSurfaceType(QSurface::OpenGLSurface); + window->create(); + surface.reset(window); + } else { + QOffscreenSurface *offSurface = new QOffscreenSurface; + offSurface->create(); + surface.reset(offSurface); + } + QOpenGLContext context; context.create(); - context.makeCurrent(&surface); + context.makeCurrent(surface.data()); const char *renderer = (const char *) glGetString(GL_RENDERER); @@ -452,6 +464,7 @@ void QGLXContext::queryDummyContext() } } + context.doneCurrent(); if (oldContext && oldSurface) oldContext->makeCurrent(oldSurface); } From d7d7786026f57cfbd1b5c5ef4e2eb80d832e2d47 Mon Sep 17 00:00:00 2001 From: Jorgen Lind Date: Tue, 5 Nov 2013 12:25:29 +0100 Subject: [PATCH 33/59] Enable QOpenGLTexture for OpenGL ES 2 Change-Id: I3ec2b7af303070c92e86c0f5ca729eb1a1731682 Reviewed-by: Sean Harmer --- src/gui/kernel/qopenglcontext.cpp | 6 -- src/gui/kernel/qopenglcontext.h | 2 - src/gui/opengl/opengl.pri | 22 ++-- src/gui/opengl/qopengltexture.cpp | 132 ++++++++++++++++++++++-- src/gui/opengl/qopengltexture.h | 17 ++- src/gui/opengl/qopengltexturehelper.cpp | 17 +++ src/gui/opengl/qopengltexturehelper_p.h | 8 ++ 7 files changed, 179 insertions(+), 25 deletions(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 7b111c73e15..39dd2a2dfa7 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -56,9 +56,7 @@ #include #include -#if !defined(QT_OPENGL_ES_2) #include -#endif #include @@ -527,10 +525,8 @@ void QOpenGLContext::destroy() d->versionFunctions.clear(); qDeleteAll(d->versionFunctionsBackend); d->versionFunctionsBackend.clear(); -#if !defined(QT_OPENGL_ES_2) delete d->textureFunctions; d->textureFunctions = 0; -#endif } /*! @@ -984,7 +980,6 @@ void QOpenGLContext::removeFunctionsBackend(const QOpenGLVersionStatus &v) d->versionFunctionsBackend.remove(v); } -#if !defined(QT_OPENGL_ES_2) /*! \internal */ @@ -1002,7 +997,6 @@ void QOpenGLContext::setTextureFunctions(QOpenGLTextureHelper* textureFuncs) Q_D(QOpenGLContext); d->textureFunctions = textureFuncs; } -#endif /*! \class QOpenGLContextGroup diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index 9756be30df7..ce34a2d5a58 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -221,10 +221,8 @@ private: QOpenGLVersionFunctionsBackend *backend); void removeFunctionsBackend(const QOpenGLVersionStatus &v); -#if !defined(QT_OPENGL_ES_2) QOpenGLTextureHelper* textureFunctions() const; void setTextureFunctions(QOpenGLTextureHelper* textureFuncs); -#endif void destroy(); }; diff --git a/src/gui/opengl/opengl.pri b/src/gui/opengl/opengl.pri index 8212c0981ff..d249b855f52 100644 --- a/src/gui/opengl/opengl.pri +++ b/src/gui/opengl/opengl.pri @@ -53,6 +53,17 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { opengl/qopenglvertexarrayobject.cpp \ opengl/qopengldebug.cpp + !wince* { + HEADERS += opengl/qopengltexture.h \ + opengl/qopengltexture_p.h \ + opengl/qopengltexturehelper_p.h \ + opengl/qopenglpixeltransferoptions.h + + SOURCES += opengl/qopengltexture.cpp \ + opengl/qopengltexturehelper.cpp \ + opengl/qopenglpixeltransferoptions.cpp + } + !contains(QT_CONFIG, opengles2) { HEADERS += opengl/qopenglfunctions_1_0.h \ opengl/qopenglfunctions_1_1.h \ @@ -77,11 +88,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { opengl/qopenglfunctions_4_2_compatibility.h \ opengl/qopenglfunctions_4_3_compatibility.h \ opengl/qopenglqueryhelper_p.h \ - opengl/qopengltimerquery.h \ - opengl/qopengltexture.h \ - opengl/qopengltexture_p.h \ - opengl/qopengltexturehelper_p.h \ - opengl/qopenglpixeltransferoptions.h + opengl/qopengltimerquery.h SOURCES += opengl/qopenglfunctions_1_0.cpp \ opengl/qopenglfunctions_1_1.cpp \ @@ -105,10 +112,7 @@ contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2) { opengl/qopenglfunctions_4_1_compatibility.cpp \ opengl/qopenglfunctions_4_2_compatibility.cpp \ opengl/qopenglfunctions_4_3_compatibility.cpp \ - opengl/qopengltimerquery.cpp \ - opengl/qopengltexture.cpp \ - opengl/qopengltexturehelper.cpp \ - opengl/qopenglpixeltransferoptions.cpp + opengl/qopengltimerquery.cpp } contains(QT_CONFIG, opengles2) { diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 5407142b18d..e3fffe5a1ca 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -50,6 +50,11 @@ QT_BEGIN_NAMESPACE +//this is to work around GL_TEXTURE_WRAP_R_OES which also has 0x8072 as value +#if !defined(GL_TEXTURE_WRAP_R) + #define GL_TEXTURE_WRAP_R 0x8072 +#endif + QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarget, QOpenGLTexture *qq) : q_ptr(qq), @@ -1255,6 +1260,13 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target \value SRGB_Alpha_DXT3 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT \value SRGB_Alpha_DXT5 Equivalent to GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT \value SRGB_BP_UNorm Equivalent to GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB + + \value DepthFormat Equivalent to GL_DEPTH_COMPONENT (OpenGL ES 2 only and when OES_depth_texture is present) + \value AlphaFormat Equivalent to GL_ALPHA (OpenGL ES 2 only) + \value RGBFormat Equivalent to GL_RGB (OpenGL ES 2 only) + \value RGBAFormat Equivalent to GL_RGBA (OpenGL ES 2 only) + \value LuminanceFormat Equivalent to GL_LUMINANCE (OpenGL ES 2 only) + \value LuminanceAlphaFormat Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only) */ /*! @@ -1289,6 +1301,10 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target \value BGRA_Integer Equivalent to GL_BGRA_INTEGER \value Depth Equivalent to GL_DEPTH_COMPONENT \value DepthStencil Equivalent to GL_DEPTH_STENCIL + \value Alpha Equivalent to GL_ALPHA (OpenGL ES 2 only) + \value Luminance Equivalent to GL_LUMINANCE (OpenGL ES 2 only) + \value LuminanceAlpha Equivalent to GL_LUMINANCE_ALPHA (OpenGL ES 2 only) + */ /*! @@ -1303,6 +1319,7 @@ QOpenGLTexture *QOpenGLTexturePrivate::createTextureView(QOpenGLTexture::Target \value Int32 Equivalent to GL_INT \value UInt32 Equivalent to GL_UNSIGNED_INT \value Float16 Equivalent to GL_HALF_FLOAT + \value Float16OES Equivalent to GL_HALF_FLOAT_OES \value Float32 Equivalent to GL_FLOAT \value UInt32_RGB9_E5 Equivalent to GL_UNSIGNED_INT_5_9_9_9_REV \value UInt32_RG11B10F Equivalent to GL_UNSIGNED_INT_10F_11F_11F_REV @@ -1752,6 +1769,12 @@ void QOpenGLTexture::setFormat(TextureFormat format) case D32: case D32F: case D32FS8X24: + case DepthFormat: + case AlphaFormat: + case RGBFormat: + case RGBAFormat: + case LuminanceFormat: + case LuminanceAlphaFormat: d->formatClass = FormatClass_Unique; break; } @@ -2242,6 +2265,7 @@ bool QOpenGLTexture::hasFeature(Feature feature) bool supported = false; switch (feature) { +#if !defined(QT_OPENGL_ES_2) case ImmutableMultisampleStorage: case TextureBuffer: case StencilTexturing: @@ -2289,16 +2313,38 @@ bool QOpenGLTexture::hasFeature(Feature feature) break; } +#else + case Texture3D: + supported = ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_3D")); + break; + case AnisotropicFiltering: + supported = ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_filter_anisotropic")); + break; + case NPOTTextures: + case NPOTTextureRepeat: + supported = f.version() >= qMakePair(3,0); + if (!supported) { + supported = ctx->hasExtension(QByteArrayLiteral("GL_OES_texture_npot")); + if (!supported) + supported = ctx->hasExtension(QByteArrayLiteral("GL_ARB_texture_non_power_of_two")); + } + default: + break; + } +#endif + return supported; } /*! Sets the base mipmap level used for all texture lookups with this texture to \a baseLevel. + \note This function has no effect on Qt built for OpenGL ES 2. \sa mipBaseLevel(), setMipMaxLevel(), setMipLevelRange() */ void QOpenGLTexture::setMipBaseLevel(int baseLevel) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->textureId); @@ -2306,6 +2352,10 @@ void QOpenGLTexture::setMipBaseLevel(int baseLevel) Q_ASSERT(baseLevel <= d->maxLevel); d->baseLevel = baseLevel; d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_BASE_LEVEL, baseLevel); +#else + Q_UNUSED(baseLevel); + qWarning("QOpenGLTexture: Mipmap base level is not supported"); +#endif } /*! @@ -2323,10 +2373,12 @@ int QOpenGLTexture::mipBaseLevel() const /*! Sets the maximum mipmap level used for all texture lookups with this texture to \a maxLevel. + \note This function has no effect on Qt built for OpenGL ES 2. \sa mipMaxLevel(), setMipBaseLevel(), setMipLevelRange() */ void QOpenGLTexture::setMipMaxLevel(int maxLevel) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->textureId); @@ -2334,6 +2386,10 @@ void QOpenGLTexture::setMipMaxLevel(int maxLevel) Q_ASSERT(d->baseLevel <= maxLevel); d->maxLevel = maxLevel; d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_MAX_LEVEL, maxLevel); +#else + Q_UNUSED(maxLevel); + qWarning("QOpenGLTexture: Mipmap max level is not supported"); +#endif } /*! @@ -2351,10 +2407,12 @@ int QOpenGLTexture::mipMaxLevel() const Sets the range of mipmap levels that can be used for texture lookups with this texture to range from \a baseLevel to \a maxLevel. + \note This function has no effect on Qt built for OpenGL ES 2. \sa setMipBaseLevel(), setMipMaxLevel(), mipLevelRange() */ void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->textureId); @@ -2362,6 +2420,11 @@ void QOpenGLTexture::setMipLevelRange(int baseLevel, int maxLevel) Q_ASSERT(baseLevel <= maxLevel); d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_BASE_LEVEL, baseLevel); d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_TEXTURE_MAX_LEVEL, maxLevel); +#else + Q_UNUSED(baseLevel); + Q_UNUSED(maxLevel); + qWarning("QOpenGLTexture: Mipmap level range is not supported"); +#endif } /*! @@ -2451,11 +2514,12 @@ void QOpenGLTexture::generateMipMaps(int baseLevel, bool resetBaseLevel) This function maps \a component to the output \a value. + \note This function has no effect on Mac and Qt built for OpenGL ES 2. \sa swizzleMask() */ void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue value) { -#if !defined(Q_OS_MAC) +#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2467,9 +2531,9 @@ void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue val d->swizzleMask[component - SwizzleRed] = value; d->texFuncs->glTextureParameteri(d->textureId, d->target, component, value); #else - qWarning("Texture swizzling is not supported"); Q_UNUSED(component); Q_UNUSED(value); + qWarning("QOpenGLTexture: Texture swizzling is not supported"); #endif } @@ -2479,7 +2543,7 @@ void QOpenGLTexture::setSwizzleMask(SwizzleComponent component, SwizzleValue val void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g, SwizzleValue b, SwizzleValue a) { -#if !defined(Q_OS_MAC) +#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2495,11 +2559,11 @@ void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g, d->swizzleMask[3] = a; d->texFuncs->glTextureParameteriv(d->textureId, d->target, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask); #else - qWarning("Texture swizzling is not supported"); Q_UNUSED(r); Q_UNUSED(g); Q_UNUSED(b); Q_UNUSED(a); + qWarning("QOpenGLTexture: Texture swizzling is not supported"); #endif } @@ -2520,11 +2584,12 @@ QOpenGLTexture::SwizzleValue QOpenGLTexture::swizzleMask(SwizzleComponent compon shader will access the depth component as a single float, as normal. But when the parameter is set to StencilMode?, the shader will access the stencil component. + \note This function has no effect on Mac and Qt built for OpenGL ES 2. \sa depthStencilMode() */ void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode) { -#if !defined(Q_OS_MAC) +#if !defined(Q_OS_MAC) && !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2537,7 +2602,7 @@ void QOpenGLTexture::setDepthStencilMode(QOpenGLTexture::DepthStencilMode mode) d->texFuncs->glTextureParameteri(d->textureId, d->target, GL_DEPTH_STENCIL_TEXTURE_MODE, mode); #else Q_UNUSED(mode); - qWarning("DepthStencil Mode is not supported"); + qWarning("QOpenGLTexture: DepthStencil Mode is not supported"); #endif } @@ -2706,10 +2771,12 @@ QOpenGLTexture::WrapMode QOpenGLTexture::wrapMode(QOpenGLTexture::CoordinateDire /*! Sets the border color of the texture to \a color. + \note This function has no effect on Mac and Qt built for OpenGL ES 2. \sa borderColor() */ void QOpenGLTexture::setBorderColor(QColor color) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2723,6 +2790,10 @@ void QOpenGLTexture::setBorderColor(QColor color) for (int i = 0; i < 4; ++i) d->borderColor.append(QVariant(values[i])); d->texFuncs->glTextureParameterfv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values); +#else + Q_UNUSED(color); + qWarning("QOpenGLTexture: Border color is not supported"); +#endif } /*! @@ -2730,6 +2801,7 @@ void QOpenGLTexture::setBorderColor(QColor color) */ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2743,6 +2815,13 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) for (int i = 0; i < 4; ++i) d->borderColor.append(QVariant(values[i])); d->texFuncs->glTextureParameterfv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values); +#else + Q_UNUSED(r); + Q_UNUSED(g); + Q_UNUSED(b); + Q_UNUSED(a); + qWarning("QOpenGLTexture: Border color is not supported"); +#endif } /*! @@ -2750,6 +2829,7 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) */ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2763,6 +2843,13 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) for (int i = 0; i < 4; ++i) d->borderColor.append(QVariant(values[i])); d->texFuncs->glTextureParameteriv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values); +#else + Q_UNUSED(r); + Q_UNUSED(g); + Q_UNUSED(b); + Q_UNUSED(a); + qWarning("QOpenGLTexture: Border color is not supported"); +#endif // TODO Handle case of using glTextureParameterIiv() based on format } @@ -2772,6 +2859,7 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) */ void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2785,6 +2873,13 @@ void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a) for (int i = 0; i < 4; ++i) d->borderColor.append(QVariant(values[i])); d->texFuncs->glTextureParameteriv(d->textureId, d->target, GL_TEXTURE_BORDER_COLOR, values); +#else + Q_UNUSED(r); + Q_UNUSED(g); + Q_UNUSED(b); + Q_UNUSED(a); + qWarning("QOpenGLTexture: Border color is not supported"); +#endif // TODO Handle case of using glTextureParameterIuiv() based on format } @@ -2862,10 +2957,12 @@ void QOpenGLTexture::borderColor(unsigned int *border) const Sets the minimum level of detail to \a value. This limits the selection of highest resolution mipmap (lowest mipmap level). The default value is -1000. + \note This function has no effect on Qt built for OpenGL ES 2. \sa minimumLevelOfDetail(), setMaximumLevelOfDetail(), setLevelOfDetailRange() */ void QOpenGLTexture::setMinimumLevelOfDetail(float value) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2873,6 +2970,10 @@ void QOpenGLTexture::setMinimumLevelOfDetail(float value) Q_ASSERT(value < d->maxLevelOfDetail); d->minLevelOfDetail = value; d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MIN_LOD, value); +#else + Q_UNUSED(value); + qWarning("QOpenGLTexture: Detail level is not supported"); +#endif } /*! @@ -2890,10 +2991,12 @@ float QOpenGLTexture::minimumLevelOfDetail() const Sets the maximum level of detail to \a value. This limits the selection of lowest resolution mipmap (highest mipmap level). The default value is 1000. + \note This function has no effect on Qt built for OpenGL ES 2. \sa maximumLevelOfDetail(), setMinimumLevelOfDetail(), setLevelOfDetailRange() */ void QOpenGLTexture::setMaximumLevelOfDetail(float value) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2901,6 +3004,10 @@ void QOpenGLTexture::setMaximumLevelOfDetail(float value) Q_ASSERT(value > d->minLevelOfDetail); d->maxLevelOfDetail = value; d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MAX_LOD, value); +#else + Q_UNUSED(value); + qWarning("QOpenGLTexture: Detail level is not supported"); +#endif } /*! @@ -2917,10 +3024,12 @@ float QOpenGLTexture::maximumLevelOfDetail() const /*! Sets the minimum and maximum level of detail parameters. + \note This function has no effect on Qt built for OpenGL ES 2. \sa levelOfDetailRange(), setMinimumLevelOfDetail(), setMaximumLevelOfDetail() */ void QOpenGLTexture::setLevelOfDetailRange(float min, float max) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); @@ -2930,6 +3039,11 @@ void QOpenGLTexture::setLevelOfDetailRange(float min, float max) d->maxLevelOfDetail = max; d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MIN_LOD, min); d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_MAX_LOD, max); +#else + Q_UNUSED(min); + Q_UNUSED(max); + qWarning("QOpenGLTexture: Detail level is not supported"); +#endif } /*! @@ -2946,16 +3060,22 @@ QPair QOpenGLTexture::levelOfDetailRange() const /*! Sets the level of detail bias parameter. + \note This function has no effect on Qt built for OpenGL ES 2. \sa levelofDetailBias() */ void QOpenGLTexture::setLevelofDetailBias(float bias) { +#if !defined(QT_OPENGL_ES_2) Q_D(QOpenGLTexture); d->create(); Q_ASSERT(d->texFuncs); Q_ASSERT(d->textureId); d->levelOfDetailBias = bias; d->texFuncs->glTextureParameterf(d->textureId, d->target, GL_TEXTURE_LOD_BIAS, bias); +#else + Q_UNUSED(bias); + qWarning("QOpenGLTexture: Detail level is not supported"); +#endif } /*! diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h index 3428f0d74a5..5c0f8101a69 100644 --- a/src/gui/opengl/qopengltexture.h +++ b/src/gui/opengl/qopengltexture.h @@ -222,7 +222,16 @@ public: SRGB_Alpha_DXT1 = 0x8C4D, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT SRGB_Alpha_DXT3 = 0x8C4E, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT SRGB_Alpha_DXT5 = 0x8C4F, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT - SRGB_BP_UNorm = 0x8E8D // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB + SRGB_BP_UNorm = 0x8E8D, // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB + + // ES 2 formats + DepthFormat = 0x1902, // GL_DEPTH_COMPONENT + AlphaFormat = 0x1906, // GL_ALPHA + RGBFormat = 0x1907, // GL_RGB + RGBAFormat = 0x1908, // GL_RGBA + LuminanceFormat = 0x1909, // GL_LUMINANCE + LuminanceAlphaFormat = 0x190A + }; // This is not used externally yet but is reserved to allow checking of @@ -296,7 +305,10 @@ public: RGBA_Integer = 0x8D99, // GL_RGBA_INTEGER BGRA_Integer = 0x8D9B, // GL_BGRA_INTEGER Depth = 0x1902, // GL_DEPTH_COMPONENT - DepthStencil = 0x84F9 // GL_DEPTH_STENCIL + DepthStencil = 0x84F9, // GL_DEPTH_STENCIL + Alpha = 0x1906, // GL_ALPHA + Luminance = 0x1909, // GL_LUMINANCE + LuminanceAlpha = 0x190A // GL_LUMINANCE_ALPHA }; enum PixelType { @@ -308,6 +320,7 @@ public: Int32 = 0x1404, // GL_INT UInt32 = 0x1405, // GL_UNSIGNED_INT Float16 = 0x140B, // GL_HALF_FLOAT + Float16OES = 0x8D61, // GL_HALF_FLOAT_OES Float32 = 0x1406, // GL_FLOAT UInt32_RGB9_E5 = 0x8C3E, // GL_UNSIGNED_INT_5_9_9_9_REV UInt32_RG11B10F = 0x8C3B, // GL_UNSIGNED_INT_10F_11F_11F_REV diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp index e09b84cce6c..7cd7ca54b2a 100644 --- a/src/gui/opengl/qopengltexturehelper.cpp +++ b/src/gui/opengl/qopengltexturehelper.cpp @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) { // Resolve EXT_direct_state_access entry points if present +#if !defined(QT_OPENGL_ES_2) if (context->hasExtension(QByteArrayLiteral("GL_EXT_direct_state_access"))) { TextureParameteriEXT = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTextureParameteriEXT"))); TextureParameterivEXT = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTextureParameterivEXT"))); @@ -96,6 +97,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) CompressedTextureImage2D = &QOpenGLTextureHelper::dsa_CompressedTextureImage2D; CompressedTextureImage3D = &QOpenGLTextureHelper::dsa_CompressedTextureImage3D; } else { +#endif // Use our own DSA emulation TextureParameteri = &QOpenGLTextureHelper::qt_TextureParameteri; TextureParameteriv = &QOpenGLTextureHelper::qt_TextureParameteriv; @@ -117,9 +119,21 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) CompressedTextureImage1D = &QOpenGLTextureHelper::qt_CompressedTextureImage1D; CompressedTextureImage2D = &QOpenGLTextureHelper::qt_CompressedTextureImage2D; CompressedTextureImage3D = &QOpenGLTextureHelper::qt_CompressedTextureImage3D; +#if defined(QT_OPENGL_ES_2) + if (context->hasExtension(QByteArrayLiteral("GL_OES_texture_3D"))) { + TexImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTexImage3DOES"))); + TexSubImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTexSubImage3DOES"))); + CompressedTexImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3DOES"))); + CompressedTexSubImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage3DOES"))); + } +#endif + +#if !defined(QT_OPENGL_ES_2) } +#endif // Some DSA functions are part of NV_texture_multisample instead +#if !defined(QT_OPENGL_ES_2) if (context->hasExtension(QByteArrayLiteral("GL_NV_texture_multisample"))) { TextureImage3DMultisampleNV = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTextureImage3DMultisampleNV"))); TextureImage2DMultisampleNV = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTextureImage2DMultisampleNV"))); @@ -127,9 +141,12 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) TextureImage3DMultisample = &QOpenGLTextureHelper::dsa_TextureImage3DMultisample; TextureImage2DMultisample = &QOpenGLTextureHelper::dsa_TextureImage2DMultisample; } else { +#endif TextureImage3DMultisample = &QOpenGLTextureHelper::qt_TextureImage3DMultisample; TextureImage2DMultisample = &QOpenGLTextureHelper::qt_TextureImage2DMultisample; +#if !defined(QT_OPENGL_ES_2) } +#endif #if defined(Q_OS_WIN) HMODULE handle = GetModuleHandleA("opengl32.dll"); diff --git a/src/gui/opengl/qopengltexturehelper_p.h b/src/gui/opengl/qopengltexturehelper_p.h index e3abaa80af4..fa4bd8120ae 100644 --- a/src/gui/opengl/qopengltexturehelper_p.h +++ b/src/gui/opengl/qopengltexturehelper_p.h @@ -256,6 +256,7 @@ public: } private: +#if !defined(QT_OPENGL_ES_2) // DSA wrapper (so we can use pointer to member function as switch) inline void dsa_TextureParameteri(GLuint texture, GLenum target, GLenum pname, GLint param) { @@ -403,6 +404,7 @@ private: { CompressedTextureImage3DEXT(texture, target, level, internalFormat, width, height, depth, border, imageSize, bits); } +#endif // DSA-like API @@ -899,6 +901,7 @@ public: int val = 0; glGetIntegerv(GL_UNPACK_ALIGNMENT, &val); options.setAlignment(val); +#if !defined(QT_OPENGL_ES_2) glGetIntegerv(GL_UNPACK_SKIP_IMAGES, &val); options.setSkipImages(val); glGetIntegerv(GL_UNPACK_SKIP_ROWS, &val); @@ -914,12 +917,14 @@ public: options.setLeastSignificantByteFirst(b); glGetBooleanv(GL_UNPACK_SWAP_BYTES, &b); options.setSwapBytesEnabled(b); +#endif return options; } inline void setPixelUploadOptions(const QOpenGLPixelTransferOptions &options) { glPixelStorei(GL_UNPACK_ALIGNMENT, options.alignment()); +#if !defined(QT_OPENGL_ES_2) glPixelStorei(GL_UNPACK_SKIP_IMAGES, options.skipImages()); glPixelStorei(GL_UNPACK_SKIP_ROWS, options.skipRows()); glPixelStorei(GL_UNPACK_SKIP_PIXELS, options.skipPixels()); @@ -927,6 +932,7 @@ public: glPixelStorei(GL_UNPACK_ROW_LENGTH, options.rowLength()); glPixelStorei(GL_UNPACK_LSB_FIRST, options.isLeastSignificantBitFirst()); glPixelStorei(GL_UNPACK_SWAP_BYTES, options.isSwapBytesEnabled()); +#endif } private: @@ -982,6 +988,7 @@ private: CompressedTextureImage2DMemberFunc CompressedTextureImage2D; CompressedTextureImage3DMemberFunc CompressedTextureImage3D; +#if !defined(QT_OPENGL_ES_2) // Raw function pointers for core and DSA functions // EXT_direct_state_access used when DSA is available @@ -1012,6 +1019,7 @@ private: // Plus some missing ones that are in the NV_texture_multisample extension instead void (QOPENGLF_APIENTRYP TextureImage3DMultisampleNV)(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); void (QOPENGLF_APIENTRYP TextureImage2DMultisampleNV)(GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +#endif // OpenGL 1.0 void (QOPENGLF_APIENTRYP GetIntegerv)(GLenum pname, GLint *params); From 900c550f0145f00ec8c39560af2e42c8a58ef9d3 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 12 Nov 2013 18:06:07 +0100 Subject: [PATCH 34/59] Doc: document QCoreApplication::arguments() behavior fix in Windows Task-number: QTBUG-34744 Change-Id: I97699710a5a8af34808bab9037ccea065f07b7d5 Reviewed-by: Kai Koehne --- dist/changes-5.2.0 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dist/changes-5.2.0 b/dist/changes-5.2.0 index b0446fbbaf5..898441a6756 100644 --- a/dist/changes-5.2.0 +++ b/dist/changes-5.2.0 @@ -158,6 +158,14 @@ Changes in Qt 5.2.0 * Platform Specific Changes * **************************************************************************** + +Qt for Windows +-------------- + - QCoreApplication::arguments() changed the handling of single quotes, double quotes + and the backslash character, in order to match what argv[] contains. + In particular, single quotes are no longer removed from the argument string. + (QTBUG-15379, QTBUG-30628) + Qt for Android -------------- - Project structure and deployment has changed with the introduction of From f5ef78cec2e2905cf58961a31fc1302cf154b73c Mon Sep 17 00:00:00 2001 From: Venu Date: Tue, 12 Nov 2013 17:42:07 +0100 Subject: [PATCH 35/59] Doc: Updated the \l links in the manual - Replaced all \l instances that were using the html file name qualifier to link to a \target. - Updated the linking instructions to not mention the html file name way to link. Task-number: QTBUG-32173 Change-Id: Ic3e266e58de7566d533bbc7fbec7ff5c3ec8f231 Reviewed-by: Nico Vertriest Reviewed-by: Martin Smith --- src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc | 234 +++++++++--------- .../qdoc/doc/qdoc-manual-contextcmds.qdoc | 56 ++--- src/tools/qdoc/doc/qdoc-manual-intro.qdoc | 4 +- .../qdoc/doc/qdoc-manual-markupcmds.qdoc | 157 ++++++------ src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc | 70 +++--- 5 files changed, 256 insertions(+), 265 deletions(-) diff --git a/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc b/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc index 97d9151e407..a713b2738dd 100644 --- a/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-cmdindex.qdoc @@ -37,123 +37,123 @@ \list - \li \l {04-qdoc-commands-textmarkup.html#a-command} {\\a} - \li \l {11-qdoc-commands-specialcontent.html#abstract-command} {\\abstract} - \li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist} - \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} \span {class="newStuff"} {(deprecated, use \\b)} - \li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief} - \li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c} - \li \l {09-qdoc-commands-includingimages.html#caption-command} {\\caption} - \li \l {05-qdoc-commands-documentstructure.html#chapter-command} {\\chapter} - \li \l {13-qdoc-commands-topics.html#class-command} {\\class} - \li \l {06-qdoc-commands-includecodeinline.html#code-command} {\\code} - \li \l {07-0-qdoc-commands-includingexternalcode.html#codeline-command} {\\codeline}, - \li \l {16-qdoc-commands-status.html#compat-command} {\\compat} - \li \l {15-qdoc-commands-navigation.html#contentspage-command} {\\contentspage} - \li \l {16-qdoc-commands-status.html#default-command} {\\default} - \li \l {21-0-qdoc-creating-dita-maps.html#ditamap-command} {\\ditamap} \span {class="newStuff"} {(new 05/03/12)} - \li \l {04-qdoc-commands-textmarkup.html#div-command} {\\div} - \li \l {07-0-qdoc-commands-includingexternalcode.html#dots-command} {\\dots} - \li \l {04-qdoc-commands-textmarkup.html#e-command} {\\e} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {12-0-qdoc-commands-miscellaneous.html#else-command} {\\else} - \li \l {12-0-qdoc-commands-miscellaneous.html#endif-command} {\\endif} - \li \l {13-qdoc-commands-topics.html#enum-command} {\\enum} - \li \l {13-qdoc-commands-topics.html#example-command} {\\example} - \li \l {13-qdoc-commands-topics.html#externalpage-command} {\\externalpage} - \li \l {13-qdoc-commands-topics.html#fn-command} {\\fn} - \li \l {11-qdoc-commands-specialcontent.html#footnote-command} {\\footnote} - \li \l {12-0-qdoc-commands-miscellaneous.html#generatelist-command} {\\generatelist} - \li \l {13-qdoc-commands-topics.html#group-command} {\\group} - \li \l {10-qdoc-commands-tablesandlists.html#header-command} {\\header} - \li \l {13-qdoc-commands-topics.html#headerfile-command} {\\headerfile} - \li \l {04-qdoc-commands-textmarkup.html#e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)} - \li \l {12-0-qdoc-commands-miscellaneous.html#if-command} {\\if} - \li \l {09-qdoc-commands-includingimages.html#image-command} {\\image} - \li \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\include} - \li \l {15-qdoc-commands-navigation.html#indexpage-command} {\\indexpage} - \li \l {19-qdoc-commands-grouping.html#ingroup-command} {\\ingroup} - \li \l {18-qdoc-commands-relating.html#inherits-command}{\\inherits} - \li \l {09-qdoc-commands-includingimages.html#inlineimage-command} {\\inlineimage} - \li \l {19-qdoc-commands-grouping.html#inmodule-command} {\\inmodule} - \li \l {13-qdoc-commands-topics.html#inqmlmodule-command} {\\inqmlmodule} - \li \l {13-qdoc-commands-topics.html#instantiates-command} {\\instantiates} \span {class="newStuff"} {(new 27/7/2012)} - \li \l {16-qdoc-commands-status.html#internal-command} {\\internal} - \li \l {08-qdoc-commands-creatinglinks.html#keyword-command} {\\keyword} - \li \l {08-qdoc-commands-creatinglinks.html#l-command} {\\l} - \li \l {11-qdoc-commands-specialcontent.html#legalese-command} {\\legalese} - \li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\li} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {10-qdoc-commands-tablesandlists.html#list-command} {\\list} - \li \l {13-qdoc-commands-topics.html#macro-command} {\\macro} - \li \l {19-qdoc-commands-grouping.html#mainclass-command} {\\mainclass} - \li \l {21-0-qdoc-creating-dita-maps.html#mapref-command} {\\mapref} \span {class="newStuff"} {(new 05/03/12)} - \li \l {12-0-qdoc-commands-miscellaneous.html#meta-command} {\\meta} - \li \l {13-qdoc-commands-topics.html#module-command} {\\module} - \li \l {13-qdoc-commands-topics.html#namespace-command} {\\namespace} - \li \l {15-qdoc-commands-navigation.html#nextpage-command} {\\nextpage} - \li \l {06-qdoc-commands-includecodeinline.html#newcode-command} {\\newcode} - \li \l {17-qdoc-commands-thread.html#nonreentrant-command} {\\nonreentrant} - \li \l {11-qdoc-commands-specialcontent.html#note-command} {\\note} - \li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)} + \li \l {a-command} {\\a} + \li \l {abstract-command} {\\abstract} + \li \l {annotatedlist-command} {\\annotatedlist} + \li \l {b-command} {\\b} \span {class="newStuff"} + \li \l {b-command} {\\bold} \span {class="newStuff"} {(deprecated, use \\b)} + \li \l {brief-command} {\\brief} + \li \l {c-command} {\\c} + \li \l {caption-command} {\\caption} + \li \l {chapter-command} {\\chapter} + \li \l {class-command} {\\class} + \li \l {code-command} {\\code} + \li \l {codeline-command} {\\codeline}, + \li \l {compat-command} {\\compat} + \li \l {contentspage-command} {\\contentspage} + \li \l {default-command} {\\default} + \li \l {ditamap-command} {\\ditamap} \span {class="newStuff"} + \li \l {div-command} {\\div} + \li \l {dots-command} {\\dots} + \li \l {e-command} {\\e} \span {class="newStuff"} + \li \l {else-command} {\\else} + \li \l {endif-command} {\\endif} + \li \l {enum-command} {\\enum} + \li \l {example-command} {\\example} + \li \l {externalpage-command} {\\externalpage} + \li \l {fn-command} {\\fn} + \li \l {footnote-command} {\\footnote} + \li \l {generatelist-command} {\\generatelist} + \li \l {group-command} {\\group} + \li \l {header-command} {\\header} + \li \l {headerfile-command} {\\headerfile} + \li \l {e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)} + \li \l {if-command} {\\if} + \li \l {image-command} {\\image} + \li \l {include-command} {\\include} + \li \l {indexpage-command} {\\indexpage} + \li \l {ingroup-command} {\\ingroup} + \li \l {inherits-command}{\\inherits} + \li \l {inlineimage-command} {\\inlineimage} + \li \l {inmodule-command} {\\inmodule} + \li \l {inqmlmodule-command} {\\inqmlmodule} + \li \l {instantiates-command} {\\instantiates} \span {class="newStuff"} {(new 27/7/2012)} + \li \l {internal-command} {\\internal} + \li \l {keyword-command} {\\keyword} + \li \l {l-command} {\\l} + \li \l {legalese-command} {\\legalese} + \li \l {li-command} {\\li} \span {class="newStuff"} + \li \l {list-command} {\\list} + \li \l {macro-command} {\\macro} + \li \l {mainclass-command} {\\mainclass} + \li \l {mapref-command} {\\mapref} \span {class="newStuff"} + \li \l {meta-command} {\\meta} + \li \l {module-command} {\\module} + \li \l {namespace-command} {\\namespace} + \li \l {nextpage-command} {\\nextpage} + \li \l {newcode-command} {\\newcode} + \li \l {nonreentrant-command} {\\nonreentrant} + \li \l {note-command} {\\note} + \li \l {li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)} - \li \l {16-qdoc-commands-status.html#obsolete-command} {\\obsolete} - \li \l {06-qdoc-commands-includecodeinline.html#oldcode-command} {\\oldcode} - \li \l {12-0-qdoc-commands-miscellaneous.html#omit-command} {\\omit} - \li \l {10-qdoc-commands-tablesandlists.html#omitvalue-command} {\\omitvalue} - \li \l {18-qdoc-commands-relating.html#overload-command} {\\overload} - \li \l {13-qdoc-commands-topics.html#page-command} {\\page} - \li \l {05-qdoc-commands-documentstructure.html#part-command} {\\part} - \li \l {16-qdoc-commands-status.html#preliminary-command} {\\preliminary} - \li \l {15-qdoc-commands-navigation.html#previouspage-command} {\\previouspage} - \li \l {07-0-qdoc-commands-includingexternalcode.html#printline-command} {\\printline} - \li \l {07-0-qdoc-commands-includingexternalcode.html#printto-command} {\\printto} - \li \l {07-0-qdoc-commands-includingexternalcode.html#printuntil-command} {\\printuntil} - \li \l {13-qdoc-commands-topics.html#property-command} {\\property} - \li \l {13-qdoc-commands-topics.html#qmlattachedproperty-command} {\\qmlattachedproperty} - \li \l {13-qdoc-commands-topics.html#qmlattachedsignal-command} {\\qmlattachedsignal} - \li \l {13-qdoc-commands-topics.html#qmlbasictype-command} {\\qmlbasictype} - \li \l {13-qdoc-commands-topics.html#qmlclass-command} {\\qmlclass} \span {class="newStuff"} {(deprecated, use \\qmltype)} - \li \l {13-qdoc-commands-topics.html#qmltype-command} {\\qmltype} \span {class="newStuff"} {(new 27/7/2012)} - \li \l {13-qdoc-commands-topics.html#qmlmethod-command} {\\qmlmethod} - \li \l {13-qdoc-commands-topics.html#qmlproperty-command} {\\qmlproperty} - \li \l {13-qdoc-commands-topics.html#qmlsignal-command} {\\qmlsignal} - \li \l {13-qdoc-commands-topics.html#qmlmodule-command} {\\qmlmodule} - \li \l {11-qdoc-commands-specialcontent.html#quotation-command} {\\quotation} - \li \l {07-0-qdoc-commands-includingexternalcode.html#quotefile-command} {\\quotefile} - \li \l {07-0-qdoc-commands-includingexternalcode.html#quotefromfile-command} {\\quotefromfile} - \li \l {12-0-qdoc-commands-miscellaneous.html#raw-command} {\\raw} \span {class="newStuff"} {(avoid)} - \li \l {17-qdoc-commands-thread.html#reentrant-command} {\\reentrant} - \li \l {18-qdoc-commands-relating.html#reimp-command} {\\reimp} - \li \l {18-qdoc-commands-relating.html#relates-command} {\\relates} - \li \l {10-qdoc-commands-tablesandlists.html#row-command} {\\row} - \li \l {08-qdoc-commands-creatinglinks.html#sa-command} {\\sa} - \li \l {05-qdoc-commands-documentstructure.html#sectionOne-command} {\\section1} - \li \l {05-qdoc-commands-documentstructure.html#sectionTwo-command} {\\section2} - \li \l {05-qdoc-commands-documentstructure.html#sectionThree-command} {\\section3} - \li \l {05-qdoc-commands-documentstructure.html#sectionFour-command} {\\section4} - \li \l {13-qdoc-commands-topics.html#service-command} {\\service} - \li \l {16-qdoc-commands-status.html#since-command} {\\since} - \li \l {07-0-qdoc-commands-includingexternalcode.html#skipline-command} {\\skipline} - \li \l {07-0-qdoc-commands-includingexternalcode.html#skipto-command} {\\skipto} - \li \l {07-0-qdoc-commands-includingexternalcode.html#skipuntil-command} {\\skipuntil} - \li \l {07-0-qdoc-commands-includingexternalcode.html#snippet-command} {\\snippet}, - \li \l {04-qdoc-commands-textmarkup.html#span-command} {\\span} - \li \l {15-qdoc-commands-navigation.html#startpage-command} {\\startpage} - \li \l {04-qdoc-commands-textmarkup.html#sub-command} {\\sub} - \li \l {20-qdoc-commands-namingthings.html#subtitle-command} {\\subtitle} - \li \l {04-qdoc-commands-textmarkup.html#sup-command} {\\sup} - \li \l {10-qdoc-commands-tablesandlists.html#table-command} {\\table} - \li \l {11-qdoc-commands-specialcontent.html#tableofcontents-command} {\\tableofcontents} - \li \l {08-qdoc-commands-creatinglinks.html#target-command} {\\target} - \li \l {17-qdoc-commands-thread.html#threadsafe-command} {\\threadsafe} - \li \l {20-qdoc-commands-namingthings.html#title-command} {\\title} - \li \l {21-0-qdoc-creating-dita-maps.html#topicref-command} {\\topicref} \span {class="newStuff"} {(new 05/03/12)} - \li \l {04-qdoc-commands-textmarkup.html#tt-command} {\\tt} - \li \l {13-qdoc-commands-topics.html#typedef-command} {\\typedef} - \li \l {04-qdoc-commands-textmarkup.html#uicontrol-command} {\\uicontrol} {(new 25/3/2012)} - \li \l {04-qdoc-commands-textmarkup.html#underline-command} {\\underline} - \li \l {13-qdoc-commands-topics.html#variable-command} {\\variable} - \li \l {10-qdoc-commands-tablesandlists.html#value-command} {\\value} - \li \l {11-qdoc-commands-specialcontent.html#warning-command} {\\warning} + \li \l {obsolete-command} {\\obsolete} + \li \l {oldcode-command} {\\oldcode} + \li \l {omit-command} {\\omit} + \li \l {omitvalue-command} {\\omitvalue} + \li \l {overload-command} {\\overload} + \li \l {page-command} {\\page} + \li \l {part-command} {\\part} + \li \l {preliminary-command} {\\preliminary} + \li \l {previouspage-command} {\\previouspage} + \li \l {printline-command} {\\printline} + \li \l {printto-command} {\\printto} + \li \l {printuntil-command} {\\printuntil} + \li \l {property-command} {\\property} + \li \l {qmlattachedproperty-command} {\\qmlattachedproperty} + \li \l {qmlattachedsignal-command} {\\qmlattachedsignal} + \li \l {qmlbasictype-command} {\\qmlbasictype} + \li \l {qmlclass-command} {\\qmlclass} \span {class="newStuff"} {(deprecated, use \\qmltype)} + \li \l {qmltype-command} {\\qmltype} \span {class="newStuff"} + \li \l {qmlmethod-command} {\\qmlmethod} + \li \l {qmlproperty-command} {\\qmlproperty} + \li \l {qmlsignal-command} {\\qmlsignal} + \li \l {qmlmodule-command} {\\qmlmodule} + \li \l {quotation-command} {\\quotation} + \li \l {quotefile-command} {\\quotefile} + \li \l {quotefromfile-command} {\\quotefromfile} + \li \l {raw-command} {\\raw} \span {class="newStuff"} {(avoid)} + \li \l {reentrant-command} {\\reentrant} + \li \l {reimp-command} {\\reimp} + \li \l {relates-command} {\\relates} + \li \l {row-command} {\\row} + \li \l {sa-command} {\\sa} + \li \l {sectionOne-command} {\\section1} + \li \l {sectionTwo-command} {\\section2} + \li \l {sectionThree-command} {\\section3} + \li \l {sectionFour-command} {\\section4} + \li \l {service-command} {\\service} + \li \l {since-command} {\\since} + \li \l {skipline-command} {\\skipline} + \li \l {skipto-command} {\\skipto} + \li \l {skipuntil-command} {\\skipuntil} + \li \l {snippet-command} {\\snippet}, + \li \l {span-command} {\\span} + \li \l {startpage-command} {\\startpage} + \li \l {sub-command} {\\sub} + \li \l {subtitle-command} {\\subtitle} + \li \l {sup-command} {\\sup} + \li \l {table-command} {\\table} + \li \l {tableofcontents-command} {\\tableofcontents} + \li \l {target-command} {\\target} + \li \l {threadsafe-command} {\\threadsafe} + \li \l {title-command} {\\title} + \li \l {topicref-command} {\\topicref} \span {class="newStuff"} + \li \l {tt-command} {\\tt} + \li \l {typedef-command} {\\typedef} + \li \l {uicontrol-command} {\\uicontrol} + \li \l {underline-command} {\\underline} + \li \l {variable-command} {\\variable} + \li \l {value-command} {\\value} + \li \l {warning-command} {\\warning} \endlist */ diff --git a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc index 8faf4a7f0df..1f777ea4416 100644 --- a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc @@ -46,28 +46,28 @@ below the \l {Topic Commands} {topic} command. \list - \li \l {16-qdoc-commands-status.html#compat-command}{\\compat}, - \li \l {15-qdoc-commands-navigation.html#contentspage-command}{\\contentspage}, - \li \l {15-qdoc-commands-navigation.html#indexpage-command}{\\indexpage}, - \li \l {19-qdoc-commands-grouping.html#ingroup-command}{\\ingroup}, - \li \l {18-qdoc-commands-relating.html#inherits-command}{\\inherits}, - \li \l {19-qdoc-commands-grouping.html#inmodule-command}{\\inmodule}, - \li \l {16-qdoc-commands-status.html#internal-command}{\\internal}, - \li \l {19-qdoc-commands-grouping.html#mainclass-command}{\\mainclass}, - \li \l {15-qdoc-commands-navigation.html#nextpage-command}{\\nextpage}, - \li \l {17-qdoc-commands-thread.html#nonreentrant-command}{\\nonreentrant}, - \li \l {16-qdoc-commands-status.html#obsolete-command}{\\obsolete}, - \li \l {18-qdoc-commands-relating.html#overload-command}{\\overload}, - \li \l {16-qdoc-commands-status.html#preliminary-command}{\\preliminary}, - \li \l {15-qdoc-commands-navigation.html#previouspage-command}{\\previouspage}, - \li \l {17-qdoc-commands-thread.html#reentrant-command}{\\reentrant}, - \li \l {18-qdoc-commands-relating.html#reimp-command}{\\reimp}, - \li \l {18-qdoc-commands-relating.html#relates-command}{\\relates}, - \li \l {16-qdoc-commands-status.html#since-command}{\\since}, - \li \l {15-qdoc-commands-navigation.html#startpage-command}{\\startpage}, - \li \l {20-qdoc-commands-namingthings.html#subtitle-command}{\\subtitle} - \li \l {17-qdoc-commands-thread.html#threadsafe-command}{\\threadsafe}, - \li \l {20-qdoc-commands-namingthings.html#title-command}{\\title} + \li \l {compat-command}{\\compat}, + \li \l {contentspage-command}{\\contentspage}, + \li \l {indexpage-command}{\\indexpage}, + \li \l {ingroup-command}{\\ingroup}, + \li \l {inherits-command}{\\inherits}, + \li \l {inmodule-command}{\\inmodule}, + \li \l {internal-command}{\\internal}, + \li \l {mainclass-command}{\\mainclass}, + \li \l {nextpage-command}{\\nextpage}, + \li \l {nonreentrant-command}{\\nonreentrant}, + \li \l {obsolete-command}{\\obsolete}, + \li \l {overload-command}{\\overload}, + \li \l {preliminary-command}{\\preliminary}, + \li \l {previouspage-command}{\\previouspage}, + \li \l {reentrant-command}{\\reentrant}, + \li \l {reimp-command}{\\reimp}, + \li \l {relates-command}{\\relates}, + \li \l {since-command}{\\since}, + \li \l {startpage-command}{\\startpage}, + \li \l {subtitle-command}{\\subtitle} + \li \l {threadsafe-command}{\\threadsafe}, + \li \l {title-command}{\\title} \endlist */ @@ -297,7 +297,7 @@ \section1 \\default The \\default command is for marking a QML property as the - \l {http://qt-project.org/doc/qt-4.7/qdeclarativeintroduction.html#default-properties} + \l {default-properties} {default property}. The word \span {class="newStuff"} {default} is shown in red in the documentation of the property. @@ -314,7 +314,7 @@ \endcode See how QDoc renders this property on the reference page for the - \l {http://qt-project.org/doc/qt-4.7/qml-state.html#changes-prop} {State} + \l {changes-prop} {State} type. \target obsolete-command @@ -448,7 +448,7 @@ \list \li ... \li Joining - \l {http://qt-project.org/doc/qt-5.0/qtcore/qchar.html#Joining-enum} + \l {Joining-enum} {joining}() const \c (preliminary) \li ... @@ -497,7 +497,7 @@ configuration variable. For that reason this reference will change according to the current documentation project. - See also \l {25-qdoc-configuration-derivedprojects.html#project} + See also \l {project} {\c project}. */ @@ -794,7 +794,7 @@ \endraw - This function overloads \l {http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#addAction} {addAction()} + This function overloads \l {addAction} {addAction()} This convenience function creates a new action with an \e icon and some \e text. The function adds the newly @@ -802,7 +802,7 @@ returns it. See also - \l {http://qt-project.org/doc/qt-5.0/qtwidgets/qwidget.html#addAction} + \l {addAction} {QWidget::addAction}(). \endquotation diff --git a/src/tools/qdoc/doc/qdoc-manual-intro.qdoc b/src/tools/qdoc/doc/qdoc-manual-intro.qdoc index db34e2a46c7..ad3779048ac 100644 --- a/src/tools/qdoc/doc/qdoc-manual-intro.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-intro.qdoc @@ -80,7 +80,7 @@ \endcode From the QDoc comment above, QDoc generates the HTML page - \l {http://qt-project.org/doc/qt-5.0/qtcore/qobject.html#details} + \l {details} {QObject Class Reference}. This manual explains how to use the QDoc commands in QDoc comments @@ -120,7 +120,7 @@ also specify \e {DITAXML} to get DITA XML output instead. Next, QDoc uses the values of the - \l {22-qdoc-configuration-generalvariables.html#headerdirs-variable} + \l {headerdirs-variable} {headerdirs} variable and/or the \l {22-qdoc-configuration-generalvariables.html#headers-variable} {headers} variable to find and parse all the header files for your diff --git a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc index b41c4507483..ee0a7b41dba 100644 --- a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc @@ -37,72 +37,72 @@ appearance and logical structure. \list - \li \l {04-qdoc-commands-textmarkup.html#a-command} {\\a} - \li \l {11-qdoc-commands-specialcontent.html#abstract-command} {\\abstract} - \li \l {12-0-qdoc-commands-miscellaneous.html#annotatedlist-command} {\\annotatedlist} - \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\b} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {04-qdoc-commands-textmarkup.html#b-command} {\\bold} {(deprecated, use \\b)} - \li \l {11-qdoc-commands-specialcontent.html#brief-command} {\\brief} - \li \l {04-qdoc-commands-textmarkup.html#c-command} {\\c} - \li \l {09-qdoc-commands-includingimages.html#caption-command} {\\caption} - \li \l {05-qdoc-commands-documentstructure.html#chapter-command} {\\chapter} - \li \l {06-qdoc-commands-includecodeinline.html#code-command} {\\code} - \li \l {07-0-qdoc-commands-includingexternalcode.html#codeline-command} {\\codeline} - \li \l {04-qdoc-commands-textmarkup.html#div-command} {\\div} - \li \l {07-0-qdoc-commands-includingexternalcode.html#dots-command} {\\dots} - \li \l {04-qdoc-commands-textmarkup.html#e-command} {\\e} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {12-0-qdoc-commands-miscellaneous.html#else-command} {\\else} - \li \l {12-0-qdoc-commands-miscellaneous.html#endif-command} {\\endif} - \li \l {11-qdoc-commands-specialcontent.html#footnote-command} {\\footnote} - \li \l {12-0-qdoc-commands-miscellaneous.html#generatelist-command} {\\generatelist} - \li \l {10-qdoc-commands-tablesandlists.html#header-command} {\\header} - \li \l {04-qdoc-commands-textmarkup.html#e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)} - \li \l {12-0-qdoc-commands-miscellaneous.html#if-command} {\\if} - \li \l {09-qdoc-commands-includingimages.html#image-command} {\\image} - \li \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\include} - \li \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\input} - \li \l {09-qdoc-commands-includingimages.html#inlineimage-command} {\\inlineimage} - \li \l {08-qdoc-commands-creatinglinks.html#keyword-command} {\\keyword} - \li \l {08-qdoc-commands-creatinglinks.html#l-command} {\\l} - \li \l {11-qdoc-commands-specialcontent.html#legalese-command} {\\legalese} - \li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\li} \span {class="newStuff"} {(new 5/3/2012)} - \li \l {10-qdoc-commands-tablesandlists.html#list-command} {\\list} - \li \l {12-0-qdoc-commands-miscellaneous.html#meta-command} {\\meta} - \li \l {06-qdoc-commands-includecodeinline.html#newcode-command} {\\newcode} - \li \l {10-qdoc-commands-tablesandlists.html#li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)} - \li \l {11-qdoc-commands-specialcontent.html#note-command} {\\note} - \li \l {06-qdoc-commands-includecodeinline.html#oldcode-command} {\\oldcode} - \li \l {12-0-qdoc-commands-miscellaneous.html#omit-command} {\\omit} - \li \l {05-qdoc-commands-documentstructure.html#part-command} {\\part} - \li \l {07-0-qdoc-commands-includingexternalcode.html#printline-command} {\\printline} - \li \l {07-0-qdoc-commands-includingexternalcode.html#printto-command} {\\printto} - \li \l {07-0-qdoc-commands-includingexternalcode.html#printuntil-command} {\\printuntil} - \li \l {11-qdoc-commands-specialcontent.html#quotation-command} {\\quotation} - \li \l {07-0-qdoc-commands-includingexternalcode.html#quotefile-command} {\\quotefile} - \li \l {07-0-qdoc-commands-includingexternalcode.html#quotefromfile-command} {\\quotefromfile} - \li \l {12-0-qdoc-commands-miscellaneous.html#raw-command} {\\raw} - \li \l {10-qdoc-commands-tablesandlists.html#row-command} {\\row} - \li \l {08-qdoc-commands-creatinglinks.html#sa-command} {\\sa} - \li \l {05-qdoc-commands-documentstructure.html#sectionOne-command} {\\section1} - \li \l {05-qdoc-commands-documentstructure.html#sectionTwo-command} {\\section2} - \li \l {05-qdoc-commands-documentstructure.html#sectionThree-command} {\\section3} - \li \l {05-qdoc-commands-documentstructure.html#sectionFour-command} {\\section4} - \li \l {07-0-qdoc-commands-includingexternalcode.html#skipline-command} {\\skipline} - \li \l {07-0-qdoc-commands-includingexternalcode.html#skipto-command} {\\skipto} - \li \l {07-0-qdoc-commands-includingexternalcode.html#skipuntil-command} {\\skipuntil} - \li \l {07-0-qdoc-commands-includingexternalcode.html#snippet-command} {\\snippet} - \li \l {04-qdoc-commands-textmarkup.html#span-command} {\\span} - \li \l {04-qdoc-commands-textmarkup.html#sub-command} {\\sub} - \li \l {04-qdoc-commands-textmarkup.html#sup-command} {\\sup} - \li \l {10-qdoc-commands-tablesandlists.html#table-command} {\\table} - \li \l {11-qdoc-commands-specialcontent.html#tableofcontents-command} {\\tableofcontents} - \li \l {08-qdoc-commands-creatinglinks.html#target-command} {\\target} - \li \l {04-qdoc-commands-textmarkup.html#tt-command} {\\tt} - \li \l {04-qdoc-commands-textmarkup.html#uicontrol-command} {\\uicontrol} {(new 25/3/2012)} - \li \l {04-qdoc-commands-textmarkup.html#underline-command} {\\underline} - \li \l {12-0-qdoc-commands-miscellaneous.html#raw-command} {\\unicode} - \li \l {11-qdoc-commands-specialcontent.html#warning-command} {\\warning} - \li \l {04-qdoc-commands-textmarkup.html#backslash-command} {\\\\} + \li \l {a-command} {\\a} + \li \l {abstract-command} {\\abstract} + \li \l {annotatedlist-command} {\\annotatedlist} + \li \l {b-command} {\\b} \span {class="newStuff"} + \li \l {b-command} {\\bold} {(deprecated, use \\b)} + \li \l {brief-command} {\\brief} + \li \l {c-command} {\\c} + \li \l {caption-command} {\\caption} + \li \l {chapter-command} {\\chapter} + \li \l {code-command} {\\code} + \li \l {codeline-command} {\\codeline} + \li \l {div-command} {\\div} + \li \l {dots-command} {\\dots} + \li \l {e-command} {\\e} \span {class="newStuff"} + \li \l {else-command} {\\else} + \li \l {endif-command} {\\endif} + \li \l {footnote-command} {\\footnote} + \li \l {generatelist-command} {\\generatelist} + \li \l {header-command} {\\header} + \li \l {e-command} {\\i} \span {class="newStuff"} {(deprecated, use \\e)} + \li \l {if-command} {\\if} + \li \l {image-command} {\\image} + \li \l {include-command} {\\include} + \li \l {include-command} {\\input} + \li \l {inlineimage-command} {\\inlineimage} + \li \l {keyword-command} {\\keyword} + \li \l {l-command} {\\l} + \li \l {legalese-command} {\\legalese} + \li \l {li-command} {\\li} \span {class="newStuff"} + \li \l {list-command} {\\list} + \li \l {meta-command} {\\meta} + \li \l {newcode-command} {\\newcode} + \li \l {li-command} {\\o} \span {class="newStuff"} {(deprecated, use \\li)} + \li \l {note-command} {\\note} + \li \l {oldcode-command} {\\oldcode} + \li \l {omit-command} {\\omit} + \li \l {part-command} {\\part} + \li \l {printline-command} {\\printline} + \li \l {printto-command} {\\printto} + \li \l {printuntil-command} {\\printuntil} + \li \l {quotation-command} {\\quotation} + \li \l {quotefile-command} {\\quotefile} + \li \l {quotefromfile-command} {\\quotefromfile} + \li \l {raw-command} {\\raw} + \li \l {row-command} {\\row} + \li \l {sa-command} {\\sa} + \li \l {sectionOne-command} {\\section1} + \li \l {sectionTwo-command} {\\section2} + \li \l {sectionThree-command} {\\section3} + \li \l {sectionFour-command} {\\section4} + \li \l {skipline-command} {\\skipline} + \li \l {skipto-command} {\\skipto} + \li \l {skipuntil-command} {\\skipuntil} + \li \l {snippet-command} {\\snippet} + \li \l {span-command} {\\span} + \li \l {sub-command} {\\sub} + \li \l {sup-command} {\\sup} + \li \l {table-command} {\\table} + \li \l {tableofcontents-command} {\\tableofcontents} + \li \l {target-command} {\\target} + \li \l {tt-command} {\\tt} + \li \l {uicontrol-command} {\\uicontrol} {(new 25/3/2012)} + \li \l {underline-command} {\\underline} + \li \l {raw-command} {\\unicode} + \li \l {warning-command} {\\warning} + \li \l {backslash-command} {\\\\} \endlist */ @@ -1826,7 +1826,7 @@ \endcode For the one-parameter version, the braces can often be omitted. - The \\l command supports several kinds of links: + The \\l command supports several ways of linking: \list @@ -1855,9 +1855,6 @@ \li \c {\l {Shared Classes}} - A keyword named in a \l {keyword-command} {\\keyword} command. - \li \c {\l network.html} - The file name used in a \l - {page-command} {\\page} command. - \li \c {\l http://qt-project.org/} - A URL. \endlist @@ -1974,22 +1971,15 @@ \endcode The target name \e{capturing parentheses} can be linked from - within the same document containing the target in two ways: + within the same document containing the target in the following way: \list \li \c {\l {capturing parentheses}} (from within the same QDoc comment) - \li \c {\l qregexp.html#capturing-parentheses} (from elsewhere in the same document) \endlist \note The brackets in the link example are required because the target name contains spaces. - The target name can be linked to in the following way from other documents: - - \list - \li \c {\l http://qt-project.org/doc/qt-5.0/qtcore/qregexp.html#capturing-parentheses} - \endlist - See also \l {l-command} {\\l}, \l {sa-command} {\\sa} and \l {keyword-command} {\\keyword}. @@ -2042,7 +2032,7 @@ \quotation When a string is surrounded by slashes, it is - interpreted as a \l {QRegExp}{regular expression}. + interpreted as a \l {regular expression}. \endquotation If the keyword text contains spaces, the brackets are required. @@ -2961,15 +2951,16 @@ \target brief class - When the \\brief command is used to describe a class, the brief - text should be a complete sentence and must start like this: + When the \\brief command is used to describe a class, we recommend + using a complete sentence like this: \code The class is|provides|contains|specifies... \endcode - \warning The brief statement is used as the first paragraph of the - detailed description. Do not repeat the sentence. + \warning Do not repeat your detailed description with the same sentence as + the brief statement will be the first paragraph of the detailed + description. \code / *! diff --git a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc index 74f5ad0c7b6..3adcf9b2139 100644 --- a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc @@ -63,7 +63,7 @@ Some configuration variables accept a list of strings as their value, for example: - \l {22-qdoc-configuration-generalvariables.html#sourcedirs-variable} + \l {sourcedirs-variable} {\c{sourcedirs}}, while others accept only a single string. Double quotes around a value string are optional, but including them allows you to use special characters like '=' and ' \" ' within the value @@ -87,39 +87,39 @@ \section1 Variable List \list - \li \l {22-qdoc-configuration-generalvariables.html#alias-variable} {alias} - \li \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoredirectives-variable} {Cpp.ignoredirectives} - \li \l {23-qdoc-configuration-cppvariables.html#Cpp.ignoretokens-variable} {Cpp.ignoretokens} - \li \l {22-qdoc-configuration-generalvariables.html#defines-variable} {defines} - \li \l {22-qdoc-configuration-generalvariables.html#edition-variable} {edition} - \li \l {22-qdoc-configuration-generalvariables.html#exampledirs-variable} {exampledirs} - \li \l {22-qdoc-configuration-generalvariables.html#examples-variable} {examples} - \li \l {22-qdoc-configuration-generalvariables.html#examples.fileextensions-variable} {examples.fileextensions} - \li \l {22-qdoc-configuration-generalvariables.html#excludedirs-variable} {excludedirs} - \li \l {22-qdoc-configuration-generalvariables.html#excludefiles-variable} {excludefiles} - \li \l {22-qdoc-configuration-generalvariables.html#extraimages-variable} {extraimages} - \li \l {22-qdoc-configuration-generalvariables.html#falsehoods-variable} {falsehoods} - \li \l {22-qdoc-configuration-generalvariables.html#headerdirs-variable} {headerdirs} - \li \l {22-qdoc-configuration-generalvariables.html#headers-variable} {headers} - \li \l {22-qdoc-configuration-generalvariables.html#headers.fileextensions-variable} {headers.fileextensions} - \li \l {24-qdoc-configuration-htmlvariables.html#HTML.footer-variable} {HTML.footer} - \li \l {24-qdoc-configuration-htmlvariables.html#HTML.postheader-variable} {HTML.postheader} - \li \l {24-qdoc-configuration-htmlvariables.html#HTML.style-variable} {HTML.style} - \li \l {22-qdoc-configuration-generalvariables.html#imagedirs-variable} {imagedirs} - \li \l {22-qdoc-configuration-generalvariables.html#images-variable} {images} - \li \l {22-qdoc-configuration-generalvariables.html#images.fileextensions-variable} {images.fileextensions} - \li \l {22-qdoc-configuration-generalvariables.html#language-variable} {language} - \li \l {22-qdoc-configuration-generalvariables.html#macro-variable} {macro} - \li \l {22-qdoc-configuration-generalvariables.html#manifestmeta-variable} {manifestmeta} - \li \l {22-qdoc-configuration-generalvariables.html#outputdir-variable} {outputdir} - \li \l {22-qdoc-configuration-generalvariables.html#outputformats-variable} {outputformats} - \li \l {22-qdoc-configuration-generalvariables.html#sourcedirs-variable} {sourcedirs} - \li \l {22-qdoc-configuration-generalvariables.html#sources-variable} {sources} - \li \l {22-qdoc-configuration-generalvariables.html#sources.fileextensions-variable} {sources.fileextensions} - \li \l {22-qdoc-configuration-generalvariables.html#spurious-variable} {spurious} - \li \l {22-qdoc-configuration-generalvariables.html#tabsize-variable} {tabsize} - \li \l {22-qdoc-configuration-generalvariables.html#version-variable} {version} - \li \l {22-qdoc-configuration-generalvariables.html#versionsym-variable} {versionsym} + \li \l {alias-variable} {alias} + \li \l {Cpp.ignoredirectives-variable} {Cpp.ignoredirectives} + \li \l {Cpp.ignoretokens-variable} {Cpp.ignoretokens} + \li \l {defines-variable} {defines} + \li \l {edition-variable} {edition} + \li \l {exampledirs-variable} {exampledirs} + \li \l {examples-variable} {examples} + \li \l {examples.fileextensions-variable} {examples.fileextensions} + \li \l {excludedirs-variable} {excludedirs} + \li \l {excludefiles-variable} {excludefiles} + \li \l {extraimages-variable} {extraimages} + \li \l {falsehoods-variable} {falsehoods} + \li \l {headerdirs-variable} {headerdirs} + \li \l {headers-variable} {headers} + \li \l {headers.fileextensions-variable} {headers.fileextensions} + \li \l {HTML.footer-variable} {HTML.footer} + \li \l {HTML.postheader-variable} {HTML.postheader} + \li \l {HTML.style-variable} {HTML.style} + \li \l {imagedirs-variable} {imagedirs} + \li \l {images-variable} {images} + \li \l {images.fileextensions-variable} {images.fileextensions} + \li \l {language-variable} {language} + \li \l {macro-variable} {macro} + \li \l {manifestmeta-variable} {manifestmeta} + \li \l {outputdir-variable} {outputdir} + \li \l {outputformats-variable} {outputformats} + \li \l {sourcedirs-variable} {sourcedirs} + \li \l {sources-variable} {sources} + \li \l {sources.fileextensions-variable} {sources.fileextensions} + \li \l {spurious-variable} {spurious} + \li \l {tabsize-variable} {tabsize} + \li \l {version-variable} {version} + \li \l {versionsym-variable} {versionsym} \endlist \section1 Categories @@ -1574,7 +1574,7 @@ dita.metadata.default.audience = programmer \endcode - See the \l {12-0-qdoc-commands-miscellaneous.html#meta-command} + See the \l {meta-command} {\\meta} command for more details on DITA metadata. */ From 127c18ff1100a9fb8559ca651dbc03ff1f8eabbd Mon Sep 17 00:00:00 2001 From: Marcel Krems Date: Sun, 10 Nov 2013 04:05:34 +0100 Subject: [PATCH 36/59] Doc: Add missing \since 5.2 to QMap::first/last{,Key} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I04b356bfdd2298dccb174ac7cc83d54a3fbcdc02 Reviewed-by: Thorbjørn Lund Martsum --- src/corelib/tools/qmap.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 9aebbb7b3c7..22d744f8699 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -897,6 +897,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! \fn const Key &QMap::firstKey() const + \since 5.2 Returns a reference to the smallest key in the map. This function assumes that the map is not empty. @@ -907,6 +908,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! \fn const Key &QMap::lastKey() const + \since 5.2 Returns a reference to the largest key in the map. This function assumes that the map is not empty. @@ -917,6 +919,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! \fn T &QMap::first() + \since 5.2 Returns a reference to the first value in the map, that is the value mapped to the smallest key. This function assumes that the map is not empty. @@ -927,11 +930,13 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! \fn const T &QMap::first() const + \since 5.2 \overload */ /*! \fn T &QMap::last() + \since 5.2 Returns a reference to the last value in the map, that is the value mapped to the largest key. This function assumes that the map is not empty. @@ -942,6 +947,7 @@ void QMapDataBase::freeData(QMapDataBase *d) */ /*! \fn const T &QMap::last() const + \since 5.2 \overload */ From 3396ba5612c1047d1b21a90c4996dff848c00114 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 13 Sep 2013 23:20:38 +0200 Subject: [PATCH 37/59] Match up the specified paper size to an existing one if possible When EnumForms was used then the dmPaperSize was not always correct for the custom paper sizes available on some printers. By using DeviceCapabilities we can be sure that the information is correct in this respect. This also fixes respecting of the custom paper size if one is given and there is no corresponding existing paper size for it. Task-number: QTBUG-34276 Change-Id: I9924d5be8527027fc434261e37f6c7aae66210c3 Reviewed-by: Friedemann Kleint --- src/printsupport/kernel/qprintengine_win.cpp | 128 +++++++++++------- .../kernel/qprinter/tst_qprinter.cpp | 79 ++++++++++- 2 files changed, 159 insertions(+), 48 deletions(-) diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index acaa32304ec..e2446c19b1f 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -67,6 +67,8 @@ QT_BEGIN_NAMESPACE Q_GUI_EXPORT HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &p, int hbitmapFormat = 0); extern QPainterPath qt_regionToPath(const QRegion ®ion); +Q_PRINTSUPPORT_EXPORT QSizeF qt_SizeFromUnitToMillimeter(const QSizeF &, QPrinter::Unit, double); +Q_PRINTSUPPORT_EXPORT double qt_multiplierForUnit(QPrinter::Unit unit, int resolution); // #define QT_DEBUG_DRAW @@ -114,6 +116,52 @@ static const struct { { 0, QPrinter::Custom } }; +// Return a list of printer paper sizes in millimeters with the corresponding dmPaperSize value +static QList > printerPaperSizes(const QString &printerName) +{ + QList > result; + const wchar_t *name = reinterpret_cast(printerName.utf16()); + DWORD paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERS, NULL, NULL); + if ((int)paperNameCount > 0) { + // If they are not equal, then there seems to be a problem with the driver + if (paperNameCount != DeviceCapabilities(name, NULL, DC_PAPERSIZE, NULL, NULL)) + return result; + QScopedArrayPointer papersNames(new wchar_t[paperNameCount]); + paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERS, papersNames.data(), NULL); + result.reserve(paperNameCount); + QScopedArrayPointer paperSizes(new POINT[paperNameCount]); + paperNameCount = DeviceCapabilities(name, NULL, DC_PAPERSIZE, (wchar_t *)paperSizes.data(), NULL); + for (int i=0; i <(int)paperNameCount; i++) + result.push_back(qMakePair(QSizeF(paperSizes[i].x / 10, paperSizes[i].y / 10), papersNames[i])); + } + return result; +} + +// Find the best-matching printer paper for size in millimeters. +static inline int findCustomPaperSize(const QSizeF &needlePt, const QString &printerName) +{ + const QList > sizes = printerPaperSizes(printerName); + const qreal nw = needlePt.width(); + const qreal nh = needlePt.height(); + for (int i = 0; i < sizes.size(); ++i) { + if (qAbs(nw - sizes.at(i).first.width()) <= 1 && qAbs(nh - sizes.at(i).first.height()) <= 1) + return sizes.at(i).second; + } + return -1; +} + +static inline void setDevModePaperFlags(DEVMODE *devMode, bool custom) +{ + if (custom) { + devMode->dmPaperSize = DMPAPER_USER; + devMode->dmFields |= DM_PAPERLENGTH | DM_PAPERWIDTH; + } else { + devMode->dmFields &= ~(DM_PAPERLENGTH | DM_PAPERWIDTH); + devMode->dmPaperLength = 0; + devMode->dmPaperWidth = 0; + } +} + QPrinter::PaperSize mapDevmodePaperSize(int s) { int i = 0; @@ -1293,6 +1341,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & break; d->devMode->dmPaperSize = mapPaperSizeDevmode(QPrinter::PaperSize(value.toInt())); d->has_custom_paper_size = (QPrinter::PaperSize(value.toInt()) == QPrinter::Custom); + setDevModePaperFlags(d->devMode, d->has_custom_paper_size); d->doReinit(); break; case PPK_PaperName: @@ -1320,9 +1369,19 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & wchar_t *papers = new wchar_t[size]; size = DeviceCapabilities(reinterpret_cast(d->name.utf16()), NULL, DC_PAPERS, papers, NULL); - d->has_custom_paper_size = false; - d->devMode->dmPaperSize = papers[paperPos]; - d->doReinit(); + QScopedArrayPointer paperSizes(new POINT[size]); + DWORD paperNameCount = DeviceCapabilities(reinterpret_cast(d->name.utf16()), NULL, DC_PAPERSIZE, (wchar_t *)paperSizes.data(), NULL); + if (paperNameCount == size) { + const double multiplier = qt_multiplierForUnit(QPrinter::Millimeter, d->resolution); + d->paper_size = QSizeF((paperSizes[paperPos].x / 10.0) * multiplier, (paperSizes[paperPos].y / 10.0) * multiplier); + // Our sizes may not match the paper name's size exactly + // So we treat it as custom so we know the paper size is correct + d->has_custom_paper_size = true; + d->devMode->dmPaperSize = papers[paperPos]; + setDevModePaperFlags(d->devMode, false); + d->doReinit(); + } + delete [] papers; } } @@ -1373,6 +1432,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & break; d->has_custom_paper_size = false; d->devMode->dmPaperSize = value.toInt(); + setDevModePaperFlags(d->devMode, d->has_custom_paper_size); d->doReinit(); break; @@ -1382,30 +1442,17 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->paper_size = value.toSizeF(); if (!d->devMode) break; - int orientation = d->devMode->dmOrientation; - DWORD needed = 0; - DWORD returned = 0; - if (!EnumForms(d->hPrinter, 1, 0, 0, &needed, &returned)) { - BYTE *forms = (BYTE *) malloc(needed); - if (EnumForms(d->hPrinter, 1, forms, needed, &needed, &returned)) { - for (DWORD i=0; i< returned; ++i) { - FORM_INFO_1 *formArray = reinterpret_cast(forms); - // the form sizes are specified in 1000th of a mm, - // convert the size to Points - QSizeF size((formArray[i].Size.cx * 72/25.4)/1000.0, - (formArray[i].Size.cy * 72/25.4)/1000.0); - if (qAbs(d->paper_size.width() - size.width()) <= 2 - && qAbs(d->paper_size.height() - size.height()) <= 2) - { - d->devMode->dmPaperSize = i + 1; - break; - } - } - } - free(forms); + const QSizeF sizeMM = qt_SizeFromUnitToMillimeter(d->paper_size, QPrinter::Point, d->resolution); + const int match = findCustomPaperSize(sizeMM, d->name); + setDevModePaperFlags(d->devMode, (match >= 0) ? false : true); + if (match >= 0) { + d->devMode->dmPaperSize = match; + if (d->devMode->dmOrientation != DMORIENT_PORTRAIT) + qSwap(d->paper_size.rwidth(), d->paper_size.rheight()); + } else { + d->devMode->dmPaperLength = qRound(sizeMM.height() * 10.0); + d->devMode->dmPaperWidth = qRound(sizeMM.width() * 10.0); } - if (orientation != DMORIENT_PORTRAIT) - d->paper_size = QSizeF(d->paper_size.height(), d->paper_size.width()); break; } @@ -1692,7 +1739,7 @@ QList > QWin32PrintEngine::supportedSizesWithNames(const for (int i=0;i<(int)size;i++) { wchar_t *paper = papers + (i * 64); QString str = QString::fromWCharArray(paper, qwcsnlen(paper, 64)); - paperSizes << qMakePair(str, QSizeF(points[i].x / 10, points[i].y / 10)); + paperSizes << qMakePair(str, QSizeF(points[i].x / 10.0, points[i].y / 10.0)); } delete [] points; } @@ -1908,30 +1955,19 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h SelectObject(hdc, old_font); } - void QWin32PrintEnginePrivate::updateCustomPaperSize() { - uint paperSize = devMode->dmPaperSize; + const uint paperSize = devMode->dmPaperSize; + has_custom_paper_size = true; if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) { - has_custom_paper_size = true; - DWORD needed = 0; - DWORD returned = 0; - if (!EnumForms(hPrinter, 1, 0, 0, &needed, &returned)) { - BYTE *forms = (BYTE *) malloc(needed); - if (EnumForms(hPrinter, 1, forms, needed, &needed, &returned)) { - if (paperSize <= returned) { - FORM_INFO_1 *formArray = (FORM_INFO_1 *) forms; - int width = formArray[paperSize - 1].Size.cx; // 1/1000 of a mm - int height = formArray[paperSize - 1].Size.cy; // 1/1000 of a mm - paper_size = QSizeF((width * 72 /25.4) / 1000.0, (height * 72 / 25.4) / 1000.0); - } else { - has_custom_paper_size = false; - } + const QList > paperSizes = printerPaperSizes(name); + for (int i=0; i > sizes = info.supportedSizesWithNames(); + if (sizes.size() == 0) + QSKIP("No printers installed on this machine"); + for (int i=0; i > sizes = info.supportedSizesWithNames(); + if (sizes.size() == 0) + QSKIP("No printers installed on this machine"); + for (int i=0; i Date: Sat, 9 Nov 2013 17:39:04 +0100 Subject: [PATCH 38/59] QKeySequenceEdit: remove RESET function from keySequence Q_PROPERTY A RESET function is only needed if the default value of the property cannot be set with the normal setter. This is not the case here, as clear() is the same as setKeySequence(QKeySequence()). Change-Id: Ib751677436ebdcec0a7951dceae1e0f0323500ff Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/widgets/widgets/qkeysequenceedit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qkeysequenceedit.h b/src/widgets/widgets/qkeysequenceedit.h index 5d827a3be8c..7eeff4e504e 100644 --- a/src/widgets/widgets/qkeysequenceedit.h +++ b/src/widgets/widgets/qkeysequenceedit.h @@ -53,7 +53,7 @@ class QKeySequenceEditPrivate; class Q_WIDGETS_EXPORT QKeySequenceEdit : public QWidget { Q_OBJECT - Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence RESET clear NOTIFY keySequenceChanged USER true) + Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence NOTIFY keySequenceChanged USER true) public: explicit QKeySequenceEdit(QWidget *parent = 0); From 38e90ad2b3cff1220c9214290b4c4fed9dd39bd5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 12 Nov 2013 11:17:05 +0100 Subject: [PATCH 39/59] qcompilerdetection.h: add Q_COMPILER_UNIFORM_INIT Up to now, the feature classe Uniform Initialization was subsumed by the Q_COMPILER_INITIALIZER_LISTS flag together with support for std::initializer_list. This caused at least two problems: 1. On QNX, the standard libray does not ship , even though the compiler (a GCC 4.6, IIRC) supports it. But since there was only one Q_COMPILER flag for both, support for the compiler-only part of the feature had to be disabled, too. 2. MSVC 2013 supports initializer lists, but has a bug that renders full uniform initialization support, as required for QUuid, useless. By splitting the feature into two, we can separate them better, and do so in QUuid, which is the only class that currently takes advantage of uniform initialization (to provide constexpr constructors). Since Q_COMPILER_INITIALIZER_LISTS worked as a flag for uniform initialization so far, with the two known exceptions above, UNIFORM_INIT is defined whenever INITIALIZER_LIST is, except that I don't revert UNIFORM_INIT on QNX as I do for INITIALIZER_LISTS and that I expect the MSVC 2013 features to set INITIALIZER_LIST, but not UNIFORM_INIT. Task-number: QTBUG-34705 Change-Id: I81916e950a0f3aab3de7977e0326d2de3d31b14c Reviewed-by: Yuchen Deng Reviewed-by: Thiago Macieira --- doc/global/qt-cpp-defines.qdocconf | 1 + src/corelib/global/qcompilerdetection.h | 7 ++++++- src/corelib/plugin/quuid.h | 4 ++-- tests/auto/corelib/plugin/quuid/tst_quuid.cpp | 12 ++++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf index b1738e129f5..528b0cd5611 100644 --- a/doc/global/qt-cpp-defines.qdocconf +++ b/doc/global/qt-cpp-defines.qdocconf @@ -15,6 +15,7 @@ defines += Q_QDOC \ Q_NO_USING_KEYWORD \ __cplusplus \ Q_COMPILER_INITIALIZER_LISTS \ + Q_COMPILER_UNIFORM_INIT \ Q_COMPILER_RVALUE_REFS Cpp.ignoretokens += \ diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index d02e4cf1993..f23478d75c6 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -465,6 +465,7 @@ * N2659 Q_COMPILER_THREAD_LOCAL * N2765 Q_COMPILER_UDL * N2442 Q_COMPILER_UNICODE_STRINGS + * N2640 Q_COMPILER_UNIFORM_INIT * N2544 Q_COMPILER_UNRESTRICTED_UNIONS * N1653 Q_COMPILER_VARIADIC_MACROS * N2242 N2555 Q_COMPILER_VARIADIC_TEMPLATES @@ -502,6 +503,7 @@ // constexpr support is only partial //# define Q_COMPILER_CONSTEXPR # define Q_COMPILER_INITIALIZER_LISTS +# define Q_COMPILER_UNIFORM_INIT # define Q_COMPILER_NOEXCEPT # endif # if __INTEL_COMPILER >= 1400 @@ -573,6 +575,7 @@ # endif # if __has_feature(cxx_generalized_initializers) # define Q_COMPILER_INITIALIZER_LISTS +# define Q_COMPILER_UNIFORM_INIT /* both covered by this feature macro, according to docs */ # endif # if __has_feature(cxx_lambdas) # define Q_COMPILER_LAMBDA @@ -645,6 +648,7 @@ # define Q_COMPILER_DELETE_MEMBERS # define Q_COMPILER_EXTERN_TEMPLATES # define Q_COMPILER_INITIALIZER_LISTS +# define Q_COMPILER_UNIFORM_INIT # define Q_COMPILER_UNICODE_STRINGS # define Q_COMPILER_VARIADIC_TEMPLATES # endif @@ -718,8 +722,9 @@ # define Q_COMPILER_DECLTYPE # define Q_COMPILER_RVALUE_REFS # define Q_COMPILER_STATIC_ASSERT -// MSVC has std::initilizer_list, but does not support the braces initialization +// MSVC's library has std::initilizer_list, but the compiler does not support the braces initialization //# define Q_COMPILER_INITIALIZER_LISTS +//# define Q_COMPILER_UNIFORM_INIT # endif # if _MSC_VER >= 1700 /* C++11 features supported in VC11 = VC2012: */ diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index 31b9890351e..a0d2923bed6 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -82,7 +82,7 @@ public: Sha1 = 5 // 0 1 0 1 }; -#if defined(Q_COMPILER_INITIALIZER_LISTS) && !defined(Q_QDOC) +#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC) Q_DECL_CONSTEXPR QUuid() : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {} Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, @@ -147,7 +147,7 @@ public: #if defined(Q_OS_WIN) // On Windows we have a type GUID that is used by the platform API, so we // provide convenience operators to cast from and to this type. -#if defined(Q_COMPILER_INITIALIZER_LISTS) && !defined(Q_QDOC) +#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC) Q_DECL_CONSTEXPR QUuid(const GUID &guid) : data1(guid.Data1), data2(guid.Data2), data3(guid.Data3), data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp index 197d56359f5..227351485d3 100644 --- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp @@ -64,6 +64,7 @@ private slots: void isNull(); void equal(); void notEqual(); + void cpp11(); // Only in Qt > 3.2.x void generate(); @@ -245,6 +246,17 @@ void tst_QUuid::notEqual() QVERIFY( uuidA != uuidB ); } +void tst_QUuid::cpp11() { +#ifdef Q_COMPILER_UNIFORM_INIT + // "{fc69b59e-cc34-4436-a43c-ee95d128b8c5}" cf, initTestCase + Q_DECL_CONSTEXPR QUuid u1{0xfc69b59e, 0xcc34, 0x4436, 0xa4, 0x3c, 0xee, 0x95, 0xd1, 0x28, 0xb8, 0xc5}; + Q_DECL_CONSTEXPR QUuid u2 = {0xfc69b59e, 0xcc34, 0x4436, 0xa4, 0x3c, 0xee, 0x95, 0xd1, 0x28, 0xb8, 0xc5}; + Q_UNUSED(u1); + Q_UNUSED(u2); +#else + QSKIP("This compiler is not in C++11 mode or it doesn't support uniform initialization"); +#endif +} void tst_QUuid::generate() { From 770a0c91f3fadcdb132d9eb96d085aafbe1bacd0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 14 Nov 2013 20:14:14 +0100 Subject: [PATCH 40/59] fix header bundling in some framework builds !build_all is a sufficient condition for bundling headers in both debug and release configurations, as it means that we will likely make only one of the builds, and that needs to be self-contained. Task-number: QTBUG-34575 Change-Id: I1a19e4b619eeff207cfbfd50d3b761053aeaa667 Reviewed-by: Thiago Macieira --- mkspecs/features/qt_module.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index 1bada0722c4..5068f7028f2 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -95,7 +95,7 @@ mac:CONFIG(shared, static|shared):contains(QT_CONFIG, qt_framework) { #QMAKE_FRAMEWORK_VERSION = 4.0 CONFIG += lib_bundle sliced_bundle qt_framework CONFIG -= qt_install_headers #no need to install these as well - !debug_and_release|if(build_all:CONFIG(release, debug|release)) { + !debug_and_release|!build_all|CONFIG(release, debug|release) { FRAMEWORK_HEADERS.version = Versions FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES FRAMEWORK_HEADERS.path = Headers From 63824d2e00de53ae61158547ad01e97038160137 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 14 Nov 2013 14:11:39 +0100 Subject: [PATCH 41/59] Android: Support popup menus This is used by QML comboboxes, menu buttons, etc. Task-number: QTBUG-31420 Change-Id: I6d3f32fd80ce91c4be34eae636d1b95a4e251a49 Reviewed-by: BogDan Vatra --- .../platforms/android/src/qandroidplatformmenu.cpp | 10 +++++++++- .../platforms/android/src/qandroidplatformmenu.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/android/src/qandroidplatformmenu.cpp b/src/plugins/platforms/android/src/qandroidplatformmenu.cpp index 253c22a12fa..1ecabb25e2c 100644 --- a/src/plugins/platforms/android/src/qandroidplatformmenu.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformmenu.cpp @@ -141,6 +141,15 @@ bool QAndroidPlatformMenu::isVisible() const return m_isVisible; } +void QAndroidPlatformMenu::showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item) +{ + Q_UNUSED(parentWindow); + Q_UNUSED(pos); + Q_UNUSED(item); + setVisible(true); + QtAndroidMenu::showContextMenu(this); +} + QPlatformMenuItem *QAndroidPlatformMenu::menuItemAt(int position) const { if (position < m_menuItems.size()) @@ -154,7 +163,6 @@ QPlatformMenuItem *QAndroidPlatformMenu::menuItemForTag(quintptr tag) const if (menuItem->tag() == tag) return menuItem; } - return 0; } diff --git a/src/plugins/platforms/android/src/qandroidplatformmenu.h b/src/plugins/platforms/android/src/qandroidplatformmenu.h index 20236cb6361..305b64168a8 100644 --- a/src/plugins/platforms/android/src/qandroidplatformmenu.h +++ b/src/plugins/platforms/android/src/qandroidplatformmenu.h @@ -71,6 +71,7 @@ public: bool isEnabled() const; void setVisible(bool visible); bool isVisible() const; + void showPopup(const QWindow *parentWindow, QPoint pos, const QPlatformMenuItem *item); QPlatformMenuItem *menuItemAt(int position) const; QPlatformMenuItem *menuItemForTag(quintptr tag) const; From 7d72516b52b20b0782d972224a55a43e74b8ae5a Mon Sep 17 00:00:00 2001 From: Alan Alpert <416365416c@gmail.com> Date: Fri, 13 Sep 2013 13:57:21 -0700 Subject: [PATCH 42/59] Change platform selectors to match qmake selectors Previously matched Qt.platform.os, however that can only provide one string. Multiple selectors can be present at once, so we can provide both unix and linux instead of having to pick the most specialized one. Task-number: QTBUG-34796 Change-Id: I219517d740fa7385e923a9e09cb7e241378fbaee Reviewed-by: David Faure --- src/corelib/io/qfileselector.cpp | 34 +++++++++++-------- .../{+generic_unix/test => +android/test2} | 0 .../qfileselector/platforms/+blackberry/test2 | 0 .../io/qfileselector/platforms/+ios/test2 | 0 .../io/qfileselector/platforms/+linux/test2 | 0 .../io/qfileselector/platforms/+mac/test | 0 .../io/qfileselector/platforms/+mac/test2 | 0 .../platforms/+unix/+android/test | 0 .../platforms/+unix/+blackberry/test | 0 .../qfileselector/platforms/+unix/+ios/test | 0 .../qfileselector/platforms/+unix/+linux/test | 0 .../qfileselector/platforms/+unix/+mac/test | 0 .../io/qfileselector/platforms/+unix/test | 0 .../io/qfileselector/platforms/+wince/test2 | 0 .../platforms/+windows/+wince/test | 0 .../io/qfileselector/platforms/+windows/test2 | 0 .../corelib/io/qfileselector/platforms/test2 | 0 .../io/qfileselector/qfileselector.qrc | 22 +++++++++--- .../io/qfileselector/tst_qfileselector.cpp | 30 ++++++++++++++-- 19 files changed, 65 insertions(+), 21 deletions(-) rename tests/auto/corelib/io/qfileselector/platforms/{+generic_unix/test => +android/test2} (100%) create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+blackberry/test2 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+ios/test2 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+linux/test2 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+mac/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+mac/test2 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+android/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+blackberry/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+linux/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+wince/test2 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+windows/+wince/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+windows/test2 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/test2 diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp index d67ea80e516..eed9e8870a6 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -348,22 +348,28 @@ void QFileSelectorPrivate::updateSelectors() QStringList QFileSelectorPrivate::platformSelectors() { QStringList ret; -#if defined(Q_OS_LINUX_ANDROID) - ret << QStringLiteral("android"); -#elif defined(Q_OS_BLACKBERRY) - ret << QStringLiteral("blackberry"); -#elif defined(Q_OS_IOS) - ret << QStringLiteral("ios"); -#elif defined(Q_OS_WINCE) - ret << QStringLiteral("wince"); -#elif defined(Q_OS_WIN) +#if defined(Q_OS_WIN) ret << QStringLiteral("windows"); -#elif defined(Q_OS_LINUX) - ret << QStringLiteral("linux"); -#elif defined(Q_OS_OSX) - ret << QStringLiteral("osx"); +# if defined(Q_OS_WINCE) + ret << QStringLiteral("wince"); +# endif #elif defined(Q_OS_UNIX) - ret << QStringLiteral("generic_unix"); + ret << QStringLiteral("unix"); +# if defined(Q_OS_LINUX_ANDROID) + ret << QStringLiteral("android"); +# elif defined(Q_OS_BLACKBERRY) + ret << QStringLiteral("blackberry"); +# elif defined(Q_OS_IOS) + ret << QStringLiteral("ios"); +# elif defined(Q_OS_LINUX) + ret << QStringLiteral("linux"); +# elif defined(Q_OS_MAC) + ret << QStringLiteral("mac"); +# else + struct utsname u; + if (uname(&u) != -1) + ret << QString::fromLatin1(u.sysname).toLower(); +# endif #endif return ret; } diff --git a/tests/auto/corelib/io/qfileselector/platforms/+generic_unix/test b/tests/auto/corelib/io/qfileselector/platforms/+android/test2 similarity index 100% rename from tests/auto/corelib/io/qfileselector/platforms/+generic_unix/test rename to tests/auto/corelib/io/qfileselector/platforms/+android/test2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test2 b/tests/auto/corelib/io/qfileselector/platforms/+blackberry/test2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+ios/test2 b/tests/auto/corelib/io/qfileselector/platforms/+ios/test2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+linux/test2 b/tests/auto/corelib/io/qfileselector/platforms/+linux/test2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+mac/test new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test2 b/tests/auto/corelib/io/qfileselector/platforms/+mac/test2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+android/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+android/test new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+blackberry/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+blackberry/test new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+linux/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+linux/test new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/test new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+wince/test2 b/tests/auto/corelib/io/qfileselector/platforms/+wince/test2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+windows/+wince/test b/tests/auto/corelib/io/qfileselector/platforms/+windows/+wince/test new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/+windows/test2 b/tests/auto/corelib/io/qfileselector/platforms/+windows/test2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/platforms/test2 b/tests/auto/corelib/io/qfileselector/platforms/test2 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc index c644e411075..abfead2a556 100644 --- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc +++ b/tests/auto/corelib/io/qfileselector/qfileselector.qrc @@ -11,13 +11,27 @@ extras/+custom3/+custom5/test extras/+custom5/+custom3/test platforms/test + platforms/+unix/+android/test + platforms/+unix/+blackberry/test + platforms/+unix/+ios/test + platforms/+unix/+mac/test + platforms/+windows/+wince/test + platforms/+windows/test + platforms/+windows/test2 + platforms/+unix/+linux/test + platforms/+unix/test + platforms/test2 + platforms/+android/test2 + platforms/+blackberry/test2 + platforms/+ios/test2 + platforms/+mac/test2 + platforms/+linux/test2 + platforms/+wince/test2 platforms/+android/test platforms/+blackberry/test platforms/+ios/test - platforms/+osx/test - platforms/+wince/test - platforms/+windows/test + platforms/+mac/test platforms/+linux/test - platforms/+generic_unix/test + platforms/+wince/test diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp index 2baebd0296d..d6461c3aba0 100644 --- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp +++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp @@ -91,9 +91,33 @@ void tst_QFileSelector::basicTest_data() QTest::addColumn("expectedPath"); QString test("/test");// '/' is here so dir string can also be selector string - QTest::newRow("platform") << QString(":/platforms/test") << QStringList() - << QString(":/platforms/") + QLatin1Char(selectorIndicator) - + QFileSelectorPrivate::platformSelectors().first() + test; + QString test2("/test2"); + QString expectedPlatform1File(":/platforms"); + QString expectedPlatform2File(""); //Only the last selector +#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_IOS) && !defined(Q_OS_LINUX) && !defined(Q_OS_MAC) + /* We are only aware of specific unixes, and do not have test files for any of the others. + However those unixes can get a selector added from the result of a uname call, so this will + lead to a case where we don't have that file so we can't expect the concatenation of platform + selectors to work. It should just find the +unix/test file.*/ + expectedPlatform1File = QString(":/platforms/") + QLatin1Char(selectorIndicator) + + QString("unix/test"); + expectedPlatform2File = QString(":/platforms/test2"); +#else + foreach (const QString &selector, QFileSelectorPrivate::platformSelectors()) { + expectedPlatform1File = expectedPlatform1File + QLatin1Char('/') + QLatin1Char(selectorIndicator) + + selector; + expectedPlatform2File = selector; + } + expectedPlatform1File += test; + expectedPlatform2File = QLatin1String(":/platforms/") + QLatin1Char(selectorIndicator) + + expectedPlatform2File + test2; +#endif + + QTest::newRow("platform1") << QString(":/platforms/test") << QStringList() + << expectedPlatform1File; + + QTest::newRow("platform2") << QString(":/platforms/test2") << QStringList() + << expectedPlatform2File; QString resourceTestPath(":/extras/test"); QString custom1("custom1"); From 00b13e63888dad5fe9d5e07426ea34aa60e8f709 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Wed, 13 Nov 2013 17:24:21 +0100 Subject: [PATCH 43/59] QNX: Fixed touch event positions Touch positions reported by libscreen have to be adjusted relative to the window position to be properly interpreted by Qt. Task-number: QTBUG-34812 Change-Id: I68744dc9da95fb1d0d1704d12154fb24c148fe03 Reviewed-by: Sean Harmer --- .../platforms/qnx/qqnxscreeneventhandler.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 9db62865bb1..6f067973930 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -438,7 +438,14 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType) m_touchPoints[touchId].normalPosition = QPointF(static_cast(pos[0]) / screenSize.width(), static_cast(pos[1]) / screenSize.height()); - m_touchPoints[touchId].area = QRectF( pos[0], pos[1], 0.0, 0.0 ); + + m_touchPoints[touchId].area = QRectF(w->geometry().left() + windowPos[0], + w->geometry().top() + windowPos[1], 0.0, 0.0); + QWindow *parent = w->parent(); + while (parent) { + m_touchPoints[touchId].area.translate(parent->geometry().topLeft()); + parent = parent->parent(); + } // determine event type and update state of current touch point QEvent::Type type = QEvent::None; @@ -473,8 +480,8 @@ void QQnxScreenEventHandler::handleTouchEvent(screen_event_t event, int qnxType) // inject event into Qt QWindowSystemInterface::handleTouchEvent(w, m_touchDevice, pointList); qScreenEventDebug() << Q_FUNC_INFO << "Qt touch, w =" << w - << ", p=(" << pos[0] << "," << pos[1] - << "), t=" << type; + << ", p=" << m_touchPoints[touchId].area.topLeft() + << ", t=" << type; } } } From 50a64e7626197dc566db4becd4ed17fd53998b43 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 12 Nov 2013 11:35:53 +0200 Subject: [PATCH 44/59] Don't maximize dialogs. Task-number: QTBUG-34765 Change-Id: Ia249e93dbbea11f3c03881c5fb88396bfad0e8fa Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/kernel/qwindow.cpp | 2 +- src/widgets/kernel/qwidget.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index a6223987c26..4a40dd7e29c 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1662,7 +1662,7 @@ void QWindow::show() bool isPopup = d_func()->windowFlags & Qt::Popup & ~Qt::Window; if (!isPopup && qApp->styleHints()->showIsFullScreen()) showFullScreen(); - else if (!isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) + else if (!isPopup && !(d_func()->windowFlags & Qt::Dialog & ~Qt::Window) && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) showMaximized(); else showNormal(); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index a41d14e7d0c..933294e21fa 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -7012,7 +7012,7 @@ void QWidget::show() bool isPopup = data->window_flags & Qt::Popup & ~Qt::Window; if (isWindow() && !isPopup && qApp->styleHints()->showIsFullScreen()) showFullScreen(); - else if (isWindow() && !isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) + else if (isWindow() && !(data->window_flags & Qt::Dialog & ~Qt::Window) && !isPopup && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ShowIsMaximized).toBool()) showMaximized(); else setVisible(true); From a106be6f462b24bbb7caed5236d4f28e8a855c09 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 11 Nov 2013 09:15:24 +0100 Subject: [PATCH 45/59] Fix QCoreApplication documentation. Task-number: QTBUG-33360 Change-Id: Ifdc0bcc580d0a2dacc6a0bdce10aa278e0bdfe9c Reviewed-by: Jerome Pasion --- 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 1ae4da12e80..43c64b7b2ce 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1027,7 +1027,7 @@ bool QCoreApplication::closingDown() You can call this function occasionally when your program is busy performing a long operation (e.g. copying a file). - In event you are running a local loop which calls this function + In the event that you are running a local loop which calls this function continuously, without an event loop, the \l{QEvent::DeferredDelete}{DeferredDelete} events will not be processed. This can affect the behaviour of widgets, From 3e88ebc43dc1ca68f9f521f34584b4374452df9b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 15 Nov 2013 12:58:49 +0100 Subject: [PATCH 46/59] Remove stray debug output This was actually causing test failures in qtdeclarative and blocking the CI there. Change-Id: I4538342f16b6468ad60b283c19948863b20ad5d4 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/cocoa/qcocoaglcontext.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index b3695c26358..144144338f5 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -242,7 +242,6 @@ void QCocoaGLContext::updateSurfaceFormat() // attribute to check explicitly for this so we use our best guess for alpha. int alphaSize = -1; [pixelFormat getValues:&alphaSize forAttribute:NSOpenGLPFAAlphaSize forVirtualScreen:0]; - qDebug() << "alphaSize =" << alphaSize; if (alphaSize > 0 && requestedFormat.alphaBufferSize() > 0) m_format.setAlphaBufferSize(alphaSize); From e3383ab646381cfca217af5ea6b059e59a837edd Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 12 Nov 2013 15:36:50 +0100 Subject: [PATCH 47/59] GTK theme should not claim to provide a native MessageDialog yet It was providing all possible types, but now MessageDialog is a new native dialog type, and only on Android at the moment. Task-number: QTBUG-34784 Change-Id: I2fb288c8d5e176ca4dafbbc310de2f29bbcfc000 Reviewed-by: J-P Nurmi --- src/plugins/platformthemes/gtk2/qgtk2theme.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp index f069d9f97ca..812f4bc0007 100644 --- a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp +++ b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp @@ -87,8 +87,16 @@ QVariant QGtk2Theme::themeHint(QPlatformTheme::ThemeHint hint) const bool QGtk2Theme::usePlatformNativeDialog(DialogType type) const { - Q_UNUSED(type); - return true; + switch (type) { + case ColorDialog: + return true; + case FileDialog: + return true; + case FontDialog: + return true; + default: + return false; + } } QPlatformDialogHelper *QGtk2Theme::createPlatformDialogHelper(DialogType type) const From 4225e7103825a55ecddf27c21ec6a7ab5f5d0f63 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:40:26 +0100 Subject: [PATCH 48/59] QCollator: mark ctor explicit QCollator and QLocale are not equivalent types, so there should be no implicit conversion between them. Change-Id: I395f8dc3c35b4202c9276c3eea0686176f8e07cc Reviewed-by: Aleix Pol Gonzalez Reviewed-by: Thiago Macieira --- src/corelib/tools/qcollator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index b99fd1c0cc5..011c2a8d023 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -79,7 +79,7 @@ private: class Q_CORE_EXPORT QCollator { public: - QCollator(const QLocale &locale = QLocale()); + explicit QCollator(const QLocale &locale = QLocale()); QCollator(const QCollator &); ~QCollator(); QCollator &operator=(const QCollator &); From 2c450d90b6cb21fa5f4d2195d603c19c7bebb9ad Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:27:11 +0100 Subject: [PATCH 49/59] QCollator(SortKey): add member-swap This is required for a Qt value type these days. Change-Id: Ibd4e1581a4f4791a410caa10fede92c26b35dd9d Reviewed-by: Thiago Macieira --- src/corelib/tools/qcollator.cpp | 7 +++++++ src/corelib/tools/qcollator.h | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index a3a9ef940b0..cfb5fe77aec 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -117,6 +117,13 @@ QCollator &QCollator::operator=(const QCollator &other) return *this; } +/*! + \fn void QCollator::swap(QCollator &other) + + Swaps this collator with \a other. This function is very fast and + never fails. +*/ + /*! \internal */ diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index 011c2a8d023..e5abc91967b 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -61,8 +61,10 @@ public: QCollatorSortKey &operator=(const QCollatorSortKey &other); #ifdef Q_COMPILER_RVALUE_REFS inline QCollatorSortKey &operator=(QCollatorSortKey &&other) - { qSwap(d, other.d); return *this; } + { swap(other); return *this; } #endif + void swap(QCollatorSortKey &other) + { d.swap(other.d); } bool operator<(const QCollatorSortKey &key) const; int compare(const QCollatorSortKey &key) const; @@ -84,6 +86,9 @@ public: ~QCollator(); QCollator &operator=(const QCollator &); + void swap(QCollator &other) + { qSwap(d, other.d); } + void setLocale(const QLocale &locale); QLocale locale() const; From 81f2d6eaacb905500f11d102e3f19c702535ec24 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 11 Nov 2013 10:35:33 +0100 Subject: [PATCH 50/59] Fix compiler warning for cast from int to id. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qcocoaapplication.mm:118:61: warning: cast to 'id' from smaller integer type 'int' [-Wint-to-pointer-cast] id a1 = ([args->arg1 isKindOfClass:[NSNumber class]]) ? (id)[args->arg1 intValue] : args->arg1; ^ qcocoaapplication.mm:119:61: warning: cast to 'id' from smaller integer type 'int' [-Wint-to-pointer-cast] id a2 = ([args->arg2 isKindOfClass:[NSNumber class]]) ? (id)[args->arg2 intValue] : args->arg2; Change-Id: Ibcf3d5d5698ff863f3c9bd65e0388ccca147f419 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qcocoaapplication.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm index c293f4cd520..551a59823cb 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplication.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm @@ -115,8 +115,8 @@ QT_USE_NAMESPACE QCocoaPostMessageArgs *args = reinterpret_cast(lower | (upper << 32)); // Special case for convenience: if the argument is an NSNumber, we unbox it directly. // Use NSValue instead if this behaviour is unwanted. - id a1 = ([args->arg1 isKindOfClass:[NSNumber class]]) ? (id)[args->arg1 intValue] : args->arg1; - id a2 = ([args->arg2 isKindOfClass:[NSNumber class]]) ? (id)[args->arg2 intValue] : args->arg2; + id a1 = ([args->arg1 isKindOfClass:[NSNumber class]]) ? (id)[args->arg1 longValue] : args->arg1; + id a2 = ([args->arg2 isKindOfClass:[NSNumber class]]) ? (id)[args->arg2 longValue] : args->arg2; switch (args->argCount) { case 0: [args->target performSelector:args->selector]; From 345525db99cf0805af04492e08aeeb9a7bbc6bec Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 13 Nov 2013 14:39:33 +0100 Subject: [PATCH 51/59] Missing entry in QImage inplace_converter_map The inplace_converter_map never had an entry for ARGB4444_Premultiplied this leads to the possibility of accessing outside of the array, and means the RGBA8888 formats are misplaced. Change-Id: Ida0d94912b53a7730b8fb5f6ccc31e7879ea3d27 Reviewed-by: Gunnar Sletta --- src/gui/image/qimage.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index d602ed40355..09168265296 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3852,6 +3852,9 @@ static InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QIma { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_RGB444 + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }, // Format_ARGB4444_Premultiplied { 0, 0, From e9af987f2821112ec6b03af5e2527c37c5580c68 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 11 Nov 2013 16:34:51 +0100 Subject: [PATCH 52/59] Try to find GL headers in Mac SDKs. Task-number: QTBUG-32308 Change-Id: Ibbab3852e5cc289faa63d0a66a3816ab8062ccb9 Reviewed-by: Stephen Kelly Reviewed-by: Brad King --- src/gui/Qt5GuiConfigExtras.cmake.in | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in index b79845b07c0..75a2385d57c 100644 --- a/src/gui/Qt5GuiConfigExtras.cmake.in +++ b/src/gui/Qt5GuiConfigExtras.cmake.in @@ -77,7 +77,21 @@ unset(_qt5gui_OPENGL_INCLUDE_DIR CACHE) macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) set(Qt5Gui_${Name}_LIBRARIES) +!!IF !mac set(Qt5Gui_${Name}_INCLUDE_DIRS ${IncDirs}) +!!ELSE + foreach(_dir ${IncDirs}) + if (EXISTS ${_dir}) + list(APPEND Qt5Gui_${Name}_INCLUDE_DIRS ${_dir}) + else() + find_path(_actual_dir ${_dir}) # Look in sdk directories + if (_actual_dir) + list(APPEND Qt5Gui_${Name}_INCLUDE_DIRS ${_actual_dir}) + endif() + unset(_actual_dir CACHE) + endif() + endforeach() +!!ENDIF foreach(_lib ${Libs}) string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_lib}) if (NOT TARGET Qt5::Gui_${_cmake_lib_name}) @@ -100,7 +114,7 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) endif() endif() add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED) - set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${IncDirs}) + set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_${Name}_INCLUDE_DIRS}) set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) _qt5_Gui_check_file_exists(\"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\") @@ -130,7 +144,7 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name}) endforeach() if (NOT CMAKE_CROSSCOMPILING) - foreach(_dir ${IncDirs}) + foreach(_dir ${Qt5Gui_${Name}_INCLUDE_DIRS}) _qt5_Gui_check_file_exists(${_dir}) endforeach() endif() From be405c86f8efac7c6bc8b749725d6d0e0499314d Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 12 Nov 2013 09:41:42 +0100 Subject: [PATCH 53/59] Fix the window flags for Cocoa windows This ensures that the possible window flag combinations are respected where possible in Cocoa. Task-number: QTBUG-34645 Task-number: QTBUG-31616 Change-Id: I6be8ca666b7cbc397575e97cd95ea298f52a7113 Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 228ef9d4841..c22f254aefe 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -470,14 +470,12 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags) styleMask = (NSUtilityWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask); } else { - // Filter flags for supported properties - flags &= Qt::WindowType_Mask | Qt::FramelessWindowHint | Qt::WindowTitleHint | - Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint; - if (flags == Qt::Window) { + if (type == Qt::Window && !(flags & Qt::CustomizeWindowHint)) { styleMask = (NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask); - } else if ((flags & Qt::Dialog) == Qt::Dialog) { + } else if (type == Qt::Dialog) { if (flags & Qt::CustomizeWindowHint) { - styleMask = NSResizableWindowMask; + if (flags & Qt::WindowMaximizeButtonHint) + styleMask = NSResizableWindowMask; if (flags & Qt::WindowTitleHint) styleMask |= NSTitledWindowMask; if (flags & Qt::WindowCloseButtonHint) @@ -488,7 +486,7 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags) styleMask = NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask; } } else if (!(flags & Qt::FramelessWindowHint)) { - if ((flags & Qt::Dialog) || (flags & Qt::WindowMaximizeButtonHint)) + if (flags & Qt::WindowMaximizeButtonHint) styleMask |= NSResizableWindowMask; if (flags & Qt::WindowTitleHint) styleMask |= NSTitledWindowMask; From 8cbea7a886e336bca6e17f5cb8404a91cbec9fda Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:52:44 +0100 Subject: [PATCH 54/59] QFileSelector: mark ctor explicit This is standard for (QObject*) ctors. Change-Id: I4756ba50b1f3148d72e95e581d52a37ebd47a7ae Reviewed-by: John Layt Reviewed-by: Alan Alpert Reviewed-by: Olivier Goffart --- src/corelib/io/qfileselector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qfileselector.h b/src/corelib/io/qfileselector.h index 9afd985757e..cb5f71faae6 100644 --- a/src/corelib/io/qfileselector.h +++ b/src/corelib/io/qfileselector.h @@ -52,7 +52,7 @@ class Q_CORE_EXPORT QFileSelector : public QObject { Q_OBJECT public: - QFileSelector(QObject *parent = 0); + explicit QFileSelector(QObject *parent = 0); ~QFileSelector(); QString select(const QString &filePath) const; From 6c04c21c101b70401ad9cb08de1562dc90166e9c Mon Sep 17 00:00:00 2001 From: Martin Pley Date: Fri, 15 Nov 2013 22:01:54 +0100 Subject: [PATCH 55/59] Crash fix in QTreeView::sizeHintForColumn(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vertical scrollbar may get out of sync. When this happens, the calculation of firstVisibleItem will retrun "-1". This must be handled in ::sizeHintForColumn(). Added an auto-test for the crashes. Task-number: QTBUG-34717 Change-Id: I867fd144ef3ce45e382337c5eafe345f573cd944 Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/itemviews/qtreeview.cpp | 20 ++++++++++++- .../itemviews/qtreeview/tst_qtreeview.cpp | 30 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index fc0d639483f..4d0eb5c3ad3 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -2858,6 +2858,21 @@ int QTreeView::sizeHintForColumn(int column) const int offset = 0; int start = d->firstVisibleItem(&offset); int end = d->lastVisibleItem(start, offset); + if (start < 0 || end < 0 || end == viewItems.size() - 1) { + end = viewItems.size() - 1; + if (maximumProcessRows < 0) { + start = 0; + } else if (maximumProcessRows == 0) { + start = qMax(0, end - 1); + int remainingHeight = viewport()->height(); + while (start > 0 && remainingHeight > 0) { + remainingHeight -= d->itemHeight(start); + --start; + } + } else { + start = qMax(0, end - maximumProcessRows); + } + } int rowsProcessed = 0; @@ -3606,8 +3621,11 @@ int QTreeViewPrivate::firstVisibleItem(int *offset) const int QTreeViewPrivate::lastVisibleItem(int firstVisual, int offset) const { - if (firstVisual < 0 || offset < 0) + if (firstVisual < 0 || offset < 0) { firstVisual = firstVisibleItem(&offset); + if (firstVisual < 0) + return -1; + } int y = - offset; int value = viewport->height(); diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 8d31fcdf13c..ccdce1fe0c7 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -259,6 +259,7 @@ private slots: void taskQTBUG_25333_adjustViewOptionsForIndex(); void taskQTBUG_18539_emitLayoutChanged(); void taskQTBUG_8176_emitOnExpandAll(); + void taskQTBUG_34717_collapseAtBottom(); void testInitialFocus(); }; @@ -4240,6 +4241,35 @@ void tst_QTreeView::taskQTBUG_8176_emitOnExpandAll() QCOMPARE(spy2.size(), 1); // item2 is collapsed } +// From QTBUG_34717 (QTreeWidget crashes when scrolling to the end +// of an expanded tree, then collapse all) +// The test passes simply if it doesn't crash. +void tst_QTreeView::taskQTBUG_34717_collapseAtBottom() +{ + QTreeWidget treeWidget; + treeWidget.header()->setSectionResizeMode(QHeaderView::ResizeToContents); + treeWidget.setColumnCount(2); + QTreeWidgetItem *mainItem = new QTreeWidgetItem(&treeWidget, QStringList() << "Root"); + for (int i = 0; i < 200; ++i) { + QTreeWidgetItem *item = new QTreeWidgetItem(mainItem, QStringList(QString("Item"))); + new QTreeWidgetItem(item, QStringList() << "Child" << "1"); + new QTreeWidgetItem(item, QStringList() << "Child" << "2"); + new QTreeWidgetItem(item, QStringList() << "Child" << "3"); + } + treeWidget.show(); + treeWidget.expandAll(); + treeWidget.scrollToBottom(); + treeWidget.collapseAll(); + + treeWidget.setAnimated(true); + treeWidget.expandAll(); + treeWidget.scrollToBottom(); + mainItem->setExpanded(false); + + PublicView *pview = (PublicView*) &treeWidget; + QVERIFY(pview->sizeHintForColumn(1) >= 0); +} + void tst_QTreeView::testInitialFocus() { QTreeWidget treeWidget; From 3e803b5180e7059c01c15ea84cadd54982e1a221 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:37:37 +0100 Subject: [PATCH 56/59] QCollator: enable move semantics This necessitates adding d==0 checks in QCollator. By documenting that moved-from instances can only be assigned to or destroyed, we can limit the functions in which to check for d==0 to the assignment operator and the destructor. Doing otherwise would destroy all advantages of move semantics by introducing a heap allocation to re-populate other.d. Add a test for this (QCollator didn't have any before). Change-Id: Ic6ff202072822bebfd5e48259c3d0fa345a63118 Reviewed-by: Thiago Macieira --- src/corelib/tools/qcollator.cpp | 26 +++++- src/corelib/tools/qcollator.h | 6 ++ .../corelib/tools/qcollator/qcollator.pro | 7 ++ .../corelib/tools/qcollator/tst_qcollator.cpp | 92 +++++++++++++++++++ tests/auto/corelib/tools/tools.pro | 1 + 5 files changed, 129 insertions(+), 3 deletions(-) create mode 100644 tests/auto/corelib/tools/qcollator/qcollator.pro create mode 100644 tests/auto/corelib/tools/qcollator/tst_qcollator.cpp diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index cfb5fe77aec..80d330bfca8 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -99,7 +99,7 @@ QCollator::QCollator(const QCollator &other) */ QCollator::~QCollator() { - if (!d->ref.deref()) + if (d && !d->ref.deref()) delete d; } @@ -109,14 +109,34 @@ QCollator::~QCollator() QCollator &QCollator::operator=(const QCollator &other) { if (this != &other) { - if (!d->ref.deref()) + if (d && !d->ref.deref()) delete d; d = other.d; - d->ref.ref(); + if (d) d->ref.ref(); } return *this; } +/* + \fn void QCollator::QCollator(QCollator &&other) + + Move constructor. Moves from \a other into this collator. + + Note that a moved-from QCollator can only be destroyed or assigned + to. The effect of calling other functions than the destructor or + one of the assignment operators is undefined. +*/ + +/* + \fn QCollator &QCollator::operator=(QCollator &&other) + + Move-assigns from \a other to this collator. + + Note that a moved-from QCollator can only be destroyed or assigned + to. The effect of calling other functions than the destructor or + one of the assignment operators is undefined. +*/ + /*! \fn void QCollator::swap(QCollator &other) diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index e5abc91967b..1007aa76236 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -85,6 +85,12 @@ public: QCollator(const QCollator &); ~QCollator(); QCollator &operator=(const QCollator &); +#ifdef Q_COMPILER_RVALUE_REFS + QCollator(QCollator &&other) + : d(other.d) { other.d = 0; } + QCollator &operator=(QCollator &&other) + { swap(other); return *this; } +#endif void swap(QCollator &other) { qSwap(d, other.d); } diff --git a/tests/auto/corelib/tools/qcollator/qcollator.pro b/tests/auto/corelib/tools/qcollator/qcollator.pro new file mode 100644 index 00000000000..3c5987ffa07 --- /dev/null +++ b/tests/auto/corelib/tools/qcollator/qcollator.pro @@ -0,0 +1,7 @@ +CONFIG += testcase parallel_test +TARGET = tst_qcollator +QT = core testlib +SOURCES = tst_qcollator.cpp +DEFINES += QT_NO_CAST_TO_ASCII +contains(QT_CONFIG,icu):DEFINES += QT_USE_ICU +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp new file mode 100644 index 00000000000..3df8422a34f --- /dev/null +++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include +#include + +#include + +class tst_QCollator : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void moveSemantics(); +}; + +#ifdef Q_COMPILER_RVALUE_REFS +static bool dpointer_is_null(QCollator &c) +{ + char mem[sizeof c]; + using namespace std; + memcpy(mem, &c, sizeof c); + for (size_t i = 0; i < sizeof c; ++i) + if (mem[i]) + return false; + return true; +} +#endif + +void tst_QCollator::moveSemantics() +{ +#ifdef Q_COMPILER_RVALUE_REFS + const QLocale de_AT(QLocale::German, QLocale::Austria); + + QCollator c1(de_AT); + QCOMPARE(c1.locale(), de_AT); + + QCollator c2(std::move(c1)); + QCOMPARE(c2.locale(), de_AT); + QVERIFY(dpointer_is_null(c1)); + + c1 = std::move(c2); + QCOMPARE(c1.locale(), de_AT); + QVERIFY(dpointer_is_null(c2)); +#else + QSKIP("The compiler is not in C++11 mode or does not support move semantics."); +#endif +} + +QTEST_APPLESS_MAIN(tst_QCollator) + +#include "tst_qcollator.moc" diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro index e920813db25..286afdfd18d 100644 --- a/tests/auto/corelib/tools/tools.pro +++ b/tests/auto/corelib/tools/tools.pro @@ -8,6 +8,7 @@ SUBDIRS=\ qbytedatabuffer \ qcache \ qchar \ + qcollator \ qcommandlineparser \ qcontiguouscache \ qcryptographichash \ From 70bc2e882ffc2ea998717d7fcde2b02a2124f52e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:29:47 +0100 Subject: [PATCH 57/59] QCollator(SortKey): declare as shared This enables specialisations of (std and q) swap using member-swap and declares the types movable for efficient use in Qt containers, and QList in particular. This is a binary-incompatible change, so cannot wait for 5.2.1. Change-Id: I7e90b6397ac4d00d0a7a5c42bae166c1b43e1994 Reviewed-by: Aleix Pol Gonzalez Reviewed-by: Thiago Macieira --- src/corelib/tools/qcollator.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index 1007aa76236..941637e2001 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -122,6 +122,9 @@ private: void detach(); }; +Q_DECLARE_SHARED(QCollatorSortKey) +Q_DECLARE_SHARED(QCollator) + QT_END_NAMESPACE #endif // QCOLLATOR_P_H From e721cf15081c8174a38797cc88f7c5197d9e527c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Nov 2013 11:25:19 +0100 Subject: [PATCH 58/59] QCollatorSortKey: inline operator< This code was duplicated in every qcollator_platform.cpp and identical everywhere, except in _icu, which uses a QByteArray m_key and the implementation used QByteArray::operator<, which is semantically and probably code-wise identical to what the other implementations did (after inlining). Inlining this function removes a potential maintenance problem and increases speed without violating encapsulation. Change-Id: If3e9d38a7d4326b49f0611a9f4187c53960e8a03 Reviewed-by: Lars Knoll --- src/corelib/tools/qcollator.cpp | 9 +++++---- src/corelib/tools/qcollator.h | 6 +++++- src/corelib/tools/qcollator_icu.cpp | 5 ----- src/corelib/tools/qcollator_macx.cpp | 5 ----- src/corelib/tools/qcollator_posix.cpp | 5 ----- src/corelib/tools/qcollator_win.cpp | 5 ----- 6 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index 80d330bfca8..9c97d6b158a 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -328,12 +328,13 @@ QCollatorSortKey& QCollatorSortKey::operator=(const QCollatorSortKey &other) } /*! - \fn bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const + \fn bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs) + \relates QCollatorSortKey - According to the QCollator that created the key, returns \c true if the - key should be sorted before than \a otherKey; otherwise returns \c false. + According to the QCollator that created the keys, returns \c true if \a lhs + should be sorted before \a rhs; otherwise returns \c false. - \sa compare() + \sa QCollatorSortKey::compare() */ /*! diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index 941637e2001..781e95b10cf 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -66,7 +66,6 @@ public: void swap(QCollatorSortKey &other) { d.swap(other.d); } - bool operator<(const QCollatorSortKey &key) const; int compare(const QCollatorSortKey &key) const; protected: @@ -78,6 +77,11 @@ private: QCollatorSortKey(); }; +inline bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs) +{ + return lhs.compare(rhs) < 0; +} + class Q_CORE_EXPORT QCollator { public: diff --git a/src/corelib/tools/qcollator_icu.cpp b/src/corelib/tools/qcollator_icu.cpp index 46f830a34cf..407a493d25d 100644 --- a/src/corelib/tools/qcollator_icu.cpp +++ b/src/corelib/tools/qcollator_icu.cpp @@ -151,11 +151,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const return QCollatorSortKey(new QCollatorSortKeyPrivate(result)); } -bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const -{ - return d->m_key < otherKey.d->m_key; -} - int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const { return qstrcmp(d->m_key, otherKey.d->m_key); diff --git a/src/corelib/tools/qcollator_macx.cpp b/src/corelib/tools/qcollator_macx.cpp index 8edd190fbe7..8985cd4ebaf 100644 --- a/src/corelib/tools/qcollator_macx.cpp +++ b/src/corelib/tools/qcollator_macx.cpp @@ -162,11 +162,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const return QCollatorSortKey(new QCollatorSortKeyPrivate(ret)); } -bool QCollatorSortKey::operator<(const QCollatorSortKey &key) const -{ - return compare(key) < 0; -} - int QCollatorSortKey::compare(const QCollatorSortKey &key) const { SInt32 order; diff --git a/src/corelib/tools/qcollator_posix.cpp b/src/corelib/tools/qcollator_posix.cpp index a43618dcf19..b47b546d019 100644 --- a/src/corelib/tools/qcollator_posix.cpp +++ b/src/corelib/tools/qcollator_posix.cpp @@ -135,11 +135,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const return QCollatorSortKey(new QCollatorSortKeyPrivate(result)); } -bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const -{ - return compare(otherKey) < 0; -} - int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const { return std::wcscmp(d->m_key.constData(), diff --git a/src/corelib/tools/qcollator_win.cpp b/src/corelib/tools/qcollator_win.cpp index 282711fbc6d..8e590009468 100644 --- a/src/corelib/tools/qcollator_win.cpp +++ b/src/corelib/tools/qcollator_win.cpp @@ -155,11 +155,6 @@ QCollatorSortKey QCollator::sortKey(const QString &string) const return QCollatorSortKey(new QCollatorSortKeyPrivate(ret)); } -bool QCollatorSortKey::operator<(const QCollatorSortKey &otherKey) const -{ - return d->m_key < otherKey.d->m_key; -} - int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const { return d->m_key.compare(otherKey.d->m_key); From eb122a6fe4de5b95acb287f92c6ca5e81864b1c6 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 16 Nov 2013 14:30:38 +0100 Subject: [PATCH 59/59] tst_QAlgorithms: fix compilation with C++11 enabled GCC refuses to use a merely static const uint array in a constexpr function. Fix by making the array constexpr if supported by the compiler. Change-Id: Idd59d3f74f8f4e98aad82bc892f4a6469932df9f Reviewed-by: Olivier Goffart Reviewed-by: Lars Knoll --- tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp index 144bc62b1b0..64eb91b7b6b 100644 --- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp +++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp @@ -1027,7 +1027,7 @@ void tst_QAlgorithms::binaryFindOnLargeContainer() const } // alternative implementation of qPopulationCount for comparison: -static const uint bitsSetInNibble[] = { +static Q_DECL_CONSTEXPR const uint bitsSetInNibble[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, };