summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-09-14 01:00:06 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-09-14 01:00:08 +0200
commit42f84de26a3445e89e6a52341a85c5ca2f132145 (patch)
tree40c82b6853621ece6a0ee49cace25c3eca72f71e /src/plugins
parentc9f316c8b90ce8bb11b6e9e0bf898c269cd35bfb (diff)
parent49efea26a5fae8c2275999c36c7c8d24cf4125de (diff)
Merge remote-tracking branch 'origin/5.11' into 5.12
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp16
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h2
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp19
3 files changed, 28 insertions, 9 deletions
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);