summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/sqlite.pri1
-rw-r--r--src/corelib/kernel/qmetatype.h38
-rw-r--r--src/gui/image/qimagewriter.cpp14
-rw-r--r--src/plugins/bearer/connman/qconnmanengine.cpp29
-rw-r--r--src/plugins/platforms/ios/qiosintegration.mm2
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp14
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp3
-rw-r--r--src/sql/kernel/qsqldriver.h1
-rw-r--r--src/sql/kernel/qsqlresult.cpp7
-rw-r--r--src/widgets/kernel/qapplication.cpp25
-rw-r--r--src/widgets/kernel/qapplication_p.h1
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp8
-rw-r--r--tests/auto/sql/kernel/qsqlresult/qsqlresult.pro2
-rw-r--r--tests/auto/sql/kernel/qsqlresult/testsqldriver.h9
-rw-r--r--tests/auto/sql/kernel/qsqlresult/tst_qsqlresult.cpp20
15 files changed, 111 insertions, 63 deletions
diff --git a/src/3rdparty/sqlite.pri b/src/3rdparty/sqlite.pri
index 072502c8e9..0c9d179660 100644
--- a/src/3rdparty/sqlite.pri
+++ b/src/3rdparty/sqlite.pri
@@ -3,6 +3,7 @@ DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE SQLITE_ENABLE_FTS3 SQ
!contains(CONFIG, largefile):DEFINES += SQLITE_DISABLE_LFS
contains(QT_CONFIG, posix_fallocate):DEFINES += HAVE_POSIX_FALLOCATE=1
winrt: DEFINES += SQLITE_OS_WINRT
+qnx: DEFINES += _QNX_SOURCE
INCLUDEPATH += $$PWD/sqlite
SOURCES += $$PWD/sqlite/sqlite3.c
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index a2e6960949..745487627e 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -783,6 +783,10 @@ struct IteratorOwner
{
*ptr = new const_iterator(iterator);
}
+ static void assign(void **ptr, void * const * src)
+ {
+ *ptr = new const_iterator(*static_cast<const_iterator*>(*src));
+ }
static void advance(void **iterator, int step)
{
@@ -804,18 +808,27 @@ struct IteratorOwner
{
return &*it;
}
+
+ static bool equal(void * const *it, void * const *other)
+ {
+ return *static_cast<const_iterator*>(*it) == *static_cast<const_iterator*>(*other);
+ }
};
-template<typename const_iterator>
-struct IteratorOwner<const const_iterator*>
+template<typename value_type>
+struct IteratorOwner<const value_type*>
{
- static void assign(void **ptr, const const_iterator *iterator )
+ static void assign(void **ptr, const value_type *iterator )
{
- *ptr = const_cast<const_iterator*>(iterator);
+ *ptr = const_cast<value_type*>(iterator);
+ }
+ static void assign(void **ptr, void * const * src)
+ {
+ *ptr = static_cast<value_type*>(*src);
}
static void advance(void **iterator, int step)
{
- const_iterator *it = static_cast<const_iterator*>(*iterator);
+ value_type *it = static_cast<value_type*>(*iterator);
std::advance(it, step);
*iterator = it;
}
@@ -829,10 +842,15 @@ struct IteratorOwner<const const_iterator*>
return *iterator;
}
- static const void *getData(const const_iterator *it)
+ static const void *getData(const value_type *it)
{
return it;
}
+
+ static bool equal(void * const *it, void * const *other)
+ {
+ return static_cast<value_type*>(*it) == static_cast<value_type*>(*other);
+ }
};
enum IteratorCapability
@@ -934,7 +952,7 @@ public:
template<class T>
static bool equalIterImpl(void * const *iterator, void * const *other)
- { return *static_cast<typename T::const_iterator*>(*iterator) == *static_cast<typename T::const_iterator*>(*other); }
+ { return IteratorOwner<typename T::const_iterator>::equal(iterator, other); }
template<class T>
static VariantData getImpl(void * const *iterator, int metaTypeId, uint flags)
@@ -942,7 +960,7 @@ public:
template<class T>
static void copyIterImpl(void **dest, void * const * src)
- { IteratorOwner<typename T::const_iterator>::assign(dest, *static_cast<typename T::const_iterator*>(*src)); }
+ { IteratorOwner<typename T::const_iterator>::assign(dest, src); }
public:
template<class T> QSequentialIterableImpl(const T*p)
@@ -1118,11 +1136,11 @@ public:
template<class T>
static bool equalIterImpl(void * const *iterator, void * const *other)
- { return *static_cast<typename T::const_iterator*>(*iterator) == *static_cast<typename T::const_iterator*>(*other); }
+ { return IteratorOwner<typename T::const_iterator>::equal(iterator, other); }
template<class T>
static void copyIterImpl(void **dest, void * const * src)
- { IteratorOwner<typename T::const_iterator>::assign(dest, *static_cast<typename T::const_iterator*>(*src)); }
+ { IteratorOwner<typename T::const_iterator>::assign(dest, src); }
public:
template<class T> QAssociativeIterableImpl(const T*p)
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index 8dd5fdd111..c12dbb6544 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -279,7 +279,7 @@ QImageWriterPrivate::QImageWriterPrivate(QImageWriter *qq)
compression = 0;
gamma = 0.0;
imageWriterError = QImageWriter::UnknownError;
- errorString = QT_TRANSLATE_NOOP(QImageWriter, QLatin1String("Unknown error"));
+ errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageWriter, "Unknown error"));
q = qq;
}
@@ -288,22 +288,19 @@ bool QImageWriterPrivate::canWriteHelper()
{
if (!device) {
imageWriterError = QImageWriter::DeviceError;
- errorString = QT_TRANSLATE_NOOP(QImageWriter,
- QLatin1String("Device is not set"));
+ errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageWriter, "Device is not set"));
return false;
}
if (!device->isOpen())
device->open(QIODevice::WriteOnly);
if (!device->isWritable()) {
imageWriterError = QImageWriter::DeviceError;
- errorString = QT_TRANSLATE_NOOP(QImageWriter,
- QLatin1String("Device not writable"));
+ errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageWriter, "Device not writable"));
return false;
}
if (!handler && (handler = createWriteHandlerHelper(device, format)) == 0) {
imageWriterError = QImageWriter::UnsupportedFormatError;
- errorString = QT_TRANSLATE_NOOP(QImageWriter,
- QLatin1String("Unsupported image format"));
+ errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageWriter, "Unsupported image format"));
return false;
}
return true;
@@ -670,8 +667,7 @@ bool QImageWriter::supportsOption(QImageIOHandler::ImageOption option) const
{
if (!d->handler && (d->handler = createWriteHandlerHelper(d->device, d->format)) == 0) {
d->imageWriterError = QImageWriter::UnsupportedFormatError;
- d->errorString = QT_TRANSLATE_NOOP(QImageWriter,
- QLatin1String("Unsupported image format"));
+ d->errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageWriter, "Unsupported image format"));
return false;
}
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp
index e85949afb6..beda0a6a26 100644
--- a/src/plugins/bearer/connman/qconnmanengine.cpp
+++ b/src/plugins/bearer/connman/qconnmanengine.cpp
@@ -150,20 +150,7 @@ void QConnmanEngine::connectToId(const QString &id)
if(!serv.isValid()) {
emit connectionError(id, QBearerEngineImpl::InterfaceLookupError);
} else {
- if(serv.getType() != "cellular") {
-
- serv.connect();
- } else {
- QOfonoManagerInterface ofonoManager(0);
- QString modemPath = ofonoManager.currentModem().path();
- QOfonoDataConnectionManagerInterface dc(modemPath,0);
- foreach (const QDBusObjectPath &dcPath,dc.getPrimaryContexts()) {
- if(dcPath.path().contains(servicePath.section("_",-1))) {
- QOfonoConnectionContextInterface primaryContext(dcPath.path(),0);
- primaryContext.setActive(true);
- }
- }
- }
+ serv.connect();
}
}
@@ -175,19 +162,7 @@ void QConnmanEngine::disconnectFromId(const QString &id)
if(!serv.isValid()) {
emit connectionError(id, DisconnectionError);
} else {
- if(serv.getType() != "cellular") {
- serv.disconnect();
- } else {
- QOfonoManagerInterface ofonoManager(0);
- QString modemPath = ofonoManager.currentModem().path();
- QOfonoDataConnectionManagerInterface dc(modemPath,0);
- foreach (const QDBusObjectPath &dcPath,dc.getPrimaryContexts()) {
- if(dcPath.path().contains(servicePath.section("_",-1))) {
- QOfonoConnectionContextInterface primaryContext(dcPath.path(),0);
- primaryContext.setActive(false);
- }
- }
- }
+ serv.disconnect();
}
}
diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm
index 5c8f67bda2..660da6397f 100644
--- a/src/plugins/platforms/ios/qiosintegration.mm
+++ b/src/plugins/platforms/ios/qiosintegration.mm
@@ -110,6 +110,8 @@ bool QIOSIntegration::hasCapability(Capability cap) const
return true;
case MultipleWindows:
return true;
+ case WindowManagement:
+ return false;
case ApplicationState:
return true;
default:
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index b7de368fa8..82deb0f473 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -586,15 +586,17 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext,
attributes[attribIndex++] = WGL_CONTEXT_MINOR_VERSION_ARB;
attributes[attribIndex++] = minorVersion;
}
+
+ int flags = 0;
+ if (format.testOption(QSurfaceFormat::DebugContext))
+ flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
if (requestedVersion >= 0x0300) {
- attributes[attribIndex++] = WGL_CONTEXT_FLAGS_ARB;
- attributes[attribIndex] = 0;
if (!format.testOption(QSurfaceFormat::DeprecatedFunctions))
- attributes[attribIndex] |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
- if (format.testOption(QSurfaceFormat::DebugContext))
- attributes[attribIndex] |= WGL_CONTEXT_DEBUG_BIT_ARB;
- attribIndex++;
+ flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
}
+ attributes[attribIndex++] = WGL_CONTEXT_FLAGS_ARB;
+ attributes[attribIndex++] = flags;
+
if (requestedVersion >= 0x0302) {
switch (format.profile()) {
case QSurfaceFormat::NoProfile:
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index 67e7c34fca..fc462e9a0a 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -1959,8 +1959,9 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h
void QWin32PrintEnginePrivate::updateCustomPaperSize()
{
const uint paperSize = devMode->dmPaperSize;
- has_custom_paper_size = true;
+ has_custom_paper_size = false;
if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) {
+ has_custom_paper_size = true;
const QList<QPair<QSizeF, int> > paperSizes = printerPaperSizes(name);
for (int i=0; i<paperSizes.size(); i++) {
if ((uint)paperSizes.at(i).second == paperSize) {
diff --git a/src/sql/kernel/qsqldriver.h b/src/sql/kernel/qsqldriver.h
index 017ffd4e4a..f93a03063b 100644
--- a/src/sql/kernel/qsqldriver.h
+++ b/src/sql/kernel/qsqldriver.h
@@ -62,6 +62,7 @@ class QVariant;
class Q_SQL_EXPORT QSqlDriver : public QObject
{
friend class QSqlDatabase;
+ friend class QSqlResultPrivate;
Q_OBJECT
Q_DECLARE_PRIVATE(QSqlDriver)
diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp
index 953e2ca66e..31b05ab9e9 100644
--- a/src/sql/kernel/qsqlresult.cpp
+++ b/src/sql/kernel/qsqlresult.cpp
@@ -51,6 +51,7 @@
#include "qsqldriver.h"
#include "qpointer.h"
#include "qsqlresult_p.h"
+#include "private/qsqldriver_p.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
@@ -89,6 +90,7 @@ QString QSqlResultPrivate::positionalToNamedBinding(const QString &query) const
result.reserve(n * 5 / 4);
QChar closingQuote;
int count = 0;
+ bool ignoreBraces = (sqldriver->d_func()->dbmsType == QSqlDriverPrivate::PostgreSQL);
for (int i = 0; i < n; ++i) {
QChar ch = query.at(i);
@@ -110,7 +112,7 @@ QString QSqlResultPrivate::positionalToNamedBinding(const QString &query) const
} else {
if (ch == QLatin1Char('\'') || ch == QLatin1Char('"') || ch == QLatin1Char('`'))
closingQuote = ch;
- else if (ch == QLatin1Char('['))
+ else if (!ignoreBraces && ch == QLatin1Char('['))
closingQuote = QLatin1Char(']');
result += ch;
}
@@ -129,6 +131,7 @@ QString QSqlResultPrivate::namedToPositionalBinding(const QString &query)
QChar closingQuote;
int count = 0;
int i = 0;
+ bool ignoreBraces = (sqldriver->d_func()->dbmsType == QSqlDriverPrivate::PostgreSQL);
while (i < n) {
QChar ch = query.at(i);
@@ -160,7 +163,7 @@ QString QSqlResultPrivate::namedToPositionalBinding(const QString &query)
} else {
if (ch == QLatin1Char('\'') || ch == QLatin1Char('"') || ch == QLatin1Char('`'))
closingQuote = ch;
- else if (ch == QLatin1Char('['))
+ else if (!ignoreBraces && ch == QLatin1Char('['))
closingQuote = QLatin1Char(']');
result += ch;
++i;
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index d8c37d6ca0..c9d6593662 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1888,6 +1888,31 @@ bool QApplication::event(QEvent *e)
\obsolete
*/
+// ### FIXME: topLevelWindows does not contain QWidgets without a parent
+// until create_sys is called. So we have to override the
+// QGuiApplication::notifyLayoutDirectionChange
+// to do the right thing.
+void QApplicationPrivate::notifyLayoutDirectionChange()
+{
+ const QWidgetList list = QApplication::topLevelWidgets();
+ QWindowList windowList = QGuiApplication::topLevelWindows();
+
+ // send to all top-level QWidgets
+ for (int i = 0; i < list.size(); ++i) {
+ QWidget *w = list.at(i);
+ windowList.removeAll(w->windowHandle());
+ QEvent ev(QEvent::ApplicationLayoutDirectionChange);
+ QCoreApplication::sendEvent(w, &ev);
+ }
+
+ // in case there are any plain QWindows in this QApplication-using
+ // application, also send the notification to them
+ for (int i = 0; i < windowList.size(); ++i) {
+ QEvent ev(QEvent::ApplicationLayoutDirectionChange);
+ QCoreApplication::sendEvent(windowList.at(i), &ev);
+ }
+}
+
/*!
\fn void QApplication::setActiveWindow(QWidget* active)
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 860e89bb4f..29c6902c78 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -116,6 +116,7 @@ public:
QApplicationPrivate(int &argc, char **argv, int flags);
~QApplicationPrivate();
+ virtual void notifyLayoutDirectionChange();
virtual void notifyActiveWindowChange(QWindow *);
virtual bool shouldQuit();
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index 93234f3958..3b6127e4e7 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -148,10 +148,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
QBackingStore *store = q->backingStore();
if (!store) {
- if (win && q->windowType() != Qt::Desktop)
- q->setBackingStore(new QBackingStore(win));
- else
+ if (win && q->windowType() != Qt::Desktop) {
+ if (q->isTopLevel())
+ q->setBackingStore(new QBackingStore(win));
+ } else {
q->setAttribute(Qt::WA_PaintOnScreen, true);
+ }
}
setWindowModified_helper();
diff --git a/tests/auto/sql/kernel/qsqlresult/qsqlresult.pro b/tests/auto/sql/kernel/qsqlresult/qsqlresult.pro
index ef6c7a7e09..114327effb 100644
--- a/tests/auto/sql/kernel/qsqlresult/qsqlresult.pro
+++ b/tests/auto/sql/kernel/qsqlresult/qsqlresult.pro
@@ -1,7 +1,7 @@
TARGET = tst_qsqlresult
CONFIG += testcase
-QT = core sql testlib
+QT = core core-private sql sql-private testlib
SOURCES += tst_qsqlresult.cpp
HEADERS += testsqldriver.h
diff --git a/tests/auto/sql/kernel/qsqlresult/testsqldriver.h b/tests/auto/sql/kernel/qsqlresult/testsqldriver.h
index 9d435a0f7c..eda0658b41 100644
--- a/tests/auto/sql/kernel/qsqlresult/testsqldriver.h
+++ b/tests/auto/sql/kernel/qsqlresult/testsqldriver.h
@@ -45,6 +45,7 @@
#include <QtSql/QSqlResult>
#include <QtSql/QSqlDriver>
#include <QtSql/QSqlRecord>
+#include <private/qsqldriver_p.h>
class TestSqlDriverResult : public QSqlResult
{
@@ -77,6 +78,8 @@ protected:
class TestSqlDriver : public QSqlDriver
{
+ Q_DECLARE_PRIVATE(QSqlDriver)
+
public:
TestSqlDriver() {}
~TestSqlDriver() {}
@@ -96,6 +99,12 @@ public:
int /* port */, const QString & /* options */)
{ return false; }
void close() {}
+ QSqlDriverPrivate::DBMSType dbmsType() const
+ {
+ Q_D(const QSqlDriver);
+ return d->dbmsType;
+ }
+
QSqlResult *createResult() const { return new TestSqlDriverResult(this); }
};
diff --git a/tests/auto/sql/kernel/qsqlresult/tst_qsqlresult.cpp b/tests/auto/sql/kernel/qsqlresult/tst_qsqlresult.cpp
index ba6b4d1fbf..2462fab879 100644
--- a/tests/auto/sql/kernel/qsqlresult/tst_qsqlresult.cpp
+++ b/tests/auto/sql/kernel/qsqlresult/tst_qsqlresult.cpp
@@ -79,18 +79,30 @@ void tst_QSqlResult::parseOfBoundValues()
QVERIFY(result.savePrepare("SELECT :1 AS ':2'"));
QCOMPARE(result.boundValues().count(), 1);
QVERIFY(result.savePrepare("SELECT :1 AS [:2]"));
- QCOMPARE(result.boundValues().count(), 1);
+ if (testDriver.dbmsType() == QSqlDriverPrivate::PostgreSQL)
+ QCOMPARE(result.boundValues().count(), 2);
+ else
+ QCOMPARE(result.boundValues().count(), 1);
QVERIFY(result.savePrepare("SELECT :1 AS [:2]]]"));
- QCOMPARE(result.boundValues().count(), 1);
+ if (testDriver.dbmsType() == QSqlDriverPrivate::PostgreSQL)
+ QCOMPARE(result.boundValues().count(), 2);
+ else
+ QCOMPARE(result.boundValues().count(), 1);
QVERIFY(result.savePrepare("SELECT :1 AS [:2]]]]]"));
- QCOMPARE(result.boundValues().count(), 1);
+ if (testDriver.dbmsType() == QSqlDriverPrivate::PostgreSQL)
+ QCOMPARE(result.boundValues().count(), 2);
+ else
+ QCOMPARE(result.boundValues().count(), 1);
QVERIFY(result.savePrepare("SELECT ? AS \"?\""));
QCOMPARE(result.boundValues().count(), 1);
QVERIFY(result.savePrepare("SELECT ? AS '?'"));
QCOMPARE(result.boundValues().count(), 1);
QVERIFY(result.savePrepare("SELECT ? AS [?]"));
- QCOMPARE(result.boundValues().count(), 1);
+ if (testDriver.dbmsType() == QSqlDriverPrivate::PostgreSQL)
+ QCOMPARE(result.boundValues().count(), 2);
+ else
+ QCOMPARE(result.boundValues().count(), 1);
QVERIFY(result.savePrepare("SELECT ? AS \"'?\""));
QCOMPARE(result.boundValues().count(), 1);