summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/network/doc/src/fortuneclient.qdoc6
-rw-r--r--examples/network/fortuneclient/client.cpp2
-rw-r--r--examples/network/loopback/dialog.cpp5
-rw-r--r--examples/network/network-chat/client.cpp3
-rw-r--r--examples/network/torrent/peerwireclient.cpp4
-rw-r--r--examples/network/torrent/torrentclient.cpp2
-rw-r--r--examples/network/torrent/torrentserver.cpp2
-rw-r--r--src/corelib/time/qdatetimeparser.cpp8
-rw-r--r--src/network/access/qftp.cpp6
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp2
-rw-r--r--src/network/access/qnetworkaccessdebugpipebackend.cpp2
-rw-r--r--src/network/socket/qabstractsocket.cpp34
-rw-r--r--src/network/socket/qabstractsocket.h4
-rw-r--r--src/network/socket/qhttpsocketengine.cpp2
-rw-r--r--src/network/socket/qlocalsocket.h4
-rw-r--r--src/network/socket/qlocalsocket_p.h4
-rw-r--r--src/network/socket/qlocalsocket_tcp.cpp6
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp6
-rw-r--r--src/network/socket/qsocks5socketengine.cpp8
-rw-r--r--src/network/socket/qsocks5socketengine_p.h4
-rw-r--r--src/network/ssl/qsslsocket.cpp2
-rw-r--r--src/widgets/dialogs/qwizard.cpp12
-rw-r--r--src/widgets/dialogs/qwizard.h5
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp22
-rw-r--r--src/widgets/widgets/qstatusbar.h1
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp2
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp2
-rw-r--r--tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp2
-rw-r--r--tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp6
-rw-r--r--tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp20
-rw-r--r--tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp4
-rw-r--r--tests/auto/network/ssl/qocsp/tst_qocsp.cpp2
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp44
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp30
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp231
-rw-r--r--tests/manual/bearerex/datatransferer.cpp2
36 files changed, 393 insertions, 108 deletions
diff --git a/examples/network/doc/src/fortuneclient.qdoc b/examples/network/doc/src/fortuneclient.qdoc
index 544fa156b7..4cb7544fc0 100644
--- a/examples/network/doc/src/fortuneclient.qdoc
+++ b/examples/network/doc/src/fortuneclient.qdoc
@@ -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
diff --git a/examples/network/fortuneclient/client.cpp b/examples/network/fortuneclient/client.cpp
index 0ccbf51df8..2daac33c2b 100644
--- a/examples/network/fortuneclient/client.cpp
+++ b/examples/network/fortuneclient/client.cpp
@@ -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]
diff --git a/examples/network/loopback/dialog.cpp b/examples/network/loopback/dialog.cpp
index d87f024031..4037f4c085 100644
--- a/examples/network/loopback/dialog.cpp
+++ b/examples/network/loopback/dialog.cpp
@@ -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);
diff --git a/examples/network/network-chat/client.cpp b/examples/network/network-chat/client.cpp
index d451181813..fe35d535f4 100644
--- a/examples/network/network-chat/client.cpp
+++ b/examples/network/network-chat/client.cpp
@@ -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);
}
diff --git a/examples/network/torrent/peerwireclient.cpp b/examples/network/torrent/peerwireclient.cpp
index cea4ef53fa..c30abd0e13 100644
--- a/examples/network/torrent/peerwireclient.cpp
+++ b/examples/network/torrent/peerwireclient.cpp
@@ -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,
diff --git a/examples/network/torrent/torrentclient.cpp b/examples/network/torrent/torrentclient.cpp
index 6b11338f42..2ba4476861 100644
--- a/examples/network/torrent/torrentclient.cpp
+++ b/examples/network/torrent/torrentclient.cpp
@@ -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);
diff --git a/examples/network/torrent/torrentserver.cpp b/examples/network/torrent/torrentserver.cpp
index 215498194b..7af958c27c 100644
--- a/examples/network/torrent/torrentserver.cpp
+++ b/examples/network/torrent/torrentserver.cpp
@@ -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);
diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp
index 790c20004a..2a19611493 100644
--- a/src/corelib/time/qdatetimeparser.cpp
+++ b/src/corelib/time/qdatetimeparser.cpp
@@ -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;
}
diff --git a/src/network/access/qftp.cpp b/src/network/access/qftp.cpp
index cda800ce35..2589c64b1c 100644
--- a/src/network/access/qftp.cpp
+++ b/src/network/access/qftp.cpp
@@ -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)),
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index ccdb1cd6cd..319c4953b1 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -157,7 +157,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);
diff --git a/src/network/access/qnetworkaccessdebugpipebackend.cpp b/src/network/access/qnetworkaccessdebugpipebackend.cpp
index 03ffc69628..0029df41fe 100644
--- a/src/network/access/qnetworkaccessdebugpipebackend.cpp
+++ b/src/network/access/qnetworkaccessdebugpipebackend.cpp
@@ -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
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 57dec59bc7..fb792e428f 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -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.
@@ -330,6 +338,7 @@
\value UnknownSocketError An unidentified error occurred.
\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.,
diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h
index de09195eeb..1482dcaab2 100644
--- a/src/network/socket/qabstractsocket.h
+++ b/src/network/socket/qabstractsocket.h
@@ -206,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
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index bce0da4ae4..9de9b284c1 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -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)),
diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h
index ae78c86b3c..9cd62abca6 100644
--- a/src/network/socket/qlocalsocket.h
+++ b/src/network/socket/qlocalsocket.h
@@ -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
diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h
index e3bcd92326..0e05e4c5d7 100644
--- a/src/network/socket/qlocalsocket_p.h
+++ b/src/network/socket/qlocalsocket_p.h
@@ -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();
diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp
index e13bcfc0cb..1c63d16187 100644
--- a/src/network/socket/qlocalsocket_tcp.cpp
+++ b/src/network/socket/qlocalsocket_tcp.cpp
@@ -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");
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
index 5e1da78c94..d9b39a7752 100644
--- a/src/network/socket/qlocalsocket_unix.cpp
+++ b/src/network/socket/qlocalsocket_unix.cpp
@@ -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");
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index 0530a1af30..4f866e4da0 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -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);
@@ -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();
diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h
index c256987e2d..77b461b944 100644
--- a/src/network/socket/qsocks5socketengine_p.h
+++ b/src/network/socket/qsocks5socketengine_p.h
@@ -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
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 775b6227ed..912b30b29b 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -2535,7 +2535,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()),
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 31e32bb931..b0f4312f40 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -2384,13 +2384,23 @@ 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
*/
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index ef71efa0cb..a40635c4a5 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -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;
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 2057794820..c52bb89f28 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -1443,7 +1443,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);
+ }
}
@@ -2061,6 +2070,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.
diff --git a/src/widgets/widgets/qstatusbar.h b/src/widgets/widgets/qstatusbar.h
index 2492e8487f..976e45f9ed 100644
--- a/src/widgets/widgets/qstatusbar.h
+++ b/src/widgets/widgets/qstatusbar.h
@@ -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;
diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
index 771a4d0a32..6001829854 100644
--- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
@@ -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()));
}
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index b1588d4120..5a97d8a9b9 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -674,7 +674,7 @@ private:
//qDebug() << "connectSocketSignals" << client;
connect(client.data(), SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
connect(client.data(), SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot()));
- connect(client.data(), SIGNAL(error(QAbstractSocket::SocketError)),
+ connect(client.data(), SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
this, SLOT(slotError(QAbstractSocket::SocketError)));
}
diff --git a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
index 7644a06380..2d0d9f5ffc 100644
--- a/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
+++ b/tests/auto/network/socket/qhttpsocketengine/tst_qhttpsocketengine.cpp
@@ -270,7 +270,7 @@ 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());
diff --git a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
index 44b5a02af4..85eec6e783 100644
--- a/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
+++ b/tests/auto/network/socket/qsocks5socketengine/tst_qsocks5socketengine.cpp
@@ -283,7 +283,7 @@ 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());
@@ -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,7 +1006,7 @@ 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());
diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
index f85d041f49..6dd390ccbd 100644
--- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
@@ -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);
@@ -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()));
@@ -2439,14 +2439,14 @@ 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");
@@ -2773,7 +2773,7 @@ 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);
@@ -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);
diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
index 0f419e9de4..cc41260d59 100644
--- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
@@ -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,
@@ -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));
diff --git a/tests/auto/network/ssl/qocsp/tst_qocsp.cpp b/tests/auto/network/ssl/qocsp/tst_qocsp.cpp
index c107230316..edd1c24547 100644
--- a/tests/auto/network/ssl/qocsp/tst_qocsp.cpp
+++ b/tests/auto/network/ssl/qocsp/tst_qocsp.cpp
@@ -410,7 +410,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;
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index cf383afd8b..23495436eb 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -1240,7 +1240,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)));
QFile file(m_keyFile);
QVERIFY(file.open(QIODevice::ReadOnly));
@@ -1377,8 +1377,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()));
@@ -1438,8 +1438,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()));
@@ -1470,8 +1470,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()));
@@ -1561,7 +1561,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());
@@ -2551,8 +2551,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());
@@ -2652,7 +2652,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);
@@ -2946,13 +2946,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);
@@ -3263,7 +3263,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()));
@@ -3297,7 +3297,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()));
@@ -3342,7 +3342,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()));
@@ -3377,7 +3377,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()));
@@ -3569,7 +3569,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()));
@@ -3830,7 +3830,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)));
@@ -3844,7 +3844,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()));
@@ -4112,7 +4112,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()));
@@ -4292,7 +4292,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);
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 9ae4508bc1..78616009a2 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -585,7 +585,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)
@@ -2292,7 +2292,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
@@ -2330,14 +2330,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);
@@ -2346,14 +2346,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);
@@ -2362,14 +2362,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);
@@ -2378,8 +2378,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);
@@ -2388,8 +2388,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);
@@ -2398,7 +2398,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);
}
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index 264625777f..4c6cf3588a 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -294,6 +294,13 @@ private slots:
void stepModifierPressAndHold_data();
void stepModifierPressAndHold();
+
+ void springForward_data();
+ void springForward();
+
+ void stepIntoDSTGap_data();
+ void stepIntoDSTGap();
+
private:
EditorDateEdit* testWidget;
QWidget *testFocusWidget;
@@ -4337,5 +4344,229 @@ void tst_QDateTimeEdit::stepModifierPressAndHold()
QCOMPARE(value.toDate(), expectedDate);
}
+/*
+ The following tests verify correct handling of the spring forward gap; which
+ hour is skipped, and on which day, depends on the local time zone. We try to
+ make it reasonably robust by discovering the first day of spring in a given
+ year, but we won't try to handle every situation.
+
+ If this function returns an invalid QDateTime, then the tests should be skipped.
+*/
+static QDateTime findSpring(int year, const QTimeZone &timeZone)
+{
+ if (!timeZone.hasTransitions())
+ return QDateTime();
+
+ // Southern hemisphere spring is after midsummer
+ const QDateTime midSummer = QDate(year, 6, 21).startOfDay();
+ const QTimeZone::OffsetData transition =
+ midSummer.isDaylightTime() ? timeZone.previousTransition(midSummer)
+ : timeZone.nextTransition(midSummer);
+ const QDateTime spring = transition.atUtc.toLocalTime();
+ // there might have been DST at some point, but not in the year we care about
+ if (spring.date().year() != year || !spring.isDaylightTime())
+ return QDateTime();
+
+ return spring;
+};
+
+/*!
+ Test that typing in a time that is invalid due to spring forward gap
+ produces reasonable results.
+*/
+void tst_QDateTimeEdit::springForward_data()
+{
+ QTest::addColumn<QDateTime>("start");
+ QTest::addColumn<QAbstractSpinBox::CorrectionMode>("correctionMode");
+ QTest::addColumn<QTime>("inputTime");
+ QTest::addColumn<QDateTime>("expected");
+
+ const QTimeZone timeZone = QTimeZone::systemTimeZone();
+ if (!timeZone.hasDaylightTime())
+ QSKIP("This test needs to run in a timezone that observes DST!");
+
+ const QDateTime springTransition = findSpring(2019, timeZone);
+ if (!springTransition.isValid())
+ QSKIP("Failed to obtain valid spring forward datetime for 2019!");
+
+ const QDate springDate = springTransition.date();
+ const int gapWidth = timeZone.daylightTimeOffset(springTransition.addDays(1));
+ const QTime springGap = springTransition.time().addSecs(-gapWidth);
+ const QTime springGapMiddle = springTransition.time().addSecs(-gapWidth/2);
+
+ QTest::addRow("forward to %s, correct to previous", qPrintable(springGap.toString("hh:mm")))
+ << QDateTime(springDate, springGap.addSecs(-gapWidth))
+ << QAbstractSpinBox::CorrectToPreviousValue
+ << springGap
+ << QDateTime(springDate, springGap.addSecs(-gapWidth));
+
+ QTest::addRow("back to %s, correct to previous", qPrintable(springGap.toString("hh:mm")))
+ << springTransition
+ << QAbstractSpinBox::CorrectToPreviousValue
+ << springGap
+ << springTransition;
+
+ QTest::addRow("forward to %s, correct to nearest", qPrintable(springGap.toString("hh:mm")))
+ << QDateTime(springDate, springGap.addSecs(-gapWidth))
+ << QAbstractSpinBox::CorrectToNearestValue
+ << springGapMiddle
+ << springTransition;
+
+ QTest::addRow("back to %s, correct to nearest", qPrintable(springGap.toString("hh:mm")))
+ << springTransition
+ << QAbstractSpinBox::CorrectToNearestValue
+ << springGapMiddle
+ << springTransition;
+
+ QTest::addRow("jump to %s, correct to nearest", qPrintable(springGapMiddle.toString("hh:mm")))
+ << QDateTime(QDate(1980, 5, 10), springGap)
+ << QAbstractSpinBox::CorrectToNearestValue
+ << springGapMiddle
+ << springTransition;
+}
+
+void tst_QDateTimeEdit::springForward()
+{
+ QFETCH(QDateTime, start);
+ QFETCH(QAbstractSpinBox::CorrectionMode, correctionMode);
+ QFETCH(QTime, inputTime);
+ QFETCH(QDateTime, expected);
+
+ QDateTimeEdit edit;
+ edit.setDisplayFormat(QLatin1String("dd.MM.yyyy hh:mm"));
+ edit.setCorrectionMode(correctionMode);
+
+ // we always want to start with a valid time
+ QVERIFY(start.isValid());
+ edit.setDateTime(start);
+
+ edit.setSelectedSection(QDateTimeEdit::DaySection);
+ const QDate date = expected.date();
+ const QString day = QString::number(date.day()).rightJustified(2, QLatin1Char('0'));
+ const QString month = QString::number(date.month()).rightJustified(2, QLatin1Char('0'));
+ const QString year = QString::number(date.year());
+ const QString hour = QString::number(inputTime.hour()).rightJustified(2, QLatin1Char('0'));
+ const QString minute = QString::number(inputTime.minute()).rightJustified(2, QLatin1Char('0'));
+ QTest::keyClicks(&edit, day);
+ QTest::keyClicks(&edit, month);
+ QTest::keyClicks(&edit, year);
+ QTest::keyClicks(&edit, hour);
+ QTest::keyClicks(&edit, minute);
+ QTest::keyClick(&edit, Qt::Key_Return, {});
+
+ QCOMPARE(edit.dateTime(), expected);
+}
+
+/*!
+ Test that using the up/down spinners to modify a valid time into a time that
+ is invalid due to daylight-saving changes produces reasonable results.
+
+ 2007 is a year in which the DST transition in most tested places was not on the
+ last or first day of the month, which allows us to test the various steps.
+*/
+void tst_QDateTimeEdit::stepIntoDSTGap_data()
+{
+ QTest::addColumn<QDateTime>("start");
+ QTest::addColumn<QDateTimeEdit::Section>("section");
+ QTest::addColumn<int>("steps");
+ QTest::addColumn<QDateTime>("end");
+
+ const QTimeZone timeZone = QTimeZone::systemTimeZone();
+ if (!timeZone.hasDaylightTime())
+ QSKIP("This test needs to run in a timezone that observes DST!");
+
+ const QDateTime springTransition = findSpring(2007, timeZone);
+ if (!springTransition.isValid())
+ QSKIP("Failed to obtain valid spring forward datetime for 2007!");
+
+ const QDate spring = springTransition.date();
+ const int gapWidth = timeZone.daylightTimeOffset(springTransition.addDays(1));
+ const QTime springGap = springTransition.time().addSecs(-gapWidth);
+
+ // change hour
+ if (springGap.hour() != 0) {
+ QTest::addRow("hour up into %s gap", qPrintable(springGap.toString("hh:mm")))
+ << QDateTime(spring, springGap.addSecs(-3600))
+ << QDateTimeEdit::HourSection
+ << +1
+ << springTransition;
+
+ // 3:00:10 into 2:00:10 should get us to 1:00:10
+ QTest::addRow("hour down into %s gap", qPrintable(springGap.toString("hh:mm")))
+ << QDateTime(spring, springGap.addSecs(3610))
+ << QDateTimeEdit::HourSection
+ << -1
+ << QDateTime(spring, springGap.addSecs(-3590));
+ }
+
+ // change day
+ if (spring.day() != 1) {
+ // today's 2:05 is tomorrow's 3:05
+ QTest::addRow("day up into %s gap", qPrintable(springGap.toString("hh:mm")))
+ << QDateTime(spring.addDays(-1), springGap.addSecs(300))
+ << QDateTimeEdit::DaySection
+ << +1
+ << springTransition.addSecs(300);
+ }
+
+ if (spring.day() != spring.daysInMonth()) {
+ QTest::addRow("day down into %s gap", qPrintable(springGap.toString("hh:mm")))
+ << QDateTime(spring.addDays(1), springGap)
+ << QDateTimeEdit::DaySection
+ << -1
+ << springTransition;
+ }
+
+ // 2018-03-25 - change month
+ QTest::addRow("month up into %s gap", qPrintable(springGap.toString("hh:mm")))
+ << QDateTime(spring.addMonths(-1), springGap)
+ << QDateTimeEdit::MonthSection
+ << +1
+ << springTransition;
+ QTest::addRow("month down into %s gap", qPrintable(springGap.toString("hh:mm")))
+ << QDateTime(spring.addMonths(1), springGap)
+ << QDateTimeEdit::MonthSection
+ << -1
+ << springTransition;
+
+ // 2018-03-25 - change year
+ QTest::addRow("year up into %s gap", qPrintable(springGap.toString("hh:mm")))
+ << QDateTime(spring.addYears(-1), springGap)
+ << QDateTimeEdit::YearSection
+ << +1
+ << springTransition;
+ QTest::addRow("year down into %s gap", qPrintable(springGap.toString("hh:mm")))
+ << QDateTime(spring.addYears(1), springGap)
+ << QDateTimeEdit::YearSection
+ << -1
+ << springTransition;
+}
+
+void tst_QDateTimeEdit::stepIntoDSTGap()
+{
+ QFETCH(QDateTime, start);
+ QFETCH(QDateTimeEdit::Section, section);
+ QFETCH(int, steps);
+ QFETCH(QDateTime, end);
+
+ QDateTimeEdit edit;
+ edit.setDisplayFormat(QLatin1String("dd.MM.yyyy hh:mm"));
+
+ // we always want to start with a valid time
+ QVERIFY(start.isValid());
+ edit.setDateTime(start);
+
+ edit.setSelectedSection(section);
+
+ // we want to end with a valid value
+ QVERIFY(end.isValid());
+
+ const auto stepCount = qAbs(steps);
+ for (int step = 0; step < stepCount; ++step)
+ QTest::keyClick(&edit, steps > 0 ? Qt::Key_Up : Qt::Key_Down, {});
+
+ QCOMPARE(edit.dateTime(), end);
+}
+
QTEST_MAIN(tst_QDateTimeEdit)
#include "tst_qdatetimeedit.moc"
diff --git a/tests/manual/bearerex/datatransferer.cpp b/tests/manual/bearerex/datatransferer.cpp
index 0eeeb090ae..b4409ce52c 100644
--- a/tests/manual/bearerex/datatransferer.cpp
+++ b/tests/manual/bearerex/datatransferer.cpp
@@ -53,7 +53,7 @@ DataTransfererQTcp::DataTransfererQTcp(QObject* parent)
connect(&m_qsocket, SIGNAL(readyRead()), this, SLOT(readyRead()));
connect(&m_qsocket, SIGNAL(connected()), this, SLOT(connected()));
- connect(&m_qsocket, SIGNAL(error(QAbstractSocket::SocketError)),
+ connect(&m_qsocket, SIGNAL(errorOccurred(QAbstractSocket::SocketError)),
this, SLOT(error(QAbstractSocket::SocketError)));
}