diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-09-14 01:00:06 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-09-14 01:00:08 +0200 |
commit | 42f84de26a3445e89e6a52341a85c5ca2f132145 (patch) | |
tree | 40c82b6853621ece6a0ee49cace25c3eca72f71e | |
parent | c9f316c8b90ce8bb11b6e9e0bf898c269cd35bfb (diff) | |
parent | 49efea26a5fae8c2275999c36c7c8d24cf4125de (diff) |
Merge remote-tracking branch 'origin/5.11' into 5.12
Change-Id: Ic4c1a8041dcfd143861c39e0014fbdaaa3fb25c6
-rw-r--r-- | examples/corelib/threads/doc/src/mandelbrot.qdoc | 16 | ||||
-rw-r--r-- | src/gui/image/qbmphandler.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/android/qandroidinputcontext.cpp | 16 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.h | 2 | ||||
-rw-r--r-- | src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp | 19 | ||||
-rw-r--r-- | tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp | 18 |
6 files changed, 56 insertions, 17 deletions
diff --git a/examples/corelib/threads/doc/src/mandelbrot.qdoc b/examples/corelib/threads/doc/src/mandelbrot.qdoc index dd0e4e5ef2..274874632e 100644 --- a/examples/corelib/threads/doc/src/mandelbrot.qdoc +++ b/examples/corelib/threads/doc/src/mandelbrot.qdoc @@ -39,7 +39,7 @@ The heavy computation here is the Mandelbrot set, probably the world's most famous fractal. These days, while sophisticated - programs such as \l{http://xaos.sourceforge.net/}{XaoS} that provide real-time zooming in the + programs such as \l{http://matek.hu/xaos/doku.php}{XaoS} that provide real-time zooming in the Mandelbrot set, the standard Mandelbrot algorithm is just slow enough for our purposes. @@ -201,7 +201,7 @@ \snippet threads/mandelbrot/renderthread.cpp 9 Once we're done with all the iterations, we call - QWaitCondition::wait() to put the thread to sleep by calling, + QWaitCondition::wait() to put the thread to sleep, unless \c restart is \c true. There's no use in keeping a worker thread looping indefinitely while there's nothing to do. @@ -232,7 +232,7 @@ \snippet threads/mandelbrot/mandelbrotwidget.cpp 0 - The implementation starts with a few contants that we'll need + The implementation starts with a few constants that we'll need later on. \snippet threads/mandelbrot/mandelbrotwidget.cpp 1 @@ -256,15 +256,15 @@ slot later on. Qt knows how to take of copy of many C++ and Qt types, but QImage isn't one of them. We must therefore call the template function qRegisterMetaType() before we can use QImage - as parameter in queued connections. + as a parameter in queued connections. \snippet threads/mandelbrot/mandelbrotwidget.cpp 2 \snippet threads/mandelbrot/mandelbrotwidget.cpp 3 \snippet threads/mandelbrot/mandelbrotwidget.cpp 4 In \l{QWidget::paintEvent()}{paintEvent()}, we start by filling - the background with black. If we have nothing yet to paint (\c - pixmap is null), we print a message on the widget asking the user + the background with black. If we have nothing to paint yet (\c + pixmap is null), we display a message on the widget asking the user to be patient and return from the function immediately. \snippet threads/mandelbrot/mandelbrotwidget.cpp 5 @@ -293,7 +293,7 @@ Notice that we rely on \c resizeEvent() being automatically called by Qt when the widget is shown the first time to generate - the image the very first time. + the initial image. \snippet threads/mandelbrot/mandelbrotwidget.cpp 11 @@ -307,7 +307,7 @@ control the zoom level. QWheelEvent::delta() returns the angle of the wheel mouse movement, in eights of a degree. For most mice, one wheel step corresponds to 15 degrees. We find out how many - mouse steps we have and determine the zoom factor in consequence. + mouse steps we have and determine the resulting zoom factor. For example, if we have two wheel steps in the positive direction (i.e., +30 degrees), the zoom factor becomes \c ZoomInFactor to the second power, i.e. 0.8 * 0.8 = 0.64. diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 587f375ce7..5dff4ab0ac 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -188,6 +188,8 @@ static bool read_dib_infoheader(QDataStream &s, BMP_INFOHDR &bi) if (!(comp == BMP_RGB || (nbits == 4 && comp == BMP_RLE4) || (nbits == 8 && comp == BMP_RLE8) || ((nbits == 16 || nbits == 32) && comp == BMP_BITFIELDS))) return false; // weird compression type + if (bi.biWidth < 0 || quint64(bi.biWidth) * qAbs(bi.biHeight) > 16384 * 16384) + return false; return true; } diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index ea3e9c1441..c5cd0b92d9 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -58,6 +58,7 @@ #include <private/qhighdpiscaling_p.h> #include <QTextCharFormat> +#include <QTextBoundaryFinder> #include <QDebug> @@ -1020,8 +1021,19 @@ jint QAndroidInputContext::getCursorCapsMode(jint /*reqModes*/) return res; const uint qtInputMethodHints = query->value(Qt::ImHints).toUInt(); - - if (!(qtInputMethodHints & Qt::ImhLowercaseOnly) && !(qtInputMethodHints & Qt::ImhNoAutoUppercase)) + const int localPos = query->value(Qt::ImCursorPosition).toInt(); + + bool atWordBoundary = (localPos == 0); + if (!atWordBoundary) { + QString surroundingText = query->value(Qt::ImSurroundingText).toString(); + surroundingText.truncate(localPos); + // Add a character to see if it is at the end of the sentence or not + QTextBoundaryFinder finder(QTextBoundaryFinder::Sentence, surroundingText + QLatin1Char('A')); + finder.setPosition(localPos); + if (finder.isAtBoundary()) + atWordBoundary = finder.isAtBoundary(); + } + if (atWordBoundary && !(qtInputMethodHints & Qt::ImhLowercaseOnly) && !(qtInputMethodHints & Qt::ImhNoAutoUppercase)) res |= CAP_MODE_SENTENCES; if (qtInputMethodHints & Qt::ImhUppercaseOnly) diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index b0c36e61b0..94f8a8876a 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -414,6 +414,8 @@ public: bool imageNeedsEndianSwap() const { + if (!hasShm()) + return false; // The non-Shm path does its own swapping #if Q_BYTE_ORDER == Q_BIG_ENDIAN return m_setup->image_byte_order != XCB_IMAGE_ORDER_MSB_FIRST; #else diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index 81b5776a7c..f1a003ddcd 100644 --- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -106,7 +106,7 @@ static QVariant::Type qGetColumnType(const QString &tpName) } static QSqlError qMakeError(sqlite3 *access, const QString &descr, QSqlError::ErrorType type, - int errorCode = -1) + int errorCode) { return QSqlError(descr, QString(reinterpret_cast<const QChar *>(sqlite3_errmsg16(access))), @@ -772,7 +772,9 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c openMode |= SQLITE_OPEN_NOMUTEX; - if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL) == SQLITE_OK) { + const int res = sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL); + + if (res == SQLITE_OK) { sqlite3_busy_timeout(d->access, timeOut); setOpen(true); setOpenError(false); @@ -785,14 +787,15 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c #endif return true; } else { + setLastError(qMakeError(d->access, tr("Error opening database"), + QSqlError::ConnectionError, res)); + setOpenError(true); + if (d->access) { sqlite3_close(d->access); d->access = 0; } - setLastError(qMakeError(d->access, tr("Error opening database"), - QSqlError::ConnectionError)); - setOpenError(true); return false; } } @@ -809,8 +812,10 @@ void QSQLiteDriver::close() sqlite3_update_hook(d->access, NULL, NULL); } - if (sqlite3_close(d->access) != SQLITE_OK) - setLastError(qMakeError(d->access, tr("Error closing database"), QSqlError::ConnectionError)); + const int res = sqlite3_close(d->access); + + if (res != SQLITE_OK) + setLastError(qMakeError(d->access, tr("Error closing database"), QSqlError::ConnectionError, res)); d->access = 0; setOpen(false); setOpenError(false); diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp index 1f055e9c33..8cf43e243b 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp @@ -197,6 +197,8 @@ private slots: void sqlite_enableRegexp_data() { generic_data("QSQLITE"); } void sqlite_enableRegexp(); + void sqlite_openError(); + private: void createTestTables(QSqlDatabase db); void dropTestTables(QSqlDatabase db); @@ -2332,6 +2334,22 @@ void tst_QSqlDatabase::sqlite_enableRegexp() QFAIL_SQL(q, next()); } +void tst_QSqlDatabase::sqlite_openError() +{ + // see QTBUG-70506 + if (!QSqlDatabase::drivers().contains("QSQLITE")) + QSKIP("Database driver QSQLITE not available"); + + QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", "sqlite_openError"); + db.setDatabaseName("/doesnotexist/foo.sqlite"); + QVERIFY(db.isValid()); + + QVERIFY(!db.open()); + QSqlError error = db.lastError(); + QCOMPARE(error.nativeErrorCode(), "14"); // SQLITE_CANTOPEN + QCOMPARE(error.databaseText(), "unable to open database file"); +} + void tst_QSqlDatabase::cloneDatabase() { QFETCH(QString, dbName); |