From 7c029e83a3e5058f7b82efd0235e766952357ffd Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 28 Nov 2013 11:00:15 +0100 Subject: Fix invalid memory read when shutting down QML applications As the last line in the QObject destructor, we call setParentHelper(0) to remove ourselves from the parent. In the process of that we also initiate the QML parentChanged callback. The first thing that parentChanged callback used to do (but now does it too late, after 26350b5ceafa0ade1328037f6234a7d288eb8f48 in qtdeclarative) is to check if the object was deleted and then return. We could re-introduce the check there, but I think it's cleaner to not bother calling the callback on a dead object in the first place. Change-Id: Ia4d43b65a9b3744a451b4c312a2d6f9c0e3b67dc Reviewed-by: Lars Knoll --- src/corelib/kernel/qobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index e062a38185..f8664ba3a2 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1876,7 +1876,7 @@ void QObjectPrivate::setParent_helper(QObject *o) } } } - if (!isDeletingChildren && declarativeData && QAbstractDeclarativeData::parentChanged) + if (!wasDeleted && !isDeletingChildren && declarativeData && QAbstractDeclarativeData::parentChanged) QAbstractDeclarativeData::parentChanged(declarativeData, q, o); } -- cgit v1.2.3 From c5b19f252188a01dd7b12090f4776420e3714000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 28 Nov 2013 15:33:06 +0100 Subject: iOS: Forward [UIApplicationDelegate handleOpenURL:] to QDesktopServices The user may use QDesktopServices::setUrlHandler() in combination with the appropriate Info.plist keys (CFBundleURLTypes, CFBundleURLSchemes) to react to URL requests from other applications. This is among other things useful for handling OAuth authentication from applications such as Dropbox. See: https://www.dropbox.com/developers/core/start/ios We protect against recursive URL opening, but an application may still redirect a request to open a URL by opening another URL, eg a website. Task-number: QTBUG-35201 Change-Id: I9f1d246206c5594b1b65bb11fa98c6bcdefc443e Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosapplicationdelegate.mm | 20 ++++++++++++++++++++ src/plugins/platforms/ios/qiosservices.h | 7 +++++++ src/plugins/platforms/ios/qiosservices.mm | 19 +++++++++++++++++++ 3 files changed, 46 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosapplicationdelegate.mm b/src/plugins/platforms/ios/qiosapplicationdelegate.mm index cf702c82af..9cf1047a6b 100644 --- a/src/plugins/platforms/ios/qiosapplicationdelegate.mm +++ b/src/plugins/platforms/ios/qiosapplicationdelegate.mm @@ -41,9 +41,14 @@ #include "qiosapplicationdelegate.h" +#include "qiosintegration.h" +#include "qiosservices.h" #include "qiosviewcontroller.h" #include "qioswindow.h" +#include +#include + #include @implementation QIOSApplicationDelegate @@ -82,6 +87,21 @@ return YES; } +- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation +{ + Q_UNUSED(application); + Q_UNUSED(sourceApplication); + Q_UNUSED(annotation); + + if (!QGuiApplication::instance()) + return NO; + + QIOSIntegration *iosIntegration = static_cast(QGuiApplicationPrivate::platformIntegration()); + QIOSServices *iosServices = static_cast(iosIntegration->services()); + + return iosServices->handleUrl(QUrl::fromNSURL(url)); +} + - (void)dealloc { [window release]; diff --git a/src/plugins/platforms/ios/qiosservices.h b/src/plugins/platforms/ios/qiosservices.h index 692b3a0b99..aa39fbbed4 100644 --- a/src/plugins/platforms/ios/qiosservices.h +++ b/src/plugins/platforms/ios/qiosservices.h @@ -41,6 +41,8 @@ #ifndef QIOSSERVICES_H #define QIOSSERVICES_H + +#include #include QT_BEGIN_NAMESPACE @@ -50,6 +52,11 @@ class QIOSServices : public QPlatformServices public: bool openUrl(const QUrl &url); bool openDocument(const QUrl &url); + + bool handleUrl(const QUrl &url); + +private: + QUrl m_handlingUrl; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosservices.mm b/src/plugins/platforms/ios/qiosservices.mm index 32203aeb71..0ac6c590ca 100644 --- a/src/plugins/platforms/ios/qiosservices.mm +++ b/src/plugins/platforms/ios/qiosservices.mm @@ -42,6 +42,7 @@ #include "qiosservices.h" #include +#include #import @@ -49,6 +50,9 @@ QT_BEGIN_NAMESPACE bool QIOSServices::openUrl(const QUrl &url) { + if (url == m_handlingUrl) + return false; + if (url.scheme().isEmpty()) return openDocument(url); @@ -66,4 +70,19 @@ bool QIOSServices::openDocument(const QUrl &url) return QPlatformServices::openDocument(url); } +/* Callback from iOS that the application should handle a URL */ +bool QIOSServices::handleUrl(const QUrl &url) +{ + QUrl previouslyHandling = m_handlingUrl; + m_handlingUrl = url; + + // FIXME: Add platform services callback from QDesktopServices::setUrlHandler + // so that we can warn the user if calling setUrlHandler without also setting + // up the matching keys in the Info.plist file (CFBundleURLTypes and friends). + bool couldHandle = QDesktopServices::openUrl(url); + + m_handlingUrl = previouslyHandling; + return couldHandle; +} + QT_END_NAMESPACE -- cgit v1.2.3 From 9b782dca45331c0e0246b8439d5cf007a440afc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 27 Nov 2013 18:20:10 +0100 Subject: iOS: Update screen properties when we trigger statusbar changes on iOS7 Ideally we'd have a callback from iOS when this happens, so we can also react to changes done outside of Qt, but willChangeStatusBarFrame and friends do not seem to give us what we want. Change-Id: I686ce7950395a83c4257372363c773a95c3935ed Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiosscreen.mm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index 57522cb1a3..96410952f9 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -189,6 +189,9 @@ void QIOSScreen::updateProperties() void QIOSScreen::updateStatusBarVisibility() { + if (!isQtApplication()) + return; + QWindow *focusWindow = QGuiApplication::focusWindow(); // If we don't have a focus window we leave the status @@ -199,20 +202,26 @@ void QIOSScreen::updateStatusBarVisibility() return; UIView *view = reinterpret_cast(focusWindow->handle()->winId()); + QIOSViewController *viewController = static_cast(view.viewController); + + bool currentStatusBarVisibility = [UIApplication sharedApplication].statusBarHidden; + if (viewController.prefersStatusBarHidden == currentStatusBarVisibility) + return; + #if QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__IPHONE_7_0) if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) { - [view.viewController setNeedsStatusBarAppearanceUpdate]; + [viewController setNeedsStatusBarAppearanceUpdate]; + dispatch_async(dispatch_get_main_queue(), ^{ + updateProperties(); + }); } else #endif { - bool wasHidden = [UIApplication sharedApplication].statusBarHidden; - QIOSViewController *viewController = static_cast(view.viewController); [[UIApplication sharedApplication] setStatusBarHidden:[viewController prefersStatusBarHidden] withAnimation:UIStatusBarAnimationNone]; - if ([UIApplication sharedApplication].statusBarHidden != wasHidden) - updateProperties(); + updateProperties(); } } -- cgit v1.2.3 From 6c3adb5f966e349f0488c194462e48cc8ddf248e Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 27 Nov 2013 14:47:26 +0100 Subject: Doc: corrected invalid ref. to output iterators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-34749 Change-Id: I7abd504b6081e84a8e67c7957e13d402999e9d38 Reviewed-by: Martin Smith Reviewed-by: Topi Reiniö --- src/corelib/tools/qalgorithms.qdoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index cd389470a4..412b9cf3b2 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -49,9 +49,9 @@ iterators they accept. For example, qFill() accepts two \l {forward iterators}. The iterator types required are specified for each algorithm. If an iterator of the wrong type is passed (for - example, if QList::ConstIterator is passed as an \l {output - iterator}), you will always get a compiler error, although not - necessarily a very informative one. + example, if QList::ConstIterator is passed as an + \l {Output Iterators}{output iterator}), you will always get a + compiler error, although not necessarily a very informative one. Some algorithms have special requirements on the value type stored in the containers. For example, @@ -99,7 +99,7 @@ \section2 Output Iterators - An \e{output iterator} is an iterator that can be used for + An output iterator is an iterator that can be used for writing data sequentially to a container or to some output stream. It must provide the following operators: unary \c{*} for writing a value (i.e., \c{*it = val}) and prefix \c{++} for -- cgit v1.2.3 From 7d5448d9e2ae4d2d10c0cff867cf34b315336feb Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 27 Nov 2013 13:24:59 +0100 Subject: Docs: add important QWheelEvent::phase() related notes Change-Id: I4901b96b44b7c1179e678689af5962cb4570d50d Reviewed-by: Jens Bache-Wiig Reviewed-by: Gabriel de Dietrich Reviewed-by: Lars Knoll --- src/gui/kernel/qevent.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 28666085a7..88f132b877 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -709,6 +709,12 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, Example: \snippet code/src_gui_kernel_qevent.cpp 0 + + \note On platforms that support scrolling \l{phase()}{phases}, the delta may be null when: + \list + \li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin), + \li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd). + \endlist */ /*! @@ -731,6 +737,12 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, Example: \snippet code/src_gui_kernel_qevent.cpp 0 + + \note On platforms that support scrolling \l{phase()}{phases}, the delta may be null when: + \list + \li scrolling is about to begin, but the distance did not yet change (Qt::ScrollBegin), + \li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd). + \endlist */ /*! @@ -830,6 +842,9 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, \since 5.2 Returns the scrolling phase of this wheel event. + + \note The Qt::ScrollBegin and Qt::ScrollEnd phases are currently + supported only on Mac OS X. */ -- cgit v1.2.3 From e8a45152b5e2e99e757e91a5d42a6dce609ff583 Mon Sep 17 00:00:00 2001 From: John Layt Date: Sat, 23 Nov 2013 19:52:34 +0100 Subject: QPrinter - Fix OutputFormat when no printers Currently the QPrinter constructor, setOutputFormat() and setPrinterName() make bad assumptions about the availability of printers when configuring NativeFormat which can lead to inconsistent print engine set-ups leading to crashes in the print dialog, especially on Windows where a valid DEVMODE is needed. This change cleans up the init and methods to ensure NativeFormat can only ever be set if we have both a valid plugin and a valid printer, if not the PdfFormat is used. One side-effect of this is that it is now impossible to set an invalid printer name via QPrinter (but still able to be done via QPrintEngine if really needed). Also if no default printer is set then use the first available one. This also fixes a bug where setting a new printer name on Windows reset all the saved settings. [ChangeLog][Important Behavior Changes] QPrinter no longer allows you to set an invalid printer name. Task-number: QTBUG-34345 Task-number: QTBUG-26008 Task-number: QTBUG-26430 Change-Id: I19737e4209d8c8df5817ea83246b3dd0c483ee85 Reviewed-by: Gunnar Sletta --- src/printsupport/kernel/qprinter.cpp | 171 ++++++++++++++++++++++------------- src/printsupport/kernel/qprinter_p.h | 28 ++++-- 2 files changed, 127 insertions(+), 72 deletions(-) (limited to 'src') diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 819f9343f7..0c08e44617 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -48,7 +48,6 @@ #include #include "qprintengine.h" -#include "qprinterinfo.h" #include "qlist.h" #include #include @@ -163,10 +162,39 @@ Q_PRINTSUPPORT_EXPORT QSizeF qt_printerPaperSize(QPrinter::Orientation orientati (qt_paperSizes[paperSize][height_index] * 72 / 25.4) / multiplier); } -void QPrinterPrivate::createDefaultEngines() +QPrinterInfo QPrinterPrivate::findValidPrinter(const QPrinterInfo &printer) { - QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); - if (outputFormat == QPrinter::NativeFormat && ps) { + // Try find a valid printer to use, either the one given, the default or the first available + QPrinterInfo printerToUse = printer; + if (printerToUse.isNull()) { + printerToUse = QPrinterInfo::defaultPrinter(); + if (printerToUse.isNull()) { + QList availablePrinters = QPrinterInfo::availablePrinters(); + if (!availablePrinters.isEmpty()) + printerToUse = availablePrinters.at(0); + } + } + return printerToUse; +} + +void QPrinterPrivate::initEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer) +{ + // Default to PdfFormat + outputFormat = QPrinter::PdfFormat; + QPlatformPrinterSupport *ps = 0; + QString printerName; + + // Only set NativeFormat if we have a valid plugin and printer to use + if (format == QPrinter::NativeFormat) { + ps = QPlatformPrinterSupportPlugin::get(); + QPrinterInfo printerToUse = findValidPrinter(printer); + if (ps && !printerToUse.isNull()) { + outputFormat = QPrinter::NativeFormat; + printerName = printerToUse.printerName(); + } + } + + if (outputFormat == QPrinter::NativeFormat) { printEngine = ps->createNativePrintEngine(printerMode); paintEngine = ps->createPaintEngine(printEngine, printerMode); } else { @@ -174,8 +202,42 @@ void QPrinterPrivate::createDefaultEngines() paintEngine = pdfEngine; printEngine = pdfEngine; } + use_default_engine = true; had_default_engines = true; + printEngine->setProperty(QPrintEngine::PPK_PrinterName, printerName); + addToManualSetList(QPrintEngine::PPK_PrinterName); + validPrinter = true; +} + +void QPrinterPrivate::changeEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer) +{ + QPrintEngine *oldPrintEngine = printEngine; + const bool def_engine = use_default_engine; + + initEngines(format, printer); + + if (oldPrintEngine) { + for (int i = 0; i < manualSetList.size(); ++i) { + QPrintEngine::PrintEnginePropertyKey key = manualSetList[i]; + QVariant prop; + // PPK_NumberOfCopies need special treatmeant since it in most cases + // will return 1, disregarding the actual value that was set + // PPK_PrinterName also needs special treatment as initEngines has set it already + if (key == QPrintEngine::PPK_NumberOfCopies) + prop = QVariant(q_ptr->copyCount()); + else if (key != QPrintEngine::PPK_PrinterName) + prop = oldPrintEngine->property(key); + + if (prop.isValid()) { + printEngine->setProperty(key, prop); + addToManualSetList(key); + } + } + } + + if (def_engine) + delete oldPrintEngine; } #ifndef QT_NO_PRINTPREVIEWWIDGET @@ -510,13 +572,7 @@ QPrinter::QPrinter(PrinterMode mode) : QPagedPaintDevice(), d_ptr(new QPrinterPrivate(this)) { - d_ptr->init(mode); - QPrinterInfo defPrn(QPrinterInfo::defaultPrinter()); - if (!defPrn.isNull()) { - setPrinterName(defPrn.printerName()); - } else if (QPrinterInfo::availablePrinters().isEmpty()) { - setOutputFormat(QPrinter::PdfFormat); - } + d_ptr->init(QPrinterInfo(), mode); } /*! @@ -528,11 +584,10 @@ QPrinter::QPrinter(const QPrinterInfo& printer, PrinterMode mode) : QPagedPaintDevice(), d_ptr(new QPrinterPrivate(this)) { - d_ptr->init(mode); - setPrinterName(printer.printerName()); + d_ptr->init(printer, mode); } -void QPrinterPrivate::init(QPrinter::PrinterMode mode) +void QPrinterPrivate::init(const QPrinterInfo &printer, QPrinter::PrinterMode mode) { if (!QCoreApplication::instance()) { qFatal("QPrinter: Must construct a QCoreApplication before a QPrinter"); @@ -540,14 +595,8 @@ void QPrinterPrivate::init(QPrinter::PrinterMode mode) } printerMode = mode; - outputFormat = QPrinter::NativeFormat; - createDefaultEngines(); -#ifndef QT_NO_PRINTPREVIEWWIDGET - previewEngine = 0; -#endif - realPrintEngine = 0; - realPaintEngine = 0; + initEngines(QPrinter::NativeFormat, printer); } /*! @@ -612,40 +661,30 @@ QPrinter::~QPrinter() \since 4.1 Sets the output format for this printer to \a format. + + If \a format is the same value as currently set then no change will be made. + + If \a format is NativeFormat then the printerName will be set to the default + printer. If there are no valid printers configured then no change will be made. + If you want to set NativeFormat with a specific printerName then use + setPrinterName(). + + \sa setPrinterName() */ void QPrinter::setOutputFormat(OutputFormat format) { Q_D(QPrinter); - if (d->validPrinter && d->outputFormat == format) - return; - d->outputFormat = format; - - QPrintEngine *oldPrintEngine = d->printEngine; - const bool def_engine = d->use_default_engine; - d->printEngine = 0; - d->createDefaultEngines(); + if (d->outputFormat == format) + return; - if (oldPrintEngine) { - for (int i = 0; i < d->manualSetList.size(); ++i) { - QPrintEngine::PrintEnginePropertyKey key = d->manualSetList[i]; - QVariant prop; - // PPK_NumberOfCopies need special treatmeant since it in most cases - // will return 1, disregarding the actual value that was set - if (key == QPrintEngine::PPK_NumberOfCopies) - prop = QVariant(copyCount()); - else - prop = oldPrintEngine->property(key); - if (prop.isValid()) - d->printEngine->setProperty(key, prop); - } + if (format == QPrinter::NativeFormat) { + QPrinterInfo printerToUse = d->findValidPrinter(); + if (!printerToUse.isNull()) + d->changeEngines(format, printerToUse); + } else { + d->changeEngines(format, QPrinterInfo()); } - - if (def_engine) - delete oldPrintEngine; - - if (d->outputFormat == QPrinter::PdfFormat) - d->validPrinter = true; } /*! @@ -683,30 +722,38 @@ QString QPrinter::printerName() const /*! Sets the printer name to \a name. - \sa printerName(), isValid() + If the \a name is empty then the output format will be set to PdfFormat. + + If the \a name is not a valid printer then no change will be made. + + If the \a name is a valid printer then the output format will be set to NativeFormat. + + \sa printerName(), isValid(), setOutputFormat() */ void QPrinter::setPrinterName(const QString &name) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setPrinterName"); - QList prnList = QPrinterInfo::availablePrinters(); + if (printerName() == name) + return; + if (name.isEmpty()) { - d->validPrinter = d->outputFormat == QPrinter::PdfFormat; - } else { - d->validPrinter = false; - for (int i = 0; i < prnList.size(); ++i) { - if (prnList[i].printerName() == name) { - d->validPrinter = true; - break; - } - } + setOutputFormat(QPrinter::PdfFormat); + return; } - d->printEngine->setProperty(QPrintEngine::PPK_PrinterName, name); - d->addToManualSetList(QPrintEngine::PPK_PrinterName); -} + QPrinterInfo printerToUse = QPrinterInfo::printerInfo(name); + if (printerToUse.isNull()) + return; + if (outputFormat() == QPrinter::PdfFormat) { + d->changeEngines(QPrinter::NativeFormat, printerToUse); + } else { + d->printEngine->setProperty(QPrintEngine::PPK_PrinterName, name); + d->addToManualSetList(QPrintEngine::PPK_PrinterName); + } +} /*! \since 4.4 diff --git a/src/printsupport/kernel/qprinter_p.h b/src/printsupport/kernel/qprinter_p.h index 2bec44aae6..7e5bc12cd0 100644 --- a/src/printsupport/kernel/qprinter_p.h +++ b/src/printsupport/kernel/qprinter_p.h @@ -59,6 +59,7 @@ #ifndef QT_NO_PRINTER #include "QtPrintSupport/qprinter.h" +#include "QtPrintSupport/qprinterinfo.h" #include "QtPrintSupport/qprintengine.h" #include "QtCore/qpointer.h" @@ -75,14 +76,19 @@ class Q_PRINTSUPPORT_EXPORT QPrinterPrivate Q_DECLARE_PUBLIC(QPrinter) public: QPrinterPrivate(QPrinter *printer) - : printEngine(0) - , paintEngine(0) - , q_ptr(printer) - , printRange(QPrinter::AllPages) - , use_default_engine(true) - , validPrinter(false) - , hasCustomPageMargins(false) - , hasUserSetPageSize(false) + : printEngine(0), + paintEngine(0), + realPrintEngine(0), + realPaintEngine(0), +#ifndef QT_NO_PRINTPREVIEWWIDGET + previewEngine(0), +#endif + q_ptr(printer), + printRange(QPrinter::AllPages), + use_default_engine(true), + validPrinter(false), + hasCustomPageMargins(false), + hasUserSetPageSize(false) { } @@ -90,9 +96,11 @@ public: } - void init(QPrinter::PrinterMode mode); + void init(const QPrinterInfo &printer, QPrinter::PrinterMode mode); - void createDefaultEngines(); + QPrinterInfo findValidPrinter(const QPrinterInfo &printer = QPrinterInfo()); + void initEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer); + void changeEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer); #ifndef QT_NO_PRINTPREVIEWWIDGET QList previewPages() const; void setPreviewMode(bool); -- cgit v1.2.3 From c6cf7520ecaf1c14b28436bafae27f2c52940081 Mon Sep 17 00:00:00 2001 From: John Layt Date: Mon, 25 Nov 2013 17:18:48 +0100 Subject: QPrinter - Simplify setting manual properties Change from a list to a set and define a utility method to both set the property and store that we have set it. Change-Id: I0cf13f1b0e90942424744316d0d3f699b9ead144 Reviewed-by: Gunnar Sletta --- src/printsupport/kernel/qprinter.cpp | 87 +++++++++++++----------------------- src/printsupport/kernel/qprinter_p.h | 5 ++- 2 files changed, 33 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 0c08e44617..5eb840c52a 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -205,8 +205,7 @@ void QPrinterPrivate::initEngines(QPrinter::OutputFormat format, const QPrinterI use_default_engine = true; had_default_engines = true; - printEngine->setProperty(QPrintEngine::PPK_PrinterName, printerName); - addToManualSetList(QPrintEngine::PPK_PrinterName); + setProperty(QPrintEngine::PPK_PrinterName, printerName); validPrinter = true; } @@ -218,8 +217,7 @@ void QPrinterPrivate::changeEngines(QPrinter::OutputFormat format, const QPrinte initEngines(format, printer); if (oldPrintEngine) { - for (int i = 0; i < manualSetList.size(); ++i) { - QPrintEngine::PrintEnginePropertyKey key = manualSetList[i]; + foreach (QPrintEngine::PrintEnginePropertyKey key, m_properties.values()) { QVariant prop; // PPK_NumberOfCopies need special treatmeant since it in most cases // will return 1, disregarding the actual value that was set @@ -229,10 +227,8 @@ void QPrinterPrivate::changeEngines(QPrinter::OutputFormat format, const QPrinte else if (key != QPrintEngine::PPK_PrinterName) prop = oldPrintEngine->property(key); - if (prop.isValid()) { - printEngine->setProperty(key, prop); - addToManualSetList(key); - } + if (prop.isValid()) + setProperty(key, prop); } } @@ -267,15 +263,14 @@ void QPrinterPrivate::setPreviewMode(bool enable) } #endif // QT_NO_PRINTPREVIEWWIDGET -void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey key) +void QPrinterPrivate::setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value) { - for (int c = 0; c < manualSetList.size(); ++c) { - if (manualSetList[c] == key) return; - } - manualSetList.append(key); + printEngine->setProperty(key, value); + m_properties.insert(key); } + /*! \class QPrinter \reentrant @@ -750,8 +745,7 @@ void QPrinter::setPrinterName(const QString &name) if (outputFormat() == QPrinter::PdfFormat) { d->changeEngines(QPrinter::NativeFormat, printerToUse); } else { - d->printEngine->setProperty(QPrintEngine::PPK_PrinterName, name); - d->addToManualSetList(QPrintEngine::PPK_PrinterName); + d->setProperty(QPrintEngine::PPK_PrinterName, name); } } @@ -821,8 +815,7 @@ void QPrinter::setOutputFileName(const QString &fileName) else if (fileName.isEmpty()) setOutputFormat(QPrinter::NativeFormat); - d->printEngine->setProperty(QPrintEngine::PPK_OutputFileName, fileName); - d->addToManualSetList(QPrintEngine::PPK_OutputFileName); + d->setProperty(QPrintEngine::PPK_OutputFileName, fileName); } @@ -857,8 +850,7 @@ void QPrinter::setPrintProgram(const QString &printProg) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setPrintProgram"); - d->printEngine->setProperty(QPrintEngine::PPK_PrinterProgram, printProg); - d->addToManualSetList(QPrintEngine::PPK_PrinterProgram); + d->setProperty(QPrintEngine::PPK_PrinterProgram, printProg); } @@ -888,8 +880,7 @@ void QPrinter::setDocName(const QString &name) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setDocName"); - d->printEngine->setProperty(QPrintEngine::PPK_DocumentName, name); - d->addToManualSetList(QPrintEngine::PPK_DocumentName); + d->setProperty(QPrintEngine::PPK_DocumentName, name); } @@ -919,8 +910,7 @@ void QPrinter::setCreator(const QString &creator) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setCreator"); - d->printEngine->setProperty(QPrintEngine::PPK_Creator, creator); - d->addToManualSetList(QPrintEngine::PPK_Creator); + d->setProperty(QPrintEngine::PPK_Creator, creator); } @@ -957,8 +947,7 @@ QPrinter::Orientation QPrinter::orientation() const void QPrinter::setOrientation(Orientation orientation) { Q_D(QPrinter); - d->printEngine->setProperty(QPrintEngine::PPK_Orientation, orientation); - d->addToManualSetList(QPrintEngine::PPK_Orientation); + d->setProperty(QPrintEngine::PPK_Orientation, orientation); } @@ -1026,8 +1015,7 @@ void QPrinter::setPageSize(PageSize newPageSize) qWarning("QPrinter::setPaperSize: Illegal paper size %d", newPageSize); return; } - d->printEngine->setProperty(QPrintEngine::PPK_PaperSize, newPageSize); - d->addToManualSetList(QPrintEngine::PPK_PaperSize); + d->setProperty(QPrintEngine::PPK_PaperSize, newPageSize); d->hasUserSetPageSize = true; } @@ -1057,8 +1045,7 @@ void QPrinter::setPageSizeMM(const QSizeF &size) QPagedPaintDevice::setPageSizeMM(size); QSizeF s = size * 72./25.4; - d->printEngine->setProperty(QPrintEngine::PPK_CustomPaperSize, s); - d->addToManualSetList(QPrintEngine::PPK_CustomPaperSize); + d->setProperty(QPrintEngine::PPK_CustomPaperSize, s); d->hasUserSetPageSize = true; } @@ -1098,8 +1085,7 @@ void QPrinter::setPaperName(const QString &paperName) Q_D(QPrinter); if (d->paintEngine->type() != QPaintEngine::Pdf) ABORT_IF_ACTIVE("QPrinter::setPaperName"); - d->printEngine->setProperty(QPrintEngine::PPK_PaperName, paperName); - d->addToManualSetList(QPrintEngine::PPK_PaperName); + d->setProperty(QPrintEngine::PPK_PaperName, paperName); } /*! @@ -1135,8 +1121,7 @@ void QPrinter::setPageOrder(PageOrder pageOrder) Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setPageOrder"); - d->printEngine->setProperty(QPrintEngine::PPK_PageOrder, pageOrder); - d->addToManualSetList(QPrintEngine::PPK_PageOrder); + d->setProperty(QPrintEngine::PPK_PageOrder, pageOrder); } @@ -1164,8 +1149,7 @@ void QPrinter::setColorMode(ColorMode newColorMode) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setColorMode"); - d->printEngine->setProperty(QPrintEngine::PPK_ColorMode, newColorMode); - d->addToManualSetList(QPrintEngine::PPK_ColorMode); + d->setProperty(QPrintEngine::PPK_ColorMode, newColorMode); } @@ -1244,8 +1228,7 @@ void QPrinter::setNumCopies(int numCopies) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setNumCopies"); - d->printEngine->setProperty(QPrintEngine::PPK_NumberOfCopies, numCopies); - d->addToManualSetList(QPrintEngine::PPK_NumberOfCopies); + d->setProperty(QPrintEngine::PPK_NumberOfCopies, numCopies); } /*! @@ -1263,8 +1246,7 @@ void QPrinter::setCopyCount(int count) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setCopyCount;"); - d->printEngine->setProperty(QPrintEngine::PPK_CopyCount, count); - d->addToManualSetList(QPrintEngine::PPK_CopyCount); + d->setProperty(QPrintEngine::PPK_CopyCount, count); } /*! @@ -1333,8 +1315,7 @@ void QPrinter::setCollateCopies(bool collate) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setCollateCopies"); - d->printEngine->setProperty(QPrintEngine::PPK_CollateCopies, collate); - d->addToManualSetList(QPrintEngine::PPK_CollateCopies); + d->setProperty(QPrintEngine::PPK_CollateCopies, collate); } @@ -1363,8 +1344,7 @@ void QPrinter::setCollateCopies(bool collate) void QPrinter::setFullPage(bool fp) { Q_D(QPrinter); - d->printEngine->setProperty(QPrintEngine::PPK_FullPage, fp); - d->addToManualSetList(QPrintEngine::PPK_FullPage); + d->setProperty(QPrintEngine::PPK_FullPage, fp); } @@ -1402,8 +1382,7 @@ void QPrinter::setResolution(int dpi) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setResolution"); - d->printEngine->setProperty(QPrintEngine::PPK_Resolution, dpi); - d->addToManualSetList(QPrintEngine::PPK_Resolution); + d->setProperty(QPrintEngine::PPK_Resolution, dpi); } @@ -1432,8 +1411,7 @@ int QPrinter::resolution() const void QPrinter::setPaperSource(PaperSource source) { Q_D(QPrinter); - d->printEngine->setProperty(QPrintEngine::PPK_PaperSource, source); - d->addToManualSetList(QPrintEngine::PPK_PaperSource); + d->setProperty(QPrintEngine::PPK_PaperSource, source); } /*! @@ -1459,8 +1437,7 @@ QPrinter::PaperSource QPrinter::paperSource() const void QPrinter::setFontEmbeddingEnabled(bool enable) { Q_D(QPrinter); - d->printEngine->setProperty(QPrintEngine::PPK_FontEmbedding, enable); - d->addToManualSetList(QPrintEngine::PPK_FontEmbedding); + d->setProperty(QPrintEngine::PPK_FontEmbedding, enable); } /*! @@ -1531,8 +1508,7 @@ bool QPrinter::doubleSidedPrinting() const void QPrinter::setDuplex(DuplexMode duplex) { Q_D(QPrinter); - d->printEngine->setProperty(QPrintEngine::PPK_Duplex, duplex); - d->addToManualSetList(QPrintEngine::PPK_Duplex); + d->setProperty(QPrintEngine::PPK_Duplex, duplex); } /*! @@ -1660,8 +1636,7 @@ void QPrinter::setMargins(const Margins &m) QList margins; margins << (m.left * multiplier) << (m.top * multiplier) << (m.right * multiplier) << (m.bottom * multiplier); - d->printEngine->setProperty(QPrintEngine::PPK_PageMargins, margins); - d->addToManualSetList(QPrintEngine::PPK_PageMargins); + d->setProperty(QPrintEngine::PPK_PageMargins, margins); d->hasCustomPageMargins = true; } @@ -1732,8 +1707,7 @@ void QPrinter::setWinPageSize(int pageSize) { Q_D(QPrinter); ABORT_IF_ACTIVE("QPrinter::setWinPageSize"); - d->printEngine->setProperty(QPrintEngine::PPK_WindowsPageSize, pageSize); - d->addToManualSetList(QPrintEngine::PPK_WindowsPageSize); + d->setProperty(QPrintEngine::PPK_WindowsPageSize, pageSize); } /*! @@ -1881,8 +1855,7 @@ QString QPrinter::printerSelectionOption() const void QPrinter::setPrinterSelectionOption(const QString &option) { Q_D(QPrinter); - d->printEngine->setProperty(QPrintEngine::PPK_SelectionOption, option); - d->addToManualSetList(QPrintEngine::PPK_SelectionOption); + d->setProperty(QPrintEngine::PPK_SelectionOption, option); } #endif diff --git a/src/printsupport/kernel/qprinter_p.h b/src/printsupport/kernel/qprinter_p.h index 7e5bc12cd0..2357b9e944 100644 --- a/src/printsupport/kernel/qprinter_p.h +++ b/src/printsupport/kernel/qprinter_p.h @@ -62,6 +62,7 @@ #include "QtPrintSupport/qprinterinfo.h" #include "QtPrintSupport/qprintengine.h" #include "QtCore/qpointer.h" +#include "QtCore/qset.h" #include @@ -106,7 +107,7 @@ public: void setPreviewMode(bool); #endif - void addToManualSetList(QPrintEngine::PrintEnginePropertyKey key); + void setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value); QPrinter::PrinterMode printerMode; QPrinter::OutputFormat outputFormat; @@ -131,7 +132,7 @@ public: uint hasUserSetPageSize : 1; // Used to remember which properties have been manually set by the user. - QList manualSetList; + QSet m_properties; }; QT_END_NAMESPACE -- cgit v1.2.3 From 2a76ef7e990404340f53cafbe4f85d8f124da0f1 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Thu, 28 Nov 2013 11:37:11 +0100 Subject: qdbusxml2cpp: Use the mtime on the input XML to avoid needless source changes. These can cause rebuilds unnecessarily when repeatedly running qdbusxml2cpp. Change-Id: I902954d4bed6fe68802183e51d82700fe30af437 Reviewed-by: Mathias Hasselmann Reviewed-by: Thiago Macieira --- src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index 6dd88824b5..560b58817e 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -65,6 +66,7 @@ static QString parentClassName; static QString proxyFile; static QString adaptorFile; static QString inputFile; +static QDateTime classCreationTime; static bool skipNamespaces; static bool verbose; static bool includeMocs; @@ -216,10 +218,13 @@ static void parseCmdLine(QStringList args) static QDBusIntrospection::Interfaces readInput() { QFile input(inputFile); - if (inputFile.isEmpty() || inputFile == QLatin1String("-")) + if (inputFile.isEmpty() || inputFile == QLatin1String("-")) { input.open(stdin, QIODevice::ReadOnly); - else + classCreationTime = QDateTime::currentDateTime(); + } else { input.open(QIODevice::ReadOnly); + classCreationTime = QFileInfo(input).lastModified(); + } QByteArray data = input.readAll(); @@ -556,7 +561,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf } includeGuard = QString(QLatin1String("%1_%2")) .arg(includeGuard) - .arg(QDateTime::currentDateTime().toTime_t()); + .arg(classCreationTime.toTime_t()); hs << "#ifndef " << includeGuard << endl << "#define " << includeGuard << endl << endl; -- cgit v1.2.3 From 0312cb3ffe3d29f7c74c142515ed4ffbc86c03ff Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Thu, 28 Nov 2013 11:51:18 -0200 Subject: BlackBerry: Fix QFileDialog show()/hide() QFileDialog::show() no longer worked after the dialog had already been shown and hidden before. Task-number: QTBUG-34983 Change-Id: I7300374b74805308e0966db7b3545e5fd8470465 Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxfiledialoghelper.h | 3 +++ src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h index e7c68f6ff5..c2033c16d3 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h @@ -87,6 +87,9 @@ public: Q_SIGNALS: void dialogClosed(); +private Q_SLOTS: + void emitSignals(); + private: void setNameFilter(const QString &filter); void setNameFilters(const QStringList &filters); diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp b/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp index dc841eb1a9..e3b1e2dc4d 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp @@ -68,6 +68,7 @@ QQnxFileDialogHelper::QQnxFileDialogHelper(const QQnxIntegration *integration) m_selectedFilter(), m_result(QPlatformDialogHelper::Rejected) { + connect(m_dialog, &QQnxFilePicker::closed, this, &QQnxFileDialogHelper::emitSignals); } QQnxFileDialogHelper::~QQnxFileDialogHelper() @@ -85,11 +86,6 @@ void QQnxFileDialogHelper::exec() QEventLoop loop; connect(m_dialog, SIGNAL(closed()), &loop, SLOT(quit())); loop.exec(); - - if (m_dialog->selectedFiles().isEmpty()) - Q_EMIT reject(); - else - Q_EMIT accept(); } bool QQnxFileDialogHelper::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) @@ -197,6 +193,14 @@ QString QQnxFileDialogHelper::selectedNameFilter() const return m_selectedFilter; } +void QQnxFileDialogHelper::emitSignals() +{ + if (m_dialog->selectedFiles().isEmpty()) + Q_EMIT reject(); + else + Q_EMIT accept(); +} + void QQnxFileDialogHelper::setNameFilter(const QString &filter) { qFileDialogHelperDebug() << Q_FUNC_INFO << "filter =" << filter; -- cgit v1.2.3 From f60e38391764bf1f8d3d747472b302b1bfbdc469 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Thu, 28 Nov 2013 11:52:51 -0200 Subject: BlackBerry: remove unused variable m_result is not used by qqnxfiledialoghelper_bb10.cpp, only by its playbook counterpart. Change-Id: I4fae924283560703393c5313527c5c9c2005d35b Reviewed-by: Tobias Koenig Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxfiledialoghelper.h | 2 +- src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h index c2033c16d3..e83fc445d6 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper.h +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper.h @@ -99,8 +99,8 @@ private: QFileDialogOptions::AcceptMode m_acceptMode; QString m_selectedFilter; - QPlatformDialogHelper::DialogCode m_result; #if defined(Q_OS_BLACKBERRY_TABLET) + QPlatformDialogHelper::DialogCode m_result; QList m_paths; #endif }; diff --git a/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp b/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp index e3b1e2dc4d..fa6e26977a 100644 --- a/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp +++ b/src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp @@ -65,8 +65,7 @@ QQnxFileDialogHelper::QQnxFileDialogHelper(const QQnxIntegration *integration) m_integration(integration), m_dialog(new QQnxFilePicker), m_acceptMode(QFileDialogOptions::AcceptOpen), - m_selectedFilter(), - m_result(QPlatformDialogHelper::Rejected) + m_selectedFilter() { connect(m_dialog, &QQnxFilePicker::closed, this, &QQnxFileDialogHelper::emitSignals); } -- cgit v1.2.3 From 2e7a90bac15ab486475884600bd55d8a04da35a0 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Thu, 28 Nov 2013 17:18:37 -0200 Subject: BlackBerry: properly clean up QFileDialog files Task-number: QTBUG-34983 Change-Id: I1af5c6a9c43eba77394b11d31d1d223af8bc221f Reviewed-by: Thomas McGuire --- src/plugins/platforms/qnx/qqnxfilepicker.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxfilepicker.cpp b/src/plugins/platforms/qnx/qqnxfilepicker.cpp index 5229d1f1f5..56c804a5b4 100644 --- a/src/plugins/platforms/qnx/qqnxfilepicker.cpp +++ b/src/plugins/platforms/qnx/qqnxfilepicker.cpp @@ -84,6 +84,9 @@ void QQnxFilePicker::open() if (m_invocationHandle) return; + // Clear any previous results + m_selectedFiles.clear(); + int errorCode = BPS_SUCCESS; errorCode = navigator_invoke_invocation_create(&m_invocationHandle); -- cgit v1.2.3 From 1b07e4e31537f4814523f2788cb99c131651e06f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Mon, 11 Nov 2013 17:04:46 +0200 Subject: Detect posix_fallocate at configure time Testing feature macros is not enough for uclibc. Fixes build of the built-in sqlite3 with uclibc <= 0.9.33.2. Later versions will have posix_fallocate(). Change-Id: I918a52777ac63624635802221effc6b86fa2269c Reviewed-by: Konstantin Ritt Reviewed-by: Oswald Buddenhagen Reviewed-by: Mark Brand --- src/3rdparty/sqlite.pri | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/3rdparty/sqlite.pri b/src/3rdparty/sqlite.pri index 58d4ddd9a1..072502c8e9 100644 --- a/src/3rdparty/sqlite.pri +++ b/src/3rdparty/sqlite.pri @@ -1,6 +1,7 @@ CONFIG(release, debug|release):DEFINES *= NDEBUG DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS SQLITE_ENABLE_RTREE !contains(CONFIG, largefile):DEFINES += SQLITE_DISABLE_LFS +contains(QT_CONFIG, posix_fallocate):DEFINES += HAVE_POSIX_FALLOCATE=1 winrt: DEFINES += SQLITE_OS_WINRT INCLUDEPATH += $$PWD/sqlite SOURCES += $$PWD/sqlite/sqlite3.c -- cgit v1.2.3 From 4f28464ab7dfe9f18cd72fc022257e66a8e2b279 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Sat, 30 Nov 2013 14:40:11 +0100 Subject: Fix evaluation of SQLite driver options Ensure that the options, which are passed to the SQLite driver, are evaluated in the correct order and do not overwrite each other. According to http://www.sqlite.org/c3ref/open.html the SQLITE_OPEN_READONLY and (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) are mutual exclusive, but SQLITE_OPEN_URI can be combined with both of them. Task-number: QTBUG-35186 [ChangeLog][QtSql][QSQLITE] Fixed evaluation of driver options Change-Id: I8e74fe1ce43b9118b15f7b13fc71670bdcd73f68 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Mark Brand --- src/sql/drivers/sqlite/qsql_sqlite.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 27bc80e63f..c98d6438fc 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -599,24 +599,32 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c if (db.isEmpty()) return false; + + int timeOut = 5000; bool sharedCache = false; - int openMode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, timeOut=5000; - QStringList opts=QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';')); - foreach(const QString &option, opts) { + bool openReadOnlyOption = false; + bool openUriOption = false; + + const QStringList opts = QString(conOpts).remove(QLatin1Char(' ')).split(QLatin1Char(';')); + foreach (const QString &option, opts) { if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) { bool ok; - int nt = option.mid(21).toInt(&ok); + const int nt = option.mid(21).toInt(&ok); if (ok) timeOut = nt; - } - if (option == QLatin1String("QSQLITE_OPEN_READONLY")) - openMode = SQLITE_OPEN_READONLY; - if (option == QLatin1String("QSQLITE_OPEN_URI")) - openMode |= SQLITE_OPEN_URI; - if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE")) + } else if (option == QLatin1String("QSQLITE_OPEN_READONLY")) { + openReadOnlyOption = true; + } else if (option == QLatin1String("QSQLITE_OPEN_URI")) { + openUriOption = true; + } else if (option == QLatin1String("QSQLITE_ENABLE_SHARED_CACHE")) { sharedCache = true; + } } + int openMode = (openReadOnlyOption ? SQLITE_OPEN_READONLY : (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)); + if (openUriOption) + openMode |= SQLITE_OPEN_URI; + sqlite3_enable_shared_cache(sharedCache); if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL) == SQLITE_OK) { -- cgit v1.2.3 From 1c47627aa022ebaffdefe1da18cb7ff8146550cc Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Sat, 30 Nov 2013 18:08:35 +0100 Subject: Fix compilation of OCI driver Add missing feature enum in switch statement to avoid warning that would lead to compilation error when compiled with -Wall. Task-number: QTBUG-34794 Change-Id: Ia2f70f27ecbb7a7dfc9d36d261103ff49b6c5e4b [ChangeLog][QtSql][QOCI] Fix compilation Reviewed-by: Mark Brand --- src/sql/drivers/oci/qsql_oci.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index fe9ae42e6f..6843407e9c 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -2159,6 +2159,7 @@ bool QOCIDriver::hasFeature(DriverFeature f) const case SimpleLocking: case EventNotifications: case FinishQuery: + case CancelQuery: case MultipleResultSets: return false; case Unicode: -- cgit v1.2.3 From 6a6f1e3c7efc3614a4160852ccdc7534252dcdd4 Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Sat, 30 Nov 2013 20:22:28 +0100 Subject: Support custom port number in IBASE SQL driver Let the IBASE SQL driver use the custom port number that is set via QSqlDatabase::setPort(). Task-number: QTBUG-33345 Change-Id: Ib55b32c8a318d82038d66e8645b416e36dad3edf [ChangeLog][QtSql][QIBASE] Support custom port number Reviewed-by: Mark Brand --- src/sql/drivers/ibase/qsql_ibase.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 05e9a4aac8..fefdf38bbd 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -1445,7 +1445,7 @@ bool QIBaseDriver::open(const QString & db, const QString & user, const QString & password, const QString & host, - int /*port*/, + int port, const QString & connOpts) { Q_D(QIBaseDriver); @@ -1513,9 +1513,13 @@ bool QIBaseDriver::open(const QString & db, i += role.length(); } + QString portString; + if (port != -1) + portString = QStringLiteral("/%1").arg(port); + QString ldb; if (!host.isEmpty()) - ldb += host + QLatin1Char(':'); + ldb += host + portString + QLatin1Char(':'); ldb += db; isc_attach_database(d->status, 0, const_cast(ldb.toLocal8Bit().constData()), &d->ibase, i, ba.data()); -- cgit v1.2.3 From a774aa69db918dc6719e160e70780f3b644c62ca Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Mon, 2 Dec 2013 13:29:10 +0100 Subject: Clear isOpenError flag on successful open call Clear the isOpenError flag in IBase driver if the QIBaseDriver::open() call was successful, otherwise a previous, unsuccessful open() call would block any further QSqlQuery::exec() calls on this database connection. Task-number: QTBUG-13435 Change-Id: Idc64e28cd63805a13f208702ec87dc1bf6b98798 [ChangeLog][QtSql][QIBASE] Fixed the internal state of IBase driver after a failed open call Reviewed-by: Mark Brand --- src/sql/drivers/ibase/qsql_ibase.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index fefdf38bbd..98da296240 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -1530,6 +1530,7 @@ bool QIBaseDriver::open(const QString & db, } setOpen(true); + setOpenError(false); return true; } -- cgit v1.2.3 From 26a0a3ed85008c3a0edae125fca48c7c36a7437f Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 2 Dec 2013 00:26:17 +0100 Subject: Respect the custom paper size settings on Mac When the user added a custom paper size then it would be silently ignored when printing on Mac. This now ensures that it is respected when appropriate. [ChangeLog][Platform Specific Changes][OS X][QtPrintSupport] Respect the custom paper size settings when printing. Task-number: QTBUG-34700 Change-Id: I08afe24e0e67a50e9301abf4642c6f65bb0df1fe Reviewed-by: John Layt --- src/plugins/platforms/cocoa/qprintengine_mac.mm | 77 ++++++++++++++++-------- src/plugins/platforms/cocoa/qprintengine_mac_p.h | 1 + 2 files changed, 53 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm index ee8d7ea157..f363b1772f 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm @@ -40,8 +40,7 @@ ****************************************************************************/ #include "qprintengine_mac_p.h" -#include -#include +#include #include #include @@ -141,30 +140,51 @@ QMacPrintEnginePrivate::~QMacPrintEnginePrivate() void QMacPrintEnginePrivate::setPaperSize(QPrinter::PaperSize ps) { Q_Q(QMacPrintEngine); - QSizeF newSize = QPlatformPrinterSupport::convertPaperSizeToQSizeF(ps); - QCFType formats; + if (hasCustomPaperSize) { + PMRelease(customPaper); + customPaper = 0; + } + hasCustomPaperSize = (ps == QPrinter::Custom); PMPrinter printer; - - if (PMSessionGetCurrentPrinter(session(), &printer) == noErr - && PMSessionCreatePageFormatList(session(), printer, &formats) == noErr) { - CFIndex total = CFArrayGetCount(formats); - PMPageFormat tmp; - PMRect paper; - for (CFIndex idx = 0; idx < total; ++idx) { - tmp = static_cast( - const_cast(CFArrayGetValueAtIndex(formats, idx))); - PMGetUnadjustedPaperRect(tmp, &paper); - int wMM = int((paper.right - paper.left) / 72 * 25.4 + 0.5); - int hMM = int((paper.bottom - paper.top) / 72 * 25.4 + 0.5); - if (newSize.width() == wMM && newSize.height() == hMM) { - PMCopyPageFormat(tmp, format()); - // reset the orientation and resolution as they are lost in the copy. - q->setProperty(QPrintEngine::PPK_Orientation, orient); - if (PMSessionValidatePageFormat(session(), format(), kPMDontWantBoolean) != noErr) { - // Don't know, warn for the moment. - qWarning("QMacPrintEngine, problem setting format and resolution for this page size"); + if (PMSessionGetCurrentPrinter(session(), &printer) == noErr) { + if (ps != QPrinter::Custom) { + QSizeF newSize = QPlatformPrinterSupport::convertPaperSizeToQSizeF(ps); + QCFType formats; + if (PMSessionCreatePageFormatList(session(), printer, &formats) == noErr) { + CFIndex total = CFArrayGetCount(formats); + PMPageFormat tmp; + PMRect paper; + for (CFIndex idx = 0; idx < total; ++idx) { + tmp = static_cast(const_cast(CFArrayGetValueAtIndex(formats, idx))); + PMGetUnadjustedPaperRect(tmp, &paper); + int wMM = int((paper.right - paper.left) / 72 * 25.4 + 0.5); + int hMM = int((paper.bottom - paper.top) / 72 * 25.4 + 0.5); + if (newSize.width() == wMM && newSize.height() == hMM) { + PMCopyPageFormat(tmp, format()); + // reset the orientation and resolution as they are lost in the copy. + q->setProperty(QPrintEngine::PPK_Orientation, orient); + if (PMSessionValidatePageFormat(session(), format(), kPMDontWantBoolean) != noErr) { + // Don't know, warn for the moment. + qWarning("QMacPrintEngine, problem setting format and resolution for this page size"); + } + break; + } } - break; + } + } else { + QCFString paperId = QCFString::toCFStringRef(QUuid::createUuid().toString()); + PMPaperMargins paperMargins; + paperMargins.left = leftMargin; + paperMargins.top = topMargin; + paperMargins.right = rightMargin; + paperMargins.bottom = bottomMargin; + PMPaperCreateCustom(printer, paperId, QCFString("Custom size"), customSize.width(), customSize.height(), &paperMargins, &customPaper); + PMPageFormat tmp; + PMCreatePageFormatWithPMPaper(&tmp, customPaper); + PMCopyPageFormat(tmp, format()); + if (PMSessionValidatePageFormat(session(), format(), kPMDontWantBoolean) != noErr) { + // Don't know, warn for the moment. + qWarning("QMacPrintEngine, problem setting paper name"); } } } @@ -183,6 +203,11 @@ QPrinter::PaperSize QMacPrintEnginePrivate::paperSize() const void QMacPrintEnginePrivate::setPaperName(const QString &name) { Q_Q(QMacPrintEngine); + if (hasCustomPaperSize) { + PMRelease(customPaper); + customPaper = 0; + hasCustomPaperSize = false; + } PMPrinter printer; if (PMSessionGetCurrentPrinter(session(), &printer) == noErr) { @@ -419,6 +444,8 @@ void QMacPrintEnginePrivate::releaseSession() { PMSessionEndPageNoDialog(session()); PMSessionEndDocumentNoDialog(session()); + if (hasCustomPaperSize) + PMRelease(customPaper); [printInfo release]; printInfo = 0; } @@ -665,10 +692,10 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va { PMOrientation orientation; PMGetOrientation(d->format(), &orientation); - d->hasCustomPaperSize = true; d->customSize = value.toSizeF(); if (orientation != kPMPortrait) d->customSize = QSizeF(d->customSize.height(), d->customSize.width()); + d->setPaperSize(QPrinter::Custom); break; } case PPK_PageMargins: diff --git a/src/plugins/platforms/cocoa/qprintengine_mac_p.h b/src/plugins/platforms/cocoa/qprintengine_mac_p.h index 28183118d8..644a07184f 100644 --- a/src/plugins/platforms/cocoa/qprintengine_mac_p.h +++ b/src/plugins/platforms/cocoa/qprintengine_mac_p.h @@ -135,6 +135,7 @@ public: qreal rightMargin; qreal bottomMargin; QHash valueCache; + PMPaper customPaper; QMacPrintEnginePrivate() : mode(QPrinter::ScreenResolution), state(QPrinter::Idle), orient(QPrinter::Portrait), printInfo(0), paintEngine(0), hasCustomPaperSize(false), hasCustomPageMargins(false) {} -- cgit v1.2.3 From 85bf1450feab88ab675442e7e51e8c98e617f39c Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 28 Nov 2013 14:03:01 +0100 Subject: Doc: fixed invalid reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Link to "Getting started with qmake" was invalid Task-number: QTBUG-34749 Change-Id: I782dc99f5182f2fe7661377eb82f35ebb50a46cf Reviewed-by: Martin Smith Reviewed-by: Topi Reiniö --- src/corelib/doc/qtcore.qdocconf | 2 +- src/corelib/plugin/qplugin.qdoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index 9ab66c6645..fa5afb033c 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -26,7 +26,7 @@ qhp.QtCore.subprojects.classes.sortPages = true tagfile = ../../../doc/qtcore/qtcore.tags -depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner qtconcurrent qtxml +depends += qtgui qtwidgets qtnetwork qtdoc qtquick qtlinguist qtdesigner qtconcurrent qtxml qmake headerdirs += .. diff --git a/src/corelib/plugin/qplugin.qdoc b/src/corelib/plugin/qplugin.qdoc index eacfe995ae..0a94077d95 100644 --- a/src/corelib/plugin/qplugin.qdoc +++ b/src/corelib/plugin/qplugin.qdoc @@ -109,6 +109,6 @@ the required plugins to your build. For example: \snippet code/doc_src_qplugin.pro 3 + \sa {Static Plugins}, {How to Create Qt Plugins}, {qmake-getting-started}{Getting Started with qmake} - \sa {Static Plugins}, {How to Create Qt Plugins}, {Using qmake} */ -- cgit v1.2.3 From d78c39ed12d16ec47b5af5a022d8a533f77408f8 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 28 Nov 2013 14:04:14 +0100 Subject: Doc: invalid reference to Qt for Linux/X11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-34749 Change-Id: I8274e41bc4c29650b22bb6ca5da264687aa70e4a Reviewed-by: Topi Reiniö --- src/sql/doc/src/sql-driver.qdoc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc index d8d10582f6..849cdcd544 100644 --- a/src/sql/doc/src/sql-driver.qdoc +++ b/src/sql/doc/src/sql-driver.qdoc @@ -151,9 +151,8 @@ \snippet code/doc_src_sql-driver.qdoc 3 - After installing Qt, as described in the \l{Installing Qt for X11 - Platforms} document, you also need to install the plugin in the - standard location: + After installing Qt, you also need to install the plugin in the standard + location: \snippet code/doc_src_sql-driver.qdoc 4 @@ -478,8 +477,8 @@ \snippet code/doc_src_sql-driver.qdoc 13 - After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, - you also need to install the plugin in the standard location: + After installing Qt, you also need to install the plugin in the standard + location: \snippet code/doc_src_sql-driver.qdoc 14 @@ -565,8 +564,8 @@ \snippet code/doc_src_sql-driver.qdoc 18 - After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, - you also need to install the plugin in the standard location: + After installing Qt, you also need to install the plugin in the standard + location: \snippet code/doc_src_sql-driver.qdoc 19 @@ -640,8 +639,7 @@ \snippet code/doc_src_sql-driver.qdoc 21 - After installing Qt, as described in the \l{Installing Qt for X11 Platforms} document, - you also need to install the plugin in the standard location: + After installing Qt, you also need to install the plugin in the standard location: \snippet code/doc_src_sql-driver.qdoc 22 -- cgit v1.2.3 From 1f6c4a514c6bbc9bdc50aff4c0079ffccfffe76f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 29 Nov 2013 12:35:52 +0100 Subject: Use case insensitive comparison when checking platform plugin keys. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iff44698dcc941ca244b476f0e6c6a993f2ad75f3 Reviewed-by: Kevin Krammer Reviewed-by: Jørgen Lind --- src/plugins/platforms/android/src/androidplatformplugin.cpp | 2 +- src/plugins/platforms/cocoa/main.mm | 3 +-- src/plugins/platforms/directfb/main.cpp | 2 +- src/plugins/platforms/eglfs/main.cpp | 2 +- src/plugins/platforms/ios/plugin.mm | 2 +- src/plugins/platforms/kms/main.cpp | 2 +- src/plugins/platforms/linuxfb/main.cpp | 2 +- src/plugins/platforms/minimal/main.cpp | 2 +- src/plugins/platforms/minimalegl/main.cpp | 2 +- src/plugins/platforms/offscreen/main.cpp | 2 +- src/plugins/platforms/openwfd/main.cpp | 2 +- src/plugins/platforms/qnx/main.cpp | 2 +- src/plugins/platforms/xcb/main.cpp | 2 +- 13 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/androidplatformplugin.cpp b/src/plugins/platforms/android/src/androidplatformplugin.cpp index 79e23c2d32..2cf5aa1e01 100644 --- a/src/plugins/platforms/android/src/androidplatformplugin.cpp +++ b/src/plugins/platforms/android/src/androidplatformplugin.cpp @@ -56,7 +56,7 @@ public: QPlatformIntegration *QAndroidPlatformIntegrationPlugin::create(const QString &key, const QStringList ¶mList) { Q_UNUSED(paramList); - if (key.toLower() == "android") + if (!key.compare(QLatin1String("android"), Qt::CaseInsensitive)) return new QAndroidPlatformIntegration(paramList); return 0; } diff --git a/src/plugins/platforms/cocoa/main.mm b/src/plugins/platforms/cocoa/main.mm index b730514b12..dd063b5da0 100644 --- a/src/plugins/platforms/cocoa/main.mm +++ b/src/plugins/platforms/cocoa/main.mm @@ -61,8 +61,7 @@ QPlatformIntegration * QCocoaIntegrationPlugin::create(const QString& system, co Q_UNUSED(paramList); QCocoaAutoReleasePool pool; - - if (system.toLower() == "cocoa") + if (!system.compare(QLatin1String("cocoa"), Qt::CaseInsensitive)) return new QCocoaIntegration; return 0; diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp index 5ba1b0996b..423e33efd5 100644 --- a/src/plugins/platforms/directfb/main.cpp +++ b/src/plugins/platforms/directfb/main.cpp @@ -68,7 +68,7 @@ QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system, Q_UNUSED(paramList); QDirectFbIntegration *integration = 0; - if (system.toLower() == "directfb") + if (!system.compare(QLatin1String("directfb"), Qt::CaseInsensitive)) integration = new QDirectFbIntegration; QT_EGL_BACKEND_CREATE(system, integration) diff --git a/src/plugins/platforms/eglfs/main.cpp b/src/plugins/platforms/eglfs/main.cpp index d8e7a3792e..245f2a6236 100644 --- a/src/plugins/platforms/eglfs/main.cpp +++ b/src/plugins/platforms/eglfs/main.cpp @@ -55,7 +55,7 @@ public: QPlatformIntegration* QEglFSIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "eglfs") + if (!system.compare(QLatin1String("eglfs"), Qt::CaseInsensitive)) return new QEglFSIntegration; return 0; diff --git a/src/plugins/platforms/ios/plugin.mm b/src/plugins/platforms/ios/plugin.mm index efb1ad8d74..3505e39a0b 100644 --- a/src/plugins/platforms/ios/plugin.mm +++ b/src/plugins/platforms/ios/plugin.mm @@ -56,7 +56,7 @@ class QIOSIntegrationPlugin : public QPlatformIntegrationPlugin QPlatformIntegration * QIOSIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "ios") + if (!system.compare(QLatin1String("ios"), Qt::CaseInsensitive)) return new QIOSIntegration; return 0; diff --git a/src/plugins/platforms/kms/main.cpp b/src/plugins/platforms/kms/main.cpp index db0582e694..3027e23c04 100644 --- a/src/plugins/platforms/kms/main.cpp +++ b/src/plugins/platforms/kms/main.cpp @@ -55,7 +55,7 @@ public: QPlatformIntegration *QKmsIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "kms") + if (!system.compare(QLatin1String("kms"), Qt::CaseInsensitive)) return new QKmsIntegration; return 0; diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index 579984d2fc..27aa91aefe 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -55,7 +55,7 @@ public: QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "linuxfb") + if (!system.compare(QLatin1String("linuxfb"), Qt::CaseInsensitive)) return new QLinuxFbIntegration(paramList); return 0; diff --git a/src/plugins/platforms/minimal/main.cpp b/src/plugins/platforms/minimal/main.cpp index 7846b5b387..a690a13d81 100644 --- a/src/plugins/platforms/minimal/main.cpp +++ b/src/plugins/platforms/minimal/main.cpp @@ -56,7 +56,7 @@ public: QPlatformIntegration *QMinimalIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "minimal") + if (!system.compare(QLatin1String("minimal"), Qt::CaseInsensitive)) return new QMinimalIntegration; return 0; diff --git a/src/plugins/platforms/minimalegl/main.cpp b/src/plugins/platforms/minimalegl/main.cpp index c951bfb0dc..be85fa082e 100644 --- a/src/plugins/platforms/minimalegl/main.cpp +++ b/src/plugins/platforms/minimalegl/main.cpp @@ -63,7 +63,7 @@ QStringList QMinimalEglIntegrationPlugin::keys() const QPlatformIntegration* QMinimalEglIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "minimalegl") + if (!system.compare(QLatin1String("minimalegl"), Qt::CaseInsensitive)) return new QMinimalEglIntegration; return 0; diff --git a/src/plugins/platforms/offscreen/main.cpp b/src/plugins/platforms/offscreen/main.cpp index f48451d00d..e89116351b 100644 --- a/src/plugins/platforms/offscreen/main.cpp +++ b/src/plugins/platforms/offscreen/main.cpp @@ -56,7 +56,7 @@ public: QPlatformIntegration *QOffscreenIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "offscreen") + if (!system.compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) return QOffscreenIntegration::createOffscreenIntegration(); return 0; diff --git a/src/plugins/platforms/openwfd/main.cpp b/src/plugins/platforms/openwfd/main.cpp index cea3c50e56..5f5d7594cd 100644 --- a/src/plugins/platforms/openwfd/main.cpp +++ b/src/plugins/platforms/openwfd/main.cpp @@ -54,7 +54,7 @@ public: QPlatformIntegration* QOpenWFDIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "openwfd") + if (!system.compare(QLatin1String("openwfd"), Qt::CaseInsensitive)) return new QOpenWFDIntegration; return 0; diff --git a/src/plugins/platforms/qnx/main.cpp b/src/plugins/platforms/qnx/main.cpp index fb81928625..50779d3e12 100644 --- a/src/plugins/platforms/qnx/main.cpp +++ b/src/plugins/platforms/qnx/main.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE QPlatformIntegration *QQnxIntegrationPlugin::create(const QString& system, const QStringList& paramList) { - if (system.toLower() == QLatin1String("qnx")) + if (!system.compare(QLatin1String("qnx"), Qt::CaseInsensitive)) return new QQnxIntegration(paramList); return 0; diff --git a/src/plugins/platforms/xcb/main.cpp b/src/plugins/platforms/xcb/main.cpp index e114827703..f21ea03cf5 100644 --- a/src/plugins/platforms/xcb/main.cpp +++ b/src/plugins/platforms/xcb/main.cpp @@ -54,7 +54,7 @@ public: QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& parameters, int &argc, char **argv) { - if (system.toLower() == "xcb") + if (!system.compare(QLatin1String("xcb"), Qt::CaseInsensitive)) return new QXcbIntegration(parameters, argc, argv); return 0; -- cgit v1.2.3 From cac6c860c00558b9692986a1c07e505dd334cc33 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 3 Dec 2013 13:00:47 +0100 Subject: Effects also need to markDirtyOnScreen for native widgets Task-number: QTBUG-33244 Change-Id: I95427b1fd6edaafe99738acfec28f6fd37b70cde Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qwidget.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 421ce57096..c646255ddb 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5036,6 +5036,8 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP return; #endif // Q_WS_MAC + const bool asRoot = flags & DrawAsRoot; + bool onScreen = paintOnScreen(); Q_Q(QWidget); #ifndef QT_NO_GRAPHICSEFFECT @@ -5065,12 +5067,17 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP sharedPainter->restore(); } sourced->context = 0; + + // Native widgets need to be marked dirty on screen so painting will be done in correct context + // Same check as in the no effects case below. + if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow())) + backingStore->markDirtyOnScreen(rgn, q, offset); + return; } } #endif //QT_NO_GRAFFICSEFFECT - const bool asRoot = flags & DrawAsRoot; const bool alsoOnScreen = flags & DrawPaintOnScreen; const bool recursive = flags & DrawRecursive; const bool alsoInvisible = flags & DrawInvisible; @@ -5084,7 +5091,6 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP subtractOpaqueChildren(toBePainted, q->rect()); if (!toBePainted.isEmpty()) { - bool onScreen = paintOnScreen(); if (!onScreen || alsoOnScreen) { //update the "in paint event" flag if (q->testAttribute(Qt::WA_WState_InPaintEvent)) -- cgit v1.2.3 From 28d77c24c2deec2eee8c735b299f0da792d75c9f Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Mon, 2 Dec 2013 11:15:31 +0200 Subject: xcb qpa: initialize EGL for non-XLib builds Move the EGL initialization code outside of the XLib ifdefs, so it can be enabled for non-XLib builds as well Change-Id: Ie025551e4e99bb0b365f025356bd9725f4283b82 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbconnection.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 4d2735ca85..c00b4d551b 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -274,21 +274,22 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra XSetEventQueueOwner(dpy, XCBOwnsEventQueue); XSetErrorHandler(nullErrorHandler); m_xlib_display = dpy; -#ifdef XCB_USE_EGL - EGLDisplay eglDisplay = eglGetDisplay(dpy); - m_egl_display = eglDisplay; - EGLint major, minor; - eglBindAPI(EGL_OPENGL_ES_API); - m_has_egl = eglInitialize(eglDisplay,&major,&minor); -#endif //XCB_USE_EGL } #else + EGLNativeDisplayType dpy = EGL_DEFAULT_DISPLAY; m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreen); #endif //XCB_USE_XLIB if (!m_connection || xcb_connection_has_error(m_connection)) qFatal("QXcbConnection: Could not connect to display %s", m_displayName.constData()); +#ifdef XCB_USE_EGL + EGLDisplay eglDisplay = eglGetDisplay(dpy); + m_egl_display = eglDisplay; + EGLint major, minor; + m_has_egl = eglInitialize(eglDisplay, &major, &minor); +#endif //XCB_USE_EGL + m_reader = new QXcbEventReader(this); m_reader->start(); -- cgit v1.2.3 From 9fc0965d1930b32277dd3845cb94b650aec67ac8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 29 Sep 2013 18:07:23 -0700 Subject: Repack structs with more than one padding hole Sizes gained (measured on 64-bit systems) BezierEase: shrunk 8 bytes QRegExpCharClass: shrunk 8 bytes QRegularExpressionPrivate: shrunk 8 bytes QTimeLinePrivate: shrunk 8 bytes QUtcTimeZonePrivate: shrunk 8 bytes QTextStreamPrivate: shrunk 8 bytes QDirPrivate: shrunk 8 bytes QFileDevicePrivate: shrunk 8 bytes Not done: QRegExpEngine: 18 bytes in 6 holes (you deserve high memory usage if you're still using QRegExp) QTextBoundaryFinder: 8 bytes in 2 holes (public class) QIODevicePrivate: 6 bytes in 2 holes, but there's no gain in packing QProcessPrivate: too complex and my copy is modified QThreadData: awaiting change from Marc Change-Id: I2a388b5ce17dec0dafcef18ed2e80d0379aa7d1e Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qdir.cpp | 4 +- src/corelib/io/qdir_p.h | 8 ++-- src/corelib/io/qfiledevice.cpp | 6 +-- src/corelib/io/qfiledevice_p.h | 13 ++++--- src/corelib/io/qtextstream_p.h | 63 +++++++++++++++++--------------- src/corelib/tools/qeasingcurve.cpp | 8 ++-- src/corelib/tools/qregexp.cpp | 4 +- src/corelib/tools/qregularexpression.cpp | 7 ++-- src/corelib/tools/qtimeline.cpp | 10 +++-- src/corelib/tools/qtimezoneprivate.cpp | 8 ++-- src/corelib/tools/qtimezoneprivate_p.h | 4 +- 11 files changed, 72 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index db27bed9d6..43db2ec1fe 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -85,10 +85,10 @@ static QString driveSpec(const QString &path) //************* QDirPrivate QDirPrivate::QDirPrivate(const QString &path, const QStringList &nameFilters_, QDir::SortFlags sort_, QDir::Filters filters_) : QSharedData() + , fileListsInitialized(false) , nameFilters(nameFilters_) , sort(sort_) , filters(filters_) - , fileListsInitialized(false) { setPath(path.isEmpty() ? QString::fromLatin1(".") : path); @@ -108,10 +108,10 @@ QDirPrivate::QDirPrivate(const QString &path, const QStringList &nameFilters_, Q QDirPrivate::QDirPrivate(const QDirPrivate ©) : QSharedData(copy) + , fileListsInitialized(false) , nameFilters(copy.nameFilters) , sort(copy.sort) , filters(copy.filters) - , fileListsInitialized(false) , dirEntry(copy.dirEntry) , metaData(copy.metaData) { diff --git a/src/corelib/io/qdir_p.h b/src/corelib/io/qdir_p.h index efcac439cd..bf7726db2f 100644 --- a/src/corelib/io/qdir_p.h +++ b/src/corelib/io/qdir_p.h @@ -73,16 +73,16 @@ public: void resolveAbsoluteEntry() const; + mutable bool fileListsInitialized; + mutable QStringList files; + mutable QFileInfoList fileInfos; + QStringList nameFilters; QDir::SortFlags sort; QDir::Filters filters; QScopedPointer fileEngine; - mutable bool fileListsInitialized; - mutable QStringList files; - mutable QFileInfoList fileInfos; - QFileSystemEntry dirEntry; mutable QFileSystemEntry absoluteDirEntry; mutable QFileSystemMetaData metaData; diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp index f25933816a..d2c8d37d4a 100644 --- a/src/corelib/io/qfiledevice.cpp +++ b/src/corelib/io/qfiledevice.cpp @@ -53,9 +53,9 @@ QT_BEGIN_NAMESPACE static const int QFILE_WRITEBUFFER_SIZE = 16384; QFileDevicePrivate::QFileDevicePrivate() - : fileEngine(0), lastWasWrite(false), - writeBuffer(QFILE_WRITEBUFFER_SIZE), error(QFile::NoError), - cachedSize(0) + : fileEngine(0), + writeBuffer(QFILE_WRITEBUFFER_SIZE), cachedSize(0), + error(QFile::NoError), lastWasWrite(false) { } diff --git a/src/corelib/io/qfiledevice_p.h b/src/corelib/io/qfiledevice_p.h index 4c9cf7b627..79d8427c0d 100644 --- a/src/corelib/io/qfiledevice_p.h +++ b/src/corelib/io/qfiledevice_p.h @@ -70,21 +70,22 @@ protected: virtual QAbstractFileEngine *engine() const; - QFileDevice::FileHandleFlags handleFlags; - - mutable QAbstractFileEngine *fileEngine; - bool lastWasWrite; - QRingBuffer writeBuffer; inline bool ensureFlushed() const; bool putCharHelper(char c); - QFileDevice::FileError error; void setError(QFileDevice::FileError err); void setError(QFileDevice::FileError err, const QString &errorString); void setError(QFileDevice::FileError err, int errNum); + mutable QAbstractFileEngine *fileEngine; + QRingBuffer writeBuffer; mutable qint64 cachedSize; + + QFileDevice::FileHandleFlags handleFlags; + QFileDevice::FileError error; + + bool lastWasWrite; }; inline bool QFileDevicePrivate::ensureFlushed() const diff --git a/src/corelib/io/qtextstream_p.h b/src/corelib/io/qtextstream_p.h index d5d5288426..ac6529e195 100644 --- a/src/corelib/io/qtextstream_p.h +++ b/src/corelib/io/qtextstream_p.h @@ -88,6 +88,21 @@ class QTextStreamPrivate { Q_DECLARE_PUBLIC(QTextStream) public: + // streaming parameters + class Params + { + public: + void reset(); + + int realNumberPrecision; + int integerBase; + int fieldWidth; + QChar padChar; + QTextStream::FieldAlignment fieldAlignment; + QTextStream::RealNumberNotation realNumberNotation; + QTextStream::NumberFlags numberFlags; + }; + QTextStreamPrivate(QTextStream *q_ptr); ~QTextStreamPrivate(); void reset(); @@ -97,7 +112,6 @@ public: #ifndef QT_NO_QOBJECT QDeviceClosedNotifier deviceClosedNotifier; #endif - bool deleteDevice; // string QString *string; @@ -110,6 +124,24 @@ public: QTextCodec::ConverterState readConverterState; QTextCodec::ConverterState writeConverterState; QTextCodec::ConverterState *readConverterSavedState; +#endif + + QString writeBuffer; + QString readBuffer; + int readBufferOffset; + int readConverterSavedStateOffset; //the offset between readBufferStartDevicePos and that start of the buffer + qint64 readBufferStartDevicePos; + + Params params; + + // status + QTextStream::Status status; + QLocale locale; + QTextStream *q_ptr; + + int lastTokenSize; + bool deleteDevice; +#ifndef QT_NO_TEXTCODEC bool autoDetectUnicode; #endif @@ -128,7 +160,6 @@ public: inline void consume(int nchars); void saveConverterState(qint64 newPos); void restoreToSavedConverterState(); - int lastTokenSize; // Return value type for getNumber() enum NumberParsingStatus { @@ -150,34 +181,6 @@ public: bool fillReadBuffer(qint64 maxBytes = -1); void resetReadBuffer(); void flushWriteBuffer(); - QString writeBuffer; - QString readBuffer; - int readBufferOffset; - int readConverterSavedStateOffset; //the offset between readBufferStartDevicePos and that start of the buffer - qint64 readBufferStartDevicePos; - - // streaming parameters - class Params - { - public: - void reset(); - - int realNumberPrecision; - int integerBase; - int fieldWidth; - QChar padChar; - QTextStream::FieldAlignment fieldAlignment; - QTextStream::RealNumberNotation realNumberNotation; - QTextStream::NumberFlags numberFlags; - }; - Params params; - - // status - QTextStream::Status status; - - QLocale locale; - - QTextStream *q_ptr; }; QT_END_NAMESPACE diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 5daf067c71..2708901866 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -432,14 +432,14 @@ struct BezierEase : public QEasingCurveFunction qreal p3x, p3y; }; - bool _init; - bool _valid; QVector _curves; - int _curveCount; QVector _intervals; + int _curveCount; + bool _init; + bool _valid; BezierEase() - : QEasingCurveFunction(InOut), _init(false), _valid(false), _curves(10), _intervals(10) + : QEasingCurveFunction(InOut), _curves(10), _intervals(10), _init(false), _valid(false) { } void init() diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index 88499ad9d9..d2b5adc974 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -1045,12 +1045,12 @@ public: #endif private: - uint c; // character classes QVector r; // character ranges - bool n; // negative? #ifndef QT_NO_REGEXP_OPTIM QVector occ1; // first-occurrence array #endif + uint c; // character classes + bool n; // negative? }; #else struct QRegExpCharClass diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index d5bd1dff00..e1cf82bb8c 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -813,8 +813,9 @@ struct QRegularExpressionPrivate : QSharedData int captureIndexForName(const QString &name) const; - QString pattern; + // sizeof(QSharedData) == 4, so start our members with an enum QRegularExpression::PatternOptions patternOptions; + QString pattern; // *All* of the following members are set managed while holding this mutex, // except for isDirty which is set to true by QRegularExpression setters @@ -889,7 +890,7 @@ QRegularExpression::QRegularExpression(QRegularExpressionPrivate &dd) \internal */ QRegularExpressionPrivate::QRegularExpressionPrivate() - : pattern(), patternOptions(0), + : patternOptions(0), pattern(), mutex(), compiledPattern(0), studyData(0), errorString(0), errorOffset(-1), @@ -919,7 +920,7 @@ QRegularExpressionPrivate::~QRegularExpressionPrivate() */ QRegularExpressionPrivate::QRegularExpressionPrivate(const QRegularExpressionPrivate &other) : QSharedData(other), - pattern(other.pattern), patternOptions(other.patternOptions), + patternOptions(other.patternOptions), pattern(other.pattern), mutex(), compiledPattern(0), studyData(0), errorString(0), diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp index 976c03aef4..3619c9e986 100644 --- a/src/corelib/tools/qtimeline.cpp +++ b/src/corelib/tools/qtimeline.cpp @@ -53,13 +53,17 @@ class QTimeLinePrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QTimeLine) public: inline QTimeLinePrivate() - : startTime(0), duration(1000), startFrame(0), endFrame(0), + : easingCurve(QEasingCurve::InOutSine), + startTime(0), duration(1000), startFrame(0), endFrame(0), updateInterval(1000 / 25), totalLoopCount(1), currentLoopCount(0), currentTime(0), timerId(0), - direction(QTimeLine::Forward), easingCurve(QEasingCurve::InOutSine), + direction(QTimeLine::Forward), state(QTimeLine::NotRunning) { } + QElapsedTimer timer; + QEasingCurve easingCurve; + int startTime; int duration; int startFrame; @@ -70,10 +74,8 @@ public: int currentTime; int timerId; - QElapsedTimer timer; QTimeLine::Direction direction; - QEasingCurve easingCurve; QTimeLine::State state; inline void setState(QTimeLine::State newState) { diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp index 08a5ce0861..ee34469c03 100644 --- a/src/corelib/tools/qtimezoneprivate.cpp +++ b/src/corelib/tools/qtimezoneprivate.cpp @@ -596,9 +596,11 @@ QUtcTimeZonePrivate::QUtcTimeZonePrivate(const QByteArray &zoneId, int offsetSec } QUtcTimeZonePrivate::QUtcTimeZonePrivate(const QUtcTimeZonePrivate &other) - : QTimeZonePrivate(other), m_offsetFromUtc(other.m_offsetFromUtc), m_name(other.m_name), - m_abbreviation(other.m_abbreviation), m_country(other.m_country), - m_comment(other.m_comment) + : QTimeZonePrivate(other), m_name(other.m_name), + m_abbreviation(other.m_abbreviation), + m_comment(other.m_comment), + m_country(other.m_country), + m_offsetFromUtc(other.m_offsetFromUtc) { } diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index 108aec2654..4fbb3ff6e0 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -203,11 +203,11 @@ private: const QString &abbreviation, QLocale::Country country, const QString &comment); - int m_offsetFromUtc; QString m_name; QString m_abbreviation; - QLocale::Country m_country; QString m_comment; + QLocale::Country m_country; + int m_offsetFromUtc; }; #ifdef QT_USE_ICU -- cgit v1.2.3 From 03ae80359f8b0cb39ae5e95902383869314716d9 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 4 Dec 2013 09:45:01 +0100 Subject: Report hardware acceleration in default manifest Qt applications require the "hardwareAccelerated" flag set on some devices or Android versions. The symptoms that this was missing was problems when handling orientation changes. When the target SDK version is >= 14, it is true by default, but for lower versions it is not. There is no reason to set this to false for a Qt application, since we don't use any of the unsupported 2D drawing operations in the documentation, so lets just set it to true for all applications. Task-number: QTBUG-35293 Change-Id: Ie131a52a2a3fc5a520d0c5dd5d64f79269e9b6b5 Reviewed-by: BogDan Vatra --- src/android/java/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/android/java/AndroidManifest.xml b/src/android/java/AndroidManifest.xml index cfad4553ee..defbe502ef 100644 --- a/src/android/java/AndroidManifest.xml +++ b/src/android/java/AndroidManifest.xml @@ -1,6 +1,6 @@ - + Date: Fri, 29 Nov 2013 12:06:45 +0100 Subject: Minimal plugin: Use a dummy font database for command line tools. Suppress warnings like: QFontDatabase: Cannot find font directory '...' - is Qt installed correctly? occurring for example when using qmlplugindump. Add option flags (similar to Windows plugin) to the integration class to be used for QT_DEBUG_BACKINGSTORE and other functionality. Add a dummy font database with empty populate() function to be used unless the debug flag for the backing store is used. Task-number: QTBUG-33674 Task-number: QTCREATORBUG-10685 Change-Id: I7eaff3025de12e6b0471a3430f986b0cd810e22c Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/minimal/main.cpp | 3 +- .../platforms/minimal/qminimalbackingstore.cpp | 6 +-- .../platforms/minimal/qminimalbackingstore.h | 2 +- .../platforms/minimal/qminimalintegration.cpp | 50 +++++++++++++++++++++- .../platforms/minimal/qminimalintegration.h | 17 +++++++- 5 files changed, 70 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/minimal/main.cpp b/src/plugins/platforms/minimal/main.cpp index a690a13d81..5e0388a0af 100644 --- a/src/plugins/platforms/minimal/main.cpp +++ b/src/plugins/platforms/minimal/main.cpp @@ -55,9 +55,8 @@ public: QPlatformIntegration *QMinimalIntegrationPlugin::create(const QString& system, const QStringList& paramList) { - Q_UNUSED(paramList); if (!system.compare(QLatin1String("minimal"), Qt::CaseInsensitive)) - return new QMinimalIntegration; + return new QMinimalIntegration(paramList); return 0; } diff --git a/src/plugins/platforms/minimal/qminimalbackingstore.cpp b/src/plugins/platforms/minimal/qminimalbackingstore.cpp index 3aac1bfe33..f58458cd31 100644 --- a/src/plugins/platforms/minimal/qminimalbackingstore.cpp +++ b/src/plugins/platforms/minimal/qminimalbackingstore.cpp @@ -41,6 +41,7 @@ #include "qminimalbackingstore.h" +#include "qminimalintegration.h" #include "qscreen.h" #include #include @@ -49,10 +50,9 @@ QT_BEGIN_NAMESPACE QMinimalBackingStore::QMinimalBackingStore(QWindow *window) - : QPlatformBackingStore(window),mDebug(false) + : QPlatformBackingStore(window) + , mDebug(QMinimalIntegration::instance()->options() & QMinimalIntegration::DebugBackingStore) { - if (QT_PREPEND_NAMESPACE(qgetenv)("QT_DEBUG_BACKINGSTORE").toInt() > 0) - mDebug = true; if (mDebug) qDebug() << "QMinimalBackingStore::QMinimalBackingStore:" << (quintptr)this; } diff --git a/src/plugins/platforms/minimal/qminimalbackingstore.h b/src/plugins/platforms/minimal/qminimalbackingstore.h index 5f1fd0f4d3..9265a09d18 100644 --- a/src/plugins/platforms/minimal/qminimalbackingstore.h +++ b/src/plugins/platforms/minimal/qminimalbackingstore.h @@ -60,7 +60,7 @@ public: private: QImage mImage; - bool mDebug; + const bool mDebug; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index a08cede76a..76b4b5b0eb 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -50,11 +50,31 @@ #include #include #include +#include QT_BEGIN_NAMESPACE -QMinimalIntegration::QMinimalIntegration() +static const char debugBackingStoreEnvironmentVariable[] = "QT_DEBUG_BACKINGSTORE"; + +static inline unsigned parseOptions(const QStringList ¶mList) +{ + unsigned options = 0; + foreach (const QString ¶m, paramList) { + if (param == QLatin1String("enable_fonts")) + options |= QMinimalIntegration::EnableFonts; + } + return options; +} + +QMinimalIntegration::QMinimalIntegration(const QStringList ¶meters) + : m_dummyFontDatabase(0) + , m_options(parseOptions(parameters)) { + if (qEnvironmentVariableIsSet(debugBackingStoreEnvironmentVariable) + && qgetenv(debugBackingStoreEnvironmentVariable).toInt() > 0) { + m_options |= DebugBackingStore | EnableFonts; + } + QMinimalScreen *mPrimaryScreen = new QMinimalScreen(); mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320); @@ -64,6 +84,11 @@ QMinimalIntegration::QMinimalIntegration() screenAdded(mPrimaryScreen); } +QMinimalIntegration::~QMinimalIntegration() +{ + delete m_dummyFontDatabase; +} + bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) const { switch (cap) { @@ -73,6 +98,24 @@ bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) co } } +// Dummy font database that does not scan the fonts directory to be +// used for command line tools like qmlplugindump that do not create windows +// unless DebugBackingStore is activated. +class DummyFontDatabase : public QPlatformFontDatabase +{ +public: + virtual void populateFontDatabase() {} +}; + +QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const +{ + if (m_options & EnableFonts) + return QPlatformIntegration::fontDatabase(); + if (!m_dummyFontDatabase) + m_dummyFontDatabase = new DummyFontDatabase; + return m_dummyFontDatabase; +} + QPlatformWindow *QMinimalIntegration::createPlatformWindow(QWindow *window) const { Q_UNUSED(window); @@ -95,4 +138,9 @@ QAbstractEventDispatcher *QMinimalIntegration::createEventDispatcher() const #endif } +QMinimalIntegration *QMinimalIntegration::instance() +{ + return static_cast(QGuiApplicationPrivate::platformIntegration()); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index 7dc01e1d51..a737057085 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -67,13 +67,28 @@ public: class QMinimalIntegration : public QPlatformIntegration { public: - QMinimalIntegration(); + enum Options { // Options to be passed on command line or determined from environment + DebugBackingStore = 0x1, + EnableFonts = 0x2 + }; + + explicit QMinimalIntegration(const QStringList ¶meters); + ~QMinimalIntegration(); bool hasCapability(QPlatformIntegration::Capability cap) const; + QPlatformFontDatabase *fontDatabase() const; QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; QAbstractEventDispatcher *createEventDispatcher() const; + + unsigned options() const { return m_options; } + + static QMinimalIntegration *instance(); + +private: + mutable QPlatformFontDatabase *m_dummyFontDatabase; + unsigned m_options; }; QT_END_NAMESPACE -- cgit v1.2.3 From edf29a9aa93660ac8e4927db7fef2b5d925e9b59 Mon Sep 17 00:00:00 2001 From: El Mehdi Fekari Date: Mon, 18 Nov 2013 18:23:26 +0100 Subject: QBBSystemLocale: Do not set fixed buffer size when reading pps objects Set dynamically the buffer size when reading pps objects since a pps file size is not always fix. Change-Id: I48f80389161bfbce3342e53ceec0b13bb7df0e4c Reviewed-by: Tony Van Eerd Reviewed-by: Rafael Roquetto --- src/corelib/tools/qlocale_blackberry.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/corelib/tools/qlocale_blackberry.cpp b/src/corelib/tools/qlocale_blackberry.cpp index 48faa73070..c2c3476b0a 100644 --- a/src/corelib/tools/qlocale_blackberry.cpp +++ b/src/corelib/tools/qlocale_blackberry.cpp @@ -60,7 +60,7 @@ static const char ppsRegionLocalePath[] = "/pps/services/locale/settings"; static const char ppsLanguageLocalePath[] = "/pps/services/confstr/_CS_LOCALE"; static const char ppsHourFormatPath[] = "/pps/system/settings"; -static const size_t ppsBufferSize = 256; +static const int MAX_PPS_SIZE = 16000; QBBSystemLocaleData::QBBSystemLocaleData() : languageNotifier(0) @@ -186,9 +186,24 @@ QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd) if (!ppsObject || ppsFd == -1) return result; - char buffer[ppsBufferSize]; + // PPS objects are of unknown size, but must be read all at once. + // Relying on the file size may not be a good idea since the size may change before reading. + // Let's try with an initial size (512), and if the buffer is too small try with bigger one, + // until we succeed or until other non buffer-size-related error occurs. + // Using QVarLengthArray means the first try (of size == 512) uses a buffer on the stack - no allocation necessary. + // Hopefully that covers most use cases. + int bytes; + QVarLengthArray buffer; + for (;;) { + errno = 0; + bytes = qt_safe_read(ppsFd, buffer.data(), buffer.capacity() - 1); + const bool bufferIsTooSmall = (bytes == -1 && errno == EMSGSIZE && buffer.capacity() < MAX_PPS_SIZE); + if (!bufferIsTooSmall) + break; + + buffer.resize(qMin(buffer.capacity()*2, MAX_PPS_SIZE)); + } - int bytes = qt_safe_read(ppsFd, buffer, ppsBufferSize - 1); // This method is called in the ctor(), so do not use qWarning to log warnings // if qt_safe_read fails to read the pps file // since the user code may install a message handler that invokes QLocale API again @@ -202,7 +217,7 @@ QByteArray QBBSystemLocaleData::readPpsValue(const char *ppsObject, int ppsFd) pps_decoder_t ppsDecoder; pps_decoder_initialize(&ppsDecoder, 0); - if (pps_decoder_parse_pps_str(&ppsDecoder, buffer) == PPS_DECODER_OK) { + if (pps_decoder_parse_pps_str(&ppsDecoder, buffer.data()) == PPS_DECODER_OK) { pps_decoder_push(&ppsDecoder, 0); const char *ppsBuff; if (pps_decoder_get_string(&ppsDecoder, ppsObject, &ppsBuff) == PPS_DECODER_OK) { -- cgit v1.2.3 From 82d474d50d3bce1b29738e432fd0c7cf8bec448a Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Fri, 29 Nov 2013 13:36:38 +0100 Subject: Doc: Corrected link to Graphicsview Examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-34749 Change-Id: I66251e4b40e2930b08ed4bd932aef60aae7ebaa4 Reviewed-by: Topi Reiniö --- src/widgets/doc/src/qtwidgets-examples.qdoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/doc/src/qtwidgets-examples.qdoc b/src/widgets/doc/src/qtwidgets-examples.qdoc index 985aa24749..6ca15f25e5 100644 --- a/src/widgets/doc/src/qtwidgets-examples.qdoc +++ b/src/widgets/doc/src/qtwidgets-examples.qdoc @@ -127,7 +127,8 @@ /*! \ingroup all-examples - \title Graphicsview Examples + \target Graphicsview Examples + \title Graphics View Examples \brief Using the Graphics View framework. \page examples-graphicsview.html -- cgit v1.2.3 From 2b70b318e39aaee6f6d2988c6666666d1a9f4188 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 3 Dec 2013 15:02:24 +0200 Subject: Android: use binary name when using loadClass. QtAndroid::findClass uses loadClass methods to find Qt's java classes. The documentation says that we should use a binary name. Change-Id: I2146789235435b7052827cde58b7719b7d62dc1d Reviewed-by: Christian Stromme --- src/plugins/platforms/android/src/qandroidinputcontext.cpp | 4 ++-- src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/src/qandroidinputcontext.cpp b/src/plugins/platforms/android/src/qandroidinputcontext.cpp index 8556e8ebf1..326972e71e 100644 --- a/src/plugins/platforms/android/src/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/src/qandroidinputcontext.cpp @@ -59,8 +59,8 @@ QT_BEGIN_NAMESPACE static QAndroidInputContext *m_androidInputContext = 0; -static char const *const QtNativeInputConnectionClassName = "org/qtproject/qt5/android/QtNativeInputConnection"; -static char const *const QtExtractedTextClassName = "org/qtproject/qt5/android/QtExtractedText"; +static char const *const QtNativeInputConnectionClassName = "org.qtproject.qt5.android.QtNativeInputConnection"; +static char const *const QtExtractedTextClassName = "org.qtproject.qt5.android.QtExtractedText"; static jclass m_extractedTextClass = 0; static jmethodID m_classConstructorMethodID = 0; static jfieldID m_partialEndOffsetFieldID = 0; diff --git a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp index f379402e18..4c91e76e0f 100644 --- a/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp +++ b/src/plugins/platforms/android/src/qandroidplatformdialoghelpers.cpp @@ -184,7 +184,7 @@ static JNINativeMethod methods[] = { bool registerNatives(JNIEnv *env) { - jclass clazz = QtAndroid::findClass("org/qtproject/qt5/android/QtMessageDialogHelper", env); + jclass clazz = QtAndroid::findClass("org.qtproject.qt5.android.QtMessageDialogHelper", env); if (!clazz) { __android_log_print(ANDROID_LOG_FATAL, QtAndroid::qtTagText(), QtAndroid::classErrorMsgFmt() , "org/qtproject/qt5/android/QtMessageDialogHelper"); -- cgit v1.2.3 From 5726999a8cb509ce86db10fe5555703c58678e41 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 27 Nov 2013 12:07:57 +0100 Subject: Doc: Add QJsonObject::const_iterator() to correct group Make QJsonObject::const_iterator() part of the same doc group as the non-const variant. Also add a \since command with the correct value. Task-number: QTBUG-33052 Change-Id: I97fa2cc44dae93decf2b99a1384e37579b7dac46 Reviewed-by: Mitch Curtis Reviewed-by: Lars Knoll --- src/corelib/json/qjsonobject.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index afc0d5f71f..27e51cf4ac 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -783,6 +783,8 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const /*! \class QJsonObject::const_iterator \inmodule QtCore + \ingroup json + \since 5.0 \brief The QJsonObject::const_iterator class provides an STL-style const iterator for QJsonObject. QJsonObject::const_iterator allows you to iterate over a QJsonObject. -- cgit v1.2.3 From ec03058fa5b84b4570a2158bf2179f7ba4d83b99 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 4 Dec 2013 12:03:33 +0100 Subject: Clear QCocoaGLContext's m_currentWindow when window is hidden. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-35363 Change-Id: I1b3d883ed10200af8a2d4188fb1725b36eb78022 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoaglcontext.h | 2 ++ src/plugins/platforms/cocoa/qcocoaglcontext.mm | 10 ++++++++++ src/plugins/platforms/cocoa/qcocoawindow.mm | 2 ++ 3 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index e1d4b602c9..30f1cdc278 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -75,6 +75,8 @@ public: bool isSharing() const; bool isValid() const; + void windowWasHidden(); + private: void setActiveWindow(QWindow *window); void updateSurfaceFormat(); diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 144144338f..777d4a871b 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -165,6 +165,16 @@ QSurfaceFormat QCocoaGLContext::format() const return m_format; } +void QCocoaGLContext::windowWasHidden() +{ + // If the window is hidden, we need to unset the m_currentWindow + // variable so that succeeding makeCurrent's will not abort prematurely + // because of the optimization in setActiveWindow. + // Doing a full doneCurrent here is not preferable, because the GL context + // might be rendering in a different thread at this time. + m_currentWindow.clear(); +} + void QCocoaGLContext::swapBuffers(QPlatformSurface *surface) { QWindow *window = static_cast(surface)->window(); diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index b5b9cec2be..1aace958ed 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -388,6 +388,8 @@ void QCocoaWindow::setVisible(bool visible) [m_contentView setHidden:NO]; } else { // qDebug() << "close" << this; + if (m_glContext) + m_glContext->windowWasHidden(); if (m_nsWindow) { if (m_hasModalSession) { QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast(QGuiApplication::instance()->eventDispatcher()); -- cgit v1.2.3 From 95822e28e2b83730bab01b0c2f79f3c5a17d4090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 4 Dec 2013 16:32:47 +0100 Subject: iOS: Don't claim that windows with zero width and/or height are exposed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When sending expose events to Qt, Qt will ask us if we're exposed, and we need to tell it that we're not, so that clients will not try to makeCurrent on a CA layer that has a zero width and/or height. Note that this only works because we flush expose events. Change-Id: Idfbe03a2f35681084061376a3c650a8da027fda4 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.h | 2 ++ src/plugins/platforms/ios/qioswindow.mm | 5 +++++ 2 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index a5e122bda1..d36a81180c 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -74,6 +74,8 @@ public: void handleContentOrientationChange(Qt::ScreenOrientation orientation); void setVisible(bool visible); + bool isExposed() const Q_DECL_OVERRIDE; + void raise() { raiseOrLower(true); } void lower() { raiseOrLower(false); } void requestActivateWindow(); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 0dd810bdf6..587ecad61c 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -579,6 +579,11 @@ void QIOSWindow::applyGeometry(const QRect &rect) [m_view layoutIfNeeded]; } +bool QIOSWindow::isExposed() const +{ + return window()->isVisible() && !window()->geometry().isEmpty(); +} + void QIOSWindow::setWindowState(Qt::WindowState state) { // Update the QWindow representation straight away, so that -- cgit v1.2.3 From cd1ce77bf8a3520dee1c2703405c2bf2762360a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 4 Dec 2013 16:35:28 +0100 Subject: iOS: Apply default geometry to platform window if not set on QWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a platform window is created from a QWindow without setting a valid size or position on the QWindow, the platform window is expected to apply sane defaults. We use the baseclass initialGeometry() function for this, similar to other platform plugins. The default geometry unless otherwise set and/or calculated based on size hints is that of the screen's available geometry. An improvement to this is to detect whenever we apply the screen geometry, and also apply the appropriate window state, but that needs more testing. Change-Id: I02b12064ce6d55c04fe0cc2cd1d2816ca1113f40 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qioswindow.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 587ecad61c..7ab136e8b9 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -449,10 +449,18 @@ QT_BEGIN_NAMESPACE QIOSWindow::QIOSWindow(QWindow *window) : QPlatformWindow(window) , m_view([[QUIView alloc] initWithQIOSWindow:this]) - , m_normalGeometry(QPlatformWindow::geometry()) , m_windowLevel(0) { setParent(QPlatformWindow::parent()); + + // Resolve default window geometry in case it was not set before creating the + // platform window. This picks up eg. minimum-size if set, and defaults to + // the "maxmized" geometry (even though we're not in that window state). + // FIXME: Detect if we apply a maximized geometry and send a window state + // change event in that case. + m_normalGeometry = initialGeometry(window, QPlatformWindow::geometry(), + screen()->availableGeometry().width(), screen()->availableGeometry().height()); + setWindowState(window->windowState()); } -- cgit v1.2.3 From b86426c81e1c95126ff9b8b84ed5824160c2965b Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Thu, 5 Dec 2013 10:25:23 +0100 Subject: Fixed a bug where toolbars sometimes could not be docked. Task-number: QTBUG-33839 Change-Id: I542fb894c31ce38509a70a71bd0ea1bc84bb2a03 Reviewed-by: Jens Bache-Wiig --- src/widgets/widgets/qtoolbararealayout.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp index 94a1148ded..04ef6a80be 100644 --- a/src/widgets/widgets/qtoolbararealayout.cpp +++ b/src/widgets/widgets/qtoolbararealayout.cpp @@ -485,9 +485,12 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos) QList QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos, int *minDistance) const { - int p = pick(o, pos); - if (rect.contains(pos)) { + // is in QToolBarAreaLayout coordinates. + // is in local dockarea coordinates (see ~20 lines below) + // Since we're comparing p with item.pos, we put them in the same coordinate system. + const int p = pick(o, pos - rect.topLeft()); + for (int j = 0; j < lines.count(); ++j) { const QToolBarAreaLayoutLine &line = lines.at(j); if (line.skip()) -- cgit v1.2.3 From 1782fc1e07619a509ca490b55f0a946537e70b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 4 Dec 2013 16:38:01 +0100 Subject: Prevent recursive resize events in QAbstractScrollArea MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During show() of a QAbstractScrollArea we might get resize events, which results in laying out the children of the scroll area. One of these children are the scrollbars, and raising them to the top means creating them, which in turn means creating all parents, including the abstract scroll area itself. Creating the abstract scroll area means creating a platform window, which might send synchronous resize events as a result of creating the window, and we end up recursing. Change-Id: I1a2813f03091d6c42e51834315835551cb2fd621 Reviewed-by: Jan Arve Sæther --- src/widgets/widgets/qabstractscrollarea.cpp | 8 ++++++-- src/widgets/widgets/qabstractscrollarea_p.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index d8ee923f7a..db4ff8a2b7 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -167,7 +167,7 @@ QT_BEGIN_NAMESPACE QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate() :hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded), - shownOnce(false), sizeAdjustPolicy(QAbstractScrollArea::AdjustIgnored), + shownOnce(false), inResize(false), sizeAdjustPolicy(QAbstractScrollArea::AdjustIgnored), viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0), xoffset(0), yoffset(0), viewportFilter(0) #ifdef Q_WS_WIN @@ -995,8 +995,12 @@ bool QAbstractScrollArea::event(QEvent *e) d->viewport->setMouseTracking(hasMouseTracking()); break; case QEvent::Resize: + if (!d->inResize) { + d->inResize = true; d->layoutChildren(); - break; + d->inResize = false; + } + break; case QEvent::Show: if (!d->shownOnce && d->sizeAdjustPolicy == QAbstractScrollArea::AdjustToContentsOnFirstShow) { d->sizeHint = QSize(); diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h index 3093c2f812..2a4b20fe81 100644 --- a/src/widgets/widgets/qabstractscrollarea_p.h +++ b/src/widgets/widgets/qabstractscrollarea_p.h @@ -76,6 +76,7 @@ public: Qt::ScrollBarPolicy vbarpolicy, hbarpolicy; bool shownOnce; + bool inResize; mutable QSize sizeHint; QAbstractScrollArea::SizeAdjustPolicy sizeAdjustPolicy; -- cgit v1.2.3 From cea101bd10cc158b97d5fbf45b33dad9b649c08b Mon Sep 17 00:00:00 2001 From: Vicente Olivert Riera Date: Mon, 2 Dec 2013 13:59:34 +0000 Subject: qtbase: Fix build error on 64bit BigEndian platforms The functions fromBytesToWord() and fromWordToBytes() are called when building on 64bit BigEndian platforms. It fails because those functions are disabled on the source code. Enabling those functions for 64bit BigEndian platforms fixes the problem. Task-number: QTBUG-35228 Change-Id: I5ccacd4fb5051df05f67c8da879b3a9e49953861 Signed-off-by: Vicente Olivert Riera Reviewed-by: Giuseppe D'Angelo Reviewed-by: Richard J. Moore --- src/3rdparty/sha3/KeccakF-1600-opt64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100755 => 100644 src/3rdparty/sha3/KeccakF-1600-opt64.c (limited to 'src') diff --git a/src/3rdparty/sha3/KeccakF-1600-opt64.c b/src/3rdparty/sha3/KeccakF-1600-opt64.c old mode 100755 new mode 100644 index 7bd442ef69..a547bb5a89 --- a/src/3rdparty/sha3/KeccakF-1600-opt64.c +++ b/src/3rdparty/sha3/KeccakF-1600-opt64.c @@ -328,7 +328,7 @@ static void KeccakPermutation(unsigned char *state) KeccakPermutationOnWords((UINT64*)state); } -#if 0 // Unused in the Qt configuration +#if (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN) static void fromBytesToWord(UINT64 *word, const UINT8 *bytes) { unsigned int i; @@ -449,7 +449,7 @@ static void KeccakAbsorb(unsigned char *state, const unsigned char *data, unsign #endif } -#if 0 // Unused in the Qt configuration +#if (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN) static void fromWordToBytes(UINT8 *bytes, const UINT64 word) { unsigned int i; -- cgit v1.2.3 From 0a1cb466df071d9ae4fb73b6ba981afc675a173c Mon Sep 17 00:00:00 2001 From: aavit Date: Mon, 11 Nov 2013 11:04:16 +0100 Subject: Fix compilation for embedded Android Change-Id: If42fd83a68543d59b5a3a6b89e2c402aa452b251 Reviewed-by: Stephen Kelly --- src/corelib/global/qglobal.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 0c72bd7022..a648949d26 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -76,7 +76,7 @@ #include #endif -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) #include #endif @@ -2387,7 +2387,7 @@ typedef uint SeedStorageType; typedef QThreadStorage SeedStorage; Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) typedef QThreadStorage AndroidRandomStorage; Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS) #endif @@ -2423,7 +2423,7 @@ void qsrand(uint seed) //global static object, fallback to srand(seed) srand(seed); } -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) if (randomTLS->hasLocalData()) { randomTLS->localData().callMethod("setSeed", "(J)V", jlong(seed)); return; @@ -2479,7 +2479,7 @@ int qrand() //global static object, fallback to rand() return rand(); } -#elif defined(Q_OS_ANDROID) +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) AndroidRandomStorage *randomStorage = randomTLS(); if (!randomStorage) return rand(); -- cgit v1.2.3 From 998e6386f04e97b08bad8db6f0cfc8c9c9055786 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Fri, 29 Nov 2013 12:32:58 +0100 Subject: Doc: Fixed broken link to General Qt Requirements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Link fixed for OpenSSL Task-number: QTBUG-34749 Change-Id: Ic72858c730400124fb3f09d887c827d93500338f Reviewed-by: Topi Reiniö --- src/network/doc/src/ssl.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/network/doc/src/ssl.qdoc b/src/network/doc/src/ssl.qdoc index 7c6ba1155f..e1bb1b9316 100644 --- a/src/network/doc/src/ssl.qdoc +++ b/src/network/doc/src/ssl.qdoc @@ -36,7 +36,7 @@ the Secure Sockets Layer (SSL) protocol, using the OpenSSL Toolkit (\l{http://www.openssl.org/}) to perform encryption and protocol handling. - See the \l{General Qt Requirements} page for information about the + See the \l {openssl-v1later}{OpenSSL Compatibility} page for information about the versions of OpenSSL that are known to work with Qt. \section1 Enabling and Disabling SSL Support -- cgit v1.2.3 From d443eff5b67fdf51cb3f1aca763bd3c407158720 Mon Sep 17 00:00:00 2001 From: Carsten Munk Date: Wed, 4 Dec 2013 08:43:15 -0600 Subject: Fix radial gradient shader compilation for OpenGL ES 2.0. Change highp to mediump. This qualifier is ignored on desktop, and mediump should be sufficient elsewhere. Task-number: QTBUG-35353 Change-Id: I79f0ed88717d45dada5dcb781e75b10e72db4bd0 Reviewed-by: Gunnar Sletta --- src/gui/opengl/qopenglengineshadersource_p.h | 4 ++-- src/opengl/gl2paintengineex/qglengineshadersource_p.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/gui/opengl/qopenglengineshadersource_p.h index 869bd057f2..ba72de3fb0 100644 --- a/src/gui/opengl/qopenglengineshadersource_p.h +++ b/src/gui/opengl/qopenglengineshadersource_p.h @@ -238,7 +238,7 @@ static const char* const qopenglslPositionWithRadialGradientBrushVertexShader = uniform mediump vec2 halfViewportSize; \n\ uniform highp mat3 brushTransform; \n\ uniform highp vec2 fmp; \n\ - uniform highp vec3 bradius; \n\ + uniform mediump vec3 bradius; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ void setPosition(void) \n\ @@ -264,7 +264,7 @@ static const char* const qopenglslRadialGradientBrushSrcFragmentShader = "\n\ uniform highp float sqrfr; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ - uniform highp vec3 bradius; \n\ + uniform mediump vec3 bradius; \n\ lowp vec4 srcPixel() \n\ { \n\ highp float c = sqrfr-dot(A, A); \n\ diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index 65fbada48f..05d923ca17 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -238,7 +238,7 @@ static const char* const qglslPositionWithRadialGradientBrushVertexShader = "\n\ uniform mediump vec2 halfViewportSize; \n\ uniform highp mat3 brushTransform; \n\ uniform highp vec2 fmp; \n\ - uniform highp vec3 bradius; \n\ + uniform mediump vec3 bradius; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ void setPosition(void) \n\ @@ -264,7 +264,7 @@ static const char* const qglslRadialGradientBrushSrcFragmentShader = "\n\ uniform highp float sqrfr; \n\ varying highp float b; \n\ varying highp vec2 A; \n\ - uniform highp vec3 bradius; \n\ + uniform mediump vec3 bradius; \n\ lowp vec4 srcPixel() \n\ { \n\ highp float c = sqrfr-dot(A, A); \n\ -- cgit v1.2.3 From d270bd8673505d8325ce25fa8476c8f8bc5a075b Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 18 Nov 2013 18:52:26 +0100 Subject: QTextEngine: fix layouting of inline objects in right-aligned tabs. (same thing for center- and delimiter-aligned tabs) The width of the inline object wasn't taken into account, the code in QTextEngine::calculateTabWidth only looked at glyph widths. Change-Id: I303a6561c67870ff2094a685698e642fc1b53b12 Reviewed-by: Konstantin Ritt Reviewed-by: Allan Sandfeld Jensen --- src/gui/text/qtextengine.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 6345ed7682..08b0491ddc 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2878,6 +2878,10 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const if (item.position > tabSectionEnd || item.position <= si.position) continue; shape(i); // first, lets make sure relevant text is already shaped + if (item.analysis.flags == QScriptAnalysis::Object) { + length += item.width; + continue; + } QGlyphLayout glyphs = this->shapedGlyphs(&item); const int end = qMin(item.position + item.num_glyphs, tabSectionEnd) - item.position; for (int i=0; i < end; i++) -- cgit v1.2.3 From 47efa9213d92a4366e03bd6d056837cd5bbadb1e Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 4 Dec 2013 20:53:30 +0100 Subject: Protect implementation of QNativeGestureEvent against QT_NO_GESTURES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The definition and usage of QNativeGestureEvent had already been protected against QT_NO_GESTURES but the implementation had been missed out before. Change-Id: Ie039e08257ad5eb7705342e4248b904f6ceca8df Reviewed-by: Friedemann Kleint Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qevent.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 88f132b877..131f1863a5 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2278,6 +2278,7 @@ QTabletEvent::~QTabletEvent() #endif // QT_NO_TABLETEVENT +#ifndef QT_NO_GESTURES /*! \class QNativeGestureEvent \since 5.2 @@ -2392,6 +2393,7 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPoin Returns the position of the gesture as a QPointF, relative to the window that received the event. */ +#endif // QT_NO_GESTURES #ifndef QT_NO_DRAGANDDROP /*! -- cgit v1.2.3