summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/mimetypes/qmimedatabase.cpp2
-rw-r--r--src/gui/doc/src/qtgui.qdoc13
-rw-r--r--src/gui/image/qimage_conversions.cpp12
-rw-r--r--src/gui/opengl/qopengltexture.cpp12
-rw-r--r--src/gui/util/qdesktopservices.cpp7
-rw-r--r--src/network/socket/qnativesocketengine_winrt.cpp34
-rw-r--r--src/network/socket/qnativesocketengine_winrt_p.h2
-rw-r--r--src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp3
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci.cpp6
-rw-r--r--src/sql/kernel/qsqldatabase.cpp6
10 files changed, 65 insertions, 32 deletions
diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp
index edc414fa0a..7d529372c4 100644
--- a/src/corelib/mimetypes/qmimedatabase.cpp
+++ b/src/corelib/mimetypes/qmimedatabase.cpp
@@ -214,6 +214,8 @@ QMimeGlobMatchResult QMimeDatabasePrivate::findByFileName(const QString &fileNam
void QMimeDatabasePrivate::loadMimeTypePrivate(QMimeTypePrivate &mimePrivate)
{
QMutexLocker locker(&mutex);
+ if (mimePrivate.name.isEmpty())
+ return; // invalid mimetype
if (!mimePrivate.loaded) { // XML provider sets loaded=true, binary provider does this on demand
Q_ASSERT(mimePrivate.fromCache);
QMimeBinaryProvider::loadMimeTypePrivate(mimePrivate);
diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc
index 010659df8c..a425c8a84d 100644
--- a/src/gui/doc/src/qtgui.qdoc
+++ b/src/gui/doc/src/qtgui.qdoc
@@ -195,19 +195,6 @@
For more information, see the \l{Hello Vulkan Widget Example}
and the \l {Hello Vulkan Window Example}.
- \section1 Qt GUI Prior to Qt 5.0
-
- Prior to Qt 5.0, the Qt GUI module was the monolithic container
- for all things relating to graphical user interfaces in Qt, and
- included the Qt widget set, the item views, the graphics view
- framework and also printing. Starting Qt 5, these classes have
- been moved to the Qt Widgets module. Printing has been
- moved to the Qt Print Support module. Please note that these
- modules can be excluded from a Qt installation.
-
- Qt GUI now contains only a small set of enablers, which are generally
- useful for all graphical applications.
-
\section1 Drag and Drop
More info in \l{Drag and Drop}
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index 39d97f4bd9..16ad0a3edc 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -1331,14 +1331,18 @@ void dither_to_Mono(QImageData *dst, const QImageData *src,
} else {
bit--;
}
+ const int e7 = ((err * 7) + 8) >> 4;
+ const int e5 = ((err * 5) + 8) >> 4;
+ const int e3 = ((err * 3) + 8) >> 4;
+ const int e1 = err - (e7 + e5 + e3);
if (x < w)
- *b1 += (err*7)>>4; // spread error to right pixel
+ *b1 += e7; // spread error to right pixel
if (not_last_line) {
- b2[0] += (err*5)>>4; // pixel below
+ b2[0] += e5; // pixel below
if (x > 1)
- b2[-1] += (err*3)>>4; // pixel below left
+ b2[-1] += e3; // pixel below left
if (x < w)
- b2[1] += err>>4; // pixel below right
+ b2[1] += e1; // pixel below right
}
b2++;
}
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index b825b56d45..cea4b51a5c 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -2800,6 +2800,11 @@ QOpenGLTexture::TextureFormat QOpenGLTexture::format() const
return d->format;
}
+static bool isNpot(int width, int height = 1, int depth = 1)
+{
+ return width & (width-1) || height & (height-1) || depth & (depth-1);
+}
+
/*!
Sets the dimensions of this texture object to \a width,
\a height, and \a depth. The default for each dimension is 1.
@@ -2807,6 +2812,10 @@ QOpenGLTexture::TextureFormat QOpenGLTexture::format() const
implementation. Allocating storage for a texture less than the
maximum size can still fail if your system is low on resources.
+ If a non-power-of-two \a width, \a height or \a depth is provided and your
+ OpenGL implementation doesn't have support for repeating non-power-of-two
+ textures, then the wrap mode is automatically set to ClampToEdge.
+
\sa width(), height(), depth()
*/
void QOpenGLTexture::setSize(int width, int height, int depth)
@@ -2819,6 +2828,9 @@ void QOpenGLTexture::setSize(int width, int height, int depth)
return;
}
+ if (isNpot(width, height, depth) && !hasFeature(Feature::NPOTTextureRepeat) && d->target != Target::TargetRectangle)
+ d->setWrapMode(WrapMode::ClampToEdge);
+
switch (d->target) {
case QOpenGLTexture::Target1D:
case QOpenGLTexture::Target1DArray:
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp
index 77ccc02aa5..dfd190ddd0 100644
--- a/src/gui/util/qdesktopservices.cpp
+++ b/src/gui/util/qdesktopservices.cpp
@@ -226,8 +226,11 @@ bool QDesktopServices::openUrl(const QUrl &url)
qWarning("The platform plugin does not support services.");
return false;
}
- return url.scheme() == QLatin1String("file") ?
- platformServices->openDocument(url) : platformServices->openUrl(url);
+ // We only use openDocument if there is no fragment for the URL to
+ // avoid it being lost when using openDocument
+ if (url.isLocalFile() && !url.hasFragment())
+ return platformServices->openDocument(url);
+ return platformServices->openUrl(url);
}
/*!
diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp
index 4470d19d8c..7ac6297de6 100644
--- a/src/network/socket/qnativesocketengine_winrt.cpp
+++ b/src/network/socket/qnativesocketengine_winrt.cpp
@@ -547,9 +547,12 @@ QNativeSocketEngine::QNativeSocketEngine(QObject *parent)
d->sslSocket = qobject_cast<QSslSocket *>(parent->parent());
#endif
- connect(this, SIGNAL(connectionReady()), SLOT(connectionNotification()), Qt::QueuedConnection);
- connect(this, SIGNAL(readReady()), SLOT(readNotification()), Qt::QueuedConnection);
- connect(this, SIGNAL(writeReady()), SLOT(writeNotification()), Qt::QueuedConnection);
+ connect(this, &QNativeSocketEngine::connectionReady,
+ this, &QNativeSocketEngine::connectionNotification, Qt::QueuedConnection);
+ connect(this, &QNativeSocketEngine::readReady,
+ this, &QNativeSocketEngine::processReadReady, Qt::QueuedConnection);
+ connect(this, &QNativeSocketEngine::writeReady,
+ this, &QNativeSocketEngine::writeNotification, Qt::QueuedConnection);
connect(d->worker, &SocketEngineWorker::connectOpFinished,
this, &QNativeSocketEngine::handleConnectOpFinished, Qt::QueuedConnection);
connect(d->worker, &SocketEngineWorker::newDataReceived, this, &QNativeSocketEngine::handleNewData, Qt::QueuedConnection);
@@ -872,12 +875,15 @@ void QNativeSocketEngine::close()
if (d->closingDown)
return;
- d->closingDown = true;
+ if (d->pendingReadNotification)
+ processReadReady();
+ d->closingDown = true;
d->notifyOnRead = false;
d->notifyOnWrite = false;
d->notifyOnException = false;
+ d->emitReadReady = false;
HRESULT hr;
if (d->socketType == QAbstractSocket::TcpSocket) {
@@ -1019,8 +1025,10 @@ qint64 QNativeSocketEngine::read(char *data, qint64 maxlen)
<< copyLength << "of" << d->worker->pendingData.length() << "bytes";
readData = d->worker->pendingData.left(maxlen);
d->worker->pendingData.remove(0, maxlen);
- if (d->notifyOnRead)
+ if (d->notifyOnRead) {
+ d->pendingReadNotification = true;
emit readReady();
+ }
}
mutexLocker.unlock();
@@ -1341,6 +1349,7 @@ void QNativeSocketEngine::handleConnectOpFinished(bool success, QAbstractSocket:
if (!success) {
d->setError(error, errorString);
d->socketState = QAbstractSocket::UnconnectedState;
+ close();
return;
}
@@ -1369,6 +1378,7 @@ void QNativeSocketEngine::handleNewData()
if (d->socketType == QAbstractSocket::UdpSocket && !d->worker->emitDataReceived)
return;
qCDebug(lcNetworkSocketVerbose) << this << Q_FUNC_INFO << "Emitting readReady";
+ d->pendingReadNotification = true;
emit readReady();
d->worker->emitDataReceived = false;
d->emitReadReady = false;
@@ -1389,9 +1399,17 @@ void QNativeSocketEngine::handleTcpError(QAbstractSocket::SocketError error)
}
d->setError(error, errorString);
- d->socketState = QAbstractSocket::UnconnectedState;
- if (d->notifyOnRead)
- emit readReady();
+ close();
+}
+
+void QNativeSocketEngine::processReadReady()
+{
+ Q_D(QNativeSocketEngine);
+ if (d->closingDown)
+ return;
+
+ d->pendingReadNotification = false;
+ readNotification();
}
bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType socketType, QAbstractSocket::NetworkLayerProtocol &socketProtocol)
diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h
index f47e2a7dd7..6688bfe35c 100644
--- a/src/network/socket/qnativesocketengine_winrt_p.h
+++ b/src/network/socket/qnativesocketengine_winrt_p.h
@@ -184,6 +184,7 @@ private slots:
WinRTSocketEngine::ErrorString errorString);
void handleNewData();
void handleTcpError(QAbstractSocket::SocketError error);
+ void processReadReady();
private:
Q_DECLARE_PRIVATE(QNativeSocketEngine)
@@ -228,6 +229,7 @@ private:
EventRegistrationToken connectionToken;
bool emitReadReady = true;
+ bool pendingReadNotification = false;
HRESULT handleClientConnection(ABI::Windows::Networking::Sockets::IStreamSocketListener *tcpListener,
ABI::Windows::Networking::Sockets::IStreamSocketListenerConnectionReceivedEventArgs *args);
diff --git a/src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp b/src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp
index 1a24015ce5..186084abd4 100644
--- a/src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp
+++ b/src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp
@@ -51,6 +51,7 @@
#include <QMetaType>
#include <QMimeType>
#include <QMimeDatabase>
+#include <QRandomGenerator>
#include <QWindow>
QT_BEGIN_NAMESPACE
@@ -231,6 +232,8 @@ void QFlatpakFileDialog::openPortal()
if (!filterList.isEmpty())
options.insert(QLatin1String("filters"), QVariant::fromValue(filterList));
+ options.insert(QLatin1String("handle_token"), QStringLiteral("qt%1").arg(QRandomGenerator::global()->generate()));
+
// TODO choices a(ssa(ss)s)
// List of serialized combo boxes to add to the file chooser.
diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp
index 272e1bc083..aee8e92b36 100644
--- a/src/plugins/sqldrivers/oci/qsql_oci.cpp
+++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp
@@ -1318,7 +1318,7 @@ struct QOCIBatchColumn
ub4 maxLen;
ub4 recordCount;
char* data;
- ub2* lengths;
+ ub4* lengths;
sb2* indicators;
ub4 maxarr_len;
ub4 curelep;
@@ -1392,7 +1392,7 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
QOCIBatchColumn &col = columns[i];
col.recordCount = boundValues.at(i).toList().count();
- col.lengths = new ub2[col.recordCount];
+ col.lengths = new ub4[col.recordCount];
col.indicators = new sb2[col.recordCount];
col.maxarr_len = col.recordCount;
col.curelep = col.recordCount;
@@ -1556,7 +1556,7 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
// binding the column
- r = OCIBindByPos(
+ r = OCIBindByPos2(
d->sql, &bindColumn.bindh, d->err, i + 1,
bindColumn.data,
bindColumn.maxLen,
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
index 291b35f8a6..2c7b4b83db 100644
--- a/src/sql/kernel/qsqldatabase.cpp
+++ b/src/sql/kernel/qsqldatabase.cpp
@@ -229,12 +229,14 @@ QSqlDatabase QSqlDatabasePrivate::database(const QString& name, bool open)
dict->lock.lockForRead();
QSqlDatabase db = dict->value(name);
dict->lock.unlock();
- if (db.driver() && db.driver()->thread() != QThread::currentThread()) {
+ if (!db.isValid())
+ return db;
+ if (db.driver()->thread() != QThread::currentThread()) {
qWarning("QSqlDatabasePrivate::database: requested database does not belong to the calling thread.");
return QSqlDatabase();
}
- if (db.isValid() && !db.isOpen() && open) {
+ if (open && !db.isOpen()) {
if (!db.open())
qWarning() << "QSqlDatabasePrivate::database: unable to open database:" << db.lastError().text();