Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
parent
fd2685c2f0
commit
aa37e67ef7
@ -703,7 +703,7 @@ int main(int argc, char *argv[])
|
|||||||
QStringList files = parser.positionalArguments();
|
QStringList files = parser.positionalArguments();
|
||||||
if (files.isEmpty())
|
if (files.isEmpty())
|
||||||
files << "-";
|
files << "-";
|
||||||
for (const QString &file : qAsConst(files)) {
|
for (const QString &file : std::as_const(files)) {
|
||||||
QFile f(file);
|
QFile f(file);
|
||||||
if (file == "-" ? f.open(stdin, QIODevice::ReadOnly) : f.open(QIODevice::ReadOnly)) {
|
if (file == "-" ? f.open(stdin, QIODevice::ReadOnly) : f.open(QIODevice::ReadOnly)) {
|
||||||
if (files.size() > 1)
|
if (files.size() > 1)
|
||||||
|
@ -31,7 +31,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QStringList inputFormats;
|
QStringList inputFormats;
|
||||||
QStringList outputFormats;
|
QStringList outputFormats;
|
||||||
for (Converter *conv : qAsConst(*availableConverters)) {
|
for (Converter *conv : std::as_const(*availableConverters)) {
|
||||||
auto direction = conv->directions();
|
auto direction = conv->directions();
|
||||||
QString name = conv->name();
|
QString name = conv->name();
|
||||||
if (direction & Converter::In)
|
if (direction & Converter::In)
|
||||||
@ -82,7 +82,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (parser.isSet(formatOptionsOption)) {
|
if (parser.isSet(formatOptionsOption)) {
|
||||||
QString format = parser.value(formatOptionsOption);
|
QString format = parser.value(formatOptionsOption);
|
||||||
for (Converter *conv : qAsConst(*availableConverters)) {
|
for (Converter *conv : std::as_const(*availableConverters)) {
|
||||||
if (conv->name() == format) {
|
if (conv->name() == format) {
|
||||||
const char *help = conv->optionsHelp();
|
const char *help = conv->optionsHelp();
|
||||||
if (help)
|
if (help)
|
||||||
@ -100,7 +100,7 @@ int main(int argc, char *argv[])
|
|||||||
Converter *inconv = nullptr;
|
Converter *inconv = nullptr;
|
||||||
QString format = parser.value(inputFormatOption);
|
QString format = parser.value(inputFormatOption);
|
||||||
if (format != "auto") {
|
if (format != "auto") {
|
||||||
for (Converter *conv : qAsConst(*availableConverters)) {
|
for (Converter *conv : std::as_const(*availableConverters)) {
|
||||||
if (conv->name() == format) {
|
if (conv->name() == format) {
|
||||||
inconv = conv;
|
inconv = conv;
|
||||||
break;
|
break;
|
||||||
@ -116,7 +116,7 @@ int main(int argc, char *argv[])
|
|||||||
Converter *outconv = nullptr;
|
Converter *outconv = nullptr;
|
||||||
format = parser.value(outputFormatOption);
|
format = parser.value(outputFormatOption);
|
||||||
if (format != "auto") {
|
if (format != "auto") {
|
||||||
for (Converter *conv : qAsConst(*availableConverters)) {
|
for (Converter *conv : std::as_const(*availableConverters)) {
|
||||||
if (conv->name() == format) {
|
if (conv->name() == format) {
|
||||||
outconv = conv;
|
outconv = conv;
|
||||||
break;
|
break;
|
||||||
@ -155,7 +155,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!inconv) {
|
if (!inconv) {
|
||||||
// probe the input to find a file format
|
// probe the input to find a file format
|
||||||
for (Converter *conv : qAsConst(*availableConverters)) {
|
for (Converter *conv : std::as_const(*availableConverters)) {
|
||||||
if (conv->directions() & Converter::In && conv->probeFile(&input)) {
|
if (conv->directions() & Converter::In && conv->probeFile(&input)) {
|
||||||
inconv = conv;
|
inconv = conv;
|
||||||
break;
|
break;
|
||||||
@ -170,7 +170,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!outconv) {
|
if (!outconv) {
|
||||||
// probe the output to find a file format
|
// probe the output to find a file format
|
||||||
for (Converter *conv : qAsConst(*availableConverters)) {
|
for (Converter *conv : std::as_const(*availableConverters)) {
|
||||||
if (conv->directions() & Converter::Out && conv->probeFile(&output)) {
|
if (conv->directions() & Converter::Out && conv->probeFile(&output)) {
|
||||||
outconv = conv;
|
outconv = conv;
|
||||||
break;
|
break;
|
||||||
|
@ -109,7 +109,7 @@ void DownloadManager::execute()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const QString &arg : qAsConst(args)) {
|
for (const QString &arg : std::as_const(args)) {
|
||||||
QUrl url = QUrl::fromEncoded(arg.toLocal8Bit());
|
QUrl url = QUrl::fromEncoded(arg.toLocal8Bit());
|
||||||
doDownload(url);
|
doDownload(url);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ void Client::sendMessage(const QString &message)
|
|||||||
if (message.isEmpty())
|
if (message.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Connection *connection : qAsConst(peers))
|
for (Connection *connection : std::as_const(peers))
|
||||||
connection->sendMessage(message);
|
connection->sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ void PeerManager::sendBroadcastDatagram()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool validBroadcastAddresses = true;
|
bool validBroadcastAddresses = true;
|
||||||
for (const QHostAddress &address : qAsConst(broadcastAddresses)) {
|
for (const QHostAddress &address : std::as_const(broadcastAddresses)) {
|
||||||
if (broadcastSocket.writeDatagram(datagram, address,
|
if (broadcastSocket.writeDatagram(datagram, address,
|
||||||
broadcastPort) == -1)
|
broadcastPort) == -1)
|
||||||
validBroadcastAddresses = false;
|
validBroadcastAddresses = false;
|
||||||
|
@ -30,7 +30,7 @@ FileManager::~FileManager()
|
|||||||
cond.wakeOne();
|
cond.wakeOne();
|
||||||
wait();
|
wait();
|
||||||
|
|
||||||
for (QFile *file : qAsConst(files)) {
|
for (QFile *file : std::as_const(files)) {
|
||||||
file->close();
|
file->close();
|
||||||
delete file;
|
delete file;
|
||||||
}
|
}
|
||||||
@ -391,7 +391,7 @@ void FileManager::verifyFileContents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify all pending pieces
|
// Verify all pending pieces
|
||||||
for (int index : qAsConst(newPendingVerificationRequests))
|
for (int index : std::as_const(newPendingVerificationRequests))
|
||||||
emit pieceVerified(index, verifySinglePiece(index));
|
emit pieceVerified(index, verifySinglePiece(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ bool MainWindow::addTorrent(const QString &fileName, const QString &destinationF
|
|||||||
const QByteArray &resumeState)
|
const QByteArray &resumeState)
|
||||||
{
|
{
|
||||||
// Check if the torrent is already being downloaded.
|
// Check if the torrent is already being downloaded.
|
||||||
for (const Job &job : qAsConst(jobs)) {
|
for (const Job &job : std::as_const(jobs)) {
|
||||||
if (job.torrentFileName == fileName && job.destinationDirectory == destinationFolder) {
|
if (job.torrentFileName == fileName && job.destinationDirectory == destinationFolder) {
|
||||||
QMessageBox::warning(this, tr("Already downloading"),
|
QMessageBox::warning(this, tr("Already downloading"),
|
||||||
tr("The torrent file %1 is "
|
tr("The torrent file %1 is "
|
||||||
@ -644,7 +644,7 @@ void MainWindow::closeEvent(QCloseEvent *)
|
|||||||
// them to signal that they have stopped.
|
// them to signal that they have stopped.
|
||||||
jobsToStop = 0;
|
jobsToStop = 0;
|
||||||
jobsStopped = 0;
|
jobsStopped = 0;
|
||||||
for (const Job &job : qAsConst(jobs)) {
|
for (const Job &job : std::as_const(jobs)) {
|
||||||
++jobsToStop;
|
++jobsToStop;
|
||||||
TorrentClient *client = job.client;
|
TorrentClient *client = job.client;
|
||||||
client->disconnect();
|
client->disconnect();
|
||||||
|
@ -33,7 +33,7 @@ void RateController::removeSocket(PeerWireClient *socket)
|
|||||||
void RateController::setDownloadLimit(int bytesPerSecond)
|
void RateController::setDownloadLimit(int bytesPerSecond)
|
||||||
{
|
{
|
||||||
downLimit = bytesPerSecond;
|
downLimit = bytesPerSecond;
|
||||||
for (PeerWireClient *socket : qAsConst(sockets))
|
for (PeerWireClient *socket : std::as_const(sockets))
|
||||||
socket->setReadBufferSize(downLimit * 4);
|
socket->setReadBufferSize(downLimit * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ void RateController::transfer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QSet<PeerWireClient *> pendingSockets;
|
QSet<PeerWireClient *> pendingSockets;
|
||||||
for (PeerWireClient *client : qAsConst(sockets)) {
|
for (PeerWireClient *client : std::as_const(sockets)) {
|
||||||
if (client->canTransferMore())
|
if (client->canTransferMore())
|
||||||
pendingSockets << client;
|
pendingSockets << client;
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ void TorrentClient::stop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Abort all existing connections
|
// Abort all existing connections
|
||||||
for (PeerWireClient *client : qAsConst(d->connections)) {
|
for (PeerWireClient *client : std::as_const(d->connections)) {
|
||||||
RateController::instance()->removeSocket(client);
|
RateController::instance()->removeSocket(client);
|
||||||
ConnectionManager::instance()->removeConnection(client);
|
ConnectionManager::instance()->removeConnection(client);
|
||||||
client->abort();
|
client->abort();
|
||||||
@ -439,7 +439,7 @@ void TorrentClient::setPaused(bool paused)
|
|||||||
// connections to 0. Keep the list of peers, so we can quickly
|
// connections to 0. Keep the list of peers, so we can quickly
|
||||||
// resume later.
|
// resume later.
|
||||||
d->setState(Paused);
|
d->setState(Paused);
|
||||||
for (PeerWireClient *client : qAsConst(d->connections))
|
for (PeerWireClient *client : std::as_const(d->connections))
|
||||||
client->abort();
|
client->abort();
|
||||||
d->connections.clear();
|
d->connections.clear();
|
||||||
TorrentServer::instance()->removeClient(this);
|
TorrentServer::instance()->removeClient(this);
|
||||||
@ -574,7 +574,7 @@ void TorrentClient::pieceVerified(int pieceIndex, bool ok)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the peer list so we know who's still interesting.
|
// Update the peer list so we know who's still interesting.
|
||||||
for (TorrentPeer *peer : qAsConst(d->peers)) {
|
for (TorrentPeer *peer : std::as_const(d->peers)) {
|
||||||
if (!peer->interesting)
|
if (!peer->interesting)
|
||||||
continue;
|
continue;
|
||||||
bool interesting = false;
|
bool interesting = false;
|
||||||
@ -594,7 +594,7 @@ void TorrentClient::pieceVerified(int pieceIndex, bool ok)
|
|||||||
d->incompletePieces.clearBit(pieceIndex);
|
d->incompletePieces.clearBit(pieceIndex);
|
||||||
|
|
||||||
// Notify connected peers.
|
// Notify connected peers.
|
||||||
for (PeerWireClient *client : qAsConst(d->connections)) {
|
for (PeerWireClient *client : std::as_const(d->connections)) {
|
||||||
if (client->state() == QAbstractSocket::ConnectedState
|
if (client->state() == QAbstractSocket::ConnectedState
|
||||||
&& !client->availablePieces().testBit(pieceIndex)) {
|
&& !client->availablePieces().testBit(pieceIndex)) {
|
||||||
client->sendPieceNotification(pieceIndex);
|
client->sendPieceNotification(pieceIndex);
|
||||||
@ -672,9 +672,9 @@ QList<TorrentPeer *> TorrentClient::weighedFreePeers() const
|
|||||||
qint64 now = QDateTime::currentSecsSinceEpoch();
|
qint64 now = QDateTime::currentSecsSinceEpoch();
|
||||||
QList<TorrentPeer *> freePeers;
|
QList<TorrentPeer *> freePeers;
|
||||||
QMap<QString, int> connectionsPerPeer;
|
QMap<QString, int> connectionsPerPeer;
|
||||||
for (TorrentPeer *peer : qAsConst(d->peers)) {
|
for (TorrentPeer *peer : std::as_const(d->peers)) {
|
||||||
bool busy = false;
|
bool busy = false;
|
||||||
for (PeerWireClient *client : qAsConst(d->connections)) {
|
for (PeerWireClient *client : std::as_const(d->connections)) {
|
||||||
if (client->state() == PeerWireClient::ConnectedState
|
if (client->state() == PeerWireClient::ConnectedState
|
||||||
&& client->peerAddress() == peer->address
|
&& client->peerAddress() == peer->address
|
||||||
&& client->peerPort() == peer->port) {
|
&& client->peerPort() == peer->port) {
|
||||||
@ -694,7 +694,7 @@ QList<TorrentPeer *> TorrentClient::weighedFreePeers() const
|
|||||||
|
|
||||||
// Assign points based on connection speed and pieces available.
|
// Assign points based on connection speed and pieces available.
|
||||||
QList<QPair<int, TorrentPeer *> > points;
|
QList<QPair<int, TorrentPeer *> > points;
|
||||||
for (TorrentPeer *peer : qAsConst(freePeers)) {
|
for (TorrentPeer *peer : std::as_const(freePeers)) {
|
||||||
int tmp = 0;
|
int tmp = 0;
|
||||||
if (peer->interesting) {
|
if (peer->interesting) {
|
||||||
tmp += peer->numCompletedPieces;
|
tmp += peer->numCompletedPieces;
|
||||||
@ -717,7 +717,7 @@ QList<TorrentPeer *> TorrentClient::weighedFreePeers() const
|
|||||||
QMultiMap<int, TorrentPeer *> pointMap;
|
QMultiMap<int, TorrentPeer *> pointMap;
|
||||||
int lowestScore = 0;
|
int lowestScore = 0;
|
||||||
int lastIndex = 0;
|
int lastIndex = 0;
|
||||||
for (const PointPair &point : qAsConst(points)) {
|
for (const PointPair &point : std::as_const(points)) {
|
||||||
if (point.first > lowestScore) {
|
if (point.first > lowestScore) {
|
||||||
lowestScore = point.first;
|
lowestScore = point.first;
|
||||||
++lastIndex;
|
++lastIndex;
|
||||||
@ -768,7 +768,7 @@ void TorrentClient::setupOutgoingConnection()
|
|||||||
PeerWireClient *client = qobject_cast<PeerWireClient *>(sender());
|
PeerWireClient *client = qobject_cast<PeerWireClient *>(sender());
|
||||||
|
|
||||||
// Update connection statistics.
|
// Update connection statistics.
|
||||||
for (TorrentPeer *peer : qAsConst(d->peers)) {
|
for (TorrentPeer *peer : std::as_const(d->peers)) {
|
||||||
if (peer->port == client->peerPort() && peer->address == client->peerAddress()) {
|
if (peer->port == client->peerPort() && peer->address == client->peerAddress()) {
|
||||||
peer->connectTime = peer->lastVisited - peer->connectStart;
|
peer->connectTime = peer->lastVisited - peer->connectStart;
|
||||||
break;
|
break;
|
||||||
@ -1040,7 +1040,7 @@ void TorrentClient::scheduleUploads()
|
|||||||
// no use in unchoking them.
|
// no use in unchoking them.
|
||||||
QList<PeerWireClient *> allClients = d->connections;
|
QList<PeerWireClient *> allClients = d->connections;
|
||||||
QList<QPair<qint64, PeerWireClient *>> transferSpeeds;
|
QList<QPair<qint64, PeerWireClient *>> transferSpeeds;
|
||||||
for (PeerWireClient *client : qAsConst(allClients)) {
|
for (PeerWireClient *client : std::as_const(allClients)) {
|
||||||
if (client->state() == QAbstractSocket::ConnectedState
|
if (client->state() == QAbstractSocket::ConnectedState
|
||||||
&& client->availablePieces().count(true) != d->pieceCount) {
|
&& client->availablePieces().count(true) != d->pieceCount) {
|
||||||
if (d->state == Seeding) {
|
if (d->state == Seeding) {
|
||||||
@ -1098,7 +1098,7 @@ void TorrentClient::scheduleDownloads()
|
|||||||
|
|
||||||
// Check what each client is doing, and assign payloads to those
|
// Check what each client is doing, and assign payloads to those
|
||||||
// who are either idle or done.
|
// who are either idle or done.
|
||||||
for (PeerWireClient *client : qAsConst(d->connections))
|
for (PeerWireClient *client : std::as_const(d->connections))
|
||||||
schedulePieceForClient(client);
|
schedulePieceForClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1177,7 +1177,7 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client)
|
|||||||
incompletePiecesAvailableToClient &= client->availablePieces();
|
incompletePiecesAvailableToClient &= client->availablePieces();
|
||||||
|
|
||||||
// Remove all pieces that this client has already requested.
|
// Remove all pieces that this client has already requested.
|
||||||
for (int i : qAsConst(currentPieces))
|
for (int i : std::as_const(currentPieces))
|
||||||
incompletePiecesAvailableToClient.clearBit(i);
|
incompletePiecesAvailableToClient.clearBit(i);
|
||||||
|
|
||||||
// Only continue if more pieces can be scheduled. If no pieces
|
// Only continue if more pieces can be scheduled. If no pieces
|
||||||
@ -1213,7 +1213,7 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client)
|
|||||||
memset(occurrences, 0, d->pieceCount * sizeof(int));
|
memset(occurrences, 0, d->pieceCount * sizeof(int));
|
||||||
|
|
||||||
// Count how many of each piece are available.
|
// Count how many of each piece are available.
|
||||||
for (PeerWireClient *peer : qAsConst(d->connections)) {
|
for (PeerWireClient *peer : std::as_const(d->connections)) {
|
||||||
QBitArray peerPieces = peer->availablePieces();
|
QBitArray peerPieces = peer->availablePieces();
|
||||||
int peerPiecesSize = peerPieces.size();
|
int peerPiecesSize = peerPieces.size();
|
||||||
for (int i = 0; i < peerPiecesSize; ++i) {
|
for (int i = 0; i < peerPiecesSize; ++i) {
|
||||||
@ -1311,7 +1311,7 @@ void TorrentClient::requestMore(PeerWireClient *client)
|
|||||||
|
|
||||||
// Starting with the first piece that we're waiting for, request
|
// Starting with the first piece that we're waiting for, request
|
||||||
// blocks until the quota is filled up.
|
// blocks until the quota is filled up.
|
||||||
for (TorrentPiece *piece : qAsConst(piecesInProgress)) {
|
for (TorrentPiece *piece : std::as_const(piecesInProgress)) {
|
||||||
numBlocksInProgress += requestBlocks(client, piece, maxInProgress - numBlocksInProgress);
|
numBlocksInProgress += requestBlocks(client, piece, maxInProgress - numBlocksInProgress);
|
||||||
if (numBlocksInProgress == maxInProgress)
|
if (numBlocksInProgress == maxInProgress)
|
||||||
break;
|
break;
|
||||||
@ -1414,7 +1414,7 @@ void TorrentClient::addToPeerList(const QList<TorrentPeer> &peerList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool known = false;
|
bool known = false;
|
||||||
for (const TorrentPeer *knownPeer : qAsConst(d->peers)) {
|
for (const TorrentPeer *knownPeer : std::as_const(d->peers)) {
|
||||||
if (knownPeer->port == peer.port
|
if (knownPeer->port == peer.port
|
||||||
&& knownPeer->address == peer.address) {
|
&& knownPeer->address == peer.address) {
|
||||||
known = true;
|
known = true;
|
||||||
@ -1445,7 +1445,7 @@ void TorrentClient::addToPeerList(const QList<TorrentPeer> &peerList)
|
|||||||
const auto firstNInactivePeers = [&tooMany, this] (TorrentPeer *peer) {
|
const auto firstNInactivePeers = [&tooMany, this] (TorrentPeer *peer) {
|
||||||
if (!tooMany)
|
if (!tooMany)
|
||||||
return false;
|
return false;
|
||||||
for (const PeerWireClient *client : qAsConst(d->connections)) {
|
for (const PeerWireClient *client : std::as_const(d->connections)) {
|
||||||
if (client->peer() == peer && (client->downloadSpeed() + client->uploadSpeed()) > 1024)
|
if (client->peer() == peer && (client->downloadSpeed() + client->uploadSpeed()) > 1024)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ void TorrentServer::removeClient()
|
|||||||
void TorrentServer::processInfoHash(const QByteArray &infoHash)
|
void TorrentServer::processInfoHash(const QByteArray &infoHash)
|
||||||
{
|
{
|
||||||
PeerWireClient *peer = qobject_cast<PeerWireClient *>(sender());
|
PeerWireClient *peer = qobject_cast<PeerWireClient *>(sender());
|
||||||
for (TorrentClient *client : qAsConst(clients)) {
|
for (TorrentClient *client : std::as_const(clients)) {
|
||||||
if (client->state() >= TorrentClient::Searching && client->infoHash() == infoHash) {
|
if (client->state() >= TorrentClient::Searching && client->infoHash() == infoHash) {
|
||||||
peer->disconnect(peer, nullptr, this, nullptr);
|
peer->disconnect(peer, nullptr, this, nullptr);
|
||||||
client->setupIncomingConnection(peer);
|
client->setupIncomingConnection(peer);
|
||||||
|
@ -345,7 +345,7 @@ void Widget::renderWindowReady()
|
|||||||
QList<QByteArray> extensionList = context->extensions().values();
|
QList<QByteArray> extensionList = context->extensions().values();
|
||||||
std::sort(extensionList.begin(), extensionList.end());
|
std::sort(extensionList.begin(), extensionList.end());
|
||||||
m_extensions->append(tr("Found %1 extensions:").arg(extensionList.count()));
|
m_extensions->append(tr("Found %1 extensions:").arg(extensionList.count()));
|
||||||
for (const QByteArray &ext : qAsConst(extensionList))
|
for (const QByteArray &ext : std::as_const(extensionList))
|
||||||
m_extensions->append(QString::fromLatin1(ext));
|
m_extensions->append(QString::fromLatin1(ext));
|
||||||
|
|
||||||
m_output->moveCursor(QTextCursor::Start);
|
m_output->moveCursor(QTextCursor::Start);
|
||||||
|
@ -358,7 +358,7 @@ void GLWidget::paintGL()
|
|||||||
painter.endNativePainting();
|
painter.endNativePainting();
|
||||||
|
|
||||||
if (m_showBubbles) {
|
if (m_showBubbles) {
|
||||||
for (Bubble *bubble : qAsConst(m_bubbles))
|
for (Bubble *bubble : std::as_const(m_bubbles))
|
||||||
bubble->drawBubble(&painter);
|
bubble->drawBubble(&painter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ void GLWidget::paintGL()
|
|||||||
|
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
for (Bubble *bubble : qAsConst(m_bubbles))
|
for (Bubble *bubble : std::as_const(m_bubbles))
|
||||||
bubble->move(rect());
|
bubble->move(rect());
|
||||||
|
|
||||||
if (!(m_frames % 100)) {
|
if (!(m_frames % 100)) {
|
||||||
|
@ -133,7 +133,7 @@ void MainWindow::timerUsageChanged(bool enabled)
|
|||||||
m_timer->start();
|
m_timer->start();
|
||||||
} else {
|
} else {
|
||||||
m_timer->stop();
|
m_timer->stop();
|
||||||
for (QOpenGLWidget *w : qAsConst(m_glWidgets))
|
for (QOpenGLWidget *w : std::as_const(m_glWidgets))
|
||||||
w->update();
|
w->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ void DialogOptionsWidget::addSpacer()
|
|||||||
int DialogOptionsWidget::value() const
|
int DialogOptionsWidget::value() const
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (const CheckBoxEntry &checkboxEntry : qAsConst(checkBoxEntries)) {
|
for (const CheckBoxEntry &checkboxEntry : std::as_const(checkBoxEntries)) {
|
||||||
if (checkboxEntry.first->isChecked())
|
if (checkboxEntry.first->isChecked())
|
||||||
result |= checkboxEntry.second;
|
result |= checkboxEntry.second;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ void DiagramItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||||||
QVariant DiagramItem::itemChange(GraphicsItemChange change, const QVariant &value)
|
QVariant DiagramItem::itemChange(GraphicsItemChange change, const QVariant &value)
|
||||||
{
|
{
|
||||||
if (change == QGraphicsItem::ItemPositionChange) {
|
if (change == QGraphicsItem::ItemPositionChange) {
|
||||||
for (Arrow *arrow : qAsConst(arrows))
|
for (Arrow *arrow : std::as_const(arrows))
|
||||||
arrow->updatePosition();
|
arrow->updatePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ void MainWindow::buttonGroupClicked(QAbstractButton *button)
|
|||||||
void MainWindow::deleteItem()
|
void MainWindow::deleteItem()
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem *> selectedItems = scene->selectedItems();
|
QList<QGraphicsItem *> selectedItems = scene->selectedItems();
|
||||||
for (QGraphicsItem *item : qAsConst(selectedItems)) {
|
for (QGraphicsItem *item : std::as_const(selectedItems)) {
|
||||||
if (item->type() == Arrow::Type) {
|
if (item->type() == Arrow::Type) {
|
||||||
scene->removeItem(item);
|
scene->removeItem(item);
|
||||||
Arrow *arrow = qgraphicsitem_cast<Arrow *>(item);
|
Arrow *arrow = qgraphicsitem_cast<Arrow *>(item);
|
||||||
@ -98,7 +98,7 @@ void MainWindow::deleteItem()
|
|||||||
}
|
}
|
||||||
|
|
||||||
selectedItems = scene->selectedItems();
|
selectedItems = scene->selectedItems();
|
||||||
for (QGraphicsItem *item : qAsConst(selectedItems)) {
|
for (QGraphicsItem *item : std::as_const(selectedItems)) {
|
||||||
if (item->type() == DiagramItem::Type)
|
if (item->type() == DiagramItem::Type)
|
||||||
qgraphicsitem_cast<DiagramItem *>(item)->removeArrows();
|
qgraphicsitem_cast<DiagramItem *>(item)->removeArrows();
|
||||||
scene->removeItem(item);
|
scene->removeItem(item);
|
||||||
|
@ -123,11 +123,11 @@ void GraphWidget::timerEvent(QTimerEvent *event)
|
|||||||
nodes << node;
|
nodes << node;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Node *node : qAsConst(nodes))
|
for (Node *node : std::as_const(nodes))
|
||||||
node->calculateForces();
|
node->calculateForces();
|
||||||
|
|
||||||
bool itemsMoved = false;
|
bool itemsMoved = false;
|
||||||
for (Node *node : qAsConst(nodes)) {
|
for (Node *node : std::as_const(nodes)) {
|
||||||
if (node->advancePosition())
|
if (node->advancePosition())
|
||||||
itemsMoved = true;
|
itemsMoved = true;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ void Node::calculateForces()
|
|||||||
//! [4]
|
//! [4]
|
||||||
// Now subtract all forces pulling items together
|
// Now subtract all forces pulling items together
|
||||||
double weight = (edgeList.size() + 1) * 10;
|
double weight = (edgeList.size() + 1) * 10;
|
||||||
for (const Edge *edge : qAsConst(edgeList)) {
|
for (const Edge *edge : std::as_const(edgeList)) {
|
||||||
QPointF vec;
|
QPointF vec;
|
||||||
if (edge->sourceNode() == this)
|
if (edge->sourceNode() == this)
|
||||||
vec = mapToItem(edge->destNode(), 0, 0);
|
vec = mapToItem(edge->destNode(), 0, 0);
|
||||||
@ -148,7 +148,7 @@ QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value)
|
|||||||
{
|
{
|
||||||
switch (change) {
|
switch (change) {
|
||||||
case ItemPositionHasChanged:
|
case ItemPositionHasChanged:
|
||||||
for (Edge *edge : qAsConst(edgeList))
|
for (Edge *edge : std::as_const(edgeList))
|
||||||
edge->adjust();
|
edge->adjust();
|
||||||
graph->itemMoved();
|
graph->itemMoved();
|
||||||
break;
|
break;
|
||||||
|
@ -102,7 +102,7 @@ QSizeF FlowLayout::minSize(const QSizeF &constraint) const
|
|||||||
} else if (constraint.height() >= 0) { // width for height?
|
} else if (constraint.height() >= 0) { // width for height?
|
||||||
// not supported
|
// not supported
|
||||||
} else {
|
} else {
|
||||||
for (const QGraphicsLayoutItem *item : qAsConst(m_items))
|
for (const QGraphicsLayoutItem *item : std::as_const(m_items))
|
||||||
size = size.expandedTo(item->effectiveSizeHint(Qt::MinimumSize));
|
size = size.expandedTo(item->effectiveSizeHint(Qt::MinimumSize));
|
||||||
size += QSizeF(left + right, top + bottom);
|
size += QSizeF(left + right, top + bottom);
|
||||||
}
|
}
|
||||||
@ -116,7 +116,7 @@ QSizeF FlowLayout::prefSize() const
|
|||||||
|
|
||||||
qreal maxh = 0;
|
qreal maxh = 0;
|
||||||
qreal totalWidth = 0;
|
qreal totalWidth = 0;
|
||||||
for (const QGraphicsLayoutItem *item : qAsConst(m_items)) {
|
for (const QGraphicsLayoutItem *item : std::as_const(m_items)) {
|
||||||
if (totalWidth > 0)
|
if (totalWidth > 0)
|
||||||
totalWidth += spacing(Qt::Horizontal);
|
totalWidth += spacing(Qt::Horizontal);
|
||||||
QSizeF pref = item->effectiveSizeHint(Qt::PreferredSize);
|
QSizeF pref = item->effectiveSizeHint(Qt::PreferredSize);
|
||||||
@ -135,7 +135,7 @@ QSizeF FlowLayout::maxSize() const
|
|||||||
{
|
{
|
||||||
qreal totalWidth = 0;
|
qreal totalWidth = 0;
|
||||||
qreal totalHeight = 0;
|
qreal totalHeight = 0;
|
||||||
for (const QGraphicsLayoutItem *item : qAsConst(m_items)) {
|
for (const QGraphicsLayoutItem *item : std::as_const(m_items)) {
|
||||||
if (totalWidth > 0)
|
if (totalWidth > 0)
|
||||||
totalWidth += spacing(Qt::Horizontal);
|
totalWidth += spacing(Qt::Horizontal);
|
||||||
if (totalHeight > 0)
|
if (totalHeight > 0)
|
||||||
|
@ -164,7 +164,7 @@ void AddressWidget::readFromFile(const QString &fileName)
|
|||||||
QMessageBox::information(this, tr("No contacts in file"),
|
QMessageBox::information(this, tr("No contacts in file"),
|
||||||
tr("The file you are attempting to open contains no contacts."));
|
tr("The file you are attempting to open contains no contacts."));
|
||||||
} else {
|
} else {
|
||||||
for (const auto &contact: qAsConst(contacts))
|
for (const auto &contact: std::as_const(contacts))
|
||||||
addEntry(contact.name, contact.address);
|
addEntry(contact.name, contact.address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ bool TreeItem::insertColumns(int position, int columns)
|
|||||||
for (int column = 0; column < columns; ++column)
|
for (int column = 0; column < columns; ++column)
|
||||||
itemData.insert(position, QVariant());
|
itemData.insert(position, QVariant());
|
||||||
|
|
||||||
for (TreeItem *child : qAsConst(childItems))
|
for (TreeItem *child : std::as_const(childItems))
|
||||||
child->insertColumns(position, columns);
|
child->insertColumns(position, columns);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -123,7 +123,7 @@ bool TreeItem::removeColumns(int position, int columns)
|
|||||||
for (int column = 0; column < columns; ++column)
|
for (int column = 0; column < columns; ++column)
|
||||||
itemData.remove(position);
|
itemData.remove(position);
|
||||||
|
|
||||||
for (TreeItem *child : qAsConst(childItems))
|
for (TreeItem *child : std::as_const(childItems))
|
||||||
child->removeColumns(position, columns);
|
child->removeColumns(position, columns);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -57,7 +57,7 @@ void Dialog::rotateWidgets()
|
|||||||
{
|
{
|
||||||
Q_ASSERT(rotatableWidgets.count() % 2 == 0);
|
Q_ASSERT(rotatableWidgets.count() % 2 == 0);
|
||||||
|
|
||||||
for (QWidget *widget : qAsConst(rotatableWidgets))
|
for (QWidget *widget : std::as_const(rotatableWidgets))
|
||||||
rotatableLayout->removeWidget(widget);
|
rotatableLayout->removeWidget(widget);
|
||||||
|
|
||||||
rotatableWidgets.enqueue(rotatableWidgets.dequeue());
|
rotatableWidgets.enqueue(rotatableWidgets.dequeue());
|
||||||
|
@ -108,7 +108,7 @@ QSize FlowLayout::sizeHint() const
|
|||||||
QSize FlowLayout::minimumSize() const
|
QSize FlowLayout::minimumSize() const
|
||||||
{
|
{
|
||||||
QSize size;
|
QSize size;
|
||||||
for (const QLayoutItem *item : qAsConst(itemList))
|
for (const QLayoutItem *item : std::as_const(itemList))
|
||||||
size = size.expandedTo(item->minimumSize());
|
size = size.expandedTo(item->minimumSize());
|
||||||
|
|
||||||
const QMargins margins = contentsMargins();
|
const QMargins margins = contentsMargins();
|
||||||
@ -129,7 +129,7 @@ int FlowLayout::doLayout(const QRect &rect, bool testOnly) const
|
|||||||
//! [9]
|
//! [9]
|
||||||
|
|
||||||
//! [10]
|
//! [10]
|
||||||
for (QLayoutItem *item : qAsConst(itemList)) {
|
for (QLayoutItem *item : std::as_const(itemList)) {
|
||||||
const QWidget *wid = item->widget();
|
const QWidget *wid = item->widget();
|
||||||
int spaceX = horizontalSpacing();
|
int spaceX = horizontalSpacing();
|
||||||
if (spaceX == -1)
|
if (spaceX == -1)
|
||||||
|
@ -260,7 +260,7 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
|
|||||||
bool italic = item->data(0, Qt::UserRole + 1).toBool();
|
bool italic = item->data(0, Qt::UserRole + 1).toBool();
|
||||||
|
|
||||||
// Calculate the maximum width and total height of the text.
|
// Calculate the maximum width and total height of the text.
|
||||||
for (int size : qAsConst(sampleSizes)) {
|
for (int size : std::as_const(sampleSizes)) {
|
||||||
QFont font(family, size, weight, italic);
|
QFont font(family, size, weight, italic);
|
||||||
font.setStyleName(style);
|
font.setStyleName(style);
|
||||||
font = QFont(font, painter->device());
|
font = QFont(font, painter->device());
|
||||||
@ -294,7 +294,7 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
|
|||||||
bool italic = item->data(0, Qt::UserRole + 1).toBool();
|
bool italic = item->data(0, Qt::UserRole + 1).toBool();
|
||||||
|
|
||||||
// Draw each line of text.
|
// Draw each line of text.
|
||||||
for (int size : qAsConst(sampleSizes)) {
|
for (int size : std::as_const(sampleSizes)) {
|
||||||
QFont font(family, size, weight, italic);
|
QFont font(family, size, weight, italic);
|
||||||
font.setStyleName(style);
|
font.setStyleName(style);
|
||||||
font = QFont(font, painter->device());
|
font = QFont(font, painter->device());
|
||||||
|
@ -534,7 +534,7 @@ void GradientRenderer::paint(QPainter *p)
|
|||||||
g = QConicalGradient(pts.at(0), angle);
|
g = QConicalGradient(pts.at(0), angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &stop : qAsConst(m_stops))
|
for (const auto &stop : std::as_const(m_stops))
|
||||||
g.setColorAt(stop.first, stop.second);
|
g.setColorAt(stop.first, stop.second);
|
||||||
|
|
||||||
g.setSpread(m_spread);
|
g.setSpread(m_spread);
|
||||||
|
@ -156,7 +156,7 @@ Window::Window()
|
|||||||
connect(penColorComboBox, &QComboBox::activated,
|
connect(penColorComboBox, &QComboBox::activated,
|
||||||
this, &Window::penColorChanged);
|
this, &Window::penColorChanged);
|
||||||
|
|
||||||
for (RenderArea *area : qAsConst(renderAreas)) {
|
for (RenderArea *area : std::as_const(renderAreas)) {
|
||||||
connect(penWidthSpinBox, &QSpinBox::valueChanged,
|
connect(penWidthSpinBox, &QSpinBox::valueChanged,
|
||||||
area, &RenderArea::setPenWidth);
|
area, &RenderArea::setPenWidth);
|
||||||
connect(rotationAngleSpinBox, &QSpinBox::valueChanged,
|
connect(rotationAngleSpinBox, &QSpinBox::valueChanged,
|
||||||
@ -167,7 +167,7 @@ Window::Window()
|
|||||||
QGridLayout *topLayout = new QGridLayout;
|
QGridLayout *topLayout = new QGridLayout;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (RenderArea *area : qAsConst(renderAreas)) {
|
for (RenderArea *area : std::as_const(renderAreas)) {
|
||||||
topLayout->addWidget(area, i / 3, i % 3);
|
topLayout->addWidget(area, i / 3, i % 3);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ void Window::fillRuleChanged()
|
|||||||
{
|
{
|
||||||
Qt::FillRule rule = (Qt::FillRule)currentItemData(fillRuleComboBox).toInt();
|
Qt::FillRule rule = (Qt::FillRule)currentItemData(fillRuleComboBox).toInt();
|
||||||
|
|
||||||
for (RenderArea *area : qAsConst(renderAreas))
|
for (RenderArea *area : std::as_const(renderAreas))
|
||||||
area->setFillRule(rule);
|
area->setFillRule(rule);
|
||||||
}
|
}
|
||||||
//! [19]
|
//! [19]
|
||||||
@ -215,7 +215,7 @@ void Window::fillGradientChanged()
|
|||||||
QColor color1 = qvariant_cast<QColor>(currentItemData(fillColor1ComboBox));
|
QColor color1 = qvariant_cast<QColor>(currentItemData(fillColor1ComboBox));
|
||||||
QColor color2 = qvariant_cast<QColor>(currentItemData(fillColor2ComboBox));
|
QColor color2 = qvariant_cast<QColor>(currentItemData(fillColor2ComboBox));
|
||||||
|
|
||||||
for (RenderArea *area : qAsConst(renderAreas))
|
for (RenderArea *area : std::as_const(renderAreas))
|
||||||
area->setFillGradient(color1, color2);
|
area->setFillGradient(color1, color2);
|
||||||
}
|
}
|
||||||
//! [20]
|
//! [20]
|
||||||
@ -225,7 +225,7 @@ void Window::penColorChanged()
|
|||||||
{
|
{
|
||||||
QColor color = qvariant_cast<QColor>(currentItemData(penColorComboBox));
|
QColor color = qvariant_cast<QColor>(currentItemData(penColorComboBox));
|
||||||
|
|
||||||
for (RenderArea *area : qAsConst(renderAreas))
|
for (RenderArea *area : std::as_const(renderAreas))
|
||||||
area->setPenColor(color);
|
area->setPenColor(color);
|
||||||
}
|
}
|
||||||
//! [21]
|
//! [21]
|
||||||
|
@ -268,7 +268,7 @@ void HoverPoints::paintPoints()
|
|||||||
p.setPen(m_pointPen);
|
p.setPen(m_pointPen);
|
||||||
p.setBrush(m_pointBrush);
|
p.setBrush(m_pointBrush);
|
||||||
|
|
||||||
for (const auto &point : qAsConst(m_points)) {
|
for (const auto &point : std::as_const(m_points)) {
|
||||||
QRectF bounds = pointBoundingRect(point);
|
QRectF bounds = pointBoundingRect(point);
|
||||||
if (m_shape == CircleShape)
|
if (m_shape == CircleShape)
|
||||||
p.drawEllipse(bounds);
|
p.drawEllipse(bounds);
|
||||||
|
@ -72,7 +72,7 @@ Highlighter::Highlighter(QTextDocument *parent)
|
|||||||
//! [7]
|
//! [7]
|
||||||
void Highlighter::highlightBlock(const QString &text)
|
void Highlighter::highlightBlock(const QString &text)
|
||||||
{
|
{
|
||||||
for (const HighlightingRule &rule : qAsConst(highlightingRules)) {
|
for (const HighlightingRule &rule : std::as_const(highlightingRules)) {
|
||||||
QRegularExpressionMatchIterator matchIterator = rule.pattern.globalMatch(text);
|
QRegularExpressionMatchIterator matchIterator = rule.pattern.globalMatch(text);
|
||||||
while (matchIterator.hasNext()) {
|
while (matchIterator.hasNext()) {
|
||||||
QRegularExpressionMatch match = matchIterator.next();
|
QRegularExpressionMatch match = matchIterator.next();
|
||||||
|
@ -153,7 +153,7 @@ void MainWindow::createMenus()
|
|||||||
//! [15] //! [16]
|
//! [15] //! [16]
|
||||||
{
|
{
|
||||||
saveAsMenu = new QMenu(tr("&Save As"), this);
|
saveAsMenu = new QMenu(tr("&Save As"), this);
|
||||||
for (QAction *action : qAsConst(saveAsActs))
|
for (QAction *action : std::as_const(saveAsActs))
|
||||||
saveAsMenu->addAction(action);
|
saveAsMenu->addAction(action);
|
||||||
|
|
||||||
fileMenu = new QMenu(tr("&File"), this);
|
fileMenu = new QMenu(tr("&File"), this);
|
||||||
|
@ -97,7 +97,7 @@ void SortingBox::paintEvent(QPaintEvent * /* event */)
|
|||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.setRenderHint(QPainter::Antialiasing);
|
painter.setRenderHint(QPainter::Antialiasing);
|
||||||
for (const ShapeItem &shapeItem : qAsConst(shapeItems)) {
|
for (const ShapeItem &shapeItem : std::as_const(shapeItems)) {
|
||||||
//! [8] //! [9]
|
//! [8] //! [9]
|
||||||
painter.translate(shapeItem.position());
|
painter.translate(shapeItem.position());
|
||||||
//! [9] //! [10]
|
//! [9] //! [10]
|
||||||
|
@ -51,7 +51,7 @@ void parseHtmlFile(QTextStream &out, const QString &fileName)
|
|||||||
while (links.size() > 5)
|
while (links.size() > 5)
|
||||||
links.removeLast();
|
links.removeLast();
|
||||||
|
|
||||||
for (const QString &link : qAsConst(links))
|
for (const QString &link : std::as_const(links))
|
||||||
out << " " << link << Qt::endl;
|
out << " " << link << Qt::endl;
|
||||||
out << Qt::endl << Qt::endl;
|
out << Qt::endl << Qt::endl;
|
||||||
}
|
}
|
||||||
|
@ -429,17 +429,17 @@ ProjectBuilderSources::files(QMakeProject *project) const
|
|||||||
|
|
||||||
static QString xcodeFiletypeForFilename(const QString &filename)
|
static QString xcodeFiletypeForFilename(const QString &filename)
|
||||||
{
|
{
|
||||||
for (const QString &ext : qAsConst(Option::cpp_ext)) {
|
for (const QString &ext : std::as_const(Option::cpp_ext)) {
|
||||||
if (filename.endsWith(ext))
|
if (filename.endsWith(ext))
|
||||||
return QStringLiteral("sourcecode.cpp.cpp");
|
return QStringLiteral("sourcecode.cpp.cpp");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const QString &ext : qAsConst(Option::c_ext)) {
|
for (const QString &ext : std::as_const(Option::c_ext)) {
|
||||||
if (filename.endsWith(ext))
|
if (filename.endsWith(ext))
|
||||||
return QStringLiteral("sourcecode.c.c");
|
return QStringLiteral("sourcecode.c.c");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const QString &ext : qAsConst(Option::h_ext)) {
|
for (const QString &ext : std::as_const(Option::h_ext)) {
|
||||||
if (filename.endsWith(ext))
|
if (filename.endsWith(ext))
|
||||||
return "sourcecode.c.h";
|
return "sourcecode.c.h";
|
||||||
}
|
}
|
||||||
@ -1181,13 +1181,13 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
|
|
||||||
if (copyBundleResources && ((!osx && path.isEmpty())
|
if (copyBundleResources && ((!osx && path.isEmpty())
|
||||||
|| (osx && path == QLatin1String("Contents/Resources")))) {
|
|| (osx && path == QLatin1String("Contents/Resources")))) {
|
||||||
for (const ProString &s : qAsConst(bundle_files))
|
for (const ProString &s : std::as_const(bundle_files))
|
||||||
bundle_resources_files << s;
|
bundle_resources_files << s;
|
||||||
} else if (copyBundleResources && isEmbeddedFramework) {
|
} else if (copyBundleResources && isEmbeddedFramework) {
|
||||||
for (const ProString &s : qAsConst(bundle_files))
|
for (const ProString &s : std::as_const(bundle_files))
|
||||||
embedded_frameworks << s;
|
embedded_frameworks << s;
|
||||||
} else if (copyBundleResources && isEmbeddedPlugin) {
|
} else if (copyBundleResources && isEmbeddedPlugin) {
|
||||||
for (const ProString &s : qAsConst(bundle_files)) {
|
for (const ProString &s : std::as_const(bundle_files)) {
|
||||||
ProString subpath = (path == pluginsPrefix) ? ProString() : path.mid(pluginsPrefix.size() + 1);
|
ProString subpath = (path == pluginsPrefix) ? ProString() : path.mid(pluginsPrefix.size() + 1);
|
||||||
embedded_plugins[subpath] << s;
|
embedded_plugins[subpath] << s;
|
||||||
}
|
}
|
||||||
|
@ -1031,7 +1031,7 @@ MakefileGenerator::writeProjectMakefile()
|
|||||||
|
|
||||||
//install
|
//install
|
||||||
t << "install: ";
|
t << "install: ";
|
||||||
for (SubTarget *s : qAsConst(targets))
|
for (SubTarget *s : std::as_const(targets))
|
||||||
t << s->target << '-';
|
t << s->target << '-';
|
||||||
t << "install " << Qt::endl;
|
t << "install " << Qt::endl;
|
||||||
|
|
||||||
@ -1961,7 +1961,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
|||||||
if (raw_clean.isEmpty())
|
if (raw_clean.isEmpty())
|
||||||
raw_clean << tmp_out;
|
raw_clean << tmp_out;
|
||||||
QString tmp_clean;
|
QString tmp_clean;
|
||||||
for (const QString &rc : qAsConst(raw_clean))
|
for (const QString &rc : std::as_const(raw_clean))
|
||||||
tmp_clean += ' ' + escapeFilePath(Option::fixPathToTargetOS(rc));
|
tmp_clean += ' ' + escapeFilePath(Option::fixPathToTargetOS(rc));
|
||||||
QString tmp_clean_cmds = project->values(ProKey(*it + ".clean_commands")).join(' ');
|
QString tmp_clean_cmds = project->values(ProKey(*it + ".clean_commands")).join(' ');
|
||||||
if(!tmp_inputs.isEmpty())
|
if(!tmp_inputs.isEmpty())
|
||||||
@ -1986,7 +1986,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
|||||||
for (ProStringList::ConstIterator input = tmp_inputs.cbegin(); input != tmp_inputs.cend(); ++input) {
|
for (ProStringList::ConstIterator input = tmp_inputs.cbegin(); input != tmp_inputs.cend(); ++input) {
|
||||||
QString tinp = (*input).toQString();
|
QString tinp = (*input).toQString();
|
||||||
QString out = replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell);
|
QString out = replaceExtraCompilerVariables(tmp_out, tinp, QString(), NoShell);
|
||||||
for (const QString &rc : qAsConst(raw_clean)) {
|
for (const QString &rc : std::as_const(raw_clean)) {
|
||||||
dels << ' ' + escapeFilePath(fileFixify(
|
dels << ' ' + escapeFilePath(fileFixify(
|
||||||
replaceExtraCompilerVariables(rc, tinp, out, NoShell),
|
replaceExtraCompilerVariables(rc, tinp, out, NoShell),
|
||||||
FileFixifyFromOutdir));
|
FileFixifyFromOutdir));
|
||||||
@ -1997,7 +1997,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
|||||||
} else {
|
} else {
|
||||||
QString files;
|
QString files;
|
||||||
const int commandlineLimit = 2047; // NT limit, expanded
|
const int commandlineLimit = 2047; // NT limit, expanded
|
||||||
for (const QString &file : qAsConst(dels)) {
|
for (const QString &file : std::as_const(dels)) {
|
||||||
if(del_statement.size() + files.size() +
|
if(del_statement.size() + files.size() +
|
||||||
qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) {
|
qMax(fixEnvVariables(file).size(), file.size()) > commandlineLimit) {
|
||||||
cleans.append(files);
|
cleans.append(files);
|
||||||
@ -2263,11 +2263,11 @@ QString MakefileGenerator::buildArgs(bool withExtra)
|
|||||||
{
|
{
|
||||||
QString ret;
|
QString ret;
|
||||||
|
|
||||||
for (const QString &arg : qAsConst(Option::globals->qmake_args))
|
for (const QString &arg : std::as_const(Option::globals->qmake_args))
|
||||||
ret += " " + shellQuote(arg);
|
ret += " " + shellQuote(arg);
|
||||||
if (withExtra && !Option::globals->qmake_extra_args.isEmpty()) {
|
if (withExtra && !Option::globals->qmake_extra_args.isEmpty()) {
|
||||||
ret += " --";
|
ret += " --";
|
||||||
for (const QString &arg : qAsConst(Option::globals->qmake_extra_args))
|
for (const QString &arg : std::as_const(Option::globals->qmake_extra_args))
|
||||||
ret += " " + shellQuote(arg);
|
ret += " " + shellQuote(arg);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -809,7 +809,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!exists) { //path lookup
|
if(!exists) { //path lookup
|
||||||
for (const QMakeLocalFileName &depdir : qAsConst(depdirs)) {
|
for (const QMakeLocalFileName &depdir : std::as_const(depdirs)) {
|
||||||
QMakeLocalFileName f(depdir.real() + Option::dir_sep + lfn.real());
|
QMakeLocalFileName f(depdir.real() + Option::dir_sep + lfn.real());
|
||||||
QFileInfo fi(findFileInfo(f));
|
QFileInfo fi(findFileInfo(f));
|
||||||
if(fi.exists() && !fi.isDir()) {
|
if(fi.exists() && !fi.isDir()) {
|
||||||
|
@ -14,7 +14,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
ProStringList UnixMakefileGenerator::libdirToFlags(const ProKey &key)
|
ProStringList UnixMakefileGenerator::libdirToFlags(const ProKey &key)
|
||||||
{
|
{
|
||||||
ProStringList results;
|
ProStringList results;
|
||||||
for (const auto &libdir : qAsConst(project->values(key))) {
|
for (const auto &libdir : std::as_const(project->values(key))) {
|
||||||
if (!project->isEmpty("QMAKE_LFLAGS_RPATH") && project->isActiveConfig("rpath_libdirs"))
|
if (!project->isEmpty("QMAKE_LFLAGS_RPATH") && project->isActiveConfig("rpath_libdirs"))
|
||||||
project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATH") + libdir;
|
project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATH") + libdir;
|
||||||
results.append("-L" + escapeFilePath(libdir));
|
results.append("-L" + escapeFilePath(libdir));
|
||||||
@ -299,7 +299,7 @@ QStringList
|
|||||||
ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
|
ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
|
||||||
if (pchArchs.isEmpty())
|
if (pchArchs.isEmpty())
|
||||||
pchArchs << ProString(); // normal single-arch PCH
|
pchArchs << ProString(); // normal single-arch PCH
|
||||||
for (const ProString &arch : qAsConst(pchArchs)) {
|
for (const ProString &arch : std::as_const(pchArchs)) {
|
||||||
auto pfx = header_prefix;
|
auto pfx = header_prefix;
|
||||||
if (!arch.isEmpty())
|
if (!arch.isEmpty())
|
||||||
pfx.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
|
pfx.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
|
||||||
@ -337,7 +337,7 @@ QStringList
|
|||||||
ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
|
ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
|
||||||
if (pchArchs.isEmpty())
|
if (pchArchs.isEmpty())
|
||||||
pchArchs << ProString(); // normal single-arch PCH
|
pchArchs << ProString(); // normal single-arch PCH
|
||||||
for (const ProString &arch : qAsConst(pchArchs)) {
|
for (const ProString &arch : std::as_const(pchArchs)) {
|
||||||
QString precompiledHeader = header_prefix + language + header_suffix;
|
QString precompiledHeader = header_prefix + language + header_suffix;
|
||||||
if (!arch.isEmpty()) {
|
if (!arch.isEmpty()) {
|
||||||
precompiledHeader.replace(QLatin1String("${QMAKE_PCH_ARCH}"),
|
precompiledHeader.replace(QLatin1String("${QMAKE_PCH_ARCH}"),
|
||||||
@ -392,7 +392,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
|
|||||||
libdirs.insert(libidx++, f);
|
libdirs.insert(libidx++, f);
|
||||||
} else if(opt.startsWith("-l")) {
|
} else if(opt.startsWith("-l")) {
|
||||||
QString lib = opt.mid(2);
|
QString lib = opt.mid(2);
|
||||||
for (const QMakeLocalFileName &libdir : qAsConst(libdirs)) {
|
for (const QMakeLocalFileName &libdir : std::as_const(libdirs)) {
|
||||||
QString libBase = libdir.local() + '/'
|
QString libBase = libdir.local() + '/'
|
||||||
+ project->first("QMAKE_PREFIX_SHLIB") + lib;
|
+ project->first("QMAKE_PREFIX_SHLIB") + lib;
|
||||||
if (linkPrl && processPrlFile(libBase, true))
|
if (linkPrl && processPrlFile(libBase, true))
|
||||||
@ -418,7 +418,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
|
|||||||
frameworkName.truncate(suffixPosition);
|
frameworkName.truncate(suffixPosition);
|
||||||
opt.remove(suffixMarker); // Apply suffix by removing marker
|
opt.remove(suffixMarker); // Apply suffix by removing marker
|
||||||
}
|
}
|
||||||
for (const QMakeLocalFileName &dir : qAsConst(frameworkdirs)) {
|
for (const QMakeLocalFileName &dir : std::as_const(frameworkdirs)) {
|
||||||
auto processPrlIfFound = [&](QString directory) {
|
auto processPrlIfFound = [&](QString directory) {
|
||||||
QString suffixedPrl = directory + opt;
|
QString suffixedPrl = directory + opt;
|
||||||
if (processPrlFile(suffixedPrl, true))
|
if (processPrlFile(suffixedPrl, true))
|
||||||
|
@ -805,7 +805,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
QString icon = fileFixify(var("ICON"));
|
QString icon = fileFixify(var("ICON"));
|
||||||
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
|
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
|
||||||
<< "@sed ";
|
<< "@sed ";
|
||||||
for (const ProString &arg : qAsConst(commonSedArgs))
|
for (const ProString &arg : std::as_const(commonSedArgs))
|
||||||
t << arg;
|
t << arg;
|
||||||
const QString iconName = icon.section(Option::dir_sep, -1);
|
const QString iconName = icon.section(Option::dir_sep, -1);
|
||||||
t << "-e \"s,@ICON@," << iconName << ",g\" "
|
t << "-e \"s,@ICON@," << iconName << ",g\" "
|
||||||
@ -837,7 +837,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
symlinks[bundle_dir + "Resources"] = "Versions/Current/Resources";
|
symlinks[bundle_dir + "Resources"] = "Versions/Current/Resources";
|
||||||
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
|
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
|
||||||
<< "@sed ";
|
<< "@sed ";
|
||||||
for (const ProString &arg : qAsConst(commonSedArgs))
|
for (const ProString &arg : std::as_const(commonSedArgs))
|
||||||
t << arg;
|
t << arg;
|
||||||
t << "-e \"s,@LIBRARY@," << lib_bundle_name << ",g\" "
|
t << "-e \"s,@LIBRARY@," << lib_bundle_name << ",g\" "
|
||||||
<< "-e \"s,\\$${EXECUTABLE_NAME}," << lib_bundle_name << ",g\" "
|
<< "-e \"s,\\$${EXECUTABLE_NAME}," << lib_bundle_name << ",g\" "
|
||||||
@ -977,7 +977,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
|
ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
|
||||||
if (pchArchs.isEmpty())
|
if (pchArchs.isEmpty())
|
||||||
pchArchs << ProString(); // normal single-arch PCH
|
pchArchs << ProString(); // normal single-arch PCH
|
||||||
for (const ProString &arch : qAsConst(pchArchs)) {
|
for (const ProString &arch : std::as_const(pchArchs)) {
|
||||||
ProString pchOutput;
|
ProString pchOutput;
|
||||||
if (!project->isEmpty("PRECOMPILED_DIR"))
|
if (!project->isEmpty("PRECOMPILED_DIR"))
|
||||||
pchOutput = project->first("PRECOMPILED_DIR");
|
pchOutput = project->first("PRECOMPILED_DIR");
|
||||||
@ -1008,7 +1008,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
|
ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
|
||||||
if (pchArchs.isEmpty())
|
if (pchArchs.isEmpty())
|
||||||
pchArchs << ProString(); // normal single-arch PCH
|
pchArchs << ProString(); // normal single-arch PCH
|
||||||
for (const ProString &arch : qAsConst(pchArchs)) {
|
for (const ProString &arch : std::as_const(pchArchs)) {
|
||||||
QString file = precomph_out_dir + header_prefix + language + header_suffix;
|
QString file = precomph_out_dir + header_prefix + language + header_suffix;
|
||||||
if (!arch.isEmpty())
|
if (!arch.isEmpty())
|
||||||
file.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
|
file.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
|
||||||
@ -1106,7 +1106,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
}
|
}
|
||||||
pchFlags.replace(QLatin1String("${QMAKE_PCH_INPUT}"), escapeFilePath(pchInput))
|
pchFlags.replace(QLatin1String("${QMAKE_PCH_INPUT}"), escapeFilePath(pchInput))
|
||||||
.replace(QLatin1String("${QMAKE_PCH_OUTPUT_BASE}"), escapeFilePath(pchBaseName.toQString()));
|
.replace(QLatin1String("${QMAKE_PCH_OUTPUT_BASE}"), escapeFilePath(pchBaseName.toQString()));
|
||||||
for (const ProString &arch : qAsConst(pchArchs)) {
|
for (const ProString &arch : std::as_const(pchArchs)) {
|
||||||
auto pchArchOutput = pchOutput.toQString();
|
auto pchArchOutput = pchOutput.toQString();
|
||||||
if (!arch.isEmpty())
|
if (!arch.isEmpty())
|
||||||
pchArchOutput.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
|
pchArchOutput.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
|
||||||
|
@ -191,7 +191,7 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const ProString &incit: qAsConst(incs)) {
|
for (const ProString &incit: std::as_const(incs)) {
|
||||||
QString inc = incit.toQString();
|
QString inc = incit.toQString();
|
||||||
inc.replace(QRegularExpression("\\\\$"), "");
|
inc.replace(QRegularExpression("\\\\$"), "");
|
||||||
inc.replace('\\', '/');
|
inc.replace('\\', '/');
|
||||||
|
@ -264,9 +264,9 @@ QStringList NmakeMakefileGenerator::sourceFilesForImplicitRulesFilter()
|
|||||||
{
|
{
|
||||||
QStringList filter;
|
QStringList filter;
|
||||||
const QChar wildcard = QLatin1Char('*');
|
const QChar wildcard = QLatin1Char('*');
|
||||||
for (const QString &ext : qAsConst(Option::c_ext))
|
for (const QString &ext : std::as_const(Option::c_ext))
|
||||||
filter << wildcard + ext;
|
filter << wildcard + ext;
|
||||||
for (const QString &ext : qAsConst(Option::cpp_ext))
|
for (const QString &ext : std::as_const(Option::cpp_ext))
|
||||||
filter << wildcard + ext;
|
filter << wildcard + ext;
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
@ -314,7 +314,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
|
|||||||
const QStringList sourceFilesFilter = sourceFilesForImplicitRulesFilter();
|
const QStringList sourceFilesFilter = sourceFilesForImplicitRulesFilter();
|
||||||
QStringList fixifiedSourceDirs = fileFixify(QList<QString>(source_directories.constBegin(), source_directories.constEnd()), FileFixifyAbsolute);
|
QStringList fixifiedSourceDirs = fileFixify(QList<QString>(source_directories.constBegin(), source_directories.constEnd()), FileFixifyAbsolute);
|
||||||
fixifiedSourceDirs.removeDuplicates();
|
fixifiedSourceDirs.removeDuplicates();
|
||||||
for (const QString &sourceDir : qAsConst(fixifiedSourceDirs)) {
|
for (const QString &sourceDir : std::as_const(fixifiedSourceDirs)) {
|
||||||
QDirIterator dit(sourceDir, sourceFilesFilter, QDir::Files | QDir::NoDotAndDotDot);
|
QDirIterator dit(sourceDir, sourceFilesFilter, QDir::Files | QDir::NoDotAndDotDot);
|
||||||
while (dit.hasNext()) {
|
while (dit.hasNext()) {
|
||||||
const QFileInfo fi = dit.nextFileInfo();
|
const QFileInfo fi = dit.nextFileInfo();
|
||||||
@ -339,7 +339,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
|
|||||||
project->variables().remove("QMAKE_RUN_CXX");
|
project->variables().remove("QMAKE_RUN_CXX");
|
||||||
project->variables().remove("QMAKE_RUN_CC");
|
project->variables().remove("QMAKE_RUN_CC");
|
||||||
|
|
||||||
for (const QString &sourceDir : qAsConst(source_directories)) {
|
for (const QString &sourceDir : std::as_const(source_directories)) {
|
||||||
if (sourceDir.isEmpty())
|
if (sourceDir.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
QString objDir = var("OBJECTS_DIR");
|
QString objDir = var("OBJECTS_DIR");
|
||||||
|
@ -2271,7 +2271,7 @@ void VCFilter::modifyPCHstage(QString str)
|
|||||||
lines << "* WARNING: All changes made in this file will be lost.";
|
lines << "* WARNING: All changes made in this file will be lost.";
|
||||||
lines << "--------------------------------------------------------------------*/";
|
lines << "--------------------------------------------------------------------*/";
|
||||||
lines << "#include \"" + Project->precompHFilename + "\"";
|
lines << "#include \"" + Project->precompHFilename + "\"";
|
||||||
for (const QString &line : qAsConst(lines))
|
for (const QString &line : std::as_const(lines))
|
||||||
CustomBuildTool.CommandLine += "echo " + line + ">>" + toFile;
|
CustomBuildTool.CommandLine += "echo " + line + ">>" + toFile;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2461,7 +2461,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
|
|||||||
|
|
||||||
// Ensure that none of the output files are also dependencies. Or else, the custom buildstep
|
// Ensure that none of the output files are also dependencies. Or else, the custom buildstep
|
||||||
// will be rebuild every time, even if nothing has changed.
|
// will be rebuild every time, even if nothing has changed.
|
||||||
for (const QString &output : qAsConst(CustomBuildTool.Outputs))
|
for (const QString &output : std::as_const(CustomBuildTool.Outputs))
|
||||||
CustomBuildTool.AdditionalDependencies.removeAll(output);
|
CustomBuildTool.AdditionalDependencies.removeAll(output);
|
||||||
|
|
||||||
useCustomBuildTool = !CustomBuildTool.CommandLine.isEmpty();
|
useCustomBuildTool = !CustomBuildTool.CommandLine.isEmpty();
|
||||||
|
@ -349,7 +349,7 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
|
|||||||
collectedSubdirs.append(qMakePair(tmpdir.toQString(), proj->values(ProKey(tmp_proj_subdirs.at(x) + ".depends"))));
|
collectedSubdirs.append(qMakePair(tmpdir.toQString(), proj->values(ProKey(tmp_proj_subdirs.at(x) + ".depends"))));
|
||||||
projLookup.insert(tmp_proj_subdirs.at(x).toQString(), tmpdir.toQString());
|
projLookup.insert(tmp_proj_subdirs.at(x).toQString(), tmpdir.toQString());
|
||||||
}
|
}
|
||||||
for (const auto &subdir : qAsConst(collectedSubdirs)) {
|
for (const auto &subdir : std::as_const(collectedSubdirs)) {
|
||||||
QString profile = subdir.first;
|
QString profile = subdir.first;
|
||||||
QFileInfo fi(fileInfo(Option::normalizePath(profile)));
|
QFileInfo fi(fileInfo(Option::normalizePath(profile)));
|
||||||
if (fi.exists()) {
|
if (fi.exists()) {
|
||||||
|
@ -546,7 +546,7 @@ void QMakeEvaluator::populateDeps(
|
|||||||
if (depends.isEmpty()) {
|
if (depends.isEmpty()) {
|
||||||
rootSet.insert(first(ProKey(prefix + item + priosfx)).toInt(), item);
|
rootSet.insert(first(ProKey(prefix + item + priosfx)).toInt(), item);
|
||||||
} else {
|
} else {
|
||||||
for (const ProString &dep : qAsConst(depends)) {
|
for (const ProString &dep : std::as_const(depends)) {
|
||||||
dset.insert(dep.toKey());
|
dset.insert(dep.toKey());
|
||||||
dependees[dep.toKey()] << item;
|
dependees[dep.toKey()] << item;
|
||||||
}
|
}
|
||||||
@ -703,7 +703,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
|
|||||||
}
|
}
|
||||||
case E_NUM_ADD: {
|
case E_NUM_ADD: {
|
||||||
qlonglong sum = 0;
|
qlonglong sum = 0;
|
||||||
for (const ProString &arg : qAsConst(args)) {
|
for (const ProString &arg : std::as_const(args)) {
|
||||||
if (arg.contains(QLatin1Char('.'))) {
|
if (arg.contains(QLatin1Char('.'))) {
|
||||||
evalError(fL1S("num_add(): floats are currently not supported."));
|
evalError(fL1S("num_add(): floats are currently not supported."));
|
||||||
goto allfail;
|
goto allfail;
|
||||||
@ -1103,7 +1103,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
|
|||||||
rootSet.erase(it);
|
rootSet.erase(it);
|
||||||
if ((func_t == E_RESOLVE_DEPENDS) || orgList.contains(item))
|
if ((func_t == E_RESOLVE_DEPENDS) || orgList.contains(item))
|
||||||
ret.prepend(item);
|
ret.prepend(item);
|
||||||
for (const ProString &dep : qAsConst(dependees[item.toKey()])) {
|
for (const ProString &dep : std::as_const(dependees[item.toKey()])) {
|
||||||
QSet<ProKey> &dset = dependencies[dep.toKey()];
|
QSet<ProKey> &dset = dependencies[dep.toKey()];
|
||||||
dset.remove(item.toKey());
|
dset.remove(item.toKey());
|
||||||
if (dset.isEmpty())
|
if (dset.isEmpty())
|
||||||
@ -1114,11 +1114,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
|
|||||||
}
|
}
|
||||||
case E_ENUMERATE_VARS: {
|
case E_ENUMERATE_VARS: {
|
||||||
QSet<ProString> keys;
|
QSet<ProString> keys;
|
||||||
for (const ProValueMap &vmap : qAsConst(m_valuemapStack))
|
for (const ProValueMap &vmap : std::as_const(m_valuemapStack))
|
||||||
for (ProValueMap::ConstIterator it = vmap.constBegin(); it != vmap.constEnd(); ++it)
|
for (ProValueMap::ConstIterator it = vmap.constBegin(); it != vmap.constEnd(); ++it)
|
||||||
keys.insert(it.key());
|
keys.insert(it.key());
|
||||||
ret.reserve(keys.size());
|
ret.reserve(keys.size());
|
||||||
for (const ProString &key : qAsConst(keys))
|
for (const ProString &key : std::as_const(keys))
|
||||||
ret << key;
|
ret << key;
|
||||||
break; }
|
break; }
|
||||||
case E_SHADOWED: {
|
case E_SHADOWED: {
|
||||||
|
@ -1233,7 +1233,7 @@ bool QMakeEvaluator::loadSpec()
|
|||||||
qmakespec = m_hostBuild ? QLatin1String("default-host") : QLatin1String("default");
|
qmakespec = m_hostBuild ? QLatin1String("default-host") : QLatin1String("default");
|
||||||
#endif
|
#endif
|
||||||
if (IoUtils::isRelativePath(qmakespec)) {
|
if (IoUtils::isRelativePath(qmakespec)) {
|
||||||
for (const QString &root : qAsConst(m_mkspecPaths)) {
|
for (const QString &root : std::as_const(m_mkspecPaths)) {
|
||||||
QString mkspec = root + QLatin1Char('/') + qmakespec;
|
QString mkspec = root + QLatin1Char('/') + qmakespec;
|
||||||
if (IoUtils::exists(mkspec)) {
|
if (IoUtils::exists(mkspec)) {
|
||||||
qmakespec = mkspec;
|
qmakespec = mkspec;
|
||||||
@ -1475,7 +1475,7 @@ void QMakeEvaluator::updateMkspecPaths()
|
|||||||
for (const QString &it : paths)
|
for (const QString &it : paths)
|
||||||
ret << it + concat;
|
ret << it + concat;
|
||||||
|
|
||||||
for (const QString &it : qAsConst(m_qmakepath))
|
for (const QString &it : std::as_const(m_qmakepath))
|
||||||
ret << it + concat;
|
ret << it + concat;
|
||||||
|
|
||||||
if (!m_buildRoot.isEmpty())
|
if (!m_buildRoot.isEmpty())
|
||||||
@ -1516,7 +1516,7 @@ void QMakeEvaluator::updateFeaturePaths()
|
|||||||
for (const QString &item : items)
|
for (const QString &item : items)
|
||||||
feature_bases << (item + mkspecs_concat);
|
feature_bases << (item + mkspecs_concat);
|
||||||
|
|
||||||
for (const QString &item : qAsConst(m_qmakepath))
|
for (const QString &item : std::as_const(m_qmakepath))
|
||||||
feature_bases << (item + mkspecs_concat);
|
feature_bases << (item + mkspecs_concat);
|
||||||
|
|
||||||
if (!m_qmakespec.isEmpty()) {
|
if (!m_qmakespec.isEmpty()) {
|
||||||
@ -1538,7 +1538,7 @@ void QMakeEvaluator::updateFeaturePaths()
|
|||||||
feature_bases << (m_option->propertyValue(ProKey("QT_HOST_DATA/get")) + mkspecs_concat);
|
feature_bases << (m_option->propertyValue(ProKey("QT_HOST_DATA/get")) + mkspecs_concat);
|
||||||
feature_bases << (m_option->propertyValue(ProKey("QT_HOST_DATA/src")) + mkspecs_concat);
|
feature_bases << (m_option->propertyValue(ProKey("QT_HOST_DATA/src")) + mkspecs_concat);
|
||||||
|
|
||||||
for (const QString &fb : qAsConst(feature_bases)) {
|
for (const QString &fb : std::as_const(feature_bases)) {
|
||||||
const auto sfxs = values(ProKey("QMAKE_PLATFORM"));
|
const auto sfxs = values(ProKey("QMAKE_PLATFORM"));
|
||||||
for (const ProString &sfx : sfxs)
|
for (const ProString &sfx : sfxs)
|
||||||
feature_roots << (fb + features_concat + sfx + QLatin1Char('/'));
|
feature_roots << (fb + features_concat + sfx + QLatin1Char('/'));
|
||||||
@ -1552,7 +1552,7 @@ void QMakeEvaluator::updateFeaturePaths()
|
|||||||
feature_roots.removeDuplicates();
|
feature_roots.removeDuplicates();
|
||||||
|
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
for (const QString &root : qAsConst(feature_roots))
|
for (const QString &root : std::as_const(feature_roots))
|
||||||
if (IoUtils::exists(root))
|
if (IoUtils::exists(root))
|
||||||
ret << root;
|
ret << root;
|
||||||
m_featureRoots = new QMakeFeatureRoots(ret);
|
m_featureRoots = new QMakeFeatureRoots(ret);
|
||||||
|
@ -168,7 +168,7 @@ void QMakeGlobals::commitCommandLineArguments(QMakeCmdLineParserState &state)
|
|||||||
{
|
{
|
||||||
if (!state.extraargs.isEmpty()) {
|
if (!state.extraargs.isEmpty()) {
|
||||||
QString extra = fL1S("QMAKE_EXTRA_ARGS =");
|
QString extra = fL1S("QMAKE_EXTRA_ARGS =");
|
||||||
for (const QString &ea : qAsConst(state.extraargs))
|
for (const QString &ea : std::as_const(state.extraargs))
|
||||||
extra += QLatin1Char(' ') + QMakeEvaluator::quoteValue(ProString(ea));
|
extra += QLatin1Char(' ') + QMakeEvaluator::quoteValue(ProString(ea));
|
||||||
state.cmds[QMakeEvalBefore] << extra;
|
state.cmds[QMakeEvalBefore] << extra;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ ProFileCache::ProFileCache()
|
|||||||
|
|
||||||
ProFileCache::~ProFileCache()
|
ProFileCache::~ProFileCache()
|
||||||
{
|
{
|
||||||
for (const Entry &ent : qAsConst(parsed_files))
|
for (const Entry &ent : std::as_const(parsed_files))
|
||||||
if (ent.pro)
|
if (ent.pro)
|
||||||
ent.pro->deref();
|
ent.pro->deref();
|
||||||
QMakeVfs::deref();
|
QMakeVfs::deref();
|
||||||
|
@ -126,7 +126,7 @@ static int doSed(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if (inFiles.isEmpty())
|
if (inFiles.isEmpty())
|
||||||
inFiles << "-";
|
inFiles << "-";
|
||||||
for (const char *inFile : qAsConst(inFiles)) {
|
for (const char *inFile : std::as_const(inFiles)) {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
if (!strcmp(inFile, "-")) {
|
if (!strcmp(inFile, "-")) {
|
||||||
f = stdin;
|
f = stdin;
|
||||||
|
@ -138,7 +138,7 @@ void QMakeProject::dump() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
out.sort();
|
out.sort();
|
||||||
for (const QString &v : qAsConst(out))
|
for (const QString &v : std::as_const(out))
|
||||||
puts(qPrintable(v));
|
puts(qPrintable(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ int QMakeProperty::queryProperty(const QStringList &optionProperties,
|
|||||||
specialProps.append("QMAKE_VERSION");
|
specialProps.append("QMAKE_VERSION");
|
||||||
#endif
|
#endif
|
||||||
specialProps.append("QT_VERSION");
|
specialProps.append("QT_VERSION");
|
||||||
for (const QString &prop : qAsConst(specialProps)) {
|
for (const QString &prop : std::as_const(specialProps)) {
|
||||||
ProString val = value(ProKey(prop));
|
ProString val = value(ProKey(prop));
|
||||||
ProString pval = value(ProKey(prop + "/raw"));
|
ProString pval = value(ProKey(prop + "/raw"));
|
||||||
ProString gval = value(ProKey(prop + "/get"));
|
ProString gval = value(ProKey(prop + "/get"));
|
||||||
|
@ -25,8 +25,8 @@ template <typename T>
|
|||||||
class QForeachContainer {
|
class QForeachContainer {
|
||||||
Q_DISABLE_COPY_MOVE(QForeachContainer)
|
Q_DISABLE_COPY_MOVE(QForeachContainer)
|
||||||
public:
|
public:
|
||||||
QForeachContainer(const T &t) : c(t), i(qAsConst(c).begin()), e(qAsConst(c).end()) {}
|
QForeachContainer(const T &t) : c(t), i(std::as_const(c).begin()), e(std::as_const(c).end()) {}
|
||||||
QForeachContainer(T &&t) : c(std::move(t)), i(qAsConst(c).begin()), e(qAsConst(c).end()) {}
|
QForeachContainer(T &&t) : c(std::move(t)), i(std::as_const(c).begin()), e(std::as_const(c).end()) {}
|
||||||
|
|
||||||
T c;
|
T c;
|
||||||
typename T::const_iterator i, e;
|
typename T::const_iterator i, e;
|
||||||
|
@ -54,9 +54,9 @@
|
|||||||
|
|
||||||
\note Since Qt 5.7, the use of this macro is discouraged. It will
|
\note Since Qt 5.7, the use of this macro is discouraged. It will
|
||||||
be removed in a future version of Qt. Please use C++11 range-for,
|
be removed in a future version of Qt. Please use C++11 range-for,
|
||||||
possibly with qAsConst(), as needed.
|
possibly with std::as_const(), as needed.
|
||||||
|
|
||||||
\sa qAsConst()
|
\sa std::as_const()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -70,7 +70,7 @@
|
|||||||
|
|
||||||
\note Since Qt 5.7, the use of this macro is discouraged. It will
|
\note Since Qt 5.7, the use of this macro is discouraged. It will
|
||||||
be removed in a future version of Qt. Please use C++11 range-for,
|
be removed in a future version of Qt. Please use C++11 range-for,
|
||||||
possibly with qAsConst(), as needed.
|
possibly with std::as_const(), as needed.
|
||||||
|
|
||||||
\sa qAsConst()
|
\sa std::as_const()
|
||||||
*/
|
*/
|
||||||
|
@ -223,7 +223,7 @@ QInotifyFileSystemWatcherEngine::QInotifyFileSystemWatcherEngine(int fd, QObject
|
|||||||
QInotifyFileSystemWatcherEngine::~QInotifyFileSystemWatcherEngine()
|
QInotifyFileSystemWatcherEngine::~QInotifyFileSystemWatcherEngine()
|
||||||
{
|
{
|
||||||
notifier.setEnabled(false);
|
notifier.setEnabled(false);
|
||||||
for (int id : qAsConst(pathToID))
|
for (int id : std::as_const(pathToID))
|
||||||
inotify_rm_watch(inotifyFd, id < 0 ? -id : id);
|
inotify_rm_watch(inotifyFd, id < 0 ? -id : id);
|
||||||
|
|
||||||
::close(inotifyFd);
|
::close(inotifyFd);
|
||||||
|
@ -51,7 +51,7 @@ QKqueueFileSystemWatcherEngine::~QKqueueFileSystemWatcherEngine()
|
|||||||
notifier.setEnabled(false);
|
notifier.setEnabled(false);
|
||||||
close(kqfd);
|
close(kqfd);
|
||||||
|
|
||||||
for (int id : qAsConst(pathToID))
|
for (int id : std::as_const(pathToID))
|
||||||
::close(id < 0 ? -id : id);
|
::close(id < 0 ? -id : id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,9 +317,9 @@ QWindowsFileSystemWatcherEngine::QWindowsFileSystemWatcherEngine(QObject *parent
|
|||||||
|
|
||||||
QWindowsFileSystemWatcherEngine::~QWindowsFileSystemWatcherEngine()
|
QWindowsFileSystemWatcherEngine::~QWindowsFileSystemWatcherEngine()
|
||||||
{
|
{
|
||||||
for (auto *thread : qAsConst(threads))
|
for (auto *thread : std::as_const(threads))
|
||||||
thread->stop();
|
thread->stop();
|
||||||
for (auto *thread : qAsConst(threads))
|
for (auto *thread : std::as_const(threads))
|
||||||
thread->wait();
|
thread->wait();
|
||||||
qDeleteAll(threads);
|
qDeleteAll(threads);
|
||||||
}
|
}
|
||||||
@ -433,7 +433,7 @@ QStringList QWindowsFileSystemWatcherEngine::addPaths(const QStringList &paths,
|
|||||||
|
|
||||||
// now look for a thread to insert
|
// now look for a thread to insert
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (QWindowsFileSystemWatcherEngineThread *thread : qAsConst(threads)) {
|
for (QWindowsFileSystemWatcherEngineThread *thread : std::as_const(threads)) {
|
||||||
const auto locker = qt_scoped_lock(thread->mutex);
|
const auto locker = qt_scoped_lock(thread->mutex);
|
||||||
if (thread->handles.count() < MAXIMUM_WAIT_OBJECTS) {
|
if (thread->handles.count() < MAXIMUM_WAIT_OBJECTS) {
|
||||||
DEBUG() << "Added handle" << handle.handle << "for" << absolutePath << "to watch" << fileInfo.absoluteFilePath()
|
DEBUG() << "Added handle" << handle.handle << "for" << absolutePath << "to watch" << fileInfo.absoluteFilePath()
|
||||||
@ -586,7 +586,7 @@ QWindowsFileSystemWatcherEngineThread::~QWindowsFileSystemWatcherEngineThread()
|
|||||||
CloseHandle(handles.at(0));
|
CloseHandle(handles.at(0));
|
||||||
handles[0] = INVALID_HANDLE_VALUE;
|
handles[0] = INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
for (HANDLE h : qAsConst(handles)) {
|
for (HANDLE h : std::as_const(handles)) {
|
||||||
if (h == INVALID_HANDLE_VALUE)
|
if (h == INVALID_HANDLE_VALUE)
|
||||||
continue;
|
continue;
|
||||||
FindCloseChangeNotification(h);
|
FindCloseChangeNotification(h);
|
||||||
|
@ -1081,16 +1081,16 @@ QConfFileSettingsPrivate::QConfFileSettingsPrivate(QSettings::Format format,
|
|||||||
QStringList paths;
|
QStringList paths;
|
||||||
if (!application.isEmpty()) {
|
if (!application.isEmpty()) {
|
||||||
paths.reserve(dirs.size() * 2);
|
paths.reserve(dirs.size() * 2);
|
||||||
for (const auto &dir : qAsConst(dirs))
|
for (const auto &dir : std::as_const(dirs))
|
||||||
paths.append(dir + u'/' + appFile);
|
paths.append(dir + u'/' + appFile);
|
||||||
} else {
|
} else {
|
||||||
paths.reserve(dirs.size());
|
paths.reserve(dirs.size());
|
||||||
}
|
}
|
||||||
for (const auto &dir : qAsConst(dirs))
|
for (const auto &dir : std::as_const(dirs))
|
||||||
paths.append(dir + u'/' + orgFile);
|
paths.append(dir + u'/' + orgFile);
|
||||||
|
|
||||||
// Note: No check for existence of files is done intentionally.
|
// Note: No check for existence of files is done intentionally.
|
||||||
for (const auto &path : qAsConst(paths))
|
for (const auto &path : std::as_const(paths))
|
||||||
confFiles.append(QConfFile::fromName(path, false));
|
confFiles.append(QConfFile::fromName(path, false));
|
||||||
} else
|
} else
|
||||||
#endif // Q_XDG_PLATFORM && !QT_NO_STANDARDPATHS
|
#endif // Q_XDG_PLATFORM && !QT_NO_STANDARDPATHS
|
||||||
@ -1123,7 +1123,7 @@ QConfFileSettingsPrivate::~QConfFileSettingsPrivate()
|
|||||||
ConfFileHash *usedHash = usedHashFunc();
|
ConfFileHash *usedHash = usedHashFunc();
|
||||||
ConfFileCache *unusedCache = unusedCacheFunc();
|
ConfFileCache *unusedCache = unusedCacheFunc();
|
||||||
|
|
||||||
for (auto conf_file : qAsConst(confFiles)) {
|
for (auto conf_file : std::as_const(confFiles)) {
|
||||||
if (!conf_file->ref.deref()) {
|
if (!conf_file->ref.deref()) {
|
||||||
if (conf_file->size == 0) {
|
if (conf_file->size == 0) {
|
||||||
delete conf_file;
|
delete conf_file;
|
||||||
@ -1197,7 +1197,7 @@ std::optional<QVariant> QConfFileSettingsPrivate::get(const QString &key) const
|
|||||||
ParsedSettingsMap::const_iterator j;
|
ParsedSettingsMap::const_iterator j;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
for (auto confFile : qAsConst(confFiles)) {
|
for (auto confFile : std::as_const(confFiles)) {
|
||||||
const auto locker = qt_scoped_lock(confFile->mutex);
|
const auto locker = qt_scoped_lock(confFile->mutex);
|
||||||
|
|
||||||
if (!confFile->addedKeys.isEmpty()) {
|
if (!confFile->addedKeys.isEmpty()) {
|
||||||
@ -1226,7 +1226,7 @@ QStringList QConfFileSettingsPrivate::children(const QString &prefix, ChildSpec
|
|||||||
QSettingsKey thePrefix(prefix, caseSensitivity);
|
QSettingsKey thePrefix(prefix, caseSensitivity);
|
||||||
qsizetype startPos = prefix.size();
|
qsizetype startPos = prefix.size();
|
||||||
|
|
||||||
for (auto confFile : qAsConst(confFiles)) {
|
for (auto confFile : std::as_const(confFiles)) {
|
||||||
const auto locker = qt_scoped_lock(confFile->mutex);
|
const auto locker = qt_scoped_lock(confFile->mutex);
|
||||||
|
|
||||||
if (thePrefix.isEmpty())
|
if (thePrefix.isEmpty())
|
||||||
@ -1277,7 +1277,7 @@ void QConfFileSettingsPrivate::sync()
|
|||||||
// people probably won't be checking the status a whole lot, so in case of
|
// people probably won't be checking the status a whole lot, so in case of
|
||||||
// error we just try to go on and make the best of it
|
// error we just try to go on and make the best of it
|
||||||
|
|
||||||
for (auto confFile : qAsConst(confFiles)) {
|
for (auto confFile : std::as_const(confFiles)) {
|
||||||
const auto locker = qt_scoped_lock(confFile->mutex);
|
const auto locker = qt_scoped_lock(confFile->mutex);
|
||||||
syncConfFile(confFile);
|
syncConfFile(confFile);
|
||||||
}
|
}
|
||||||
|
@ -713,7 +713,7 @@ QAbstractItemModel *QAbstractItemModelPrivate::staticEmptyModel()
|
|||||||
|
|
||||||
void QAbstractItemModelPrivate::invalidatePersistentIndexes()
|
void QAbstractItemModelPrivate::invalidatePersistentIndexes()
|
||||||
{
|
{
|
||||||
for (QPersistentModelIndexData *data : qAsConst(persistent.indexes))
|
for (QPersistentModelIndexData *data : std::as_const(persistent.indexes))
|
||||||
data->index = QModelIndex();
|
data->index = QModelIndex();
|
||||||
persistent.indexes.clear();
|
persistent.indexes.clear();
|
||||||
}
|
}
|
||||||
@ -861,7 +861,7 @@ void QAbstractItemModelPrivate::rowsAboutToBeInserted(const QModelIndex &parent,
|
|||||||
Q_UNUSED(last);
|
Q_UNUSED(last);
|
||||||
QList<QPersistentModelIndexData *> persistent_moved;
|
QList<QPersistentModelIndexData *> persistent_moved;
|
||||||
if (first < q->rowCount(parent)) {
|
if (first < q->rowCount(parent)) {
|
||||||
for (auto *data : qAsConst(persistent.indexes)) {
|
for (auto *data : std::as_const(persistent.indexes)) {
|
||||||
const QModelIndex &index = data->index;
|
const QModelIndex &index = data->index;
|
||||||
if (index.row() >= first && index.isValid() && index.parent() == parent) {
|
if (index.row() >= first && index.isValid() && index.parent() == parent) {
|
||||||
persistent_moved.append(data);
|
persistent_moved.append(data);
|
||||||
@ -897,7 +897,7 @@ void QAbstractItemModelPrivate::itemsAboutToBeMoved(const QModelIndex &srcParent
|
|||||||
const bool sameParent = (srcParent == destinationParent);
|
const bool sameParent = (srcParent == destinationParent);
|
||||||
const bool movingUp = (srcFirst > destinationChild);
|
const bool movingUp = (srcFirst > destinationChild);
|
||||||
|
|
||||||
for (auto *data : qAsConst(persistent.indexes)) {
|
for (auto *data : std::as_const(persistent.indexes)) {
|
||||||
const QModelIndex &index = data->index;
|
const QModelIndex &index = data->index;
|
||||||
const QModelIndex &parent = index.parent();
|
const QModelIndex &parent = index.parent();
|
||||||
const bool isSourceIndex = (parent == srcParent);
|
const bool isSourceIndex = (parent == srcParent);
|
||||||
@ -995,7 +995,7 @@ void QAbstractItemModelPrivate::rowsAboutToBeRemoved(const QModelIndex &parent,
|
|||||||
QList<QPersistentModelIndexData *> persistent_invalidated;
|
QList<QPersistentModelIndexData *> persistent_invalidated;
|
||||||
// find the persistent indexes that are affected by the change, either by being in the removed subtree
|
// find the persistent indexes that are affected by the change, either by being in the removed subtree
|
||||||
// or by being on the same level and below the removed rows
|
// or by being on the same level and below the removed rows
|
||||||
for (auto *data : qAsConst(persistent.indexes)) {
|
for (auto *data : std::as_const(persistent.indexes)) {
|
||||||
bool level_changed = false;
|
bool level_changed = false;
|
||||||
QModelIndex current = data->index;
|
QModelIndex current = data->index;
|
||||||
while (current.isValid()) {
|
while (current.isValid()) {
|
||||||
@ -1047,7 +1047,7 @@ void QAbstractItemModelPrivate::columnsAboutToBeInserted(const QModelIndex &pare
|
|||||||
Q_UNUSED(last);
|
Q_UNUSED(last);
|
||||||
QList<QPersistentModelIndexData *> persistent_moved;
|
QList<QPersistentModelIndexData *> persistent_moved;
|
||||||
if (first < q->columnCount(parent)) {
|
if (first < q->columnCount(parent)) {
|
||||||
for (auto *data : qAsConst(persistent.indexes)) {
|
for (auto *data : std::as_const(persistent.indexes)) {
|
||||||
const QModelIndex &index = data->index;
|
const QModelIndex &index = data->index;
|
||||||
if (index.column() >= first && index.isValid() && index.parent() == parent)
|
if (index.column() >= first && index.isValid() && index.parent() == parent)
|
||||||
persistent_moved.append(data);
|
persistent_moved.append(data);
|
||||||
@ -1080,7 +1080,7 @@ void QAbstractItemModelPrivate::columnsAboutToBeRemoved(const QModelIndex &paren
|
|||||||
QList<QPersistentModelIndexData *> persistent_invalidated;
|
QList<QPersistentModelIndexData *> persistent_invalidated;
|
||||||
// find the persistent indexes that are affected by the change, either by being in the removed subtree
|
// find the persistent indexes that are affected by the change, either by being in the removed subtree
|
||||||
// or by being on the same level and to the right of the removed columns
|
// or by being on the same level and to the right of the removed columns
|
||||||
for (auto *data : qAsConst(persistent.indexes)) {
|
for (auto *data : std::as_const(persistent.indexes)) {
|
||||||
bool level_changed = false;
|
bool level_changed = false;
|
||||||
QModelIndex current = data->index;
|
QModelIndex current = data->index;
|
||||||
while (current.isValid()) {
|
while (current.isValid()) {
|
||||||
@ -3460,7 +3460,7 @@ void QAbstractItemModel::changePersistentIndexList(const QModelIndexList &from,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto *data : qAsConst(toBeReinserted))
|
for (auto *data : std::as_const(toBeReinserted))
|
||||||
d->persistent.insertMultiAtEnd(data->index, data);
|
d->persistent.insertMultiAtEnd(data->index, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3474,7 +3474,7 @@ QModelIndexList QAbstractItemModel::persistentIndexList() const
|
|||||||
Q_D(const QAbstractItemModel);
|
Q_D(const QAbstractItemModel);
|
||||||
QModelIndexList result;
|
QModelIndexList result;
|
||||||
result.reserve(d->persistent.indexes.size());
|
result.reserve(d->persistent.indexes.size());
|
||||||
for (auto *data : qAsConst(d->persistent.indexes))
|
for (auto *data : std::as_const(d->persistent.indexes))
|
||||||
result.append(data->index);
|
result.append(data->index);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1616,7 +1616,7 @@ bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &par
|
|||||||
|
|
||||||
QItemSelection sel = d->ranges;
|
QItemSelection sel = d->ranges;
|
||||||
sel.merge(d->currentSelection, d->currentCommand);
|
sel.merge(d->currentSelection, d->currentCommand);
|
||||||
for (const QItemSelectionRange &range : qAsConst(sel)) {
|
for (const QItemSelectionRange &range : std::as_const(sel)) {
|
||||||
if (range.parent() != parent)
|
if (range.parent() != parent)
|
||||||
return false;
|
return false;
|
||||||
int top = range.top();
|
int top = range.top();
|
||||||
@ -1651,7 +1651,7 @@ bool QItemSelectionModel::columnIntersectsSelection(int column, const QModelInde
|
|||||||
|
|
||||||
QItemSelection sel = d->ranges;
|
QItemSelection sel = d->ranges;
|
||||||
sel.merge(d->currentSelection, d->currentCommand);
|
sel.merge(d->currentSelection, d->currentCommand);
|
||||||
for (const QItemSelectionRange &range : qAsConst(sel)) {
|
for (const QItemSelectionRange &range : std::as_const(sel)) {
|
||||||
if (range.parent() != parent)
|
if (range.parent() != parent)
|
||||||
return false;
|
return false;
|
||||||
int top = range.top();
|
int top = range.top();
|
||||||
|
@ -450,7 +450,7 @@ bool QSortFilterProxyModelPrivate::recursiveChildAcceptsRow(int source_row, cons
|
|||||||
void QSortFilterProxyModelPrivate::remove_from_mapping(const QModelIndex &source_parent)
|
void QSortFilterProxyModelPrivate::remove_from_mapping(const QModelIndex &source_parent)
|
||||||
{
|
{
|
||||||
if (Mapping *m = source_index_mapping.take(source_parent)) {
|
if (Mapping *m = source_index_mapping.take(source_parent)) {
|
||||||
for (const QModelIndex &mappedIdx : qAsConst(m->mapped_children))
|
for (const QModelIndex &mappedIdx : std::as_const(m->mapped_children))
|
||||||
remove_from_mapping(mappedIdx);
|
remove_from_mapping(mappedIdx);
|
||||||
delete m;
|
delete m;
|
||||||
}
|
}
|
||||||
@ -1175,7 +1175,7 @@ void QSortFilterProxyModelPrivate::updateChildrenMapping(const QModelIndex &sour
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reinsert moved, mapped indexes
|
// reinsert moved, mapped indexes
|
||||||
for (auto &pair : qAsConst(moved_source_index_mappings)) {
|
for (auto &pair : std::as_const(moved_source_index_mappings)) {
|
||||||
pair.second->source_parent = pair.first;
|
pair.second->source_parent = pair.first;
|
||||||
source_index_mapping.insert(pair.first, pair.second);
|
source_index_mapping.insert(pair.first, pair.second);
|
||||||
}
|
}
|
||||||
@ -1224,7 +1224,7 @@ QModelIndexPairList QSortFilterProxyModelPrivate::store_persistent_indexes() con
|
|||||||
Q_Q(const QSortFilterProxyModel);
|
Q_Q(const QSortFilterProxyModel);
|
||||||
QModelIndexPairList source_indexes;
|
QModelIndexPairList source_indexes;
|
||||||
source_indexes.reserve(persistent.indexes.size());
|
source_indexes.reserve(persistent.indexes.size());
|
||||||
for (const QPersistentModelIndexData *data : qAsConst(persistent.indexes)) {
|
for (const QPersistentModelIndexData *data : std::as_const(persistent.indexes)) {
|
||||||
const QModelIndex &proxy_index = data->index;
|
const QModelIndex &proxy_index = data->index;
|
||||||
QModelIndex source_index = q->mapToSource(proxy_index);
|
QModelIndex source_index = q->mapToSource(proxy_index);
|
||||||
source_indexes.append(qMakePair(proxy_index, QPersistentModelIndex(source_index)));
|
source_indexes.append(qMakePair(proxy_index, QPersistentModelIndex(source_index)));
|
||||||
|
@ -32,7 +32,7 @@ void QTransposeProxyModelPrivate::onLayoutChanged(const QList<QPersistentModelIn
|
|||||||
Q_ASSERT(layoutChangeProxyIndexes.size() == layoutChangePersistentIndexes.size());
|
Q_ASSERT(layoutChangeProxyIndexes.size() == layoutChangePersistentIndexes.size());
|
||||||
QModelIndexList toList;
|
QModelIndexList toList;
|
||||||
toList.reserve(layoutChangePersistentIndexes.size());
|
toList.reserve(layoutChangePersistentIndexes.size());
|
||||||
for (const QPersistentModelIndex &persistIdx : qAsConst(layoutChangePersistentIndexes))
|
for (const QPersistentModelIndex &persistIdx : std::as_const(layoutChangePersistentIndexes))
|
||||||
toList << q->mapFromSource(persistIdx);
|
toList << q->mapFromSource(persistIdx);
|
||||||
q->changePersistentIndexList(layoutChangeProxyIndexes, toList);
|
q->changePersistentIndexList(layoutChangeProxyIndexes, toList);
|
||||||
layoutChangeProxyIndexes.clear();
|
layoutChangeProxyIndexes.clear();
|
||||||
@ -172,7 +172,7 @@ void QTransposeProxyModel::setSourceModel(QAbstractItemModel* newSourceModel)
|
|||||||
return;
|
return;
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
if (d->model) {
|
if (d->model) {
|
||||||
for (const QMetaObject::Connection& discIter : qAsConst(d->sourceConnections))
|
for (const QMetaObject::Connection& discIter : std::as_const(d->sourceConnections))
|
||||||
disconnect(discIter);
|
disconnect(discIter);
|
||||||
}
|
}
|
||||||
d->sourceConnections.clear();
|
d->sourceConnections.clear();
|
||||||
|
@ -213,7 +213,7 @@ void QCFSocketNotifier::unregisterSocketNotifier(QSocketNotifier *notifier)
|
|||||||
void QCFSocketNotifier::removeSocketNotifiers()
|
void QCFSocketNotifier::removeSocketNotifiers()
|
||||||
{
|
{
|
||||||
// Remove CFSockets from the runloop.
|
// Remove CFSockets from the runloop.
|
||||||
for (MacSocketInfo *socketInfo : qAsConst(macSockets)) {
|
for (MacSocketInfo *socketInfo : std::as_const(macSockets)) {
|
||||||
unregisterSocketInfo(socketInfo);
|
unregisterSocketInfo(socketInfo);
|
||||||
delete socketInfo;
|
delete socketInfo;
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ void Q_CORE_EXPORT qt_call_post_routines()
|
|||||||
|
|
||||||
if (list.isEmpty())
|
if (list.isEmpty())
|
||||||
break;
|
break;
|
||||||
for (QtCleanUpFunction f : qAsConst(list))
|
for (QtCleanUpFunction f : std::as_const(list))
|
||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ int QEventDispatcherUNIXPrivate::activateTimers()
|
|||||||
|
|
||||||
void QEventDispatcherUNIXPrivate::markPendingSocketNotifiers()
|
void QEventDispatcherUNIXPrivate::markPendingSocketNotifiers()
|
||||||
{
|
{
|
||||||
for (const pollfd &pfd : qAsConst(pollfds)) {
|
for (const pollfd &pfd : std::as_const(pollfds)) {
|
||||||
if (pfd.fd < 0 || pfd.revents == 0)
|
if (pfd.fd < 0 || pfd.revents == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -764,7 +764,7 @@ QEventDispatcherWin32::registeredTimers(QObject *object) const
|
|||||||
|
|
||||||
Q_D(const QEventDispatcherWin32);
|
Q_D(const QEventDispatcherWin32);
|
||||||
QList<TimerInfo> list;
|
QList<TimerInfo> list;
|
||||||
for (WinTimerInfo *t : qAsConst(d->timerDict)) {
|
for (WinTimerInfo *t : std::as_const(d->timerDict)) {
|
||||||
Q_ASSERT(t);
|
Q_ASSERT(t);
|
||||||
if (t->obj == object)
|
if (t->obj == object)
|
||||||
list << TimerInfo(t->timerId, t->interval, t->timerType);
|
list << TimerInfo(t->timerId, t->interval, t->timerType);
|
||||||
@ -832,7 +832,7 @@ void QEventDispatcherWin32::closingDown()
|
|||||||
Q_ASSERT(d->active_fd.isEmpty());
|
Q_ASSERT(d->active_fd.isEmpty());
|
||||||
|
|
||||||
// clean up any timers
|
// clean up any timers
|
||||||
for (WinTimerInfo *t : qAsConst(d->timerDict))
|
for (WinTimerInfo *t : std::as_const(d->timerDict))
|
||||||
d->unregisterTimer(t);
|
d->unregisterTimer(t);
|
||||||
d->timerDict.clear();
|
d->timerDict.clear();
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ static jboolean dispatchGenericMotionEvent(JNIEnv *, jclass, jobject event)
|
|||||||
{
|
{
|
||||||
jboolean ret = JNI_FALSE;
|
jboolean ret = JNI_FALSE;
|
||||||
QMutexLocker locker(&g_genericMotionEventListeners()->mutex);
|
QMutexLocker locker(&g_genericMotionEventListeners()->mutex);
|
||||||
for (auto *listener : qAsConst(g_genericMotionEventListeners()->listeners))
|
for (auto *listener : std::as_const(g_genericMotionEventListeners()->listeners))
|
||||||
ret |= listener->handleGenericMotionEvent(event);
|
ret |= listener->handleGenericMotionEvent(event);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ static jboolean dispatchKeyEvent(JNIEnv *, jclass, jobject event)
|
|||||||
{
|
{
|
||||||
jboolean ret = JNI_FALSE;
|
jboolean ret = JNI_FALSE;
|
||||||
QMutexLocker locker(&g_keyEventListeners()->mutex);
|
QMutexLocker locker(&g_keyEventListeners()->mutex);
|
||||||
for (auto *listener : qAsConst(g_keyEventListeners()->listeners))
|
for (auto *listener : std::as_const(g_keyEventListeners()->listeners))
|
||||||
ret |= listener->handleKeyEvent(event);
|
ret |= listener->handleKeyEvent(event);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ qint64 QTimerInfoList::timerRemainingTime(int timerId)
|
|||||||
repairTimersIfNeeded();
|
repairTimersIfNeeded();
|
||||||
timespec tm = {0, 0};
|
timespec tm = {0, 0};
|
||||||
|
|
||||||
for (const auto *t : qAsConst(*this)) {
|
for (const auto *t : std::as_const(*this)) {
|
||||||
if (t->id == timerId) {
|
if (t->id == timerId) {
|
||||||
if (currentTime < t->timeout) {
|
if (currentTime < t->timeout) {
|
||||||
// time to wait
|
// time to wait
|
||||||
|
@ -635,7 +635,7 @@ static QString find_translation(const QLocale & locale,
|
|||||||
languages.insert(i + 1, lowerLang);
|
languages.insert(i + 1, lowerLang);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QString localeName : qAsConst(languages)) {
|
for (QString localeName : std::as_const(languages)) {
|
||||||
localeName.replace(u'-', u'_');
|
localeName.replace(u'-', u'_');
|
||||||
|
|
||||||
// try the complete locale name first and progressively truncate from
|
// try the complete locale name first and progressively truncate from
|
||||||
|
@ -386,7 +386,7 @@ QMimeType QMimeDatabasePrivate::mimeTypeForFileNameAndData(const QString &fileNa
|
|||||||
if (candidatesByName.m_matchingMimeTypes.contains(sniffedMime)) {
|
if (candidatesByName.m_matchingMimeTypes.contains(sniffedMime)) {
|
||||||
return candidateByData;
|
return candidateByData;
|
||||||
}
|
}
|
||||||
for (const QString &m : qAsConst(candidatesByName.m_allMatchingMimeTypes)) {
|
for (const QString &m : std::as_const(candidatesByName.m_allMatchingMimeTypes)) {
|
||||||
if (inherits(m, sniffedMime)) {
|
if (inherits(m, sniffedMime)) {
|
||||||
// We have magic + pattern pointing to this, so it's a pretty good match
|
// We have magic + pattern pointing to this, so it's a pretty good match
|
||||||
return mimeTypeForName(m);
|
return mimeTypeForName(m);
|
||||||
|
@ -449,10 +449,10 @@ void QMimeBinaryProvider::addAllMimeTypes(QList<QMimeType> &result)
|
|||||||
loadMimeTypeList();
|
loadMimeTypeList();
|
||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
result.reserve(m_mimetypeNames.size());
|
result.reserve(m_mimetypeNames.size());
|
||||||
for (const QString &name : qAsConst(m_mimetypeNames))
|
for (const QString &name : std::as_const(m_mimetypeNames))
|
||||||
result.append(mimeTypeForNameUnchecked(name));
|
result.append(mimeTypeForNameUnchecked(name));
|
||||||
} else {
|
} else {
|
||||||
for (const QString &name : qAsConst(m_mimetypeNames))
|
for (const QString &name : std::as_const(m_mimetypeNames))
|
||||||
if (std::find_if(result.constBegin(), result.constEnd(), [name](const QMimeType &mime) -> bool { return mime.name() == name; })
|
if (std::find_if(result.constBegin(), result.constEnd(), [name](const QMimeType &mime) -> bool { return mime.name() == name; })
|
||||||
== result.constEnd())
|
== result.constEnd())
|
||||||
result.append(mimeTypeForNameUnchecked(name));
|
result.append(mimeTypeForNameUnchecked(name));
|
||||||
@ -680,7 +680,7 @@ void QMimeXMLProvider::findByMagic(const QByteArray &data, int *accuracyPtr, QMi
|
|||||||
{
|
{
|
||||||
QString candidateName;
|
QString candidateName;
|
||||||
bool foundOne = false;
|
bool foundOne = false;
|
||||||
for (const QMimeMagicRuleMatcher &matcher : qAsConst(m_magicMatchers)) {
|
for (const QMimeMagicRuleMatcher &matcher : std::as_const(m_magicMatchers)) {
|
||||||
if (matcher.matches(data)) {
|
if (matcher.matches(data)) {
|
||||||
const int priority = matcher.priority();
|
const int priority = matcher.priority();
|
||||||
if (priority > *accuracyPtr) {
|
if (priority > *accuracyPtr) {
|
||||||
@ -716,7 +716,7 @@ void QMimeXMLProvider::ensureLoaded()
|
|||||||
|
|
||||||
//qDebug() << "Loading" << m_allFiles;
|
//qDebug() << "Loading" << m_allFiles;
|
||||||
|
|
||||||
for (const QString &file : qAsConst(allFiles))
|
for (const QString &file : std::as_const(allFiles))
|
||||||
load(file);
|
load(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ QString QMimeType::comment() const
|
|||||||
languageList << QLocale().name();
|
languageList << QLocale().name();
|
||||||
languageList << QLocale().uiLanguages();
|
languageList << QLocale().uiLanguages();
|
||||||
languageList << u"default"_s; // use the default locale if possible.
|
languageList << u"default"_s; // use the default locale if possible.
|
||||||
for (const QString &language : qAsConst(languageList)) {
|
for (const QString &language : std::as_const(languageList)) {
|
||||||
const QString lang = language == "C"_L1 ? u"en_US"_s : language;
|
const QString lang = language == "C"_L1 ? u"en_US"_s : language;
|
||||||
const QString comm = d->localeComments.value(lang);
|
const QString comm = d->localeComments.value(lang);
|
||||||
if (!comm.isEmpty())
|
if (!comm.isEmpty())
|
||||||
@ -410,7 +410,7 @@ QStringList QMimeType::suffixes() const
|
|||||||
QMimeDatabasePrivate::instance()->loadMimeTypePrivate(const_cast<QMimeTypePrivate&>(*d));
|
QMimeDatabasePrivate::instance()->loadMimeTypePrivate(const_cast<QMimeTypePrivate&>(*d));
|
||||||
|
|
||||||
QStringList result;
|
QStringList result;
|
||||||
for (const QString &pattern : qAsConst(d->globPatterns)) {
|
for (const QString &pattern : std::as_const(d->globPatterns)) {
|
||||||
// Not a simple suffix if it looks like: README or *. or *.* or *.JP*G or *.JP?
|
// Not a simple suffix if it looks like: README or *. or *.* or *.JP*G or *.JP?
|
||||||
if (pattern.startsWith("*."_L1) &&
|
if (pattern.startsWith("*."_L1) &&
|
||||||
pattern.size() > 2 &&
|
pattern.size() > 2 &&
|
||||||
|
@ -132,7 +132,7 @@ Q_GLOBAL_STATIC(QFactoryLoaderGlobals, qt_factoryloader_global)
|
|||||||
|
|
||||||
QFactoryLoaderPrivate::~QFactoryLoaderPrivate()
|
QFactoryLoaderPrivate::~QFactoryLoaderPrivate()
|
||||||
{
|
{
|
||||||
for (QLibraryPrivate *library : qAsConst(libraryList))
|
for (QLibraryPrivate *library : std::as_const(libraryList))
|
||||||
library->release();
|
library->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ inline void QLibraryStore::cleanup()
|
|||||||
|
|
||||||
// dump all objects that remain
|
// dump all objects that remain
|
||||||
if (lcDebugLibrary().isDebugEnabled()) {
|
if (lcDebugLibrary().isDebugEnabled()) {
|
||||||
for (QLibraryPrivate *lib : qAsConst(data->libraryMap)) {
|
for (QLibraryPrivate *lib : std::as_const(data->libraryMap)) {
|
||||||
if (lib)
|
if (lib)
|
||||||
qDebug(lcDebugLibrary)
|
qDebug(lcDebugLibrary)
|
||||||
<< "On QtCore unload," << lib->fileName << "was leaked, with"
|
<< "On QtCore unload," << lib->fileName << "was leaked, with"
|
||||||
|
@ -164,7 +164,7 @@ bool QLibraryPrivate::load_sys()
|
|||||||
QStringList tmp;
|
QStringList tmp;
|
||||||
qSwap(tmp, list);
|
qSwap(tmp, list);
|
||||||
list.reserve(tmp.size() * 2);
|
list.reserve(tmp.size() * 2);
|
||||||
for (const QString &s : qAsConst(tmp)) {
|
for (const QString &s : std::as_const(tmp)) {
|
||||||
QString modifiedPath = s;
|
QString modifiedPath = s;
|
||||||
f(&modifiedPath);
|
f(&modifiedPath);
|
||||||
list.append(modifiedPath);
|
list.append(modifiedPath);
|
||||||
|
@ -59,7 +59,7 @@ bool QLibraryPrivate::load_sys()
|
|||||||
|
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
Handle hnd = nullptr;
|
Handle hnd = nullptr;
|
||||||
for (const QString &attempt : qAsConst(attempts)) {
|
for (const QString &attempt : std::as_const(attempts)) {
|
||||||
hnd = LoadLibrary(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(attempt).utf16()));
|
hnd = LoadLibrary(reinterpret_cast<const wchar_t*>(QDir::toNativeSeparators(attempt).utf16()));
|
||||||
|
|
||||||
// If we have a handle or the last error is something other than "unable
|
// If we have a handle or the last error is something other than "unable
|
||||||
|
@ -246,9 +246,9 @@ static QString locatePlugin(const QString& fileName)
|
|||||||
paths = QCoreApplication::libraryPaths();
|
paths = QCoreApplication::libraryPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const QString &path : qAsConst(paths)) {
|
for (const QString &path : std::as_const(paths)) {
|
||||||
for (const QString &prefix : qAsConst(prefixes)) {
|
for (const QString &prefix : std::as_const(prefixes)) {
|
||||||
for (const QString &suffix : qAsConst(suffixes)) {
|
for (const QString &suffix : std::as_const(suffixes)) {
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
{
|
{
|
||||||
QString pluginPath = basePath + prefix + baseName + suffix;
|
QString pluginPath = basePath + prefix + baseName + suffix;
|
||||||
|
@ -970,7 +970,7 @@ QCborStreamReader::Type QCborStreamReader::parentContainerType() const
|
|||||||
{
|
{
|
||||||
if (d->containerStack.isEmpty())
|
if (d->containerStack.isEmpty())
|
||||||
return Invalid;
|
return Invalid;
|
||||||
return Type(cbor_value_get_type(&qAsConst(d->containerStack).top()));
|
return Type(cbor_value_get_type(&std::as_const(d->containerStack).top()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -944,7 +944,7 @@ QCborContainerPrivate *QCborContainerPrivate::clone(QCborContainerPrivate *d, qs
|
|||||||
d = u.take();
|
d = u.take();
|
||||||
d->ref.storeRelaxed(0);
|
d->ref.storeRelaxed(0);
|
||||||
|
|
||||||
for (auto &e : qAsConst(d->elements)) {
|
for (auto &e : std::as_const(d->elements)) {
|
||||||
if (e.flags & Element::IsContainer)
|
if (e.flags & Element::IsContainer)
|
||||||
e.container->ref.ref();
|
e.container->ref.ref();
|
||||||
}
|
}
|
||||||
|
@ -545,13 +545,13 @@ public:
|
|||||||
#if QT_CONFIG(cborstreamwriter)
|
#if QT_CONFIG(cborstreamwriter)
|
||||||
using QCborValueConstRef::toCbor;
|
using QCborValueConstRef::toCbor;
|
||||||
QByteArray toCbor(QCborValue::EncodingOptions opt = QCborValue::NoTransformation)
|
QByteArray toCbor(QCborValue::EncodingOptions opt = QCborValue::NoTransformation)
|
||||||
{ return qAsConst(*this).toCbor(opt); }
|
{ return std::as_const(*this).toCbor(opt); }
|
||||||
void toCbor(QCborStreamWriter &writer, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
|
void toCbor(QCborStreamWriter &writer, QCborValue::EncodingOptions opt = QCborValue::NoTransformation);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using QCborValueConstRef::toDiagnosticNotation;
|
using QCborValueConstRef::toDiagnosticNotation;
|
||||||
QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt = QCborValue::Compact)
|
QString toDiagnosticNotation(QCborValue::DiagnosticNotationOptions opt = QCborValue::Compact)
|
||||||
{ return qAsConst(*this).toDiagnosticNotation(opt); }
|
{ return std::as_const(*this).toDiagnosticNotation(opt); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QCborValue concrete(QCborValueRef that) noexcept;
|
static QCborValue concrete(QCborValueRef that) noexcept;
|
||||||
|
@ -4463,7 +4463,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after)
|
|||||||
|
|
||||||
lastEnd = 0;
|
lastEnd = 0;
|
||||||
// add the after string, with replacements for the backreferences
|
// add the after string, with replacements for the backreferences
|
||||||
for (const QStringCapture &backReference : qAsConst(backReferences)) {
|
for (const QStringCapture &backReference : std::as_const(backReferences)) {
|
||||||
// part of "after" before the backreference
|
// part of "after" before the backreference
|
||||||
len = backReference.pos - lastEnd;
|
len = backReference.pos - lastEnd;
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
@ -4501,7 +4501,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after)
|
|||||||
resize(newLength);
|
resize(newLength);
|
||||||
qsizetype i = 0;
|
qsizetype i = 0;
|
||||||
QChar *uc = data();
|
QChar *uc = data();
|
||||||
for (const QStringView &chunk : qAsConst(chunks)) {
|
for (const QStringView &chunk : std::as_const(chunks)) {
|
||||||
qsizetype len = chunk.length();
|
qsizetype len = chunk.length();
|
||||||
memcpy(uc + i, chunk.constData(), len * sizeof(QChar));
|
memcpy(uc + i, chunk.constData(), len * sizeof(QChar));
|
||||||
i += len;
|
i += len;
|
||||||
|
@ -71,7 +71,7 @@ public:
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
T *pointer()
|
T *pointer()
|
||||||
{
|
{
|
||||||
const T *p = qAsConst(*this).pointer<T>();
|
const T *p = std::as_const(*this).pointer<T>();
|
||||||
return const_cast<T *>(p);
|
return const_cast<T *>(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ inline bool comparePriority(int priority, const QueuePage *p)
|
|||||||
void QThreadPoolPrivate::enqueueTask(QRunnable *runnable, int priority)
|
void QThreadPoolPrivate::enqueueTask(QRunnable *runnable, int priority)
|
||||||
{
|
{
|
||||||
Q_ASSERT(runnable != nullptr);
|
Q_ASSERT(runnable != nullptr);
|
||||||
for (QueuePage *page : qAsConst(queue)) {
|
for (QueuePage *page : std::as_const(queue)) {
|
||||||
if (page->priority() == priority && !page->isFull()) {
|
if (page->priority() == priority && !page->isFull()) {
|
||||||
page->push(runnable);
|
page->push(runnable);
|
||||||
return;
|
return;
|
||||||
@ -269,7 +269,7 @@ void QThreadPoolPrivate::reset()
|
|||||||
|
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
|
|
||||||
for (QThreadPoolThread *thread : qAsConst(allThreadsCopy)) {
|
for (QThreadPoolThread *thread : std::as_const(allThreadsCopy)) {
|
||||||
if (thread->isRunning()) {
|
if (thread->isRunning()) {
|
||||||
thread->runnableReady.wakeAll();
|
thread->runnableReady.wakeAll();
|
||||||
thread->wait();
|
thread->wait();
|
||||||
@ -348,7 +348,7 @@ bool QThreadPool::tryTake(QRunnable *runnable)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
QMutexLocker locker(&d->mutex);
|
QMutexLocker locker(&d->mutex);
|
||||||
for (QueuePage *page : qAsConst(d->queue)) {
|
for (QueuePage *page : std::as_const(d->queue)) {
|
||||||
if (page->tryTake(runnable)) {
|
if (page->tryTake(runnable)) {
|
||||||
if (page->isFinished()) {
|
if (page->isFinished()) {
|
||||||
d->queue.removeOne(page);
|
d->queue.removeOne(page);
|
||||||
|
@ -178,7 +178,7 @@ void QWaitCondition::wakeOne()
|
|||||||
{
|
{
|
||||||
// wake up the first waiting thread in the queue
|
// wake up the first waiting thread in the queue
|
||||||
QMutexLocker locker(&d->mtx);
|
QMutexLocker locker(&d->mtx);
|
||||||
for (QWaitConditionEvent *current : qAsConst(d->queue)) {
|
for (QWaitConditionEvent *current : std::as_const(d->queue)) {
|
||||||
if (current->wokenUp)
|
if (current->wokenUp)
|
||||||
continue;
|
continue;
|
||||||
SetEvent(current->event);
|
SetEvent(current->event);
|
||||||
@ -191,7 +191,7 @@ void QWaitCondition::wakeAll()
|
|||||||
{
|
{
|
||||||
// wake up the all threads in the queue
|
// wake up the all threads in the queue
|
||||||
QMutexLocker locker(&d->mtx);
|
QMutexLocker locker(&d->mtx);
|
||||||
for (QWaitConditionEvent *current : qAsConst(d->queue)) {
|
for (QWaitConditionEvent *current : std::as_const(d->queue)) {
|
||||||
SetEvent(current->event);
|
SetEvent(current->event);
|
||||||
current->wokenUp = true;
|
current->wokenUp = true;
|
||||||
}
|
}
|
||||||
|
@ -826,7 +826,7 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::findEntry(const QByteArray &ianaId)
|
|||||||
// Offsets are stored as total offset, want to know separate UTC and DST offsets
|
// Offsets are stored as total offset, want to know separate UTC and DST offsets
|
||||||
// so find the first non-dst transition to use as base UTC Offset
|
// so find the first non-dst transition to use as base UTC Offset
|
||||||
int utcOffset = ret.m_preZoneRule.stdOffset;
|
int utcOffset = ret.m_preZoneRule.stdOffset;
|
||||||
for (const QTzTransition &tran : qAsConst(tranList)) {
|
for (const QTzTransition &tran : std::as_const(tranList)) {
|
||||||
if (!typeList.at(tran.tz_typeind).tz_isdst) {
|
if (!typeList.at(tran.tz_typeind).tz_isdst) {
|
||||||
utcOffset = typeList.at(tran.tz_typeind).tz_gmtoff;
|
utcOffset = typeList.at(tran.tz_typeind).tz_gmtoff;
|
||||||
break;
|
break;
|
||||||
|
@ -793,7 +793,7 @@ bool QCommandLineParser::isSet(const QString &name) const
|
|||||||
if (d->optionNames.contains(name))
|
if (d->optionNames.contains(name))
|
||||||
return true;
|
return true;
|
||||||
const QStringList aliases = d->aliases(name);
|
const QStringList aliases = d->aliases(name);
|
||||||
for (const QString &optionName : qAsConst(d->optionNames)) {
|
for (const QString &optionName : std::as_const(d->optionNames)) {
|
||||||
if (aliases.contains(optionName))
|
if (aliases.contains(optionName))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1110,7 +1110,7 @@ QString QCommandLineParserPrivate::helpText(bool includeQtOptions) const
|
|||||||
QStringList optionNameList;
|
QStringList optionNameList;
|
||||||
optionNameList.reserve(options.size());
|
optionNameList.reserve(options.size());
|
||||||
int longestOptionNameString = 0;
|
int longestOptionNameString = 0;
|
||||||
for (const QCommandLineOption &option : qAsConst(options)) {
|
for (const QCommandLineOption &option : std::as_const(options)) {
|
||||||
if (option.flags() & QCommandLineOption::HiddenFromHelp)
|
if (option.flags() & QCommandLineOption::HiddenFromHelp)
|
||||||
continue;
|
continue;
|
||||||
const QStringList optionNames = option.names();
|
const QStringList optionNames = option.names();
|
||||||
@ -1130,7 +1130,7 @@ QString QCommandLineParserPrivate::helpText(bool includeQtOptions) const
|
|||||||
++longestOptionNameString;
|
++longestOptionNameString;
|
||||||
const int optionNameMaxWidth = qMin(50, longestOptionNameString);
|
const int optionNameMaxWidth = qMin(50, longestOptionNameString);
|
||||||
auto optionNameIterator = optionNameList.cbegin();
|
auto optionNameIterator = optionNameList.cbegin();
|
||||||
for (const QCommandLineOption &option : qAsConst(options)) {
|
for (const QCommandLineOption &option : std::as_const(options)) {
|
||||||
if (option.flags() & QCommandLineOption::HiddenFromHelp)
|
if (option.flags() & QCommandLineOption::HiddenFromHelp)
|
||||||
continue;
|
continue;
|
||||||
text += wrapText(*optionNameIterator, optionNameMaxWidth, option.description());
|
text += wrapText(*optionNameIterator, optionNameMaxWidth, option.description());
|
||||||
|
@ -2121,7 +2121,7 @@ public:
|
|||||||
{
|
{
|
||||||
const auto copy = isDetached() ? QMultiHash() : *this; // keep 'key' alive across the detach
|
const auto copy = isDetached() ? QMultiHash() : *this; // keep 'key' alive across the detach
|
||||||
detach();
|
detach();
|
||||||
auto pair = qAsConst(*this).equal_range(key);
|
auto pair = std::as_const(*this).equal_range(key);
|
||||||
return qMakePair(iterator(pair.first.i), iterator(pair.second.i));
|
return qMakePair(iterator(pair.first.i), iterator(pair.second.i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ Q_INLINE_TEMPLATE QSet<T> &QSet<T>::intersect(const QSet<T> &other)
|
|||||||
copy2 = *this;
|
copy2 = *this;
|
||||||
*this = copy1;
|
*this = copy1;
|
||||||
}
|
}
|
||||||
for (const auto &e : qAsConst(copy1)) {
|
for (const auto &e : std::as_const(copy1)) {
|
||||||
if (!copy2.contains(e))
|
if (!copy2.contains(e))
|
||||||
remove(e);
|
remove(e);
|
||||||
}
|
}
|
||||||
|
@ -415,9 +415,9 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj)
|
|||||||
qsizetype data_size = idata.size() +
|
qsizetype data_size = idata.size() +
|
||||||
(header->methodCount * (QMetaObjectPrivate::IntsPerMethod+intsPerMethod)) + methodParametersDataSize +
|
(header->methodCount * (QMetaObjectPrivate::IntsPerMethod+intsPerMethod)) + methodParametersDataSize +
|
||||||
(header->propertyCount * (QMetaObjectPrivate::IntsPerProperty+intsPerProperty));
|
(header->propertyCount * (QMetaObjectPrivate::IntsPerProperty+intsPerProperty));
|
||||||
for (const Method &mm : qAsConst(signals_))
|
for (const Method &mm : std::as_const(signals_))
|
||||||
data_size += 2 + mm.inputTypes.size() + mm.outputTypes.size();
|
data_size += 2 + mm.inputTypes.size() + mm.outputTypes.size();
|
||||||
for (const Method &mm : qAsConst(methods))
|
for (const Method &mm : std::as_const(methods))
|
||||||
data_size += 2 + mm.inputTypes.size() + mm.outputTypes.size();
|
data_size += 2 + mm.inputTypes.size() + mm.outputTypes.size();
|
||||||
idata.resize(data_size + 1);
|
idata.resize(data_size + 1);
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ QDBusServer::~QDBusServer()
|
|||||||
QMutexLocker locker(managerMutex);
|
QMutexLocker locker(managerMutex);
|
||||||
QWriteLocker writeLocker(&d->lock);
|
QWriteLocker writeLocker(&d->lock);
|
||||||
if (QDBusConnectionManager::instance()) {
|
if (QDBusConnectionManager::instance()) {
|
||||||
for (const QString &name : qAsConst(d->serverConnectionNames))
|
for (const QString &name : std::as_const(d->serverConnectionNames))
|
||||||
QDBusConnectionManager::instance()->removeConnection(name);
|
QDBusConnectionManager::instance()->removeConnection(name);
|
||||||
d->serverConnectionNames.clear();
|
d->serverConnectionNames.clear();
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
|
@ -62,7 +62,7 @@ void QDBusServiceWatcherPrivate::setConnection(const QStringList &services,
|
|||||||
{
|
{
|
||||||
if (connection.isConnected()) {
|
if (connection.isConnected()) {
|
||||||
// remove older rules
|
// remove older rules
|
||||||
for (const QString &s : qAsConst(watchedServicesData.value()))
|
for (const QString &s : std::as_const(watchedServicesData.value()))
|
||||||
removeService(s);
|
removeService(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ void QDBusServiceWatcherPrivate::setConnection(const QStringList &services,
|
|||||||
|
|
||||||
if (connection.isConnected()) {
|
if (connection.isConnected()) {
|
||||||
// add new rules
|
// add new rules
|
||||||
for (const QString &s : qAsConst(watchedServicesData.value()))
|
for (const QString &s : std::as_const(watchedServicesData.value()))
|
||||||
addService(s);
|
addService(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ void QPixmapIconEngine::addFile(const QString &fileName, const QSize &size, QIco
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const QImage &i : qAsConst(icoImages))
|
for (const QImage &i : std::as_const(icoImages))
|
||||||
pixmaps += QPixmapIconEngineEntry(abs, i, mode, state);
|
pixmaps += QPixmapIconEngineEntry(abs, i, mode, state);
|
||||||
if (icoImages.isEmpty() && !ignoreSize) // Add placeholder with the filename and empty pixmap for the size.
|
if (icoImages.isEmpty() && !ignoreSize) // Add placeholder with the filename and empty pixmap for the size.
|
||||||
pixmaps += QPixmapIconEngineEntry(abs, size, mode, state);
|
pixmaps += QPixmapIconEngineEntry(abs, size, mode, state);
|
||||||
|
@ -282,9 +282,9 @@ void QFileInfoGatherer::run()
|
|||||||
condition.wait(&mutex);
|
condition.wait(&mutex);
|
||||||
if (abort.loadRelaxed())
|
if (abort.loadRelaxed())
|
||||||
return;
|
return;
|
||||||
const QString thisPath = qAsConst(path).front();
|
const QString thisPath = std::as_const(path).front();
|
||||||
path.pop_front();
|
path.pop_front();
|
||||||
const QStringList thisList = qAsConst(files).front();
|
const QStringList thisList = std::as_const(files).front();
|
||||||
files.pop_front();
|
files.pop_front();
|
||||||
locker.unlock();
|
locker.unlock();
|
||||||
|
|
||||||
|
@ -1944,7 +1944,7 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path,
|
|||||||
std::sort(rowsToUpdate.begin(), rowsToUpdate.end());
|
std::sort(rowsToUpdate.begin(), rowsToUpdate.end());
|
||||||
QString min;
|
QString min;
|
||||||
QString max;
|
QString max;
|
||||||
for (const QString &value : qAsConst(rowsToUpdate)) {
|
for (const QString &value : std::as_const(rowsToUpdate)) {
|
||||||
//##TODO is there a way to bundle signals with QString as the content of the list?
|
//##TODO is there a way to bundle signals with QString as the content of the list?
|
||||||
/*if (min.isEmpty()) {
|
/*if (min.isEmpty()) {
|
||||||
min = value;
|
min = value;
|
||||||
|
@ -146,7 +146,7 @@ public:
|
|||||||
void updateIcon(QAbstractFileIconProvider *iconProvider, const QString &path) {
|
void updateIcon(QAbstractFileIconProvider *iconProvider, const QString &path) {
|
||||||
if (info)
|
if (info)
|
||||||
info->icon = iconProvider->icon(QFileInfo(path));
|
info->icon = iconProvider->icon(QFileInfo(path));
|
||||||
for (QFileSystemNode *child : qAsConst(children)) {
|
for (QFileSystemNode *child : std::as_const(children)) {
|
||||||
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
|
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
|
||||||
if (!path.isEmpty()) {
|
if (!path.isEmpty()) {
|
||||||
if (path.endsWith(u'/'))
|
if (path.endsWith(u'/'))
|
||||||
@ -161,7 +161,7 @@ public:
|
|||||||
void retranslateStrings(QAbstractFileIconProvider *iconProvider, const QString &path) {
|
void retranslateStrings(QAbstractFileIconProvider *iconProvider, const QString &path) {
|
||||||
if (info)
|
if (info)
|
||||||
info->displayType = iconProvider->type(QFileInfo(path));
|
info->displayType = iconProvider->type(QFileInfo(path));
|
||||||
for (QFileSystemNode *child : qAsConst(children)) {
|
for (QFileSystemNode *child : std::as_const(children)) {
|
||||||
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
|
//On windows the root (My computer) has no path so we don't want to add a / for nothing (e.g. /C:/)
|
||||||
if (!path.isEmpty()) {
|
if (!path.isEmpty()) {
|
||||||
if (path.endsWith(u'/'))
|
if (path.endsWith(u'/'))
|
||||||
|
@ -840,7 +840,7 @@ QStandardItem &QStandardItem::operator=(const QStandardItem &other)
|
|||||||
QStandardItem::~QStandardItem()
|
QStandardItem::~QStandardItem()
|
||||||
{
|
{
|
||||||
Q_D(QStandardItem);
|
Q_D(QStandardItem);
|
||||||
for (QStandardItem *child : qAsConst(d->children)) {
|
for (QStandardItem *child : std::as_const(d->children)) {
|
||||||
if (child)
|
if (child)
|
||||||
child->d_func()->setModel(nullptr);
|
child->d_func()->setModel(nullptr);
|
||||||
delete child;
|
delete child;
|
||||||
@ -3144,7 +3144,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
stack.reserve(itemsSet.size());
|
stack.reserve(itemsSet.size());
|
||||||
for (QStandardItem *item : qAsConst(itemsSet))
|
for (QStandardItem *item : std::as_const(itemsSet))
|
||||||
stack.push(item);
|
stack.push(item);
|
||||||
|
|
||||||
//stream everything recursively
|
//stream everything recursively
|
||||||
|
@ -81,26 +81,26 @@ void QActionPrivate::sendDataChanged()
|
|||||||
void QActionPrivate::redoGrab(QShortcutMap &map)
|
void QActionPrivate::redoGrab(QShortcutMap &map)
|
||||||
{
|
{
|
||||||
Q_Q(QAction);
|
Q_Q(QAction);
|
||||||
for (int id : qAsConst(shortcutIds)) {
|
for (int id : std::as_const(shortcutIds)) {
|
||||||
if (id)
|
if (id)
|
||||||
map.removeShortcut(id, q);
|
map.removeShortcut(id, q);
|
||||||
}
|
}
|
||||||
|
|
||||||
shortcutIds.clear();
|
shortcutIds.clear();
|
||||||
for (const QKeySequence &shortcut : qAsConst(shortcuts)) {
|
for (const QKeySequence &shortcut : std::as_const(shortcuts)) {
|
||||||
if (!shortcut.isEmpty())
|
if (!shortcut.isEmpty())
|
||||||
shortcutIds.append(map.addShortcut(q, shortcut, shortcutContext, contextMatcher()));
|
shortcutIds.append(map.addShortcut(q, shortcut, shortcutContext, contextMatcher()));
|
||||||
else
|
else
|
||||||
shortcutIds.append(0);
|
shortcutIds.append(0);
|
||||||
}
|
}
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
for (int id : qAsConst(shortcutIds)) {
|
for (int id : std::as_const(shortcutIds)) {
|
||||||
if (id)
|
if (id)
|
||||||
map.setShortcutEnabled(false, id, q);
|
map.setShortcutEnabled(false, id, q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!autorepeat) {
|
if (!autorepeat) {
|
||||||
for (int id : qAsConst(shortcutIds)) {
|
for (int id : std::as_const(shortcutIds)) {
|
||||||
if (id)
|
if (id)
|
||||||
map.setShortcutAutoRepeat(false, id, q);
|
map.setShortcutAutoRepeat(false, id, q);
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ void QActionPrivate::redoGrab(QShortcutMap &map)
|
|||||||
void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
|
void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
|
||||||
{
|
{
|
||||||
Q_Q(QAction);
|
Q_Q(QAction);
|
||||||
for (int id : qAsConst(shortcutIds)) {
|
for (int id : std::as_const(shortcutIds)) {
|
||||||
if (id)
|
if (id)
|
||||||
map.setShortcutEnabled(enable, id, q);
|
map.setShortcutEnabled(enable, id, q);
|
||||||
}
|
}
|
||||||
@ -458,7 +458,7 @@ QAction::~QAction()
|
|||||||
d->group->removeAction(this);
|
d->group->removeAction(this);
|
||||||
#if QT_CONFIG(shortcut)
|
#if QT_CONFIG(shortcut)
|
||||||
if (qApp) {
|
if (qApp) {
|
||||||
for (int id : qAsConst(d->shortcutIds)) {
|
for (int id : std::as_const(d->shortcutIds)) {
|
||||||
if (id)
|
if (id)
|
||||||
QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(id, this);
|
QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(id, this);
|
||||||
}
|
}
|
||||||
@ -1024,7 +1024,7 @@ bool QAction::event(QEvent *e)
|
|||||||
{
|
{
|
||||||
Q_D(QAction);
|
Q_D(QAction);
|
||||||
if (e->type() == QEvent::ActionChanged) {
|
if (e->type() == QEvent::ActionChanged) {
|
||||||
for (auto object : qAsConst(d->associatedObjects))
|
for (auto object : std::as_const(d->associatedObjects))
|
||||||
QCoreApplication::sendEvent(object, e);
|
QCoreApplication::sendEvent(object, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ void QActionGroup::setEnabled(bool b)
|
|||||||
{
|
{
|
||||||
Q_D(QActionGroup);
|
Q_D(QActionGroup);
|
||||||
d->enabled = b;
|
d->enabled = b;
|
||||||
for (auto action : qAsConst(d->actions)) {
|
for (auto action : std::as_const(d->actions)) {
|
||||||
action->d_func()->setEnabled(b, true);
|
action->d_func()->setEnabled(b, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,7 +311,7 @@ void QActionGroup::setVisible(bool b)
|
|||||||
{
|
{
|
||||||
Q_D(QActionGroup);
|
Q_D(QActionGroup);
|
||||||
d->visible = b;
|
d->visible = b;
|
||||||
for (auto action : qAsConst(d->actions)) {
|
for (auto action : std::as_const(d->actions)) {
|
||||||
if (!action->d_func()->forceInvisible)
|
if (!action->d_func()->forceInvisible)
|
||||||
action->d_func()->setVisible(b);
|
action->d_func()->setVisible(b);
|
||||||
}
|
}
|
||||||
|
@ -837,7 +837,7 @@ void QGuiApplicationPrivate::showModalWindow(QWindow *modal)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QWindow *window : qAsConst(QGuiApplicationPrivate::window_list)) {
|
for (QWindow *window : std::as_const(QGuiApplicationPrivate::window_list)) {
|
||||||
if (needsWindowBlockedEvent(window) && !window->d_func()->blockedByModalWindow)
|
if (needsWindowBlockedEvent(window) && !window->d_func()->blockedByModalWindow)
|
||||||
updateBlockedStatus(window);
|
updateBlockedStatus(window);
|
||||||
}
|
}
|
||||||
@ -849,7 +849,7 @@ void QGuiApplicationPrivate::hideModalWindow(QWindow *window)
|
|||||||
{
|
{
|
||||||
self->modalWindowList.removeAll(window);
|
self->modalWindowList.removeAll(window);
|
||||||
|
|
||||||
for (QWindow *window : qAsConst(QGuiApplicationPrivate::window_list)) {
|
for (QWindow *window : std::as_const(QGuiApplicationPrivate::window_list)) {
|
||||||
if (needsWindowBlockedEvent(window) && window->d_func()->blockedByModalWindow)
|
if (needsWindowBlockedEvent(window) && window->d_func()->blockedByModalWindow)
|
||||||
updateBlockedStatus(window);
|
updateBlockedStatus(window);
|
||||||
}
|
}
|
||||||
@ -1097,7 +1097,7 @@ qreal QGuiApplication::devicePixelRatio() const
|
|||||||
return QGuiApplicationPrivate::m_maxDevicePixelRatio;
|
return QGuiApplicationPrivate::m_maxDevicePixelRatio;
|
||||||
|
|
||||||
QGuiApplicationPrivate::m_maxDevicePixelRatio = 1.0; // make sure we never return 0.
|
QGuiApplicationPrivate::m_maxDevicePixelRatio = 1.0; // make sure we never return 0.
|
||||||
for (QScreen *screen : qAsConst(QGuiApplicationPrivate::screen_list))
|
for (QScreen *screen : std::as_const(QGuiApplicationPrivate::screen_list))
|
||||||
QGuiApplicationPrivate::m_maxDevicePixelRatio = qMax(QGuiApplicationPrivate::m_maxDevicePixelRatio, screen->devicePixelRatio());
|
QGuiApplicationPrivate::m_maxDevicePixelRatio = qMax(QGuiApplicationPrivate::m_maxDevicePixelRatio, screen->devicePixelRatio());
|
||||||
|
|
||||||
return QGuiApplicationPrivate::m_maxDevicePixelRatio;
|
return QGuiApplicationPrivate::m_maxDevicePixelRatio;
|
||||||
@ -1245,7 +1245,7 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
|
|||||||
qCDebug(lcQpaTheme) << "Adding platform integration's theme names to list of theme names:" << platformIntegrationThemeNames;
|
qCDebug(lcQpaTheme) << "Adding platform integration's theme names to list of theme names:" << platformIntegrationThemeNames;
|
||||||
themeNames += platformIntegrationThemeNames;
|
themeNames += platformIntegrationThemeNames;
|
||||||
// 4) Look for a theme plugin.
|
// 4) Look for a theme plugin.
|
||||||
for (const QString &themeName : qAsConst(themeNames)) {
|
for (const QString &themeName : std::as_const(themeNames)) {
|
||||||
qCDebug(lcQpaTheme) << "Attempting to create platform theme" << themeName << "via QPlatformThemeFactory::create";
|
qCDebug(lcQpaTheme) << "Attempting to create platform theme" << themeName << "via QPlatformThemeFactory::create";
|
||||||
QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(themeName, platformPluginPath);
|
QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(themeName, platformPluginPath);
|
||||||
if (QGuiApplicationPrivate::platform_theme) {
|
if (QGuiApplicationPrivate::platform_theme) {
|
||||||
@ -1257,7 +1257,7 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
|
|||||||
// 5) If no theme plugin was found ask the platform integration to
|
// 5) If no theme plugin was found ask the platform integration to
|
||||||
// create a theme
|
// create a theme
|
||||||
if (!QGuiApplicationPrivate::platform_theme) {
|
if (!QGuiApplicationPrivate::platform_theme) {
|
||||||
for (const QString &themeName : qAsConst(themeNames)) {
|
for (const QString &themeName : std::as_const(themeNames)) {
|
||||||
qCDebug(lcQpaTheme) << "Attempting to create platform theme" << themeName << "via createPlatformTheme";
|
qCDebug(lcQpaTheme) << "Attempting to create platform theme" << themeName << "via createPlatformTheme";
|
||||||
QGuiApplicationPrivate::platform_theme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName);
|
QGuiApplicationPrivate::platform_theme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName);
|
||||||
if (QGuiApplicationPrivate::platform_theme) {
|
if (QGuiApplicationPrivate::platform_theme) {
|
||||||
@ -1278,7 +1278,7 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
|
|||||||
// boolean 'foo' or strings: 'foo=bar'
|
// boolean 'foo' or strings: 'foo=bar'
|
||||||
if (!platformArguments.isEmpty()) {
|
if (!platformArguments.isEmpty()) {
|
||||||
if (QObject *nativeInterface = QGuiApplicationPrivate::platform_integration->nativeInterface()) {
|
if (QObject *nativeInterface = QGuiApplicationPrivate::platform_integration->nativeInterface()) {
|
||||||
for (const QString &argument : qAsConst(platformArguments)) {
|
for (const QString &argument : std::as_const(platformArguments)) {
|
||||||
const int equalsPos = argument.indexOf(u'=');
|
const int equalsPos = argument.indexOf(u'=');
|
||||||
const QByteArray name =
|
const QByteArray name =
|
||||||
equalsPos != -1 ? argument.left(equalsPos).toUtf8() : argument.toUtf8();
|
equalsPos != -1 ? argument.left(equalsPos).toUtf8() : argument.toUtf8();
|
||||||
|
@ -127,14 +127,14 @@ void QShortcutPrivate::redoGrab(QShortcutMap &map)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int id : qAsConst(sc_ids))
|
for (int id : std::as_const(sc_ids))
|
||||||
map.removeShortcut(id, q);
|
map.removeShortcut(id, q);
|
||||||
|
|
||||||
sc_ids.clear();
|
sc_ids.clear();
|
||||||
if (sc_sequences.isEmpty())
|
if (sc_sequences.isEmpty())
|
||||||
return;
|
return;
|
||||||
sc_ids.reserve(sc_sequences.size());
|
sc_ids.reserve(sc_sequences.size());
|
||||||
for (const auto &keySequence : qAsConst(sc_sequences)) {
|
for (const auto &keySequence : std::as_const(sc_sequences)) {
|
||||||
if (keySequence.isEmpty())
|
if (keySequence.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
int id = map.addShortcut(q, keySequence, sc_context, contextMatcher());
|
int id = map.addShortcut(q, keySequence, sc_context, contextMatcher());
|
||||||
@ -337,7 +337,7 @@ QShortcut::~QShortcut()
|
|||||||
{
|
{
|
||||||
Q_D(QShortcut);
|
Q_D(QShortcut);
|
||||||
if (qApp) {
|
if (qApp) {
|
||||||
for (int id : qAsConst(d->sc_ids))
|
for (int id : std::as_const(d->sc_ids))
|
||||||
QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(id, this);
|
QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(id, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ void QShortcutMap::dispatchEvent(QKeyEvent *e)
|
|||||||
if (lcShortcutMap().isDebugEnabled()) {
|
if (lcShortcutMap().isDebugEnabled()) {
|
||||||
if (ambiguousShortcuts.size() > 1) {
|
if (ambiguousShortcuts.size() > 1) {
|
||||||
qCDebug(lcShortcutMap) << "The following shortcuts are about to be activated ambiguously:";
|
qCDebug(lcShortcutMap) << "The following shortcuts are about to be activated ambiguously:";
|
||||||
for (const QShortcutEntry *entry : qAsConst(ambiguousShortcuts))
|
for (const QShortcutEntry *entry : std::as_const(ambiguousShortcuts))
|
||||||
qCDebug(lcShortcutMap).nospace() << "- " << entry->keyseq << " (belonging to " << entry->owner << ")";
|
qCDebug(lcShortcutMap).nospace() << "- " << entry->keyseq << " (belonging to " << entry->owner << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ static inline QPoint fromNativeGlobalPixels(const QPoint &point)
|
|||||||
#ifndef QT_NO_HIGHDPISCALING
|
#ifndef QT_NO_HIGHDPISCALING
|
||||||
QPoint res = point;
|
QPoint res = point;
|
||||||
if (QHighDpiScaling::isActive()) {
|
if (QHighDpiScaling::isActive()) {
|
||||||
for (const QScreen *s : qAsConst(QGuiApplicationPrivate::screen_list)) {
|
for (const QScreen *s : std::as_const(QGuiApplicationPrivate::screen_list)) {
|
||||||
if (s->handle()->geometry().contains(point)) {
|
if (s->handle()->geometry().contains(point)) {
|
||||||
res = QHighDpi::fromNativePixels(point, s);
|
res = QHighDpi::fromNativePixels(point, s);
|
||||||
break;
|
break;
|
||||||
|
@ -132,7 +132,7 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
auto nsImage = [[[NSImage alloc] initWithSize:NSZeroSize] autorelease];
|
auto nsImage = [[[NSImage alloc] initWithSize:NSZeroSize] autorelease];
|
||||||
|
|
||||||
for (QSize size : qAsConst(availableSizes)) {
|
for (QSize size : std::as_const(availableSizes)) {
|
||||||
QImage image = icon.pixmap(size).toImage();
|
QImage image = icon.pixmap(size).toImage();
|
||||||
if (image.isNull())
|
if (image.isNull())
|
||||||
continue;
|
continue;
|
||||||
|
@ -381,7 +381,7 @@ void QPainterPrivate::draw_helper(const QPainterPath &originalPath, DrawOperatio
|
|||||||
|
|
||||||
if (q->hasClipping()) {
|
if (q->hasClipping()) {
|
||||||
bool hasPerspectiveTransform = false;
|
bool hasPerspectiveTransform = false;
|
||||||
for (const QPainterClipInfo &info : qAsConst(state->clipInfo)) {
|
for (const QPainterClipInfo &info : std::as_const(state->clipInfo)) {
|
||||||
if (info.matrix.type() == QTransform::TxProject) {
|
if (info.matrix.type() == QTransform::TxProject) {
|
||||||
hasPerspectiveTransform = true;
|
hasPerspectiveTransform = true;
|
||||||
break;
|
break;
|
||||||
@ -1616,7 +1616,7 @@ void QPainter::restore()
|
|||||||
tmp->clipPath = QPainterPath();
|
tmp->clipPath = QPainterPath();
|
||||||
d->engine->updateState(*tmp);
|
d->engine->updateState(*tmp);
|
||||||
// replay the list of clip states,
|
// replay the list of clip states,
|
||||||
for (const QPainterClipInfo &info : qAsConst(d->state->clipInfo)) {
|
for (const QPainterClipInfo &info : std::as_const(d->state->clipInfo)) {
|
||||||
tmp->matrix = info.matrix;
|
tmp->matrix = info.matrix;
|
||||||
tmp->matrix *= d->state->redirectionMatrix;
|
tmp->matrix *= d->state->redirectionMatrix;
|
||||||
tmp->clipOperation = info.operation;
|
tmp->clipOperation = info.operation;
|
||||||
@ -2478,7 +2478,7 @@ QRegion QPainter::clipRegion() const
|
|||||||
const_cast<QPainter *>(this)->d_ptr->updateInvMatrix();
|
const_cast<QPainter *>(this)->d_ptr->updateInvMatrix();
|
||||||
|
|
||||||
// ### Falcon: Use QPainterPath
|
// ### Falcon: Use QPainterPath
|
||||||
for (const QPainterClipInfo &info : qAsConst(d->state->clipInfo)) {
|
for (const QPainterClipInfo &info : std::as_const(d->state->clipInfo)) {
|
||||||
switch (info.clipType) {
|
switch (info.clipType) {
|
||||||
|
|
||||||
case QPainterClipInfo::RegionClip: {
|
case QPainterClipInfo::RegionClip: {
|
||||||
@ -2645,7 +2645,7 @@ QRectF QPainter::clipBoundingRect() const
|
|||||||
// fast.
|
// fast.
|
||||||
QRectF bounds;
|
QRectF bounds;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (const QPainterClipInfo &info : qAsConst(d->state->clipInfo)) {
|
for (const QPainterClipInfo &info : std::as_const(d->state->clipInfo)) {
|
||||||
QRectF r;
|
QRectF r;
|
||||||
|
|
||||||
if (info.clipType == QPainterClipInfo::RectClip)
|
if (info.clipType == QPainterClipInfo::RectClip)
|
||||||
|
@ -45,7 +45,7 @@ QXdgDBusImageVector iconToQXdgDBusImageVector(const QIcon &icon)
|
|||||||
bool hasSmallIcon = false;
|
bool hasSmallIcon = false;
|
||||||
bool hasMediumIcon = false;
|
bool hasMediumIcon = false;
|
||||||
QList<QSize> toRemove;
|
QList<QSize> toRemove;
|
||||||
for (const QSize &size : qAsConst(sizes)) {
|
for (const QSize &size : std::as_const(sizes)) {
|
||||||
int maxSize = qMax(size.width(), size.height());
|
int maxSize = qMax(size.width(), size.height());
|
||||||
if (maxSize <= IconNormalSmallSize)
|
if (maxSize <= IconNormalSmallSize)
|
||||||
hasSmallIcon = true;
|
hasSmallIcon = true;
|
||||||
@ -54,7 +54,7 @@ QXdgDBusImageVector iconToQXdgDBusImageVector(const QIcon &icon)
|
|||||||
else if (maxSize > IconSizeLimit)
|
else if (maxSize > IconSizeLimit)
|
||||||
toRemove << size;
|
toRemove << size;
|
||||||
}
|
}
|
||||||
for (const QSize &size : qAsConst(toRemove))
|
for (const QSize &size : std::as_const(toRemove))
|
||||||
sizes.removeOne(size);
|
sizes.removeOne(size);
|
||||||
if (!hasSmallIcon)
|
if (!hasSmallIcon)
|
||||||
sizes.append(QSize(IconNormalSmallSize, IconNormalSmallSize));
|
sizes.append(QSize(IconNormalSmallSize, IconNormalSmallSize));
|
||||||
@ -62,7 +62,7 @@ QXdgDBusImageVector iconToQXdgDBusImageVector(const QIcon &icon)
|
|||||||
sizes.append(QSize(IconNormalMediumSize, IconNormalMediumSize));
|
sizes.append(QSize(IconNormalMediumSize, IconNormalMediumSize));
|
||||||
|
|
||||||
ret.reserve(sizes.size());
|
ret.reserve(sizes.size());
|
||||||
for (const QSize &size : qAsConst(sizes)) {
|
for (const QSize &size : std::as_const(sizes)) {
|
||||||
// Protocol specifies ARGB32 format in network byte order
|
// Protocol specifies ARGB32 format in network byte order
|
||||||
QImage im = engine->pixmap(size, QIcon::Normal, QIcon::Off).toImage().convertToFormat(QImage::Format_ARGB32);
|
QImage im = engine->pixmap(size, QIcon::Normal, QIcon::Off).toImage().convertToFormat(QImage::Format_ARGB32);
|
||||||
// letterbox if necessary to make it square
|
// letterbox if necessary to make it square
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user