Merge "Merge remote-tracking branch 'origin/5.15' into dev"
This commit is contained in:
commit
60f12c58a0
@ -144,7 +144,7 @@ public:
|
||||
private slots:
|
||||
|
||||
void handleNetworkData(QNetworkReply *networkReply) {
|
||||
if (!networkReply->networkError()) {
|
||||
if (!networkReply->error()) {
|
||||
if (!mapReplies.contains(networkReply)) {
|
||||
// Assume UTF-8 encoded
|
||||
QByteArray data = networkReply->readAll();
|
||||
|
@ -162,7 +162,7 @@ void SlippyMap::handleNetworkData(QNetworkReply *reply)
|
||||
{
|
||||
QImage img;
|
||||
QPoint tp = reply->request().attribute(QNetworkRequest::User).toPoint();
|
||||
if (!reply->networkError())
|
||||
if (!reply->error())
|
||||
if (!img.load(reply, 0))
|
||||
img = QImage();
|
||||
reply->deleteLater();
|
||||
|
@ -103,7 +103,7 @@ void FortuneThread::run()
|
||||
//! [6] //! [8]
|
||||
|
||||
if (!socket.waitForConnected(Timeout)) {
|
||||
emit error(socket.socketError(), socket.errorString());
|
||||
emit error(socket.error(), socket.errorString());
|
||||
return;
|
||||
}
|
||||
//! [8] //! [11]
|
||||
@ -115,7 +115,7 @@ void FortuneThread::run()
|
||||
|
||||
do {
|
||||
if (!socket.waitForReadyRead(Timeout)) {
|
||||
emit error(socket.socketError(), socket.errorString());
|
||||
emit error(socket.error(), socket.errorString());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@
|
||||
|
||||
The only QTcpSocket signals we need in this example are
|
||||
QTcpSocket::readyRead(), signifying that data has been received, and
|
||||
QTcpSocket::error(), which we will use to catch any connection errors:
|
||||
QTcpSocket::errorOccurred(), which we will use to catch any connection errors:
|
||||
|
||||
\dots
|
||||
\snippet fortuneclient/client.cpp 3
|
||||
@ -118,11 +118,11 @@
|
||||
|
||||
\li \e{An error occurs.} We need to inform the user if the connection
|
||||
failed or was broken. In this case, QTcpSocket will emit
|
||||
\l{QTcpSocket::error()}{error()}, and \c Client::displayError() will be
|
||||
\l{QTcpSocket::errorOccurred()}{errorOccurred()}, and \c Client::displayError() will be
|
||||
called.
|
||||
\endlist
|
||||
|
||||
Let's go through the \l{QTcpSocket::error()}{error()} case first:
|
||||
Let's go through the \l{QTcpSocket::errorOccurred()}{errorOccurred()} case first:
|
||||
|
||||
\snippet fortuneclient/client.cpp 13
|
||||
|
||||
|
@ -175,7 +175,7 @@ void DownloadManager::sslErrors(const QList<QSslError> &sslErrors)
|
||||
void DownloadManager::downloadFinished(QNetworkReply *reply)
|
||||
{
|
||||
QUrl url = reply->url();
|
||||
if (reply->networkError()) {
|
||||
if (reply->error()) {
|
||||
fprintf(stderr, "Download of %s failed: %s\n",
|
||||
url.toEncoded().constData(),
|
||||
qPrintable(reply->errorString()));
|
||||
|
@ -162,7 +162,7 @@ void DownloadManager::downloadFinished()
|
||||
progressBar.clear();
|
||||
output.close();
|
||||
|
||||
if (currentDownload->networkError()) {
|
||||
if (currentDownload->error()) {
|
||||
// download failed
|
||||
fprintf(stderr, "Failed: %s\n", qPrintable(currentDownload->errorString()));
|
||||
output.remove();
|
||||
|
@ -121,7 +121,7 @@ Client::Client(QWidget *parent)
|
||||
//! [2] //! [3]
|
||||
connect(tcpSocket, &QIODevice::readyRead, this, &Client::readFortune);
|
||||
//! [2] //! [4]
|
||||
connect(tcpSocket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),
|
||||
connect(tcpSocket, &QAbstractSocket::errorOccurred,
|
||||
//! [3]
|
||||
this, &Client::displayError);
|
||||
//! [4]
|
||||
|
@ -209,7 +209,7 @@ void GSuggestCompletion::preventSuggest()
|
||||
void GSuggestCompletion::handleNetworkData(QNetworkReply *networkReply)
|
||||
{
|
||||
QUrl url = networkReply->url();
|
||||
if (networkReply->networkError() == QNetworkReply::NoError) {
|
||||
if (networkReply->error() == QNetworkReply::NoError) {
|
||||
QVector<QString> choices;
|
||||
|
||||
QByteArray response(networkReply->readAll());
|
||||
|
@ -28,6 +28,16 @@ target_link_libraries(http PUBLIC
|
||||
Qt::Widgets
|
||||
)
|
||||
|
||||
if(ANDROID AND TARGET Qt::AndroidExtras)
|
||||
target_compile_definitions(http PUBLIC
|
||||
REQUEST_PERMISSIONS_ON_ANDROID
|
||||
)
|
||||
|
||||
target_link_libraries(http PUBLIC
|
||||
Qt::AndroidExtras
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS http
|
||||
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
|
@ -1,4 +1,8 @@
|
||||
QT += network widgets
|
||||
android: qtHaveModule(androidextras) {
|
||||
QT += androidextras
|
||||
DEFINES += REQUEST_PERMISSIONS_ON_ANDROID
|
||||
}
|
||||
|
||||
HEADERS += httpwindow.h
|
||||
SOURCES += httpwindow.cpp \
|
||||
|
@ -249,7 +249,7 @@ void HttpWindow::httpFinished()
|
||||
return;
|
||||
}
|
||||
|
||||
if (reply->networkError()) {
|
||||
if (reply->error()) {
|
||||
QFile::remove(fi.absoluteFilePath());
|
||||
statusLabel->setText(tr("Download failed:\n%1.").arg(reply->errorString()));
|
||||
downloadButton->setEnabled(true);
|
||||
|
@ -53,11 +53,30 @@
|
||||
#include <QScreen>
|
||||
|
||||
#include "httpwindow.h"
|
||||
#ifdef REQUEST_PERMISSIONS_ON_ANDROID
|
||||
#include <QtAndroid>
|
||||
|
||||
bool requestStoragePermission() {
|
||||
using namespace QtAndroid;
|
||||
|
||||
QString permission = QStringLiteral("android.permission.WRITE_EXTERNAL_STORAGE");
|
||||
const QHash<QString, PermissionResult> results = requestPermissionsSync(QStringList({permission}));
|
||||
if (!results.contains(permission) || results[permission] == PermissionResult::Denied) {
|
||||
qWarning() << "Couldn't get permission: " << permission;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
#ifdef REQUEST_PERMISSIONS_ON_ANDROID
|
||||
if (!requestStoragePermission())
|
||||
return -1;
|
||||
#endif
|
||||
HttpWindow httpWin;
|
||||
const QRect availableSize = httpWin.screen()->availableGeometry();
|
||||
httpWin.resize(availableSize.width() / 5, availableSize.height() / 5);
|
||||
|
@ -78,7 +78,7 @@ Dialog::Dialog(QWidget *parent)
|
||||
connect(&tcpClient, &QAbstractSocket::connected, this, &Dialog::startTransfer);
|
||||
connect(&tcpClient, &QIODevice::bytesWritten,
|
||||
this, &Dialog::updateClientProgress);
|
||||
connect(&tcpClient, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),
|
||||
connect(&tcpClient, &QAbstractSocket::errorOccurred,
|
||||
this, &Dialog::displayError);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
@ -131,8 +131,7 @@ void Dialog::acceptConnection()
|
||||
|
||||
connect(tcpServerConnection, &QIODevice::readyRead,
|
||||
this, &Dialog::updateServerProgress);
|
||||
connect(tcpServerConnection,
|
||||
QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),
|
||||
connect(tcpServerConnection, &QAbstractSocket::errorOccurred,
|
||||
this, &Dialog::displayError);
|
||||
connect(tcpServerConnection, &QTcpSocket::disconnected,
|
||||
tcpServerConnection, &QTcpSocket::deleteLater);
|
||||
|
@ -102,8 +102,7 @@ void Client::newConnection(Connection *connection)
|
||||
{
|
||||
connection->setGreetingMessage(peerManager->userName());
|
||||
|
||||
connect(connection, QOverload<QAbstractSocket::SocketError>::of(&Connection::error),
|
||||
this, &Client::connectionError);
|
||||
connect(connection, &Connection::errorOccurred, this, &Client::connectionError);
|
||||
connect(connection, &Connection::disconnected, this, &Client::disconnected);
|
||||
connect(connection, &Connection::readyForUse, this, &Client::readyForUse);
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void FortuneThread::run()
|
||||
QTcpSocket tcpSocket;
|
||||
//! [1] //! [2]
|
||||
if (!tcpSocket.setSocketDescriptor(socketDescriptor)) {
|
||||
emit error(tcpSocket.socketError());
|
||||
emit error(tcpSocket.error());
|
||||
return;
|
||||
}
|
||||
//! [2] //! [3]
|
||||
|
@ -107,8 +107,8 @@ PeerWireClient::PeerWireClient(const QByteArray &peerId, QObject *parent)
|
||||
this, &PeerWireClient::readyRead);
|
||||
connect(&socket, &QTcpSocket::disconnected,
|
||||
this, &PeerWireClient::disconnected);
|
||||
connect(&socket, QOverload<QAbstractSocket::SocketError>::of(&QTcpSocket::error),
|
||||
this, QOverload<QAbstractSocket::SocketError>::of(&PeerWireClient::error));
|
||||
connect(&socket, &QTcpSocket::errorOccurred,
|
||||
this, &PeerWireClient::errorOccurred);
|
||||
connect(&socket, &QTcpSocket::bytesWritten,
|
||||
this, &PeerWireClient::bytesWritten);
|
||||
connect(&socket, &QTcpSocket::stateChanged,
|
||||
|
@ -843,7 +843,7 @@ void TorrentClient::initializeConnection(PeerWireClient *client)
|
||||
this, &TorrentClient::setupOutgoingConnection);
|
||||
connect(client, &PeerWireClient::disconnected,
|
||||
this, &TorrentClient::removeClient);
|
||||
connect(client, QOverload<QAbstractSocket::SocketError>::of(&PeerWireClient::error),
|
||||
connect(client, &PeerWireClient::errorOccurred,
|
||||
this, &TorrentClient::removeClient);
|
||||
connect(client, &PeerWireClient::piecesAvailable,
|
||||
this, &TorrentClient::peerPiecesAvailable);
|
||||
@ -867,7 +867,7 @@ void TorrentClient::removeClient()
|
||||
|
||||
// Remove the host from our list of known peers if the connection
|
||||
// failed.
|
||||
if (client->peer() && client->socketError() == QAbstractSocket::ConnectionRefusedError)
|
||||
if (client->peer() && client->error() == QAbstractSocket::ConnectionRefusedError)
|
||||
d->peers.removeAll(client->peer());
|
||||
|
||||
// Remove the client from RateController and all structures.
|
||||
|
@ -80,7 +80,7 @@ void TorrentServer::incomingConnection(qintptr socketDescriptor)
|
||||
if (ConnectionManager::instance()->canAddConnection() && !clients.isEmpty()) {
|
||||
connect(client, &PeerWireClient::infoHashReceived,
|
||||
this, &TorrentServer::processInfoHash);
|
||||
connect(client, QOverload<QAbstractSocket::SocketError>::of(&PeerWireClient::error),
|
||||
connect(client, &PeerWireClient::errorOccurred,
|
||||
this, QOverload<>::of(&TorrentServer::removeClient));
|
||||
RateController::instance()->addSocket(client);
|
||||
ConnectionManager::instance()->addConnection(client);
|
||||
|
@ -165,8 +165,8 @@ void TrackerClient::httpRequestDone(QNetworkReply *reply)
|
||||
return;
|
||||
}
|
||||
|
||||
if (reply->networkError() != QNetworkReply::NoError) {
|
||||
emit connectionError(reply->networkError());
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
emit connectionError(reply->error());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ include(g++-base.conf)
|
||||
|
||||
MAKEFILE_GENERATOR = MINGW
|
||||
QMAKE_PLATFORM = win32 mingw
|
||||
CONFIG += precompile_header
|
||||
CONFIG += debug_and_release debug_and_release_target precompile_header
|
||||
DEFINES += UNICODE _UNICODE WIN32 MINGW_HAS_SECURE_API=1
|
||||
QMAKE_COMPILER_DEFINES += __GNUC__ _WIN32
|
||||
# can't add 'DEFINES += WIN64' and 'QMAKE_COMPILER_DEFINES += _WIN64' defines for
|
||||
|
@ -91,10 +91,13 @@ android|uikit|winrt: \
|
||||
# Prevent warnings about object files without any symbols
|
||||
macos: CONFIG += no_warn_empty_obj_files
|
||||
|
||||
# Make sure the doc features are loaded last since they depend on other
|
||||
# features setting up things like includepaths to find everything.
|
||||
CONFIG = prepare_docs qt_docs_targets $$CONFIG
|
||||
|
||||
CONFIG += \
|
||||
utf8_source \
|
||||
create_prl link_prl \
|
||||
prepare_docs qt_docs_targets \
|
||||
no_private_qt_headers_warning QTDIR_build \
|
||||
qt_example_installs \
|
||||
# Qt modules get compiled without exceptions enabled by default.
|
||||
|
@ -60,7 +60,7 @@ win32|CONFIG(static, static|shared) {
|
||||
"QMAKE_DEFINES_$${ucmodule} = $$val_escape(MODULE_DEFINES)"
|
||||
android {
|
||||
MODULE_PRI_CONT += "QMAKE_LIBS_$${ucmodule} ="
|
||||
} else: debug_and_release {
|
||||
} else: qtConfig(debug_and_release): {
|
||||
win32: \
|
||||
MODULE_DEBUG_LIBS = $$DESTDIR/$$prefix$${TARGET}d.$$suffix
|
||||
else: darwin: \
|
||||
|
@ -447,6 +447,17 @@ QSize QConcatenateTablesProxyModel::span(const QModelIndex &index) const
|
||||
return sourceIndex.model()->span(sourceIndex);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a list of models that were added as source models for this proxy model.
|
||||
|
||||
\since 5.15
|
||||
*/
|
||||
QList<QAbstractItemModel *> QConcatenateTablesProxyModel::sourceModels() const
|
||||
{
|
||||
Q_D(const QConcatenateTablesProxyModel);
|
||||
return d->m_models.toList();
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds a source model \a sourceModel, below all previously added source models.
|
||||
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
explicit QConcatenateTablesProxyModel(QObject *parent = nullptr);
|
||||
~QConcatenateTablesProxyModel();
|
||||
|
||||
QList<QAbstractItemModel *> sourceModels() const;
|
||||
Q_SCRIPTABLE void addSourceModel(QAbstractItemModel *sourceModel);
|
||||
Q_SCRIPTABLE void removeSourceModel(QAbstractItemModel *sourceModel);
|
||||
|
||||
|
@ -285,11 +285,15 @@ namespace QtPrivate {
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using is_bool = std::is_same<bool, typename std::decay<T>::type>;
|
||||
|
||||
template<typename From, typename To>
|
||||
struct AreArgumentsNarrowedBase<From, To, typename std::enable_if<sizeof(From) && sizeof(To)>::type>
|
||||
: std::integral_constant<bool,
|
||||
(std::is_floating_point<From>::value && std::is_integral<To>::value) ||
|
||||
(std::is_floating_point<From>::value && std::is_floating_point<To>::value && sizeof(From) > sizeof(To)) ||
|
||||
((std::is_pointer<From>::value || std::is_member_pointer<From>::value) && QtPrivate::is_bool<To>::value) ||
|
||||
((std::is_integral<From>::value || std::is_enum<From>::value) && std::is_floating_point<To>::value) ||
|
||||
(std::is_integral<From>::value && std::is_integral<To>::value
|
||||
&& (sizeof(From) > sizeof(To)
|
||||
|
@ -140,7 +140,7 @@ public:
|
||||
enum : bool { InternalDatabaseAvailable = false };
|
||||
QMimeXMLProvider(QMimeDatabasePrivate *db, InternalDatabaseEnum)
|
||||
: QMimeProviderBase(db, QString())
|
||||
{ Q_UNREACHABLE() };
|
||||
{ Q_UNREACHABLE(); };
|
||||
#endif
|
||||
QMimeXMLProvider(QMimeDatabasePrivate *db, const QString &directory);
|
||||
~QMimeXMLProvider();
|
||||
|
@ -2041,6 +2041,42 @@ QStringRef QXmlStreamReader::dtdSystemId() const
|
||||
return QStringRef();
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
|
||||
Returns the maximum amount of characters a single entity is
|
||||
allowed to expand into. If a single entity expands past the
|
||||
given limit, the document is not considered well formed.
|
||||
|
||||
\sa setEntityExpansionLimit
|
||||
*/
|
||||
int QXmlStreamReader::entityExpansionLimit() const
|
||||
{
|
||||
Q_D(const QXmlStreamReader);
|
||||
return d->entityExpansionLimit;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
|
||||
Sets the maximum amount of characters a single entity is
|
||||
allowed to expand into to \a limit. If a single entity expands
|
||||
past the given limit, the document is not considered well formed.
|
||||
|
||||
The limit is there to prevent DoS attacks when loading unknown
|
||||
XML documents where recursive entity expansion could otherwise
|
||||
exhaust all available memory.
|
||||
|
||||
The default value for this property is 4096 characters.
|
||||
|
||||
\sa entityExpansionLimit
|
||||
*/
|
||||
void QXmlStreamReader::setEntityExpansionLimit(int limit)
|
||||
{
|
||||
Q_D(QXmlStreamReader);
|
||||
d->entityExpansionLimit = limit;
|
||||
}
|
||||
|
||||
/*! If the tokenType() is \l StartElement, this function returns the
|
||||
element's namespace declarations. Otherwise an empty vector is
|
||||
returned.
|
||||
|
@ -285,9 +285,19 @@ public:
|
||||
QHash<QStringView, Entity> entityHash;
|
||||
QHash<QStringView, Entity> parameterEntityHash;
|
||||
QXmlStreamSimpleStack<Entity *>entityReferenceStack;
|
||||
int entityExpansionLimit = 4096;
|
||||
int entityLength = 0;
|
||||
inline bool referenceEntity(Entity &entity) {
|
||||
if (entity.isCurrentlyReferenced) {
|
||||
raiseWellFormedError(QXmlStream::tr("Recursive entity detected."));
|
||||
raiseWellFormedError(QXmlStream::tr("Self-referencing entity detected."));
|
||||
return false;
|
||||
}
|
||||
// entityLength represents the amount of additional characters the
|
||||
// entity expands into (can be negative for e.g. &). It's used to
|
||||
// avoid DoS attacks through recursive entity expansions
|
||||
entityLength += entity.value.size() - entity.name.size() - 2;
|
||||
if (entityLength > entityExpansionLimit) {
|
||||
raiseWellFormedError(QXmlStream::tr("Entity expands to more characters than the entity expansion limit."));
|
||||
return false;
|
||||
}
|
||||
entity.isCurrentlyReferenced = true;
|
||||
@ -838,6 +848,8 @@ entity_done ::= ENTITY_DONE;
|
||||
/.
|
||||
case $rule_number:
|
||||
entityReferenceStack.pop()->isCurrentlyReferenced = false;
|
||||
if (entityReferenceStack.isEmpty())
|
||||
entityLength = 0;
|
||||
clearSym();
|
||||
break;
|
||||
./
|
||||
|
@ -426,6 +426,8 @@ public:
|
||||
QStringRef dtdPublicId() const;
|
||||
QStringRef dtdSystemId() const;
|
||||
|
||||
int entityExpansionLimit() const;
|
||||
void setEntityExpansionLimit(int limit);
|
||||
|
||||
enum Error {
|
||||
NoError,
|
||||
|
@ -774,9 +774,19 @@ public:
|
||||
QHash<QStringView, Entity> entityHash;
|
||||
QHash<QStringView, Entity> parameterEntityHash;
|
||||
QXmlStreamSimpleStack<Entity *>entityReferenceStack;
|
||||
int entityExpansionLimit = 4096;
|
||||
int entityLength = 0;
|
||||
inline bool referenceEntity(Entity &entity) {
|
||||
if (entity.isCurrentlyReferenced) {
|
||||
raiseWellFormedError(QXmlStream::tr("Recursive entity detected."));
|
||||
raiseWellFormedError(QXmlStream::tr("Self-referencing entity detected."));
|
||||
return false;
|
||||
}
|
||||
// entityLength represents the amount of additional characters the
|
||||
// entity expands into (can be negative for e.g. &). It's used to
|
||||
// avoid DoS attacks through recursive entity expansions
|
||||
entityLength += entity.value.size() - entity.name.size() - 2;
|
||||
if (entityLength > entityExpansionLimit) {
|
||||
raiseWellFormedError(QXmlStream::tr("Entity expands to more characters than the entity expansion limit."));
|
||||
return false;
|
||||
}
|
||||
entity.isCurrentlyReferenced = true;
|
||||
@ -1308,6 +1318,8 @@ bool QXmlStreamReaderPrivate::parse()
|
||||
|
||||
case 10:
|
||||
entityReferenceStack.pop()->isCurrentlyReferenced = false;
|
||||
if (entityReferenceStack.isEmpty())
|
||||
entityLength = 0;
|
||||
clearSym();
|
||||
break;
|
||||
|
||||
|
@ -115,29 +115,29 @@ QRunnable::~QRunnable()
|
||||
|
||||
class FunctionRunnable : public QRunnable
|
||||
{
|
||||
std::function<void()> m_functor;
|
||||
std::function<void()> m_functionToRun;
|
||||
public:
|
||||
FunctionRunnable(std::function<void()> functor) : m_functor(std::move(functor))
|
||||
FunctionRunnable(std::function<void()> functionToRun) : m_functionToRun(std::move(functionToRun))
|
||||
{
|
||||
}
|
||||
void run() override
|
||||
{
|
||||
m_functor();
|
||||
m_functionToRun();
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
|
||||
Creates a QRunnable that calls \a fun in run().
|
||||
Creates a QRunnable that calls \a functionToRun in run().
|
||||
|
||||
Auto-deletion is enabled by default.
|
||||
|
||||
\sa run(), autoDelete()
|
||||
*/
|
||||
QRunnable *QRunnable::create(std::function<void()> fun)
|
||||
QRunnable *QRunnable::create(std::function<void()> functionToRun)
|
||||
{
|
||||
return new FunctionRunnable(std::move(fun));
|
||||
return new FunctionRunnable(std::move(functionToRun));
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
QRunnable() : ref(0) { }
|
||||
virtual ~QRunnable();
|
||||
static QRunnable *create(std::function<void()> fun);
|
||||
static QRunnable *create(std::function<void()> functionToRun);
|
||||
|
||||
bool autoDelete() const { return ref != -1; }
|
||||
void setAutoDelete(bool _autoDelete) { ref = _autoDelete ? 0 : -1; }
|
||||
|
@ -515,16 +515,16 @@ void QThreadPool::start(QRunnable *runnable, int priority)
|
||||
\overload
|
||||
\since 5.15
|
||||
|
||||
Reserves a thread and uses it to run \a fun, unless this thread will
|
||||
Reserves a thread and uses it to run \a functionToRun, unless this thread will
|
||||
make the current thread count exceed maxThreadCount(). In that case,
|
||||
\a fun is added to a run queue instead. The \a priority argument can
|
||||
\a functionToRun is added to a run queue instead. The \a priority argument can
|
||||
be used to control the run queue's order of execution.
|
||||
*/
|
||||
void QThreadPool::start(std::function<void()> fun, int priority)
|
||||
void QThreadPool::start(std::function<void()> functionToRun, int priority)
|
||||
{
|
||||
if (!fun)
|
||||
if (!functionToRun)
|
||||
return;
|
||||
start(QRunnable::create(std::move(fun)), priority);
|
||||
start(QRunnable::create(std::move(functionToRun)), priority);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -561,17 +561,17 @@ bool QThreadPool::tryStart(QRunnable *runnable)
|
||||
/*!
|
||||
\overload
|
||||
\since 5.15
|
||||
Attempts to reserve a thread to run \a fun.
|
||||
Attempts to reserve a thread to run \a functionToRun.
|
||||
|
||||
If no threads are available at the time of calling, then this function
|
||||
does nothing and returns \c false. Otherwise, \a fun is run immediately
|
||||
does nothing and returns \c false. Otherwise, \a functionToRun is run immediately
|
||||
using one available thread and this function returns \c true.
|
||||
*/
|
||||
bool QThreadPool::tryStart(std::function<void()> fun)
|
||||
bool QThreadPool::tryStart(std::function<void()> functionToRun)
|
||||
{
|
||||
if (!fun)
|
||||
if (!functionToRun)
|
||||
return false;
|
||||
return tryStart(QRunnable::create(std::move(fun)));
|
||||
return tryStart(QRunnable::create(std::move(functionToRun)));
|
||||
}
|
||||
|
||||
/*! \property QThreadPool::expiryTimeout
|
||||
|
@ -72,8 +72,8 @@ public:
|
||||
void start(QRunnable *runnable, int priority = 0);
|
||||
bool tryStart(QRunnable *runnable);
|
||||
|
||||
void start(std::function<void()> fun, int priority = 0);
|
||||
bool tryStart(std::function<void()> fun);
|
||||
void start(std::function<void()> functionToRun, int priority = 0);
|
||||
bool tryStart(std::function<void()> functionToRun);
|
||||
|
||||
int expiryTimeout() const;
|
||||
void setExpiryTimeout(int expiryTimeout);
|
||||
|
@ -1539,6 +1539,14 @@ QDateTimeParser::parse(QString input, int position, const QDateTime &defaultValu
|
||||
text = scan.input = input;
|
||||
// Set spec *after* all checking, so validity is a property of the string:
|
||||
scan.value = scan.value.toTimeSpec(spec);
|
||||
|
||||
/*
|
||||
However, even with a valid string we might have ended up with an invalid datetime:
|
||||
the non-existent hour during dst changes, for instance.
|
||||
*/
|
||||
if (!scan.value.isValid() && scan.state == Acceptable)
|
||||
scan.state = Intermediate;
|
||||
|
||||
return scan;
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ public:
|
||||
QHashData::Node *i;
|
||||
|
||||
public:
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
#if QT_DEPRECATED_WARNINGS_SINCE < QT_VERSION_CHECK(5, 15, 0)
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
#else
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
@ -354,23 +354,23 @@ public:
|
||||
return r;
|
||||
}
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
inline QT_DEPRECATED iterator &operator--()
|
||||
inline QT_DEPRECATED_VERSION_5_15 iterator &operator--()
|
||||
{
|
||||
i = QHashData::previousNode(i);
|
||||
return *this;
|
||||
}
|
||||
inline QT_DEPRECATED iterator operator--(int)
|
||||
inline QT_DEPRECATED_VERSION_5_15 iterator operator--(int)
|
||||
{
|
||||
iterator r = *this;
|
||||
i = QHashData::previousNode(i);
|
||||
return r;
|
||||
}
|
||||
inline QT_DEPRECATED iterator operator+(int j) const
|
||||
inline QT_DEPRECATED_VERSION_5_15 iterator operator+(int j) const
|
||||
{ iterator r = *this; if (j > 0) while (j--) ++r; else while (j++) --r; return r; }
|
||||
inline QT_DEPRECATED iterator operator-(int j) const { return operator+(-j); }
|
||||
inline QT_DEPRECATED iterator &operator+=(int j) { return *this = *this + j; }
|
||||
inline QT_DEPRECATED iterator &operator-=(int j) { return *this = *this - j; }
|
||||
friend inline QT_DEPRECATED iterator operator+(int j, iterator k) { return k + j; }
|
||||
inline QT_DEPRECATED_VERSION_5_15 iterator operator-(int j) const { return operator+(-j); }
|
||||
inline QT_DEPRECATED_VERSION_5_15 iterator &operator+=(int j) { return *this = *this + j; }
|
||||
inline QT_DEPRECATED_VERSION_5_15 iterator &operator-=(int j) { return *this = *this - j; }
|
||||
friend inline QT_DEPRECATED_VERSION_5_15 iterator operator+(int j, iterator k) { return k + j; }
|
||||
#endif
|
||||
|
||||
inline bool operator==(const const_iterator &o) const { return i == o.i; }
|
||||
@ -387,7 +387,7 @@ public:
|
||||
QHashData::Node *i;
|
||||
|
||||
public:
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
#if QT_DEPRECATED_WARNINGS_SINCE < QT_VERSION_CHECK(5, 15, 0)
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
#else
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
@ -420,23 +420,23 @@ public:
|
||||
return r;
|
||||
}
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
inline QT_DEPRECATED const_iterator &operator--()
|
||||
inline QT_DEPRECATED_VERSION_5_15 const_iterator &operator--()
|
||||
{
|
||||
i = QHashData::previousNode(i);
|
||||
return *this;
|
||||
}
|
||||
inline QT_DEPRECATED const_iterator operator--(int)
|
||||
inline QT_DEPRECATED_VERSION_5_15 const_iterator operator--(int)
|
||||
{
|
||||
const_iterator r = *this;
|
||||
i = QHashData::previousNode(i);
|
||||
return r;
|
||||
}
|
||||
inline QT_DEPRECATED const_iterator operator+(int j) const
|
||||
inline QT_DEPRECATED_VERSION_5_15 const_iterator operator+(int j) const
|
||||
{ const_iterator r = *this; if (j > 0) while (j--) ++r; else while (j++) --r; return r; }
|
||||
inline QT_DEPRECATED const_iterator operator-(int j) const { return operator+(-j); }
|
||||
inline QT_DEPRECATED const_iterator &operator+=(int j) { return *this = *this + j; }
|
||||
inline QT_DEPRECATED const_iterator &operator-=(int j) { return *this = *this - j; }
|
||||
friend inline QT_DEPRECATED const_iterator operator+(int j, const_iterator k)
|
||||
inline QT_DEPRECATED_VERSION_5_15 const_iterator operator-(int j) const { return operator+(-j); }
|
||||
inline QT_DEPRECATED_VERSION_5_15 const_iterator &operator+=(int j) { return *this = *this + j; }
|
||||
inline QT_DEPRECATED_VERSION_5_15 const_iterator &operator-=(int j) { return *this = *this - j; }
|
||||
friend inline QT_DEPRECATED_VERSION_5_15 const_iterator operator+(int j, const_iterator k)
|
||||
{
|
||||
return k + j;
|
||||
}
|
||||
@ -466,12 +466,12 @@ public:
|
||||
inline key_iterator &operator++() { ++i; return *this; }
|
||||
inline key_iterator operator++(int) { return key_iterator(i++);}
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
inline QT_DEPRECATED key_iterator &operator--()
|
||||
inline QT_DEPRECATED_VERSION_5_15 key_iterator &operator--()
|
||||
{
|
||||
--i;
|
||||
return *this;
|
||||
}
|
||||
inline QT_DEPRECATED key_iterator operator--(int) { return key_iterator(i--); }
|
||||
inline QT_DEPRECATED_VERSION_5_15 key_iterator operator--(int) { return key_iterator(i--); }
|
||||
#endif
|
||||
const_iterator base() const { return i; }
|
||||
};
|
||||
@ -1302,18 +1302,18 @@ public:
|
||||
return false;
|
||||
}
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
inline QT_DEPRECATED bool hasPrevious() const { return i != c.constBegin(); }
|
||||
inline QT_DEPRECATED Item previous()
|
||||
inline QT_DEPRECATED_VERSION_5_15 bool hasPrevious() const { return i != c.constBegin(); }
|
||||
inline QT_DEPRECATED_VERSION_5_15 Item previous()
|
||||
{
|
||||
n = --i;
|
||||
return n;
|
||||
}
|
||||
inline QT_DEPRECATED Item peekPrevious() const
|
||||
inline QT_DEPRECATED_VERSION_5_15 Item peekPrevious() const
|
||||
{
|
||||
const_iterator p = i;
|
||||
return --p;
|
||||
}
|
||||
inline bool QT_DEPRECATED findPrevious(const T &t)
|
||||
inline bool QT_DEPRECATED_VERSION_5_15 findPrevious(const T &t)
|
||||
{
|
||||
while (i != c.constBegin())
|
||||
if (*(n = --i) == t)
|
||||
@ -1399,18 +1399,18 @@ public:
|
||||
return false;
|
||||
}
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
inline QT_DEPRECATED bool hasPrevious() const { return const_iterator(i) != c->constBegin(); }
|
||||
inline QT_DEPRECATED Item previous()
|
||||
inline QT_DEPRECATED_VERSION_5_15 bool hasPrevious() const { return const_iterator(i) != c->constBegin(); }
|
||||
inline QT_DEPRECATED_VERSION_5_15 Item previous()
|
||||
{
|
||||
n = --i;
|
||||
return n;
|
||||
}
|
||||
inline QT_DEPRECATED Item peekPrevious() const
|
||||
inline QT_DEPRECATED_VERSION_5_15 Item peekPrevious() const
|
||||
{
|
||||
iterator p = i;
|
||||
return --p;
|
||||
}
|
||||
inline QT_DEPRECATED bool findPrevious(const T &t)
|
||||
inline QT_DEPRECATED_VERSION_5_15 bool findPrevious(const T &t)
|
||||
{
|
||||
while (const_iterator(i) != c->constBegin())
|
||||
if (*(n = --i) == t)
|
||||
|
@ -710,7 +710,7 @@ void QScreenPrivate::updatePrimaryOrientation()
|
||||
|
||||
\since 5.15
|
||||
*/
|
||||
QScreen *QScreen::virtualSiblingAt(const QPoint &point)
|
||||
QScreen *QScreen::virtualSiblingAt(QPoint point)
|
||||
{
|
||||
const auto &siblings = virtualSiblings();
|
||||
for (QScreen *sibling : siblings) {
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
QRect availableGeometry() const;
|
||||
|
||||
QList<QScreen *> virtualSiblings() const;
|
||||
QScreen *virtualSiblingAt(const QPoint &point);
|
||||
QScreen *virtualSiblingAt(QPoint point);
|
||||
|
||||
QSize virtualSize() const;
|
||||
QRect virtualGeometry() const;
|
||||
|
@ -663,6 +663,9 @@ glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs)
|
||||
QFixed ymax = 0;
|
||||
QFixed xmax = 0;
|
||||
for (int i = 0; i < glyphs.numGlyphs; i++) {
|
||||
// If shaping has found this should be ignored, ignore it.
|
||||
if (!glyphs.advances[i] || glyphs.attributes[i].dontPrint)
|
||||
continue;
|
||||
glyph_metrics_t bb = boundingBox(glyphs.glyphs[i]);
|
||||
QFixed x = overall.xoff + glyphs.offsets[i].x + bb.x;
|
||||
QFixed y = overall.yoff + glyphs.offsets[i].y + bb.y;
|
||||
|
@ -712,9 +712,8 @@ struct QBidiAlgorithm {
|
||||
analysis[pos].bidiDirection = QChar::DirEN;
|
||||
++it;
|
||||
}
|
||||
} else {
|
||||
lastETPosition.clear();
|
||||
}
|
||||
lastETPosition.clear();
|
||||
}
|
||||
last = current;
|
||||
lastPos = pos;
|
||||
|
@ -324,7 +324,7 @@ void QFtpDTP::connectToHost(const QString & host, quint16 port)
|
||||
socket->setObjectName(QLatin1String("QFtpDTP Passive state socket"));
|
||||
connect(socket, SIGNAL(connected()), SLOT(socketConnected()));
|
||||
connect(socket, SIGNAL(readyRead()), SLOT(socketReadyRead()));
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError(QAbstractSocket::SocketError)));
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), SLOT(socketError(QAbstractSocket::SocketError)));
|
||||
connect(socket, SIGNAL(disconnected()), SLOT(socketConnectionClosed()));
|
||||
connect(socket, SIGNAL(bytesWritten(qint64)), SLOT(socketBytesWritten(qint64)));
|
||||
|
||||
@ -769,7 +769,7 @@ void QFtpDTP::setupSocket()
|
||||
socket->setObjectName(QLatin1String("QFtpDTP Active state socket"));
|
||||
connect(socket, SIGNAL(connected()), SLOT(socketConnected()));
|
||||
connect(socket, SIGNAL(readyRead()), SLOT(socketReadyRead()));
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError(QAbstractSocket::SocketError)));
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), SLOT(socketError(QAbstractSocket::SocketError)));
|
||||
connect(socket, SIGNAL(disconnected()), SLOT(socketConnectionClosed()));
|
||||
connect(socket, SIGNAL(bytesWritten(qint64)), SLOT(socketBytesWritten(qint64)));
|
||||
|
||||
@ -807,7 +807,7 @@ QFtpPI::QFtpPI(QObject *parent) :
|
||||
SLOT(connectionClosed()));
|
||||
connect(&commandSocket, SIGNAL(readyRead()),
|
||||
SLOT(readyRead()));
|
||||
connect(&commandSocket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
connect(&commandSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
SLOT(error(QAbstractSocket::SocketError)));
|
||||
|
||||
connect(&dtp, SIGNAL(connectState(int)),
|
||||
|
@ -156,7 +156,7 @@ void QHttpNetworkConnectionChannel::init()
|
||||
QObject::connect(socket, SIGNAL(disconnected()),
|
||||
this, SLOT(_q_disconnected()),
|
||||
Qt::DirectConnection);
|
||||
QObject::connect(socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
QObject::connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
this, SLOT(_q_error(QAbstractSocket::SocketError)),
|
||||
Qt::DirectConnection);
|
||||
|
||||
|
@ -233,7 +233,7 @@ void QHttpProtocolHandler::_q_readyRead()
|
||||
char c;
|
||||
qint64 ret = m_socket->peek(&c, 1);
|
||||
if (ret < 0) {
|
||||
m_channel->_q_error(m_socket->socketError());
|
||||
m_channel->_q_error(m_socket->error());
|
||||
// We still need to handle the reply so it emits its signals etc.
|
||||
if (m_reply)
|
||||
_q_receiveReply();
|
||||
|
@ -98,7 +98,7 @@ void QNetworkAccessDebugPipeBackend::open()
|
||||
|
||||
// socket ready read -> we can push from socket to downstream
|
||||
connect(&socket, SIGNAL(readyRead()), SLOT(socketReadyRead()));
|
||||
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(socketError()));
|
||||
connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), SLOT(socketError()));
|
||||
connect(&socket, SIGNAL(disconnected()), SLOT(socketDisconnected()));
|
||||
connect(&socket, SIGNAL(connected()), SLOT(socketConnected()));
|
||||
// socket bytes written -> we can push more from upstream to socket
|
||||
@ -242,9 +242,9 @@ void QNetworkAccessDebugPipeBackend::closeDownstreamChannel()
|
||||
|
||||
void QNetworkAccessDebugPipeBackend::socketError()
|
||||
{
|
||||
qWarning("QNetworkAccessDebugPipeBackend::socketError() %d",socket.socketError());
|
||||
qWarning("QNetworkAccessDebugPipeBackend::socketError() %d",socket.error());
|
||||
QNetworkReply::NetworkError code;
|
||||
switch (socket.socketError()) {
|
||||
switch (socket.error()) {
|
||||
case QAbstractSocket::RemoteHostClosedError:
|
||||
return; // socketDisconnected will be called
|
||||
|
||||
|
@ -1726,7 +1726,7 @@ int QNetworkAccessManager::transferTimeout() const
|
||||
Transfers are aborted if no bytes are transferred before
|
||||
the timeout expires. Zero means no timer is set. If no
|
||||
argument is provided, the timeout is
|
||||
QNetworkRequest::TransferTimeoutPreset. If this function
|
||||
QNetworkRequest::DefaultTransferTimeoutConstant. If this function
|
||||
is not called, the timeout is disabled and has the
|
||||
value zero. The request-specific non-zero timeouts set for
|
||||
the requests that are executed override this value. This means
|
||||
|
@ -554,32 +554,13 @@ QNetworkAccessManager::Operation QNetworkReply::operation() const
|
||||
return d_func()->operation;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\deprecated
|
||||
|
||||
Use networkError() instead.
|
||||
|
||||
Returns the error that was found during the processing of this
|
||||
request. If no error was found, returns NoError.
|
||||
|
||||
\sa setError(), networkError()
|
||||
*/
|
||||
QNetworkReply::NetworkError QNetworkReply::error() const
|
||||
{
|
||||
return networkError();
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
|
||||
Returns the error that was found during the processing of this
|
||||
request. If no error was found, returns NoError.
|
||||
|
||||
\sa setError()
|
||||
*/
|
||||
QNetworkReply::NetworkError QNetworkReply::networkError() const
|
||||
QNetworkReply::NetworkError QNetworkReply::error() const
|
||||
{
|
||||
return d_func()->errorCode;
|
||||
}
|
||||
@ -877,7 +858,7 @@ void QNetworkReply::setRequest(const QNetworkRequest &request)
|
||||
Calling setError() does not emit the error(QNetworkReply::NetworkError)
|
||||
signal.
|
||||
|
||||
\sa error(), errorString(), networkError()
|
||||
\sa error(), errorString()
|
||||
*/
|
||||
void QNetworkReply::setError(NetworkError errorCode, const QString &errorString)
|
||||
{
|
||||
|
@ -124,12 +124,7 @@ public:
|
||||
QNetworkAccessManager *manager() const;
|
||||
QNetworkAccessManager::Operation operation() const;
|
||||
QNetworkRequest request() const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use networkError()") NetworkError error() const;
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
NetworkError networkError() const;
|
||||
|
||||
NetworkError error() const;
|
||||
bool isFinished() const;
|
||||
bool isRunning() const;
|
||||
QUrl url() const;
|
||||
|
@ -931,7 +931,7 @@ int QNetworkRequest::transferTimeout() const
|
||||
Transfers are aborted if no bytes are transferred before
|
||||
the timeout expires. Zero means no timer is set. If no
|
||||
argument is provided, the timeout is
|
||||
QNetworkRequest::TransferTimeoutPreset. If this function
|
||||
QNetworkRequest::DefaultTransferTimeoutConstant. If this function
|
||||
is not called, the timeout is disabled and has the
|
||||
value zero.
|
||||
|
||||
|
@ -84,7 +84,7 @@
|
||||
HostLookupState. If the host is found, QAbstractSocket enters
|
||||
ConnectingState and emits the hostFound() signal. When the
|
||||
connection has been established, it enters ConnectedState and
|
||||
emits connected(). If an error occurs at any stage, error() is
|
||||
emits connected(). If an error occurs at any stage, errorOccurred() is
|
||||
emitted. Whenever the state changes, stateChanged() is emitted.
|
||||
For convenience, isValid() returns \c true if the socket is ready for
|
||||
reading and writing, but note that the socket's state must be
|
||||
@ -113,7 +113,7 @@
|
||||
QAbstractSocket::UnconnectedState, and emits disconnected(). If you want
|
||||
to abort a connection immediately, discarding all pending data, call
|
||||
abort() instead. If the remote host closes the connection,
|
||||
QAbstractSocket will emit error(QAbstractSocket::RemoteHostClosedError),
|
||||
QAbstractSocket will emit errorOccurred(QAbstractSocket::RemoteHostClosedError),
|
||||
during which the socket state will still be ConnectedState, and then the
|
||||
disconnected() signal will be emitted.
|
||||
|
||||
@ -203,6 +203,14 @@
|
||||
|
||||
/*!
|
||||
\fn void QAbstractSocket::error(QAbstractSocket::SocketError socketError)
|
||||
\obsolete
|
||||
|
||||
Use errorOccurred() instead.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QAbstractSocket::errorOccurred(QAbstractSocket::SocketError socketError)
|
||||
\since 5.15
|
||||
|
||||
This signal is emitted after an error occurred. The \a socketError
|
||||
parameter describes the type of error that occurred.
|
||||
@ -215,7 +223,7 @@
|
||||
connections, you will have to register it with Q_DECLARE_METATYPE() and
|
||||
qRegisterMetaType().
|
||||
|
||||
\sa socketError(), errorString(), {Creating Custom Qt Types}
|
||||
\sa error(), errorString(), {Creating Custom Qt Types}
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -329,7 +337,8 @@
|
||||
is non-blocking).
|
||||
|
||||
\value UnknownSocketError An unidentified error occurred.
|
||||
\sa QAbstractSocket::socketError()
|
||||
\sa QAbstractSocket::error()
|
||||
\sa QAbstractSocket::errorOccurred()
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -988,7 +997,7 @@ void QAbstractSocketPrivate::startConnectingByName(const QString &host)
|
||||
}
|
||||
|
||||
state = QAbstractSocket::UnconnectedState;
|
||||
emit q->error(socketError);
|
||||
emit q->errorOccurred(socketError);
|
||||
emit q->stateChanged(state);
|
||||
}
|
||||
|
||||
@ -1047,7 +1056,7 @@ void QAbstractSocketPrivate::_q_startConnecting(const QHostInfo &hostInfo)
|
||||
state = QAbstractSocket::UnconnectedState;
|
||||
setError(QAbstractSocket::HostNotFoundError, QAbstractSocket::tr("Host not found"));
|
||||
emit q->stateChanged(state);
|
||||
emit q->error(QAbstractSocket::HostNotFoundError);
|
||||
emit q->errorOccurred(QAbstractSocket::HostNotFoundError);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1070,8 +1079,8 @@ void QAbstractSocketPrivate::_q_startConnecting(const QHostInfo &hostInfo)
|
||||
_q_testConnection(), this function takes the first address of the
|
||||
pending addresses list and tries to connect to it. If the
|
||||
connection succeeds, QAbstractSocket will emit
|
||||
connected(). Otherwise, error(ConnectionRefusedError) or
|
||||
error(SocketTimeoutError) is emitted.
|
||||
connected(). Otherwise, errorOccurred(ConnectionRefusedError) or
|
||||
errorOccurred(SocketTimeoutError) is emitted.
|
||||
*/
|
||||
void QAbstractSocketPrivate::_q_connectToNextAddress()
|
||||
{
|
||||
@ -1101,7 +1110,7 @@ void QAbstractSocketPrivate::_q_connectToNextAddress()
|
||||
// q->setErrorString(QAbstractSocket::tr("Connection refused"));
|
||||
}
|
||||
emit q->stateChanged(state);
|
||||
emit q->error(socketError);
|
||||
emit q->errorOccurred(socketError);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1223,7 +1232,7 @@ void QAbstractSocketPrivate::_q_abortConnectionAttempt()
|
||||
setError(QAbstractSocket::SocketTimeoutError,
|
||||
QAbstractSocket::tr("Connection timed out"));
|
||||
emit q->stateChanged(state);
|
||||
emit q->error(socketError);
|
||||
emit q->errorOccurred(socketError);
|
||||
} else {
|
||||
_q_connectToNextAddress();
|
||||
}
|
||||
@ -1430,14 +1439,14 @@ void QAbstractSocketPrivate::setError(QAbstractSocket::SocketError errorCode,
|
||||
\internal
|
||||
|
||||
Sets the socket error state to \c errorCode and \a errorString,
|
||||
and emits the QAbstractSocket::error() signal.
|
||||
and emits the QAbstractSocket::errorOccurred() signal.
|
||||
*/
|
||||
void QAbstractSocketPrivate::setErrorAndEmit(QAbstractSocket::SocketError errorCode,
|
||||
const QString &errorString)
|
||||
{
|
||||
Q_Q(QAbstractSocket);
|
||||
setError(errorCode, errorString);
|
||||
emit q->error(errorCode);
|
||||
emit q->errorOccurred(errorCode);
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
@ -1456,6 +1465,9 @@ QAbstractSocket::QAbstractSocket(SocketType socketType,
|
||||
: socketType == SctpSocket ? "Sctp" : "Unknown", &dd, parent);
|
||||
#endif
|
||||
d->socketType = socketType;
|
||||
|
||||
// Support the deprecated error() signal:
|
||||
connect(this, &QAbstractSocket::errorOccurred, this, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error));
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1654,7 +1666,7 @@ bool QAbstractSocket::isValid() const
|
||||
established, QAbstractSocket enters ConnectedState and
|
||||
emits connected().
|
||||
|
||||
At any point, the socket can emit error() to signal that an error
|
||||
At any point, the socket can emit errorOccurred() to signal that an error
|
||||
occurred.
|
||||
|
||||
\a hostName may be an IP address in string form (e.g.,
|
||||
@ -2092,7 +2104,7 @@ QVariant QAbstractSocket::socketOption(QAbstractSocket::SocketOption option)
|
||||
Waits until the socket is connected, up to \a msecs
|
||||
milliseconds. If the connection has been established, this
|
||||
function returns \c true; otherwise it returns \c false. In the case
|
||||
where it returns \c false, you can call socketError() to determine
|
||||
where it returns \c false, you can call error() to determine
|
||||
the cause of the error.
|
||||
|
||||
The following example waits up to one second for a connection
|
||||
@ -2864,7 +2876,7 @@ void QAbstractSocket::setReadBufferSize(qint64 size)
|
||||
/*!
|
||||
Returns the state of the socket.
|
||||
|
||||
\sa socketError()
|
||||
\sa error()
|
||||
*/
|
||||
QAbstractSocket::SocketState QAbstractSocket::state() const
|
||||
{
|
||||
@ -2891,35 +2903,16 @@ QAbstractSocket::SocketType QAbstractSocket::socketType() const
|
||||
return d_func()->socketType;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\deprecated
|
||||
|
||||
Use socketError() instead.
|
||||
|
||||
Returns the type of error that last occurred.
|
||||
|
||||
\sa state(), errorString(), socketError()
|
||||
*/
|
||||
QAbstractSocket::SocketError QAbstractSocket::error() const
|
||||
{
|
||||
return socketError();
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
|
||||
Returns the type of error that last occurred.
|
||||
|
||||
\sa state(), errorString()
|
||||
*/
|
||||
QAbstractSocket::SocketError QAbstractSocket::socketError() const
|
||||
QAbstractSocket::SocketError QAbstractSocket::error() const
|
||||
{
|
||||
return d_func()->socketError;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Sets the type of error that last occurred to \a socketError.
|
||||
|
||||
|
@ -180,12 +180,7 @@ public:
|
||||
|
||||
SocketType socketType() const;
|
||||
SocketState state() const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_X("Use socketError()") SocketError error() const;
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
SocketError socketError() const;
|
||||
SocketError error() const;
|
||||
|
||||
// from QIODevice
|
||||
void close() override;
|
||||
@ -211,7 +206,11 @@ Q_SIGNALS:
|
||||
void connected();
|
||||
void disconnected();
|
||||
void stateChanged(QAbstractSocket::SocketState);
|
||||
#if QT_DEPRECATED_SINCE(5,15)
|
||||
QT_DEPRECATED_X("Use QAbstractSocket::errorOccurred(QAbstractSocket::SocketError) instead")
|
||||
void error(QAbstractSocket::SocketError);
|
||||
#endif
|
||||
void errorOccurred(QAbstractSocket::SocketError);
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator);
|
||||
#endif
|
||||
|
@ -93,7 +93,7 @@ bool QHttpSocketEngine::initialize(QAbstractSocket::SocketType type, QAbstractSo
|
||||
connect(d->socket, SIGNAL(bytesWritten(qint64)),
|
||||
this, SLOT(slotSocketBytesWritten()),
|
||||
Qt::DirectConnection);
|
||||
connect(d->socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
connect(d->socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
this, SLOT(slotSocketError(QAbstractSocket::SocketError)),
|
||||
Qt::DirectConnection);
|
||||
connect(d->socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
|
||||
@ -370,8 +370,8 @@ bool QHttpSocketEngine::waitForRead(int msecs, bool *timedOut)
|
||||
if (!d->socket->waitForReadyRead(qt_subtract_from_timeout(msecs, stopWatch.elapsed()))) {
|
||||
if (d->socket->state() == QAbstractSocket::UnconnectedState)
|
||||
return true;
|
||||
setError(d->socket->socketError(), d->socket->errorString());
|
||||
if (timedOut && d->socket->socketError() == QAbstractSocket::SocketTimeoutError)
|
||||
setError(d->socket->error(), d->socket->errorString());
|
||||
if (timedOut && d->socket->error() == QAbstractSocket::SocketTimeoutError)
|
||||
*timedOut = true;
|
||||
return false;
|
||||
}
|
||||
@ -385,8 +385,8 @@ bool QHttpSocketEngine::waitForRead(int msecs, bool *timedOut)
|
||||
|
||||
// Report any error that may occur.
|
||||
if (d->state != Connected) {
|
||||
setError(d->socket->socketError(), d->socket->errorString());
|
||||
if (timedOut && d->socket->socketError() == QAbstractSocket::SocketTimeoutError)
|
||||
setError(d->socket->error(), d->socket->errorString());
|
||||
if (timedOut && d->socket->error() == QAbstractSocket::SocketTimeoutError)
|
||||
*timedOut = true;
|
||||
return false;
|
||||
}
|
||||
@ -401,7 +401,7 @@ bool QHttpSocketEngine::waitForWrite(int msecs, bool *timedOut)
|
||||
if (d->state == Connected) {
|
||||
if (d->socket->bytesToWrite()) {
|
||||
if (!d->socket->waitForBytesWritten(msecs)) {
|
||||
if (d->socket->socketError() == QAbstractSocket::SocketTimeoutError && timedOut)
|
||||
if (d->socket->error() == QAbstractSocket::SocketTimeoutError && timedOut)
|
||||
*timedOut = true;
|
||||
return false;
|
||||
}
|
||||
@ -421,7 +421,8 @@ bool QHttpSocketEngine::waitForWrite(int msecs, bool *timedOut)
|
||||
|
||||
// Report any error that may occur.
|
||||
if (d->state != Connected) {
|
||||
if (timedOut && d->socket->socketError() == QAbstractSocket::SocketTimeoutError)
|
||||
// setError(d->socket->error(), d->socket->errorString());
|
||||
if (timedOut && d->socket->error() == QAbstractSocket::SocketTimeoutError)
|
||||
*timedOut = true;
|
||||
}
|
||||
|
||||
|
@ -132,14 +132,14 @@ private:
|
||||
Q_DISABLE_COPY(QLocalSocket)
|
||||
#if defined(QT_LOCALSOCKET_TCP)
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QAbstractSocket::SocketState))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_errorOccurred(QAbstractSocket::SocketError))
|
||||
#elif defined(Q_OS_WIN)
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_canWrite())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_pipeClosed())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_winError(ulong, const QString &))
|
||||
#else
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QAbstractSocket::SocketState))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_error(QAbstractSocket::SocketError))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_errorOccurred(QAbstractSocket::SocketError))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_connectToSocket())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_abortConnectionAttempt())
|
||||
#endif
|
||||
|
@ -127,7 +127,7 @@ public:
|
||||
QString generateErrorString(QLocalSocket::LocalSocketError, const QString &function) const;
|
||||
void setErrorAndEmit(QLocalSocket::LocalSocketError, const QString &function);
|
||||
void _q_stateChanged(QAbstractSocket::SocketState newState);
|
||||
void _q_error(QAbstractSocket::SocketError newError);
|
||||
void _q_errorOccurred(QAbstractSocket::SocketError newError);
|
||||
#elif defined(Q_OS_WIN)
|
||||
~QLocalSocketPrivate();
|
||||
void destroyPipeHandles();
|
||||
@ -144,7 +144,7 @@ public:
|
||||
QString generateErrorString(QLocalSocket::LocalSocketError, const QString &function) const;
|
||||
void setErrorAndEmit(QLocalSocket::LocalSocketError, const QString &function);
|
||||
void _q_stateChanged(QAbstractSocket::SocketState newState);
|
||||
void _q_error(QAbstractSocket::SocketError newError);
|
||||
void _q_errorOccurred(QAbstractSocket::SocketError newError);
|
||||
void _q_connectToSocket();
|
||||
void _q_abortConnectionAttempt();
|
||||
void cancelDelayedConnect();
|
||||
|
@ -77,8 +77,8 @@ void QLocalSocketPrivate::setSocket(QLocalUnixSocket* socket)
|
||||
q->connect(tcpSocket, SIGNAL(disconnected()), q, SIGNAL(disconnected()));
|
||||
q->connect(tcpSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
|
||||
q, SLOT(_q_stateChanged(QAbstractSocket::SocketState)));
|
||||
q->connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
q, SLOT(_q_error(QAbstractSocket::SocketError)));
|
||||
q->connect(tcpSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
q, SLOT(_q_errorOccurred(QAbstractSocket::SocketError)));
|
||||
q->connect(tcpSocket, SIGNAL(readChannelFinished()), q, SIGNAL(readChannelFinished()));
|
||||
tcpSocket->setParent(q);
|
||||
}
|
||||
@ -88,7 +88,7 @@ qint64 QLocalSocketPrivate::skip(qint64 maxSize)
|
||||
return tcpSocket->skip(maxSize);
|
||||
}
|
||||
|
||||
void QLocalSocketPrivate::_q_error(QAbstractSocket::SocketError socketError)
|
||||
void QLocalSocketPrivate::_q_errorOccurred(QAbstractSocket::SocketError socketError)
|
||||
{
|
||||
Q_Q(QLocalSocket);
|
||||
QString function = QLatin1String("QLocalSocket");
|
||||
|
@ -81,8 +81,8 @@ void QLocalSocketPrivate::init()
|
||||
q->connect(&unixSocket, SIGNAL(disconnected()), q, SIGNAL(disconnected()));
|
||||
q->connect(&unixSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
|
||||
q, SLOT(_q_stateChanged(QAbstractSocket::SocketState)));
|
||||
q->connect(&unixSocket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
q, SLOT(_q_error(QAbstractSocket::SocketError)));
|
||||
q->connect(&unixSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
q, SLOT(_q_errorOccurred(QAbstractSocket::SocketError)));
|
||||
q->connect(&unixSocket, SIGNAL(readChannelFinished()), q, SIGNAL(readChannelFinished()));
|
||||
unixSocket.setParent(q);
|
||||
}
|
||||
@ -92,7 +92,7 @@ qint64 QLocalSocketPrivate::skip(qint64 maxSize)
|
||||
return unixSocket.skip(maxSize);
|
||||
}
|
||||
|
||||
void QLocalSocketPrivate::_q_error(QAbstractSocket::SocketError socketError)
|
||||
void QLocalSocketPrivate::_q_errorOccurred(QAbstractSocket::SocketError socketError)
|
||||
{
|
||||
Q_Q(QLocalSocket);
|
||||
QString function = QLatin1String("QLocalSocket");
|
||||
@ -464,7 +464,7 @@ void QLocalSocket::disconnectFromServer()
|
||||
QLocalSocket::LocalSocketError QLocalSocket::error() const
|
||||
{
|
||||
Q_D(const QLocalSocket);
|
||||
switch (d->unixSocket.socketError()) {
|
||||
switch (d->unixSocket.error()) {
|
||||
case QAbstractSocket::ConnectionRefusedError:
|
||||
return QLocalSocket::ConnectionRefusedError;
|
||||
case QAbstractSocket::RemoteHostClosedError:
|
||||
|
@ -559,8 +559,8 @@ void QSocks5SocketEnginePrivate::initialize(Socks5Mode socks5Mode)
|
||||
Qt::DirectConnection);
|
||||
QObject::connect(data->controlSocket, SIGNAL(bytesWritten(qint64)), q, SLOT(_q_controlSocketBytesWritten()),
|
||||
Qt::DirectConnection);
|
||||
QObject::connect(data->controlSocket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
q, SLOT(_q_controlSocketError(QAbstractSocket::SocketError)),
|
||||
QObject::connect(data->controlSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
q, SLOT(_q_controlSocketErrorOccurred(QAbstractSocket::SocketError)),
|
||||
Qt::DirectConnection);
|
||||
QObject::connect(data->controlSocket, SIGNAL(disconnected()), q, SLOT(_q_controlSocketDisconnected()),
|
||||
Qt::DirectConnection);
|
||||
@ -594,7 +594,7 @@ void QSocks5SocketEnginePrivate::setErrorState(Socks5State state, const QString
|
||||
|
||||
case ConnectError:
|
||||
case ControlSocketError: {
|
||||
QAbstractSocket::SocketError controlSocketError = data->controlSocket->socketError();
|
||||
QAbstractSocket::SocketError controlSocketError = data->controlSocket->error();
|
||||
if (socks5State != Connected) {
|
||||
switch (controlSocketError) {
|
||||
case QAbstractSocket::ConnectionRefusedError:
|
||||
@ -918,7 +918,7 @@ void QSocks5SocketEnginePrivate::_q_emitPendingReadNotification()
|
||||
return;
|
||||
// check if there needs to be a new zero read notification
|
||||
if (data && data->controlSocket->state() == QAbstractSocket::UnconnectedState
|
||||
&& data->controlSocket->socketError() == QAbstractSocket::RemoteHostClosedError) {
|
||||
&& data->controlSocket->error() == QAbstractSocket::RemoteHostClosedError) {
|
||||
connectData->readBuffer.clear();
|
||||
emitReadNotification();
|
||||
}
|
||||
@ -1056,7 +1056,7 @@ bool QSocks5SocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::
|
||||
Qt::DirectConnection);
|
||||
QObject::connect(d->data->controlSocket, SIGNAL(bytesWritten(qint64)), this, SLOT(_q_controlSocketBytesWritten()),
|
||||
Qt::DirectConnection);
|
||||
QObject::connect(d->data->controlSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(_q_controlSocketError(QAbstractSocket::SocketError)),
|
||||
QObject::connect(d->data->controlSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this, SLOT(_q_controlSocketErrorOccurred(QAbstractSocket::SocketError)),
|
||||
Qt::DirectConnection);
|
||||
QObject::connect(d->data->controlSocket, SIGNAL(disconnected()), this, SLOT(_q_controlSocketDisconnected()),
|
||||
Qt::DirectConnection);
|
||||
@ -1231,7 +1231,7 @@ void QSocks5SocketEnginePrivate::_q_controlSocketBytesWritten()
|
||||
}
|
||||
}
|
||||
|
||||
void QSocks5SocketEnginePrivate::_q_controlSocketError(QAbstractSocket::SocketError error)
|
||||
void QSocks5SocketEnginePrivate::_q_controlSocketErrorOccurred(QAbstractSocket::SocketError error)
|
||||
{
|
||||
QSOCKS5_D_DEBUG << "controlSocketError" << error << data->controlSocket->errorString();
|
||||
|
||||
@ -1256,7 +1256,7 @@ void QSocks5SocketEnginePrivate::_q_controlSocketError(QAbstractSocket::SocketEr
|
||||
data->controlSocket->close();
|
||||
emitConnectionNotification();
|
||||
} else {
|
||||
q_func()->setError(data->controlSocket->socketError(), data->controlSocket->errorString());
|
||||
q_func()->setError(data->controlSocket->error(), data->controlSocket->errorString());
|
||||
emitReadNotification();
|
||||
emitWriteNotification();
|
||||
}
|
||||
@ -1348,7 +1348,7 @@ bool QSocks5SocketEngine::bind(const QHostAddress &addr, quint16 port)
|
||||
if (d->mode == QSocks5SocketEnginePrivate::UdpAssociateMode) {
|
||||
if (!d->udpData->udpSocket->bind(address, port)) {
|
||||
QSOCKS5_Q_DEBUG << "local udp bind failed";
|
||||
setError(d->udpData->udpSocket->socketError(), d->udpData->udpSocket->errorString());
|
||||
setError(d->udpData->udpSocket->error(), d->udpData->udpSocket->errorString());
|
||||
return false;
|
||||
}
|
||||
d->localAddress = d->udpData->udpSocket->localAddress();
|
||||
@ -1656,8 +1656,8 @@ qint64 QSocks5SocketEngine::writeDatagram(const char *data, qint64 len, const QI
|
||||
}
|
||||
if (d->udpData->udpSocket->writeDatagram(sealedBuf, d->udpData->associateAddress, d->udpData->associatePort) != sealedBuf.size()) {
|
||||
//### try frgamenting
|
||||
if (d->udpData->udpSocket->socketError() == QAbstractSocket::DatagramTooLargeError)
|
||||
setError(d->udpData->udpSocket->socketError(), d->udpData->udpSocket->errorString());
|
||||
if (d->udpData->udpSocket->error() == QAbstractSocket::DatagramTooLargeError)
|
||||
setError(d->udpData->udpSocket->error(), d->udpData->udpSocket->errorString());
|
||||
//### else maybe more serious error
|
||||
return -1;
|
||||
}
|
||||
@ -1727,7 +1727,7 @@ bool QSocks5SocketEnginePrivate::waitForConnected(int msecs, bool *timedOut)
|
||||
return true;
|
||||
|
||||
setErrorState(QSocks5SocketEnginePrivate::ControlSocketError);
|
||||
if (timedOut && data->controlSocket->socketError() == QAbstractSocket::SocketTimeoutError)
|
||||
if (timedOut && data->controlSocket->error() == QAbstractSocket::SocketTimeoutError)
|
||||
*timedOut = true;
|
||||
return false;
|
||||
}
|
||||
@ -1765,8 +1765,8 @@ bool QSocks5SocketEngine::waitForRead(int msecs, bool *timedOut)
|
||||
if (d->data->controlSocket->state() == QAbstractSocket::UnconnectedState)
|
||||
return true;
|
||||
|
||||
setError(d->data->controlSocket->socketError(), d->data->controlSocket->errorString());
|
||||
if (timedOut && d->data->controlSocket->socketError() == QAbstractSocket::SocketTimeoutError)
|
||||
setError(d->data->controlSocket->error(), d->data->controlSocket->errorString());
|
||||
if (timedOut && d->data->controlSocket->error() == QAbstractSocket::SocketTimeoutError)
|
||||
*timedOut = true;
|
||||
return false;
|
||||
}
|
||||
@ -1775,8 +1775,8 @@ bool QSocks5SocketEngine::waitForRead(int msecs, bool *timedOut)
|
||||
} else {
|
||||
while (!d->readNotificationActivated) {
|
||||
if (!d->udpData->udpSocket->waitForReadyRead(qt_subtract_from_timeout(msecs, stopWatch.elapsed()))) {
|
||||
setError(d->udpData->udpSocket->socketError(), d->udpData->udpSocket->errorString());
|
||||
if (timedOut && d->udpData->udpSocket->socketError() == QAbstractSocket::SocketTimeoutError)
|
||||
setError(d->udpData->udpSocket->error(), d->udpData->udpSocket->errorString());
|
||||
if (timedOut && d->udpData->udpSocket->error() == QAbstractSocket::SocketTimeoutError)
|
||||
*timedOut = true;
|
||||
return false;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ private:
|
||||
Q_DISABLE_COPY_MOVE(QSocks5SocketEngine)
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_controlSocketConnected())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_controlSocketReadNotification())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_controlSocketError(QAbstractSocket::SocketError))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_controlSocketErrorOccurred(QAbstractSocket::SocketError))
|
||||
#ifndef QT_NO_UDPSOCKET
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_udpSocketReadNotification())
|
||||
#endif
|
||||
@ -246,7 +246,7 @@ public:
|
||||
|
||||
void _q_controlSocketConnected();
|
||||
void _q_controlSocketReadNotification();
|
||||
void _q_controlSocketError(QAbstractSocket::SocketError);
|
||||
void _q_controlSocketErrorOccurred(QAbstractSocket::SocketError);
|
||||
#ifndef QT_NO_UDPSOCKET
|
||||
void _q_udpSocketReadNotification();
|
||||
#endif
|
||||
|
@ -1125,7 +1125,7 @@ qint64 QDtlsPrivateOpenSSL::writeDatagramEncrypted(QUdpSocket *socket,
|
||||
// some errors can be just ignored (it's UDP, not TCP after all).
|
||||
// Unlike QSslSocket we do not abort though.
|
||||
QString description(QSslSocketBackendPrivate::getErrorsFromOpenSsl());
|
||||
if (socket->socketError() != QAbstractSocket::UnknownSocketError && description.isEmpty()) {
|
||||
if (socket->error() != QAbstractSocket::UnknownSocketError && description.isEmpty()) {
|
||||
setDtlsError(QDtlsError::UnderlyingSocketError, socket->errorString());
|
||||
} else {
|
||||
setDtlsError(QDtlsError::TlsFatalError,
|
||||
|
@ -676,7 +676,7 @@ bool QSslSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState state
|
||||
d->createPlainSocket(openMode);
|
||||
bool retVal = d->plainSocket->setSocketDescriptor(socketDescriptor, state, openMode);
|
||||
d->cachedSocketDescriptor = d->plainSocket->socketDescriptor();
|
||||
d->setError(d->plainSocket->socketError(), d->plainSocket->errorString());
|
||||
d->setError(d->plainSocket->error(), d->plainSocket->errorString());
|
||||
setSocketState(state);
|
||||
setOpenMode(openMode);
|
||||
setLocalPort(d->plainSocket->localPort());
|
||||
@ -1784,7 +1784,7 @@ bool QSslSocket::waitForConnected(int msecs)
|
||||
bool retVal = d->plainSocket->waitForConnected(msecs);
|
||||
if (!retVal) {
|
||||
setSocketState(d->plainSocket->state());
|
||||
d->setError(d->plainSocket->socketError(), d->plainSocket->errorString());
|
||||
d->setError(d->plainSocket->error(), d->plainSocket->errorString());
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
@ -1953,7 +1953,7 @@ bool QSslSocket::waitForDisconnected(int msecs)
|
||||
bool retVal = d->plainSocket->waitForDisconnected(qt_subtract_from_timeout(msecs, stopWatch.elapsed()));
|
||||
if (!retVal) {
|
||||
setSocketState(d->plainSocket->state());
|
||||
d->setError(d->plainSocket->socketError(), d->plainSocket->errorString());
|
||||
d->setError(d->plainSocket->error(), d->plainSocket->errorString());
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
@ -2681,7 +2681,7 @@ void QSslSocketPrivate::createPlainSocket(QIODevice::OpenMode openMode)
|
||||
q->connect(plainSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
|
||||
q, SLOT(_q_stateChangedSlot(QAbstractSocket::SocketState)),
|
||||
Qt::DirectConnection);
|
||||
q->connect(plainSocket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
q->connect(plainSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
q, SLOT(_q_errorSlot(QAbstractSocket::SocketError)),
|
||||
Qt::DirectConnection);
|
||||
q->connect(plainSocket, SIGNAL(readyRead()),
|
||||
@ -2857,7 +2857,7 @@ void QSslSocketPrivate::_q_errorSlot(QAbstractSocket::SocketError error)
|
||||
readBufferMaxSize = tmpReadBufferMaxSize;
|
||||
}
|
||||
|
||||
setErrorAndEmit(plainSocket->socketError(), plainSocket->errorString());
|
||||
setErrorAndEmit(plainSocket->error(), plainSocket->errorString());
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1125,7 +1125,7 @@ void QSslSocketBackendPrivate::transmit()
|
||||
if (actualWritten < 0) {
|
||||
//plain socket write fails if it was in the pending close state.
|
||||
const ScopedBool bg(inSetAndEmitError, true);
|
||||
setErrorAndEmit(plainSocket->socketError(), plainSocket->errorString());
|
||||
setErrorAndEmit(plainSocket->error(), plainSocket->errorString());
|
||||
return;
|
||||
}
|
||||
transmitting = true;
|
||||
|
@ -576,7 +576,7 @@ bool QSslSocketBackendPrivate::sendToken(void *token, unsigned long tokenLength,
|
||||
if (written != qint64(tokenLength)) {
|
||||
// Failed to write/buffer everything or an error occurred
|
||||
if (emitError)
|
||||
setErrorAndEmit(plainSocket->socketError(), plainSocket->errorString());
|
||||
setErrorAndEmit(plainSocket->error(), plainSocket->errorString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -1286,7 +1286,7 @@ void QSslSocketBackendPrivate::transmit()
|
||||
if (bytesWritten >= 0) {
|
||||
totalBytesWritten += bytesWritten;
|
||||
} else {
|
||||
setErrorAndEmit(plainSocket->socketError(), plainSocket->errorString());
|
||||
setErrorAndEmit(plainSocket->error(), plainSocket->errorString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1693,6 +1693,9 @@ glyph_metrics_t QFontEngineFT::boundingBox(const QGlyphLayout &glyphs)
|
||||
QFixed ymax = 0;
|
||||
QFixed xmax = 0;
|
||||
for (int i = 0; i < glyphs.numGlyphs; i++) {
|
||||
// If shaping has found this should be ignored, ignore it.
|
||||
if (!glyphs.advances[i] || glyphs.attributes[i].dontPrint)
|
||||
continue;
|
||||
Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs.glyphs[i]) : nullptr;
|
||||
if (!g) {
|
||||
if (!face)
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <QtGui/qpainter.h>
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <qpa/qplatformscreen.h>
|
||||
|
||||
#include <QtGui/qoffscreensurface.h>
|
||||
#include <QtGui/qbackingstore.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -53,12 +53,29 @@ QWasmBackingStore::QWasmBackingStore(QWasmCompositor *compositor, QWindow *windo
|
||||
|
||||
QWasmBackingStore::~QWasmBackingStore()
|
||||
{
|
||||
auto window = this->window();
|
||||
QWasmIntegration::get()->removeBackingStore(window);
|
||||
destroy();
|
||||
QWasmWindow *wasmWindow = static_cast<QWasmWindow *>(window->handle());
|
||||
if (wasmWindow)
|
||||
wasmWindow->setBackingStore(nullptr);
|
||||
}
|
||||
|
||||
void QWasmBackingStore::destroy()
|
||||
{
|
||||
if (m_texture->isCreated())
|
||||
if (m_texture->isCreated()) {
|
||||
auto context = m_compositor->context();
|
||||
auto currentContext = QOpenGLContext::currentContext();
|
||||
if (!currentContext || !QOpenGLContext::areSharing(context, currentContext)) {
|
||||
QOffscreenSurface offScreenSurface(m_compositor->screen()->screen());
|
||||
offScreenSurface.setFormat(context->format());
|
||||
offScreenSurface.create();
|
||||
context->makeCurrent(&offScreenSurface);
|
||||
m_texture->destroy();
|
||||
} else {
|
||||
m_texture->destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QPaintDevice *QWasmBackingStore::paintDevice()
|
||||
@ -81,9 +98,9 @@ void QWasmBackingStore::updateTexture()
|
||||
if (m_dirty.isNull())
|
||||
return;
|
||||
|
||||
if (m_recreateTexture && m_texture->isCreated()) {
|
||||
if (m_recreateTexture) {
|
||||
m_recreateTexture = false;
|
||||
m_texture->destroy();
|
||||
destroy();
|
||||
}
|
||||
|
||||
if (!m_texture->isCreated()) {
|
||||
|
@ -58,7 +58,6 @@ QWasmCompositedWindow::QWasmCompositedWindow()
|
||||
|
||||
QWasmCompositor::QWasmCompositor(QWasmScreen *screen)
|
||||
:QObject(screen)
|
||||
, m_frameBuffer(nullptr)
|
||||
, m_blitter(new QOpenGLTextureBlitter)
|
||||
, m_needComposit(false)
|
||||
, m_inFlush(false)
|
||||
@ -70,7 +69,6 @@ QWasmCompositor::QWasmCompositor(QWasmScreen *screen)
|
||||
|
||||
QWasmCompositor::~QWasmCompositor()
|
||||
{
|
||||
delete m_frameBuffer;
|
||||
destroy();
|
||||
}
|
||||
|
||||
@ -747,3 +745,8 @@ QWasmScreen *QWasmCompositor::screen()
|
||||
{
|
||||
return static_cast<QWasmScreen *>(parent());
|
||||
}
|
||||
|
||||
QOpenGLContext *QWasmCompositor::context()
|
||||
{
|
||||
return m_context.data();
|
||||
}
|
||||
|
@ -124,11 +124,13 @@ public:
|
||||
static QWasmTitleBarOptions makeTitleBarOptions(const QWasmWindow *window);
|
||||
static QRect titlebarRect(QWasmTitleBarOptions tb, QWasmCompositor::SubControls subcontrol);
|
||||
|
||||
QWasmScreen *screen();
|
||||
QOpenGLContext *context();
|
||||
|
||||
private slots:
|
||||
void frame();
|
||||
|
||||
private:
|
||||
QWasmScreen *screen();
|
||||
void notifyTopWindowChanged(QWasmWindow *window);
|
||||
void drawWindow(QOpenGLTextureBlitter *blitter, QWasmScreen *screen, QWasmWindow *window);
|
||||
void drawWindowContent(QOpenGLTextureBlitter *blitter, QWasmScreen *screen, QWasmWindow *window);
|
||||
@ -137,7 +139,6 @@ private:
|
||||
void drawWindowDecorations(QOpenGLTextureBlitter *blitter, QWasmScreen *screen, QWasmWindow *window);
|
||||
void drwPanelButton();
|
||||
|
||||
QImage *m_frameBuffer;
|
||||
QScopedPointer<QOpenGLContext> m_context;
|
||||
QScopedPointer<QOpenGLTextureBlitter> m_blitter;
|
||||
|
||||
|
@ -189,6 +189,11 @@ QPlatformBackingStore *QWasmIntegration::createPlatformBackingStore(QWindow *win
|
||||
#endif
|
||||
}
|
||||
|
||||
void QWasmIntegration::removeBackingStore(QWindow* window)
|
||||
{
|
||||
m_backingStores.remove(window);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
QPlatformOpenGLContext *QWasmIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
|
||||
{
|
||||
|
@ -89,6 +89,7 @@ public:
|
||||
void resizeScreen(const emscripten::val &canvas);
|
||||
void resizeAllScreens();
|
||||
void updateDpi();
|
||||
void removeBackingStore(QWindow* window);
|
||||
|
||||
private:
|
||||
mutable QWasmFontDatabase *m_fontDb;
|
||||
|
@ -181,7 +181,7 @@
|
||||
Run the installer,
|
||||
select custom installation and install the MySQL C Connector
|
||||
which matches your Qt installation (x86 or x64).
|
||||
After installation make sure that the needed files are there:
|
||||
After installation check that the needed files are there:
|
||||
\list
|
||||
\li \c {<MySQL dir>/lib/libmysql.lib}
|
||||
\li \c {<MySQL dir>/lib/libmysql.dll}
|
||||
@ -194,16 +194,20 @@
|
||||
\li \c {<MariaDB dir>/include/mysql.h}
|
||||
\endlist
|
||||
|
||||
Build the plugin as follows (here it is assumed that the MySQL
|
||||
C Connector is installed in
|
||||
\note As of MySQL 8.0.19, the C Connector is no longer offered as a standalone
|
||||
installable component. Instead, you can get \c{mysql.h} and \c{libmysql.*} by
|
||||
installing the full MySQL Server (x64 only) or the
|
||||
\l{https://downloads.mariadb.org/connector-c/}{MariaDB C Connector}.
|
||||
|
||||
Build the plugin as follows (here it is assumed that \c{<MySQL dir>} is
|
||||
\c{C:/Program Files/MySQL/MySQL Connector C 6.1}):
|
||||
|
||||
\snippet code/doc_src_sql-driver.qdoc 5
|
||||
|
||||
If you are not using a Microsoft compiler, replace \c nmake with \c
|
||||
mingw32-make in the line above.
|
||||
mingw32-make above.
|
||||
|
||||
When you distribute your application, remember to include libmysql.dll / libmariadb.dll
|
||||
When you distribute your application, remember to include \e libmysql.dll / \e libmariadb.dll
|
||||
in your installation package. It must be placed in the same folder
|
||||
as the application executable. \e libmysql.dll additionally needs the
|
||||
MSVC runtime libraries which can be installed with
|
||||
|
@ -1302,8 +1302,12 @@ QStringList QFileDialog::selectedFiles() const
|
||||
QStringList files;
|
||||
const QList<QUrl> userSelectedFiles = d->userSelectedFiles();
|
||||
files.reserve(userSelectedFiles.size());
|
||||
for (const QUrl &file : userSelectedFiles)
|
||||
for (const QUrl &file : userSelectedFiles) {
|
||||
if (file.isLocalFile() || file.isEmpty())
|
||||
files.append(file.toLocalFile());
|
||||
else
|
||||
files.append(file.toString());
|
||||
}
|
||||
if (files.isEmpty() && d->usingWidgets()) {
|
||||
const FileMode fm = fileMode();
|
||||
if (fm != ExistingFile && fm != ExistingFiles)
|
||||
@ -3151,7 +3155,7 @@ void QFileDialogPrivate::createWidgets()
|
||||
|
||||
// filetype
|
||||
qFileDialogUi->fileTypeCombo->setDuplicatesEnabled(false);
|
||||
qFileDialogUi->fileTypeCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
|
||||
qFileDialogUi->fileTypeCombo->setSizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow);
|
||||
qFileDialogUi->fileTypeCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
QObject::connect(qFileDialogUi->fileTypeCombo, SIGNAL(activated(int)),
|
||||
q, SLOT(_q_useNameFilter(int)));
|
||||
|
@ -2384,12 +2384,22 @@ bool QWizard::hasVisitedPage(int theid) const
|
||||
|
||||
\sa hasVisitedPage()
|
||||
*/
|
||||
QList<int> QWizard::visitedPages() const
|
||||
QList<int> QWizard::visitedIds() const
|
||||
{
|
||||
Q_D(const QWizard);
|
||||
return d->history;
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete Use visitedIds() instead
|
||||
*/
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QList<int> QWizard::visitedPages() const
|
||||
{
|
||||
return visitedIds();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Returns the list of page IDs.
|
||||
\since 4.5
|
||||
|
@ -128,7 +128,10 @@ public:
|
||||
void removePage(int id);
|
||||
QWizardPage *page(int id) const;
|
||||
bool hasVisitedPage(int id) const;
|
||||
QList<int> visitedPages() const; // ### Qt 6: visitedIds()?
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QList<int> visitedPages() const;
|
||||
#endif
|
||||
QList<int> visitedIds() const;
|
||||
QList<int> pageIds() const;
|
||||
void setStartId(int id);
|
||||
int startId() const;
|
||||
|
@ -90,7 +90,8 @@ public:
|
||||
template<class Obj1, typename Func1>
|
||||
QShortcut(const QKeySequence &key, QWidget *parent,
|
||||
const Obj1 *object1, Func1 slot1,
|
||||
Qt::ShortcutContext context = Qt::WindowShortcut)
|
||||
Qt::ShortcutContext context = Qt::WindowShortcut,
|
||||
typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj1*>::Value>::type* = 0)
|
||||
: QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
|
||||
{
|
||||
connect(this, &QShortcut::activated, object1, std::move(slot1));
|
||||
@ -98,7 +99,8 @@ public:
|
||||
template<class Obj1, typename Func1, typename Func2>
|
||||
QShortcut(const QKeySequence &key, QWidget *parent,
|
||||
const Obj1 *object1, Func1 slot1, Func2 slot2,
|
||||
Qt::ShortcutContext context = Qt::WindowShortcut)
|
||||
Qt::ShortcutContext context = Qt::WindowShortcut,
|
||||
typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj1*>::Value>::type* = 0)
|
||||
: QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
|
||||
{
|
||||
connect(this, &QShortcut::activated, object1, std::move(slot1));
|
||||
@ -108,7 +110,9 @@ public:
|
||||
QShortcut(const QKeySequence &key, QWidget *parent,
|
||||
const Obj1 *object1, Func1 slot1,
|
||||
const Obj2 *object2, Func2 slot2,
|
||||
Qt::ShortcutContext context = Qt::WindowShortcut)
|
||||
Qt::ShortcutContext context = Qt::WindowShortcut,
|
||||
typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj1*>::Value>::type* = 0,
|
||||
typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<Obj2*>::Value>::type* = 0)
|
||||
: QShortcut(key, parent, static_cast<const char*>(nullptr), static_cast<const char*>(nullptr), context)
|
||||
{
|
||||
connect(this, &QShortcut::activated, object1, std::move(slot1));
|
||||
|
@ -395,7 +395,7 @@ void QWidget::setAutoFillBackground(bool enabled)
|
||||
Every widget's constructor accepts one or two standard arguments:
|
||||
|
||||
\list 1
|
||||
\li \c{QWidget *parent = \nullptr} is the parent of the new widget.
|
||||
\li \c{QWidget *parent = nullptr} is the parent of the new widget.
|
||||
If it is \nullptr (the default), the new widget will be a window.
|
||||
If not, it will be a child of \e parent, and be constrained by
|
||||
\e parent's geometry (unless you specify Qt::Window as window flag).
|
||||
|
@ -894,7 +894,7 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const
|
||||
|
||||
\value AdjustToContents The combobox will always adjust to the contents
|
||||
\value AdjustToContentsOnFirstShow The combobox will adjust to its contents the first time it is shown.
|
||||
\value AdjustToMinimumContentsLength Use AdjustToContents or AdjustToContentsOnFirstShow instead.
|
||||
\omitvalue AdjustToMinimumContentsLength
|
||||
\value AdjustToMinimumContentsLengthWithIcon The combobox will adjust to \l minimumContentsLength plus space for an icon. For performance reasons use this policy on large models.
|
||||
*/
|
||||
|
||||
|
@ -137,8 +137,11 @@ public:
|
||||
enum SizeAdjustPolicy {
|
||||
AdjustToContents,
|
||||
AdjustToContentsOnFirstShow,
|
||||
AdjustToMinimumContentsLength, // ### Qt 6: remove
|
||||
AdjustToMinimumContentsLengthWithIcon
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
AdjustToMinimumContentsLength Q_DECL_ENUMERATOR_DEPRECATED_X(
|
||||
"Use AdjustToContents or AdjustToContentsOnFirstShow"), // ### Qt 6: remove
|
||||
#endif
|
||||
AdjustToMinimumContentsLengthWithIcon = AdjustToContentsOnFirstShow + 2
|
||||
};
|
||||
Q_ENUM(SizeAdjustPolicy)
|
||||
|
||||
|
@ -683,7 +683,8 @@ void QDateTimeEdit::setTimeRange(QTime min, QTime max)
|
||||
\brief The currently displayed fields of the date time edit.
|
||||
|
||||
Returns a bit set of the displayed sections for this format.
|
||||
\a setDisplayFormat(), displayFormat()
|
||||
|
||||
\sa setDisplayFormat(), displayFormat()
|
||||
*/
|
||||
|
||||
QDateTimeEdit::Sections QDateTimeEdit::displayedSections() const
|
||||
@ -696,7 +697,8 @@ QDateTimeEdit::Sections QDateTimeEdit::displayedSections() const
|
||||
\property QDateTimeEdit::currentSection
|
||||
|
||||
\brief The current section of the spinbox.
|
||||
\a setCurrentSection()
|
||||
|
||||
\sa setCurrentSection()
|
||||
*/
|
||||
|
||||
QDateTimeEdit::Section QDateTimeEdit::currentSection() const
|
||||
@ -776,8 +778,7 @@ int QDateTimeEdit::sectionCount() const
|
||||
the cursorPosition is 5, currentSectionIndex returns 1. If the
|
||||
cursorPosition is 3, currentSectionIndex is 0, and so on.
|
||||
|
||||
\a setCurrentSection()
|
||||
\sa currentSection()
|
||||
\sa setCurrentSection(), currentSection()
|
||||
*/
|
||||
|
||||
int QDateTimeEdit::currentSectionIndex() const
|
||||
@ -1448,7 +1449,16 @@ void QDateTimeEdit::fixup(QString &input) const
|
||||
QValidator::State state;
|
||||
int copy = d->edit->cursorPosition();
|
||||
|
||||
d->validateAndInterpret(input, copy, state, true);
|
||||
QDateTime value = d->validateAndInterpret(input, copy, state, true);
|
||||
/*
|
||||
String was valid, but the datetime still is not; use the time that
|
||||
has the same distance from epoch.
|
||||
CorrectToPreviousValue correction is handled by QAbstractSpinBox.
|
||||
*/
|
||||
if (!value.isValid() && d->correctionMode == QAbstractSpinBox::CorrectToNearestValue) {
|
||||
value = QDateTime::fromMSecsSinceEpoch(value.toMSecsSinceEpoch(), value.timeSpec());
|
||||
input = textFromDateTime(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2085,6 +2095,17 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c
|
||||
const int oldDay = v.date().day(calendar);
|
||||
|
||||
setDigit(v, sectionIndex, val);
|
||||
/*
|
||||
Stepping into a daylight saving time that doesn't exist,
|
||||
so use the time that has the same distance from epoch.
|
||||
*/
|
||||
if (!v.isValid()) {
|
||||
auto msecsSinceEpoch = v.toMSecsSinceEpoch();
|
||||
// decreasing from e.g 3am to 2am would get us back to 3am, but we want 1am
|
||||
if (steps < 0 && sn.type & HourSectionMask)
|
||||
msecsSinceEpoch -= 3600 * 1000;
|
||||
v = QDateTime::fromMSecsSinceEpoch(msecsSinceEpoch, v.timeSpec());
|
||||
}
|
||||
// if this sets year or month it will make
|
||||
// sure that days are lowered if needed.
|
||||
|
||||
|
@ -78,7 +78,10 @@ public:
|
||||
DockWidgetVerticalTitleBar = 0x08,
|
||||
|
||||
DockWidgetFeatureMask = 0x0f,
|
||||
AllDockWidgetFeatures = DockWidgetClosable|DockWidgetMovable|DockWidgetFloatable, // ### Qt 6: remove
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
AllDockWidgetFeatures Q_DECL_ENUMERATOR_DEPRECATED =
|
||||
DockWidgetClosable|DockWidgetMovable|DockWidgetFloatable, // ### Qt 6: remove
|
||||
#endif
|
||||
NoDockWidgetFeatures = 0x00,
|
||||
|
||||
Reserved = 0xff
|
||||
|
@ -713,7 +713,7 @@ void QLCDNumber::paintEvent(QPaintEvent *)
|
||||
void QLCDNumberPrivate::internalSetString(const QString& s)
|
||||
{
|
||||
Q_Q(QLCDNumber);
|
||||
QString buffer;
|
||||
QString buffer(ndigits, QChar());
|
||||
int i;
|
||||
int len = s.length();
|
||||
QBitArray newPoints(ndigits);
|
||||
|
@ -1202,8 +1202,8 @@ QMargins QLineEdit::textMargins() const
|
||||
|
||||
The input mask is an input template string. It can contain the following elements:
|
||||
\table
|
||||
\row \li Mask Characters \li Defines the class of input characters that are
|
||||
considered valid in this position
|
||||
\row \li Mask Characters \li Defines the \l {QChar::} {Category} of input characters
|
||||
that are considered valid in this position
|
||||
\row \li Meta Characters \li Various special meanings
|
||||
\row \li Separators \li All other characters are regarded as immutable separators
|
||||
\endtable
|
||||
@ -1212,17 +1212,21 @@ QMargins QLineEdit::textMargins() const
|
||||
|
||||
\table
|
||||
\header \li Mask Character \li Meaning
|
||||
\row \li \c A \li ASCII alphabetic character required. A-Z, a-z.
|
||||
\row \li \c a \li ASCII alphabetic character permitted but not required.
|
||||
\row \li \c N \li ASCII alphanumeric character required. A-Z, a-z, 0-9.
|
||||
\row \li \c n \li ASCII alphanumeric character permitted but not required.
|
||||
\row \li \c A \li character of the Letter category required, such as A-Z, a-z.
|
||||
\row \li \c a \li character of the Letter category permitted but not required.
|
||||
\row \li \c N \li character of the Letter or Number category required, such as
|
||||
A-Z, a-z, 0-9.
|
||||
\row \li \c n \li character of the Letter or Number category permitted but not required.
|
||||
\row \li \c X \li Any non-blank character required.
|
||||
\row \li \c x \li Any non-blank character permitted but not required.
|
||||
\row \li \c 9 \li ASCII digit required. 0-9.
|
||||
\row \li \c 0 \li ASCII digit permitted but not required.
|
||||
\row \li \c D \li ASCII digit required. 1-9.
|
||||
\row \li \c d \li ASCII digit permitted but not required (1-9).
|
||||
\row \li \c # \li ASCII digit or plus/minus sign permitted but not required.
|
||||
\row \li \c 9 \li character of the Number category required, e.g 0-9.
|
||||
\row \li \c 0 \li character of the Number category permitted but not required.
|
||||
\row \li \c D \li character of the Number category and larger than zero required,
|
||||
such as 1-9
|
||||
\row \li \c d \li character of the Number category and larger than zero permitted but not
|
||||
required, such as 1-9.
|
||||
\row \li \c # \li character of the Number category, or plus/minus sign permitted but not
|
||||
required.
|
||||
\row \li \c H \li Hexadecimal character required. A-F, a-f, 0-9.
|
||||
\row \li \c h \li Hexadecimal character permitted but not required.
|
||||
\row \li \c B \li Binary character required. 0-1.
|
||||
@ -1264,7 +1268,7 @@ QMargins QLineEdit::textMargins() const
|
||||
To get range control (e.g., for an IP address) use masks together
|
||||
with \l{setValidator()}{validators}.
|
||||
|
||||
\sa maxLength
|
||||
\sa maxLength, QChar::isLetter(), QChar::isNumber(), QChar::digitValue()
|
||||
*/
|
||||
QString QLineEdit::inputMask() const
|
||||
{
|
||||
|
@ -83,7 +83,6 @@ protected:
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
void resizeEvent(QResizeEvent *) override;
|
||||
|
||||
// ### Qt 6: consider making reformat() and hideOrShow() private
|
||||
void reformat();
|
||||
void hideOrShow();
|
||||
bool event(QEvent *) override;
|
||||
|
@ -2335,14 +2335,15 @@ void tst_QSettings::testRegistry32And64Bit()
|
||||
|
||||
void tst_QSettings::trailingWhitespace()
|
||||
{
|
||||
const QString path = settingsPath("trailingWhitespace");
|
||||
{
|
||||
QSettings s("tst_QSettings_trailingWhitespace");
|
||||
QSettings s(path, QSettings::IniFormat);
|
||||
s.setValue("trailingSpace", "x ");
|
||||
s.setValue("trailingTab", "x\t");
|
||||
s.setValue("trailingNewline", "x\n");
|
||||
}
|
||||
{
|
||||
QSettings s("tst_QSettings_trailingWhitespace");
|
||||
QSettings s(path, QSettings::IniFormat);
|
||||
QCOMPARE(s.value("trailingSpace").toString(), QLatin1String("x "));
|
||||
QCOMPARE(s.value("trailingTab").toString(), QLatin1String("x\t"));
|
||||
QCOMPARE(s.value("trailingNewline").toString(), QLatin1String("x\n"));
|
||||
|
@ -580,11 +580,26 @@ void tst_QDeadlineTimer::stdchrono()
|
||||
auto now = QDeadlineTimer::current(timerType);
|
||||
QTest::qSleep(minResolution);
|
||||
|
||||
auto sampling_start = steady_clock::now();
|
||||
auto steady_deadline = now.deadline<steady_clock>();
|
||||
auto system_deadline = now.deadline<system_clock>();
|
||||
auto steady_after = steady_clock::now();
|
||||
auto system_after = system_clock::now();
|
||||
auto sampling_end = steady_clock::now();
|
||||
|
||||
auto sampling_diff = duration_cast<milliseconds>(sampling_end - sampling_start).count();
|
||||
if (sampling_diff > minResolution/2) {
|
||||
qWarning() << "Sampling clock took" << sampling_diff << "ms";
|
||||
QSKIP("Sampling clock took too long, aborting test", Abort);
|
||||
}
|
||||
auto total_diff = duration_cast<milliseconds>(steady_after - steady_before).count();
|
||||
if (total_diff >= 3*minResolution) {
|
||||
qWarning() << "Measurement took" << total_diff << "ms";
|
||||
QSKIP("Measurement took too long, aborting test", Abort);
|
||||
}
|
||||
|
||||
{
|
||||
auto diff = duration_cast<milliseconds>(steady_after - now.deadline<steady_clock>());
|
||||
auto diff = duration_cast<milliseconds>(steady_after - steady_deadline);
|
||||
QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count())));
|
||||
QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count())));
|
||||
QDeadlineTimer dt_after(steady_after, timerType);
|
||||
@ -592,7 +607,7 @@ void tst_QDeadlineTimer::stdchrono()
|
||||
("now = " + QLocale().toString(now.deadlineNSecs()) +
|
||||
"; after = " + QLocale().toString(dt_after.deadlineNSecs())).toLatin1());
|
||||
|
||||
diff = duration_cast<milliseconds>(now.deadline<steady_clock>() - steady_before);
|
||||
diff = duration_cast<milliseconds>(steady_deadline - steady_before);
|
||||
QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count())));
|
||||
QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count())));
|
||||
QDeadlineTimer dt_before(steady_before, timerType);
|
||||
@ -601,7 +616,7 @@ void tst_QDeadlineTimer::stdchrono()
|
||||
"; before = " + QLocale().toString(dt_before.deadlineNSecs())).toLatin1());
|
||||
}
|
||||
{
|
||||
auto diff = duration_cast<milliseconds>(system_after - now.deadline<system_clock>());
|
||||
auto diff = duration_cast<milliseconds>(system_after - system_deadline);
|
||||
QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count())));
|
||||
QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count())));
|
||||
QDeadlineTimer dt_after(system_after, timerType);
|
||||
@ -609,7 +624,7 @@ void tst_QDeadlineTimer::stdchrono()
|
||||
("now = " + QLocale().toString(now.deadlineNSecs()) +
|
||||
"; after = " + QLocale().toString(dt_after.deadlineNSecs())).toLatin1());
|
||||
|
||||
diff = duration_cast<milliseconds>(now.deadline<system_clock>() - system_before);
|
||||
diff = duration_cast<milliseconds>(system_deadline - system_before);
|
||||
QVERIFY2(diff.count() > minResolution/2, QByteArray::number(qint64(diff.count())));
|
||||
QVERIFY2(diff.count() < 3*minResolution/2, QByteArray::number(qint64(diff.count())));
|
||||
QDeadlineTimer dt_before(system_before, timerType);
|
||||
|
@ -7416,6 +7416,12 @@ void tst_QObject::checkArgumentsForNarrowing()
|
||||
FITS(bool, const QObject *&);
|
||||
FITS(int (*)(bool), void (QObject::*)());
|
||||
|
||||
{
|
||||
// wg21.link/P1957
|
||||
NARROWS(char*, bool);
|
||||
NARROWS(void (QObject::*)(), bool);
|
||||
}
|
||||
|
||||
#undef IS_UNSCOPED_ENUM_SIGNED
|
||||
|
||||
#undef NARROWS_IF
|
||||
|
@ -397,8 +397,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
QXmlStreamReader reader(&inputFile);
|
||||
|
||||
/* See testcases.dtd which reads: 'Nonvalidating parsers
|
||||
* must also accept "invalid" testcases, but validating ones must reject them.' */
|
||||
if(type == QLatin1String("invalid") || type == QLatin1String("valid"))
|
||||
@ -583,6 +581,8 @@ private slots:
|
||||
void roundTrip() const;
|
||||
void roundTrip_data() const;
|
||||
|
||||
void entityExpansionLimit() const;
|
||||
|
||||
private:
|
||||
static QByteArray readFile(const QString &filename);
|
||||
|
||||
@ -1755,6 +1755,46 @@ void tst_QXmlStream::roundTrip_data() const
|
||||
"</root>\n";
|
||||
}
|
||||
|
||||
void tst_QXmlStream::entityExpansionLimit() const
|
||||
{
|
||||
QString xml = QStringLiteral("<?xml version=\"1.0\"?>"
|
||||
"<!DOCTYPE foo ["
|
||||
"<!ENTITY a \"0123456789\" >"
|
||||
"<!ENTITY b \"&a;&a;&a;&a;&a;&a;&a;&a;&a;&a;\" >"
|
||||
"<!ENTITY c \"&b;&b;&b;&b;&b;&b;&b;&b;&b;&b;\" >"
|
||||
"<!ENTITY d \"&c;&c;&c;&c;&c;&c;&c;&c;&c;&c;\" >"
|
||||
"]>"
|
||||
"<foo>&d;&d;&d;</foo>");
|
||||
{
|
||||
QXmlStreamReader reader(xml);
|
||||
QCOMPARE(reader.entityExpansionLimit(), 4096);
|
||||
do {
|
||||
reader.readNext();
|
||||
} while (!reader.atEnd());
|
||||
QCOMPARE(reader.error(), QXmlStreamReader::NotWellFormedError);
|
||||
}
|
||||
|
||||
// &d; expands to 10k characters, minus the 3 removed (&d;) means it should fail
|
||||
// with a limit of 9996 chars and pass with 9997
|
||||
{
|
||||
QXmlStreamReader reader(xml);
|
||||
reader.setEntityExpansionLimit(9996);
|
||||
do {
|
||||
reader.readNext();
|
||||
} while (!reader.atEnd());
|
||||
|
||||
QCOMPARE(reader.error(), QXmlStreamReader::NotWellFormedError);
|
||||
}
|
||||
{
|
||||
QXmlStreamReader reader(xml);
|
||||
reader.setEntityExpansionLimit(9997);
|
||||
do {
|
||||
reader.readNext();
|
||||
} while (!reader.atEnd());
|
||||
QCOMPARE(reader.error(), QXmlStreamReader::NoError);
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QXmlStream::roundTrip() const
|
||||
{
|
||||
QFETCH(QString, in);
|
||||
|
@ -1081,7 +1081,7 @@ private slots:
|
||||
void acceptNewConnection()
|
||||
{
|
||||
serverSocket = server.nextPendingConnection();
|
||||
connect(serverSocket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
connect(serverSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
this, SLOT(remoteHostClosed()));
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,7 @@ private slots:
|
||||
void mnemonicTextWidth();
|
||||
void leadingBelowLine();
|
||||
void elidedMetrics();
|
||||
void zeroWidthMetrics();
|
||||
};
|
||||
|
||||
void tst_QFontMetrics::same()
|
||||
@ -358,5 +359,28 @@ void tst_QFontMetrics::elidedMetrics()
|
||||
QFontDatabase::removeApplicationFont(id);
|
||||
}
|
||||
|
||||
void tst_QFontMetrics::zeroWidthMetrics()
|
||||
{
|
||||
QString zwnj(QChar(0x200c));
|
||||
QString zwsp(QChar(0x200b));
|
||||
|
||||
QFont font;
|
||||
QFontMetricsF fm(font);
|
||||
QCOMPARE(fm.horizontalAdvance(zwnj), 0);
|
||||
QCOMPARE(fm.horizontalAdvance(zwsp), 0);
|
||||
QCOMPARE(fm.boundingRect(zwnj).width(), 0);
|
||||
QCOMPARE(fm.boundingRect(zwsp).width(), 0);
|
||||
|
||||
QString string1 = QStringLiteral("(") + zwnj + QStringLiteral(")");
|
||||
QString string2 = QStringLiteral("(") + zwnj + zwnj + QStringLiteral(")");
|
||||
QString string3 = QStringLiteral("(") + zwsp + QStringLiteral(")");
|
||||
QString string4 = QStringLiteral("(") + zwsp + zwsp + QStringLiteral(")");
|
||||
|
||||
QCOMPARE(fm.horizontalAdvance(string1), fm.horizontalAdvance(string2));
|
||||
QCOMPARE(fm.horizontalAdvance(string3), fm.horizontalAdvance(string4));
|
||||
QCOMPARE(fm.boundingRect(string1).width(), fm.boundingRect(string2).width());
|
||||
QCOMPARE(fm.boundingRect(string3).width(), fm.boundingRect(string4).width());
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QFontMetrics)
|
||||
#include "tst_qfontmetrics.moc"
|
||||
|
@ -190,7 +190,7 @@ public:
|
||||
if (!s.peerAddress().isNull())
|
||||
debug << ", peer=" << s.peerAddress().toString() << ':' << s.peerPort();
|
||||
debug << ", type=" << s.socketType() << ", state=" << s.state()
|
||||
<< ", error=" << s.socketError() << ": " << s.errorString();
|
||||
<< ", error=" << s.error() << ": " << s.errorString();
|
||||
return result.toLocal8Bit();
|
||||
}
|
||||
#endif // QT_NETWORK_LIB
|
||||
|
@ -279,7 +279,7 @@ void tst_Http2::singleRequest()
|
||||
QVERIFY(prefaceOK);
|
||||
QVERIFY(serverGotSettingsACK);
|
||||
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(reply->isFinished());
|
||||
}
|
||||
|
||||
@ -444,7 +444,7 @@ void tst_Http2::pushPromise()
|
||||
QVERIFY(prefaceOK);
|
||||
QVERIFY(serverGotSettingsACK);
|
||||
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(reply->isFinished());
|
||||
|
||||
// Now, the most interesting part!
|
||||
@ -466,7 +466,7 @@ void tst_Http2::pushPromise()
|
||||
QCOMPARE(nSentRequests, 0);
|
||||
// Decreased by replyFinished():
|
||||
QCOMPARE(nRequests, 0);
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(reply->isFinished());
|
||||
}
|
||||
|
||||
@ -511,7 +511,7 @@ void tst_Http2::goaway()
|
||||
QNetworkRequest request(url);
|
||||
request.setAttribute(QNetworkRequest::Http2AllowedAttribute, QVariant(true));
|
||||
replies[i] = manager->get(request);
|
||||
QCOMPARE(replies[i]->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(replies[i]->error(), QNetworkReply::NoError);
|
||||
void (QNetworkReply::*errorSignal)(QNetworkReply::NetworkError) =
|
||||
&QNetworkReply::error;
|
||||
connect(replies[i], errorSignal, this, &tst_Http2::replyFinishedWithError);
|
||||
@ -671,7 +671,7 @@ void tst_Http2::connectToHost()
|
||||
connect(reply, &QNetworkReply::finished, [this, reply]() {
|
||||
--nRequests;
|
||||
eventLoop.exitLoop();
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(reply->isFinished());
|
||||
// Nothing received back:
|
||||
QVERIFY(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).isNull());
|
||||
@ -698,7 +698,7 @@ void tst_Http2::connectToHost()
|
||||
QVERIFY(prefaceOK);
|
||||
QVERIFY(serverGotSettingsACK);
|
||||
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
QVERIFY(reply->isFinished());
|
||||
}
|
||||
|
||||
@ -927,10 +927,10 @@ void tst_Http2::replyFinished()
|
||||
QVERIFY(nRequests);
|
||||
|
||||
if (const auto reply = qobject_cast<QNetworkReply *>(sender())) {
|
||||
if (reply->networkError() != QNetworkReply::NoError)
|
||||
if (reply->error() != QNetworkReply::NoError)
|
||||
stopEventLoop();
|
||||
|
||||
QCOMPARE(reply->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
|
||||
const QVariant http2Used(reply->attribute(QNetworkRequest::Http2WasUsedAttribute));
|
||||
if (!http2Used.isValid() || !http2Used.toBool())
|
||||
@ -960,9 +960,9 @@ void tst_Http2::replyFinishedWithError()
|
||||
if (const auto reply = qobject_cast<QNetworkReply *>(sender())) {
|
||||
// For now this is a 'generic' code, it just verifies some error was
|
||||
// reported without testing its type.
|
||||
if (reply->networkError() == QNetworkReply::NoError)
|
||||
if (reply->error() == QNetworkReply::NoError)
|
||||
stopEventLoop();
|
||||
QVERIFY(reply->networkError() != QNetworkReply::NoError);
|
||||
QVERIFY(reply->error() != QNetworkReply::NoError);
|
||||
}
|
||||
|
||||
--nRequests;
|
||||
|
@ -322,10 +322,10 @@ void tst_QAbstractNetworkCache::runTest()
|
||||
|
||||
QByteArray secondData = reply2->readAll();
|
||||
if (!fetchFromCache && cacheLoadControl == QNetworkRequest::AlwaysCache) {
|
||||
QCOMPARE(reply2->networkError(), QNetworkReply::ContentNotFoundError);
|
||||
QCOMPARE(reply2->error(), QNetworkReply::ContentNotFoundError);
|
||||
QCOMPARE(secondData, QByteArray());
|
||||
} else {
|
||||
QCOMPARE(reply2->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply2->error(), QNetworkReply::NoError);
|
||||
QCOMPARE(QString(secondData), QString(goodData));
|
||||
QCOMPARE(secondData, goodData);
|
||||
QCOMPARE(reply2->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
|
||||
@ -375,12 +375,12 @@ void tst_QAbstractNetworkCache::checkSynchronous()
|
||||
|
||||
QByteArray secondData = reply2->readAll();
|
||||
if (!fetchFromCache && cacheLoadControl == QNetworkRequest::AlwaysCache) {
|
||||
QCOMPARE(reply2->networkError(), QNetworkReply::ContentNotFoundError);
|
||||
QCOMPARE(reply2->error(), QNetworkReply::ContentNotFoundError);
|
||||
QCOMPARE(secondData, QByteArray());
|
||||
} else {
|
||||
if (reply2->networkError() != QNetworkReply::NoError)
|
||||
if (reply2->error() != QNetworkReply::NoError)
|
||||
qDebug() << reply2->errorString();
|
||||
QCOMPARE(reply2->networkError(), QNetworkReply::NoError);
|
||||
QCOMPARE(reply2->error(), QNetworkReply::NoError);
|
||||
QCOMPARE(QString(secondData), QString(goodData));
|
||||
QCOMPARE(secondData, goodData);
|
||||
QCOMPARE(reply2->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -270,12 +270,12 @@ void tst_QHttpSocketEngine::errorTest()
|
||||
socket.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, hostname, port, username, username));
|
||||
socket.connectToHost("0.1.2.3", 12345);
|
||||
|
||||
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
&QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
QTestEventLoop::instance().enterLoop(30);
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
|
||||
QCOMPARE(int(socket.socketError()), expectedError);
|
||||
QCOMPARE(int(socket.error()), expectedError);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -283,12 +283,12 @@ void tst_QSocks5SocketEngine::errorTest()
|
||||
socket.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, hostname, port, username, username));
|
||||
socket.connectToHost("0.1.2.3", 12345);
|
||||
|
||||
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
&QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
QTestEventLoop::instance().enterLoop(10);
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
|
||||
QCOMPARE(int(socket.socketError()), expectedError);
|
||||
QCOMPARE(int(socket.error()), expectedError);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -753,7 +753,7 @@ void tst_QSocks5SocketEngine::downloadBigFile()
|
||||
QTestEventLoop::instance().exitLoop();
|
||||
});
|
||||
|
||||
connect(&socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),
|
||||
connect(&socket, &QAbstractSocket::errorOccurred,
|
||||
[&socket, &stopWatch] (QAbstractSocket::SocketError errorCode)
|
||||
{
|
||||
qWarning().noquote().nospace() << QTest::currentTestFunction()
|
||||
@ -1006,12 +1006,12 @@ void tst_QSocks5SocketEngine::incomplete()
|
||||
|
||||
connect(&socket, SIGNAL(connected()),
|
||||
&QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
&QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
QTestEventLoop::instance().enterLoop(70);
|
||||
QVERIFY(!QTestEventLoop::instance().timeout());
|
||||
|
||||
QCOMPARE(socket.socketError(), QAbstractSocket::ProxyConnectionClosedError);
|
||||
QCOMPARE(socket.error(), QAbstractSocket::ProxyConnectionClosedError);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -493,7 +493,7 @@ void tst_QTcpSocket::constructing()
|
||||
QCOMPARE(socket->peerAddress(), QHostAddress());
|
||||
QCOMPARE(socket->readChannelCount(), 0);
|
||||
QCOMPARE(socket->writeChannelCount(), 0);
|
||||
QCOMPARE(socket->socketError(), QTcpSocket::UnknownSocketError);
|
||||
QCOMPARE(socket->error(), QTcpSocket::UnknownSocketError);
|
||||
QCOMPARE(socket->errorString(), QString("Unknown error"));
|
||||
|
||||
// Check the state of the socket layer?
|
||||
@ -603,7 +603,7 @@ void tst_QTcpSocket::bind()
|
||||
}
|
||||
|
||||
bool bindSuccess = socket->bind(addr, port);
|
||||
if (!bindSuccess && randomPort && socket->socketError() == QTcpSocket::AddressInUseError) {
|
||||
if (!bindSuccess && randomPort && socket->error() == QTcpSocket::AddressInUseError) {
|
||||
// we may have been unlucky and hit an already open port, so try another
|
||||
--attemptsLeft;
|
||||
continue;
|
||||
@ -730,7 +730,7 @@ void tst_QTcpSocket::setInvalidSocketDescriptor()
|
||||
QVERIFY(!socket->setSocketDescriptor(-5, QTcpSocket::UnconnectedState));
|
||||
QCOMPARE(socket->socketDescriptor(), (qintptr)-1);
|
||||
|
||||
QCOMPARE(socket->socketError(), QTcpSocket::UnsupportedSocketOperationError);
|
||||
QCOMPARE(socket->error(), QTcpSocket::UnsupportedSocketOperationError);
|
||||
|
||||
delete socket;
|
||||
}
|
||||
@ -893,7 +893,7 @@ void tst_QTcpSocket::hostNotFound()
|
||||
"when we expect 404", Continue);
|
||||
}
|
||||
#endif
|
||||
QCOMPARE(int(socket->socketError()), int(QTcpSocket::HostNotFoundError));
|
||||
QCOMPARE(int(socket->error()), int(QTcpSocket::HostNotFoundError));
|
||||
|
||||
delete socket;
|
||||
}
|
||||
@ -919,7 +919,7 @@ void tst_QTcpSocket::timeoutConnect()
|
||||
QVERIFY(timer.elapsed() < 150);
|
||||
QVERIFY(!socket->waitForConnected(1000)); //200ms is too short when using SOCKS proxy authentication
|
||||
QCOMPARE(socket->state(), QTcpSocket::UnconnectedState);
|
||||
QCOMPARE(int(socket->socketError()), int(QTcpSocket::SocketTimeoutError));
|
||||
QCOMPARE(int(socket->error()), int(QTcpSocket::SocketTimeoutError));
|
||||
QCOMPARE(socket->readChannelCount(), 0);
|
||||
QCOMPARE(socket->writeChannelCount(), 0);
|
||||
|
||||
@ -1238,7 +1238,7 @@ void tst_QTcpSocket::openCloseOpenClose()
|
||||
QCOMPARE(socket->localAddress(), QHostAddress());
|
||||
QCOMPARE((int) socket->peerPort(), 0);
|
||||
QCOMPARE(socket->peerAddress(), QHostAddress());
|
||||
QCOMPARE(socket->socketError(), QTcpSocket::UnknownSocketError);
|
||||
QCOMPARE(socket->error(), QTcpSocket::UnknownSocketError);
|
||||
QCOMPARE(socket->errorString(), QString("Unknown error"));
|
||||
|
||||
QCOMPARE(socket->state(), QTcpSocket::UnconnectedState);
|
||||
@ -1392,7 +1392,7 @@ protected:
|
||||
while (!quit) {
|
||||
if (socket->waitForDisconnected(500))
|
||||
break;
|
||||
if (socket->socketError() != QAbstractSocket::SocketTimeoutError)
|
||||
if (socket->error() != QAbstractSocket::SocketTimeoutError)
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1628,8 +1628,8 @@ void tst_QTcpSocket::readLine()
|
||||
|
||||
QVERIFY(!socket->waitForReadyRead(100));
|
||||
QCOMPARE(socket->readLine(buffer, sizeof(buffer)), qint64(0));
|
||||
QVERIFY(socket->socketError() == QAbstractSocket::SocketTimeoutError
|
||||
|| socket->socketError() == QAbstractSocket::RemoteHostClosedError);
|
||||
QVERIFY(socket->error() == QAbstractSocket::SocketTimeoutError
|
||||
|| socket->error() == QAbstractSocket::RemoteHostClosedError);
|
||||
QCOMPARE(socket->bytesAvailable(), qint64(0));
|
||||
|
||||
socket->close();
|
||||
@ -1778,11 +1778,11 @@ void tst_QTcpSocket::dontCloseOnTimeout()
|
||||
QTcpSocket *socket = newSocket();
|
||||
socket->connectToHost(serverAddress, server.serverPort());
|
||||
QVERIFY(!socket->waitForReadyRead(100));
|
||||
QCOMPARE(socket->socketError(), QTcpSocket::SocketTimeoutError);
|
||||
QCOMPARE(socket->error(), QTcpSocket::SocketTimeoutError);
|
||||
QVERIFY(socket->isOpen());
|
||||
|
||||
QVERIFY(!socket->waitForDisconnected(100));
|
||||
QCOMPARE(socket->socketError(), QTcpSocket::SocketTimeoutError);
|
||||
QCOMPARE(socket->error(), QTcpSocket::SocketTimeoutError);
|
||||
QVERIFY(socket->isOpen());
|
||||
|
||||
delete socket;
|
||||
@ -2019,14 +2019,14 @@ void tst_QTcpSocket::remoteCloseError()
|
||||
QCOMPARE(clientSocket->bytesAvailable(), qint64(5));
|
||||
|
||||
qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError");
|
||||
QSignalSpy errorSpy(clientSocket, SIGNAL(error(QAbstractSocket::SocketError)));
|
||||
QSignalSpy errorSpy(clientSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
|
||||
QSignalSpy disconnectedSpy(clientSocket, SIGNAL(disconnected()));
|
||||
|
||||
clientSocket->write("World");
|
||||
serverSocket->disconnectFromHost();
|
||||
|
||||
tmpSocket = clientSocket;
|
||||
connect(clientSocket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
connect(clientSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
this, SLOT(remoteCloseErrorSlot()));
|
||||
|
||||
enterLoop(30);
|
||||
@ -2034,7 +2034,7 @@ void tst_QTcpSocket::remoteCloseError()
|
||||
|
||||
QCOMPARE(disconnectedSpy.count(), 1);
|
||||
QCOMPARE(errorSpy.count(), 1);
|
||||
QCOMPARE(clientSocket->socketError(), QAbstractSocket::RemoteHostClosedError);
|
||||
QCOMPARE(clientSocket->error(), QAbstractSocket::RemoteHostClosedError);
|
||||
|
||||
delete serverSocket;
|
||||
|
||||
@ -2079,7 +2079,7 @@ void tst_QTcpSocket::nestedEventLoopInErrorSlot()
|
||||
{
|
||||
QTcpSocket *socket = newSocket();
|
||||
QPointer<QTcpSocket> p(socket);
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(enterLoopSlot()));
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this, SLOT(enterLoopSlot()));
|
||||
|
||||
socket->connectToHost("hostnotfoundhostnotfound.qt-project.org", 9999);
|
||||
enterLoop(30);
|
||||
@ -2109,7 +2109,7 @@ void tst_QTcpSocket::connectToHostError()
|
||||
QFETCH(int, port);
|
||||
QFETCH(QAbstractSocket::SocketError, expectedError);
|
||||
|
||||
connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),[&](QAbstractSocket::SocketError socketError){
|
||||
connect(socket, &QAbstractSocket::errorOccurred, [&](QAbstractSocket::SocketError socketError){
|
||||
error = socketError;
|
||||
});
|
||||
socket->connectToHost(host, port); // no service running here, one suspects
|
||||
@ -2326,7 +2326,7 @@ void tst_QTcpSocket::abortiveClose()
|
||||
|
||||
qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError");
|
||||
QSignalSpy readyReadSpy(clientSocket, SIGNAL(readyRead()));
|
||||
QSignalSpy errorSpy(clientSocket, SIGNAL(error(QAbstractSocket::SocketError)));
|
||||
QSignalSpy errorSpy(clientSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
|
||||
|
||||
connect(clientSocket, SIGNAL(disconnected()), this, SLOT(exitLoopSlot()));
|
||||
QTimer::singleShot(0, this, SLOT(abortiveClose_abortSlot()));
|
||||
@ -2402,7 +2402,7 @@ void tst_QTcpSocket::zeroAndMinusOneReturns()
|
||||
|
||||
socket->write("GET / HTTP/1.0\r\n\r\n");
|
||||
QVERIFY(socket->waitForDisconnected(15000));
|
||||
QCOMPARE(socket->socketError(), QAbstractSocket::RemoteHostClosedError);
|
||||
QCOMPARE(socket->error(), QAbstractSocket::RemoteHostClosedError);
|
||||
|
||||
QCOMPARE(socket->write("BLUBBER"), qint64(-1));
|
||||
QVERIFY(socket->getChar(c));
|
||||
@ -2439,19 +2439,19 @@ void tst_QTcpSocket::connectionRefused()
|
||||
|
||||
QTcpSocket *socket = newSocket();
|
||||
QSignalSpy stateSpy(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
|
||||
QSignalSpy errorSpy(socket, SIGNAL(error(QAbstractSocket::SocketError)));
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
QSignalSpy errorSpy(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
&QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
|
||||
socket->connectToHost(QtNetworkSettings::httpServerName(), 144);
|
||||
|
||||
enterLoop(10);
|
||||
disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
disconnect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
|
||||
&QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
QVERIFY2(!timeout(), "Network timeout");
|
||||
|
||||
QCOMPARE(socket->state(), QAbstractSocket::UnconnectedState);
|
||||
QCOMPARE(socket->socketError(), QAbstractSocket::ConnectionRefusedError);
|
||||
QCOMPARE(socket->error(), QAbstractSocket::ConnectionRefusedError);
|
||||
|
||||
QCOMPARE(stateSpy.count(), 3);
|
||||
QCOMPARE(qvariant_cast<QAbstractSocket::SocketState>(stateSpy.at(0).at(0)), QAbstractSocket::HostLookupState);
|
||||
@ -2574,7 +2574,7 @@ void tst_QTcpSocket::connectToMultiIP()
|
||||
socket->connectToHost("multi.dev.qt-project.org", 81);
|
||||
QVERIFY(!socket->waitForConnected(2000));
|
||||
QVERIFY(stopWatch.elapsed() < 2000);
|
||||
QCOMPARE(socket->socketError(), QAbstractSocket::SocketTimeoutError);
|
||||
QCOMPARE(socket->error(), QAbstractSocket::SocketTimeoutError);
|
||||
|
||||
delete socket;
|
||||
#endif
|
||||
@ -2760,7 +2760,7 @@ void tst_QTcpSocket::taskQtBug5799ConnectionErrorWaitForConnected()
|
||||
socket.waitForConnected(10000);
|
||||
QVERIFY2(timer.elapsed() < 9900, "Connection to closed port timed out instead of refusing, something is wrong");
|
||||
QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, "Socket connected unexpectedly!");
|
||||
QVERIFY2(socket.socketError() == QAbstractSocket::ConnectionRefusedError,
|
||||
QVERIFY2(socket.error() == QAbstractSocket::ConnectionRefusedError,
|
||||
QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit());
|
||||
}
|
||||
|
||||
@ -2773,13 +2773,13 @@ void tst_QTcpSocket::taskQtBug5799ConnectionErrorEventLoop()
|
||||
// check that we get a proper error connecting to port 12346
|
||||
// This testcase uses an event loop
|
||||
QTcpSocket socket;
|
||||
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
socket.connectToHost(QtNetworkSettings::httpServerName(), 12346);
|
||||
|
||||
QTestEventLoop::instance().enterLoop(10);
|
||||
QVERIFY2(!QTestEventLoop::instance().timeout(), "Connection to closed port timed out instead of refusing, something is wrong");
|
||||
QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, "Socket connected unexpectedly!");
|
||||
QVERIFY2(socket.socketError() == QAbstractSocket::ConnectionRefusedError,
|
||||
QVERIFY2(socket.error() == QAbstractSocket::ConnectionRefusedError,
|
||||
QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit());
|
||||
}
|
||||
|
||||
@ -2789,12 +2789,12 @@ void tst_QTcpSocket::taskQtBug7054TimeoutErrorResetting()
|
||||
|
||||
socket->connectToHost(QtNetworkSettings::httpServerName(), 443);
|
||||
QVERIFY(socket->waitForConnected(5*1000));
|
||||
QCOMPARE(socket->socketError(), QAbstractSocket::UnknownSocketError);
|
||||
QCOMPARE(socket->error(), QAbstractSocket::UnknownSocketError);
|
||||
|
||||
// We connected to the HTTPS port. Wait two seconds to receive data. We will receive
|
||||
// nothing because we would need to start the SSL handshake
|
||||
QVERIFY(!socket->waitForReadyRead(2*1000));
|
||||
QCOMPARE(socket->socketError(), QAbstractSocket::SocketTimeoutError);
|
||||
QCOMPARE(socket->error(), QAbstractSocket::SocketTimeoutError);
|
||||
|
||||
// Now write some crap to make the server disconnect us. 4 lines are enough.
|
||||
socket->write("a\r\nb\r\nc\r\nd\r\n");
|
||||
@ -2804,7 +2804,7 @@ void tst_QTcpSocket::taskQtBug7054TimeoutErrorResetting()
|
||||
// should get a better error since the server disconnected us
|
||||
QVERIFY(!socket->waitForReadyRead(2*1000));
|
||||
// It must NOT be the SocketTimeoutError that had been set before
|
||||
QCOMPARE(socket->socketError(), QAbstractSocket::RemoteHostClosedError);
|
||||
QCOMPARE(socket->error(), QAbstractSocket::RemoteHostClosedError);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
@ -2862,7 +2862,7 @@ void tst_QTcpSocket::invalidProxy()
|
||||
|
||||
// note: the following test is not a hard failure.
|
||||
// Sometimes, error codes change for the better
|
||||
QTEST(int(socket->socketError()), "expectedError");
|
||||
QTEST(int(socket->error()), "expectedError");
|
||||
|
||||
delete socket;
|
||||
}
|
||||
@ -2982,7 +2982,7 @@ void tst_QTcpSocket::proxyFactory()
|
||||
|
||||
// note: the following test is not a hard failure.
|
||||
// Sometimes, error codes change for the better
|
||||
QTEST(int(socket->socketError()), "expectedError");
|
||||
QTEST(int(socket->error()), "expectedError");
|
||||
|
||||
delete socket;
|
||||
}
|
||||
@ -3209,7 +3209,7 @@ void tst_QTcpSocket::readNotificationsAfterBind()
|
||||
QAbstractSocket socket(QAbstractSocket::TcpSocket, nullptr);
|
||||
QVERIFY2(socket.bind(), "Bind error!");
|
||||
|
||||
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
QSignalSpy spyReadyRead(&socket, SIGNAL(readyRead()));
|
||||
socket.connectToHost(QtNetworkSettings::serverName(), 12346);
|
||||
|
||||
|
@ -337,7 +337,7 @@ void tst_QUdpSocket::constructing()
|
||||
QCOMPARE(socket.canReadLine(), false);
|
||||
QCOMPARE(socket.readLine(), QByteArray());
|
||||
QCOMPARE(socket.socketDescriptor(), (qintptr)-1);
|
||||
QCOMPARE(socket.socketError(), QUdpSocket::UnknownSocketError);
|
||||
QCOMPARE(socket.error(), QUdpSocket::UnknownSocketError);
|
||||
QCOMPARE(socket.errorString(), QString("Unknown error"));
|
||||
|
||||
// Check the state of the socket api
|
||||
@ -575,7 +575,7 @@ void tst_QUdpSocket::ipv6Loop()
|
||||
int paulPort;
|
||||
|
||||
if (!peter.bind(QHostAddress(QHostAddress::LocalHostIPv6), 0)) {
|
||||
QCOMPARE(peter.socketError(), QUdpSocket::UnsupportedSocketOperationError);
|
||||
QCOMPARE(peter.error(), QUdpSocket::UnsupportedSocketOperationError);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -883,7 +883,7 @@ void tst_QUdpSocket::writeDatagram()
|
||||
qRegisterMetaType<QAbstractSocket::SocketError>("QAbstractSocket::SocketError");
|
||||
|
||||
for(int i=0;;i++) {
|
||||
QSignalSpy errorspy(&client, SIGNAL(error(QAbstractSocket::SocketError)));
|
||||
QSignalSpy errorspy(&client, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
|
||||
QSignalSpy bytesspy(&client, SIGNAL(bytesWritten(qint64)));
|
||||
|
||||
qint64 written = client.writeDatagram(QByteArray(i * 1024, 'w'), serverAddress,
|
||||
@ -897,7 +897,7 @@ void tst_QUdpSocket::writeDatagram()
|
||||
QCOMPARE(errorspy.count(), 1);
|
||||
QCOMPARE(*static_cast<const int *>(errorspy.at(0).at(0).constData()),
|
||||
int(QUdpSocket::DatagramTooLargeError));
|
||||
QCOMPARE(client.socketError(), QUdpSocket::DatagramTooLargeError);
|
||||
QCOMPARE(client.error(), QUdpSocket::DatagramTooLargeError);
|
||||
break;
|
||||
}
|
||||
QCOMPARE(bytesspy.count(), 1);
|
||||
@ -1044,7 +1044,7 @@ void tst_QUdpSocket::writeToNonExistingPeer()
|
||||
|
||||
QUdpSocket sConnected;
|
||||
QSignalSpy sConnectedReadyReadSpy(&sConnected, SIGNAL(readyRead()));
|
||||
QSignalSpy sConnectedErrorSpy(&sConnected, SIGNAL(error(QAbstractSocket::SocketError)));
|
||||
QSignalSpy sConnectedErrorSpy(&sConnected, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
|
||||
sConnected.connectToHost(peerAddress, peerPort, QIODevice::ReadWrite);
|
||||
QVERIFY(sConnected.waitForConnected(10000));
|
||||
|
||||
@ -1054,14 +1054,14 @@ void tst_QUdpSocket::writeToNonExistingPeer()
|
||||
// the second one should fail!
|
||||
QTest::qSleep(1000); // do not process events
|
||||
QCOMPARE(sConnected.write("", 1), qint64(-1));
|
||||
QCOMPARE(int(sConnected.socketError()), int(QUdpSocket::ConnectionRefusedError));
|
||||
QCOMPARE(int(sConnected.error()), int(QUdpSocket::ConnectionRefusedError));
|
||||
|
||||
// the third one will succeed...
|
||||
QCOMPARE(sConnected.write("", 1), qint64(1));
|
||||
QTestEventLoop::instance().enterLoop(1);
|
||||
QCOMPARE(sConnectedReadyReadSpy.count(), 0);
|
||||
QCOMPARE(sConnectedErrorSpy.count(), 1);
|
||||
QCOMPARE(int(sConnected.socketError()), int(QUdpSocket::ConnectionRefusedError));
|
||||
QCOMPARE(int(sConnected.error()), int(QUdpSocket::ConnectionRefusedError));
|
||||
|
||||
// we should now get a read error
|
||||
QCOMPARE(sConnected.write("", 1), qint64(1));
|
||||
@ -1071,12 +1071,12 @@ void tst_QUdpSocket::writeToNonExistingPeer()
|
||||
QCOMPARE(sConnected.bytesAvailable(), Q_INT64_C(0));
|
||||
QCOMPARE(sConnected.pendingDatagramSize(), Q_INT64_C(-1));
|
||||
QCOMPARE(sConnected.readDatagram(buf, 2), Q_INT64_C(-1));
|
||||
QCOMPARE(int(sConnected.socketError()), int(QUdpSocket::ConnectionRefusedError));
|
||||
QCOMPARE(int(sConnected.error()), int(QUdpSocket::ConnectionRefusedError));
|
||||
|
||||
QCOMPARE(sConnected.write("", 1), qint64(1));
|
||||
QTest::qSleep(1000); // do not process events
|
||||
QCOMPARE(sConnected.read(buf, 2), Q_INT64_C(0));
|
||||
QCOMPARE(int(sConnected.socketError()), int(QUdpSocket::ConnectionRefusedError));
|
||||
QCOMPARE(int(sConnected.error()), int(QUdpSocket::ConnectionRefusedError));
|
||||
|
||||
// we should still be connected
|
||||
QCOMPARE(int(sConnected.state()), int(QUdpSocket::ConnectedState));
|
||||
|
@ -409,7 +409,7 @@ private:
|
||||
|
||||
static QString certDirPath;
|
||||
|
||||
void (QSslSocket::*socketErrorSignal)(QAbstractSocket::SocketError) = &QAbstractSocket::error;
|
||||
void (QSslSocket::*socketErrorSignal)(QAbstractSocket::SocketError) = &QAbstractSocket::errorOccurred;
|
||||
void (QSslSocket::*tlsErrorsSignal)(const QList<QSslError> &) = &QSslSocket::sslErrors;
|
||||
void (QTestEventLoop::*exitLoopSlot)() = &QTestEventLoop::exitLoop;
|
||||
|
||||
@ -605,7 +605,7 @@ void tst_QOcsp::malformedResponse()
|
||||
loop.enterLoopMSecs(handshakeTimeoutMS);
|
||||
|
||||
QVERIFY(!clientSocket.isEncrypted());
|
||||
QCOMPARE(clientSocket.socketError(), QAbstractSocket::SslHandshakeFailedError);
|
||||
QCOMPARE(clientSocket.error(), QAbstractSocket::SslHandshakeFailedError);
|
||||
}
|
||||
|
||||
void tst_QOcsp::expiredResponse_data()
|
||||
|
@ -533,7 +533,7 @@ void tst_QSslSocket::constructing()
|
||||
QCOMPARE(socket.write(0, 0), qint64(-1));
|
||||
QTest::ignoreMessage(QtWarningMsg, writeNotOpenMessage);
|
||||
QCOMPARE(socket.write(QByteArray()), qint64(-1));
|
||||
QCOMPARE(socket.socketError(), QAbstractSocket::UnknownSocketError);
|
||||
QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError);
|
||||
QVERIFY(!socket.flush());
|
||||
QVERIFY(!socket.isValid());
|
||||
QCOMPARE(socket.localAddress(), QHostAddress());
|
||||
@ -1229,7 +1229,7 @@ protected:
|
||||
configuration.setProtocol(protocol);
|
||||
if (ignoreSslErrors)
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(socketError(QAbstractSocket::SocketError)));
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this, SIGNAL(socketError(QAbstractSocket::SocketError)));
|
||||
connect(socket, &QSslSocket::alertReceived, this, &SslServer::gotAlert);
|
||||
connect(socket, &QSslSocket::alertSent, this, &SslServer::alertSent);
|
||||
|
||||
@ -1360,8 +1360,8 @@ void tst_QSslSocket::protocolServerSide()
|
||||
socket = &client;
|
||||
QFETCH(QSsl::SslProtocol, clientProtocol);
|
||||
socket->setProtocol(clientProtocol);
|
||||
// upon SSL wrong version error, error will be triggered, not sslErrors
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
// upon SSL wrong version error, errorOccurred will be triggered, not sslErrors
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
|
||||
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
|
||||
|
||||
@ -1373,16 +1373,16 @@ void tst_QSslSocket::protocolServerSide()
|
||||
QAbstractSocket::SocketState expectedState = (works) ? QAbstractSocket::ConnectedState : QAbstractSocket::UnconnectedState;
|
||||
// Determine whether the client or the server caused the event loop
|
||||
// to quit due to a socket error, and investigate the culprit.
|
||||
if (client.socketError() != QAbstractSocket::UnknownSocketError) {
|
||||
if (client.error() != QAbstractSocket::UnknownSocketError) {
|
||||
// It can happen that the client, after TCP connection established, before
|
||||
// incomingConnection() slot fired, hits TLS initialization error and stops
|
||||
// the loop, so the server socket is not created yet.
|
||||
if (server.socket)
|
||||
QVERIFY(server.socket->socketError() == QAbstractSocket::UnknownSocketError);
|
||||
QVERIFY(server.socket->error() == QAbstractSocket::UnknownSocketError);
|
||||
|
||||
QCOMPARE(client.state(), expectedState);
|
||||
} else if (server.socket->socketError() != QAbstractSocket::UnknownSocketError) {
|
||||
QVERIFY(client.socketError() == QAbstractSocket::UnknownSocketError);
|
||||
} else if (server.socket->error() != QAbstractSocket::UnknownSocketError) {
|
||||
QVERIFY(client.error() == QAbstractSocket::UnknownSocketError);
|
||||
QCOMPARE(server.socket->state(), expectedState);
|
||||
}
|
||||
|
||||
@ -1421,8 +1421,8 @@ void tst_QSslSocket::serverCipherPreferences()
|
||||
sslConfig.setCiphers({QSslCipher("AES256-SHA"), QSslCipher("AES128-SHA")});
|
||||
socket->setSslConfiguration(sslConfig);
|
||||
|
||||
// upon SSL wrong version error, error will be triggered, not sslErrors
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
// upon SSL wrong version error, errorOccurred will be triggered, not sslErrors
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
|
||||
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
|
||||
|
||||
@ -1453,8 +1453,8 @@ void tst_QSslSocket::serverCipherPreferences()
|
||||
sslConfig.setCiphers({QSslCipher("AES256-SHA"), QSslCipher("AES128-SHA")});
|
||||
socket->setSslConfiguration(sslConfig);
|
||||
|
||||
// upon SSL wrong version error, error will be triggered, not sslErrors
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
// upon SSL wrong version error, errorOccurred will be triggered, not sslErrors
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
|
||||
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
|
||||
|
||||
@ -1544,7 +1544,7 @@ void tst_QSslSocket::setLocalCertificateChain()
|
||||
const QScopedPointer<QSslSocket, QScopedPointerDeleteLater> client(new QSslSocket);
|
||||
socket = client.data();
|
||||
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
|
||||
|
||||
socket->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(), server.serverPort());
|
||||
@ -1994,7 +1994,7 @@ void tst_QSslSocket::setEmptyKey()
|
||||
QTestEventLoop::instance().enterLoop(2);
|
||||
|
||||
QCOMPARE(socket.state(), QAbstractSocket::ConnectedState);
|
||||
QCOMPARE(socket.socketError(), QAbstractSocket::UnknownSocketError);
|
||||
QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError);
|
||||
}
|
||||
|
||||
void tst_QSslSocket::spontaneousWrite()
|
||||
@ -2534,8 +2534,8 @@ void tst_QSslSocket::closeWhileEmittingSocketError()
|
||||
clientConfig.setPeerVerifyMode(QSslSocket::VerifyNone);
|
||||
clientSocket.setSslConfiguration(clientConfig);
|
||||
|
||||
QSignalSpy socketErrorSpy(&clientSocket, SIGNAL(error(QAbstractSocket::SocketError)));
|
||||
void (QSslSocket::*errorSignal)(QAbstractSocket::SocketError) = &QSslSocket::error;
|
||||
QSignalSpy socketErrorSpy(&clientSocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
|
||||
void (QSslSocket::*errorSignal)(QAbstractSocket::SocketError) = &QSslSocket::errorOccurred;
|
||||
connect(&clientSocket, errorSignal, &handshake, &BrokenPskHandshake::socketError);
|
||||
|
||||
clientSocket.connectToHostEncrypted(QStringLiteral("127.0.0.1"), handshake.serverPort());
|
||||
@ -2635,7 +2635,7 @@ void tst_QSslSocket::ignoreSslErrorsList()
|
||||
socket.ignoreSslErrors(expectedSslErrors);
|
||||
|
||||
QFETCH(int, expectedSslErrorSignalCount);
|
||||
QSignalSpy sslErrorsSpy(&socket, SIGNAL(error(QAbstractSocket::SocketError)));
|
||||
QSignalSpy sslErrorsSpy(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
|
||||
|
||||
socket.connectToHostEncrypted(QtNetworkSettings::httpServerName(), 443);
|
||||
|
||||
@ -2766,11 +2766,11 @@ void tst_QSslSocket::writeBigChunk()
|
||||
// no better way to do this right now since the error is the same as the default error.
|
||||
if (socket->errorString().startsWith(QLatin1String("Unable to write data")))
|
||||
{
|
||||
qWarning() << socket->socketError() << socket->errorString();
|
||||
qWarning() << socket->error() << socket->errorString();
|
||||
QFAIL("Error while writing! Check if the OpenSSL BIO size is limited?!");
|
||||
}
|
||||
// also check the error string. If another error (than UnknownError) occurred, it should be different than before
|
||||
QVERIFY2(errorBefore == errorAfter || socket->socketError() == QAbstractSocket::RemoteHostClosedError,
|
||||
QVERIFY2(errorBefore == errorAfter || socket->error() == QAbstractSocket::RemoteHostClosedError,
|
||||
QByteArray("unexpected error: ").append(qPrintable(errorAfter)));
|
||||
|
||||
// check that everything has been written to OpenSSL
|
||||
@ -2929,13 +2929,13 @@ void tst_QSslSocket::resume()
|
||||
|
||||
QSignalSpy sslErrorSpy(&socket, SIGNAL(sslErrors(QList<QSslError>)));
|
||||
QSignalSpy encryptedSpy(&socket, SIGNAL(encrypted()));
|
||||
QSignalSpy errorSpy(&socket, SIGNAL(error(QAbstractSocket::SocketError)));
|
||||
QSignalSpy errorSpy(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
|
||||
|
||||
connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(encrypted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
|
||||
this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
|
||||
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &QTestEventLoop::instance(), SLOT(exitLoop()));
|
||||
|
||||
socket.connectToHostEncrypted(QtNetworkSettings::imapServerName(), 993);
|
||||
QTestEventLoop::instance().enterLoop(10);
|
||||
@ -2965,7 +2965,7 @@ void tst_QSslSocket::resume()
|
||||
QCOMPARE(encryptedSpy.count(), 0);
|
||||
QVERIFY(!socket.isEncrypted());
|
||||
QCOMPARE(errorSpy.count(), 1);
|
||||
QCOMPARE(socket.socketError(), QAbstractSocket::SslHandshakeFailedError);
|
||||
QCOMPARE(socket.error(), QAbstractSocket::SslHandshakeFailedError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3246,7 +3246,7 @@ void tst_QSslSocket::dhServer()
|
||||
|
||||
QSslSocket client;
|
||||
socket = &client;
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
|
||||
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
|
||||
|
||||
@ -3280,7 +3280,7 @@ void tst_QSslSocket::dhServerCustomParamsNull()
|
||||
|
||||
QSslSocket client;
|
||||
socket = &client;
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
|
||||
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
|
||||
|
||||
@ -3325,7 +3325,7 @@ void tst_QSslSocket::dhServerCustomParams()
|
||||
|
||||
QSslSocket client;
|
||||
socket = &client;
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
|
||||
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
|
||||
|
||||
@ -3360,7 +3360,7 @@ void tst_QSslSocket::ecdhServer()
|
||||
|
||||
QSslSocket client;
|
||||
socket = &client;
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
|
||||
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
|
||||
|
||||
@ -3552,7 +3552,7 @@ void tst_QSslSocket::readBufferMaxSize()
|
||||
|
||||
QSslSocketPtr client(new QSslSocket);
|
||||
socket = client.data();
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
|
||||
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
|
||||
|
||||
@ -3813,7 +3813,7 @@ void tst_QSslSocket::simplePskConnect()
|
||||
QSignalSpy sslErrorsSpy(&socket, SIGNAL(sslErrors(QList<QSslError>)));
|
||||
QVERIFY(sslErrorsSpy.isValid());
|
||||
|
||||
QSignalSpy socketErrorsSpy(&socket, SIGNAL(error(QAbstractSocket::SocketError)));
|
||||
QSignalSpy socketErrorsSpy(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)));
|
||||
QVERIFY(socketErrorsSpy.isValid());
|
||||
|
||||
QSignalSpy peerVerifyErrorSpy(&socket, SIGNAL(peerVerifyError(QSslError)));
|
||||
@ -3827,7 +3827,7 @@ void tst_QSslSocket::simplePskConnect()
|
||||
connect(&socket, SIGNAL(modeChanged(QSslSocket::SslMode)), this, SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(encrypted()), this, SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this, SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(peerVerifyError(QSslError)), this, SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(exitLoop()));
|
||||
|
||||
@ -4095,7 +4095,7 @@ void tst_QSslSocket::pskServer()
|
||||
connect(&socket, SIGNAL(modeChanged(QSslSocket::SslMode)), this, SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(encrypted()), this, SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)), this, SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(peerVerifyError(QSslError)), this, SLOT(exitLoop()));
|
||||
connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(exitLoop()));
|
||||
|
||||
@ -4275,7 +4275,7 @@ void tst_QSslSocket::signatureAlgorithm()
|
||||
|
||||
QEventLoop loop;
|
||||
QTimer::singleShot(5000, &loop, &QEventLoop::quit);
|
||||
connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error), &loop, &QEventLoop::quit);
|
||||
connect(socket, &QAbstractSocket::errorOccurred, &loop, &QEventLoop::quit);
|
||||
connect(socket, QOverload<const QList<QSslError> &>::of(&QSslSocket::sslErrors), this, &tst_QSslSocket::ignoreErrorSlot);
|
||||
connect(socket, &QSslSocket::encrypted, &loop, &QEventLoop::quit);
|
||||
|
||||
@ -4333,9 +4333,9 @@ void tst_QSslSocket::unsupportedProtocols()
|
||||
// early, preventing any real connection from ever starting.
|
||||
QSslSocket socket;
|
||||
socket.setProtocol(unsupportedProtocol);
|
||||
QCOMPARE(socket.socketError(), QAbstractSocket::UnknownSocketError);
|
||||
QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError);
|
||||
socket.connectToHostEncrypted(QStringLiteral("doesnotmatter.org"), 1010);
|
||||
QCOMPARE(socket.socketError(), QAbstractSocket::SslInvalidUserDataError);
|
||||
QCOMPARE(socket.error(), QAbstractSocket::SslInvalidUserDataError);
|
||||
QCOMPARE(socket.state(), QAbstractSocket::UnconnectedState);
|
||||
}
|
||||
{
|
||||
@ -4345,14 +4345,14 @@ void tst_QSslSocket::unsupportedProtocols()
|
||||
QVERIFY(server.listen());
|
||||
|
||||
QSslSocket socket;
|
||||
QCOMPARE(socket.socketError(), QAbstractSocket::UnknownSocketError);
|
||||
QCOMPARE(socket.error(), QAbstractSocket::UnknownSocketError);
|
||||
|
||||
socket.connectToHost(QHostAddress::LocalHost, server.serverPort());
|
||||
QVERIFY(socket.waitForConnected(timeoutMS));
|
||||
|
||||
socket.setProtocol(unsupportedProtocol);
|
||||
socket.startClientEncryption();
|
||||
QCOMPARE(socket.socketError(), QAbstractSocket::SslInvalidUserDataError);
|
||||
QCOMPARE(socket.error(), QAbstractSocket::SslInvalidUserDataError);
|
||||
}
|
||||
{
|
||||
// 2. waitForEncrypted: client-side, blocking API plus requires from us
|
||||
@ -4376,7 +4376,7 @@ void tst_QSslSocket::unsupportedProtocols()
|
||||
loop.enterLoopMSecs(timeoutMS);
|
||||
QVERIFY(!loop.timeout());
|
||||
QVERIFY(server.socket);
|
||||
QCOMPARE(server.socket->socketError(), QAbstractSocket::SslInvalidUserDataError);
|
||||
QCOMPARE(server.socket->error(), QAbstractSocket::SslInvalidUserDataError);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ void tst_NetworkSelfTest::serverReachability()
|
||||
QVERIFY2(timer.elapsed() < 9900, "Connection to closed port timed out instead of refusing, something is wrong");
|
||||
|
||||
QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, "Socket connected unexpectedly!");
|
||||
QVERIFY2(socket.socketError() == QAbstractSocket::ConnectionRefusedError,
|
||||
QVERIFY2(socket.error() == QAbstractSocket::ConnectionRefusedError,
|
||||
QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit());
|
||||
}
|
||||
|
||||
@ -458,7 +458,7 @@ void tst_NetworkSelfTest::remotePortsOpen()
|
||||
socket.connectToHost(QtNetworkSettings::serverName(), portNumber);
|
||||
|
||||
if (!socket.waitForConnected(10000)) {
|
||||
if (socket.socketError() == QAbstractSocket::SocketTimeoutError)
|
||||
if (socket.error() == QAbstractSocket::SocketTimeoutError)
|
||||
QFAIL(QString("Network timeout connecting to the server on port %1").arg(portNumber).toLocal8Bit());
|
||||
else
|
||||
QFAIL(QString("Error connecting to server on port %1: %2").arg(portNumber).arg(socket.errorString()).toLocal8Bit());
|
||||
|
@ -586,7 +586,7 @@ void tst_QWizard::addPage()
|
||||
#define CHECK_VISITED(wizard, list) \
|
||||
do { \
|
||||
QList<int> myList = list; \
|
||||
QCOMPARE((wizard).visitedPages(), myList); \
|
||||
QCOMPARE((wizard).visitedIds(), myList); \
|
||||
Q_FOREACH(int id, myList) \
|
||||
QVERIFY((wizard).hasVisitedPage(id)); \
|
||||
} while (0)
|
||||
@ -2293,7 +2293,7 @@ void tst_QWizard::removePage()
|
||||
|
||||
wizard.restart();
|
||||
QCOMPARE(wizard.pageIds().size(), 4);
|
||||
QCOMPARE(wizard.visitedPages().size(), 1);
|
||||
QCOMPARE(wizard.visitedIds().size(), 1);
|
||||
QCOMPARE(spy.count(), 0);
|
||||
|
||||
// Removing a non-existent page
|
||||
@ -2331,14 +2331,14 @@ void tst_QWizard::removePage()
|
||||
wizard.setPage(2, page2); // restore
|
||||
wizard.restart();
|
||||
wizard.next();
|
||||
QCOMPARE(wizard.visitedPages().size(), 2);
|
||||
QCOMPARE(wizard.visitedIds().size(), 2);
|
||||
QCOMPARE(wizard.currentPage(), page1);
|
||||
QCOMPARE(spy.count(), 0);
|
||||
wizard.removePage(2);
|
||||
QCOMPARE(spy.count(), 1);
|
||||
arguments = spy.takeFirst();
|
||||
QCOMPARE(arguments.at(0).toInt(), 2);
|
||||
QCOMPARE(wizard.visitedPages().size(), 2);
|
||||
QCOMPARE(wizard.visitedIds().size(), 2);
|
||||
QVERIFY(!wizard.pageIds().contains(2));
|
||||
QCOMPARE(wizard.currentPage(), page1);
|
||||
|
||||
@ -2347,14 +2347,14 @@ void tst_QWizard::removePage()
|
||||
wizard.restart();
|
||||
wizard.next();
|
||||
QCOMPARE(spy.count(), 0);
|
||||
QCOMPARE(wizard.visitedPages().size(), 2);
|
||||
QCOMPARE(wizard.visitedIds().size(), 2);
|
||||
QCOMPARE(wizard.currentPage(), page1);
|
||||
wizard.removePage(0);
|
||||
QCOMPARE(spy.count(), 1);
|
||||
arguments = spy.takeFirst();
|
||||
QCOMPARE(arguments.at(0).toInt(), 0);
|
||||
QCOMPARE(wizard.visitedPages().size(), 1);
|
||||
QVERIFY(!wizard.visitedPages().contains(0));
|
||||
QCOMPARE(wizard.visitedIds().size(), 1);
|
||||
QVERIFY(!wizard.visitedIds().contains(0));
|
||||
QVERIFY(!wizard.pageIds().contains(0));
|
||||
QCOMPARE(wizard.currentPage(), page1);
|
||||
|
||||
@ -2363,14 +2363,14 @@ void tst_QWizard::removePage()
|
||||
wizard.restart();
|
||||
wizard.next();
|
||||
QCOMPARE(spy.count(), 0);
|
||||
QCOMPARE(wizard.visitedPages().size(), 2);
|
||||
QCOMPARE(wizard.visitedIds().size(), 2);
|
||||
QCOMPARE(wizard.currentPage(), page1);
|
||||
wizard.removePage(1);
|
||||
QCOMPARE(spy.count(), 1);
|
||||
arguments = spy.takeFirst();
|
||||
QCOMPARE(arguments.at(0).toInt(), 1);
|
||||
QCOMPARE(wizard.visitedPages().size(), 1);
|
||||
QVERIFY(!wizard.visitedPages().contains(1));
|
||||
QCOMPARE(wizard.visitedIds().size(), 1);
|
||||
QVERIFY(!wizard.visitedIds().contains(1));
|
||||
QVERIFY(!wizard.pageIds().contains(1));
|
||||
QCOMPARE(wizard.currentPage(), page0);
|
||||
|
||||
@ -2379,8 +2379,8 @@ void tst_QWizard::removePage()
|
||||
QCOMPARE(spy.count(), 1);
|
||||
arguments = spy.takeFirst();
|
||||
QCOMPARE(arguments.at(0).toInt(), 0);
|
||||
QCOMPARE(wizard.visitedPages().size(), 1);
|
||||
QVERIFY(!wizard.visitedPages().contains(0));
|
||||
QCOMPARE(wizard.visitedIds().size(), 1);
|
||||
QVERIFY(!wizard.visitedIds().contains(0));
|
||||
QCOMPARE(wizard.pageIds().size(), 2);
|
||||
QVERIFY(!wizard.pageIds().contains(0));
|
||||
QCOMPARE(wizard.currentPage(), page2);
|
||||
@ -2389,8 +2389,8 @@ void tst_QWizard::removePage()
|
||||
QCOMPARE(spy.count(), 1);
|
||||
arguments = spy.takeFirst();
|
||||
QCOMPARE(arguments.at(0).toInt(), 2);
|
||||
QCOMPARE(wizard.visitedPages().size(), 1);
|
||||
QVERIFY(!wizard.visitedPages().contains(2));
|
||||
QCOMPARE(wizard.visitedIds().size(), 1);
|
||||
QVERIFY(!wizard.visitedIds().contains(2));
|
||||
QCOMPARE(wizard.pageIds().size(), 1);
|
||||
QVERIFY(!wizard.pageIds().contains(2));
|
||||
QCOMPARE(wizard.currentPage(), page3);
|
||||
@ -2399,7 +2399,7 @@ void tst_QWizard::removePage()
|
||||
QCOMPARE(spy.count(), 1);
|
||||
arguments = spy.takeFirst();
|
||||
QCOMPARE(arguments.at(0).toInt(), 3);
|
||||
QVERIFY(wizard.visitedPages().empty());
|
||||
QVERIFY(wizard.visitedIds().empty());
|
||||
QVERIFY(wizard.pageIds().empty());
|
||||
QCOMPARE(wizard.currentPage(), nullptr);
|
||||
}
|
||||
|
@ -8,11 +8,6 @@ b2qt
|
||||
opensuse-42.3
|
||||
[restoreVersion1Geometry]
|
||||
ubuntu-16.04
|
||||
[updateWhileMinimized]
|
||||
ubuntu-18.04
|
||||
rhel-7.4
|
||||
ubuntu-16.04
|
||||
rhel-7.6
|
||||
[focusProxyAndInputMethods]
|
||||
rhel-7.6
|
||||
opensuse-leap
|
||||
|
@ -8074,7 +8074,17 @@ void tst_QWidget::updateWhileMinimized()
|
||||
QTest::qWait(10);
|
||||
if (m_platform == QStringLiteral("winrt"))
|
||||
QEXPECT_FAIL("", "WinRT: This fails. QTBUG-68297.", Abort);
|
||||
QCOMPARE(widget.numPaintEvents, 0);
|
||||
int count = 0;
|
||||
// mutter/GNOME Shell doesn't unmap when minimizing window.
|
||||
// More details at https://gitlab.gnome.org/GNOME/mutter/issues/185
|
||||
if (m_platform == QStringLiteral("xcb")) {
|
||||
const QString desktop = qgetenv("XDG_CURRENT_DESKTOP");
|
||||
qDebug() << "xcb: XDG_CURRENT_DESKTOP=" << desktop;
|
||||
if (desktop == QStringLiteral("ubuntu:GNOME")
|
||||
|| desktop == QStringLiteral("GNOME-Classic:GNOME"))
|
||||
count = 1;
|
||||
}
|
||||
QCOMPARE(widget.numPaintEvents, count);
|
||||
|
||||
// Restore window.
|
||||
widget.showNormal();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user