Use list-initialization more

Fixes a few ugly code pieces I added over the years.

Change-Id: I5c06b73e858add04ea184120c6df71720baf9be3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Marc Mutz 2017-04-20 01:43:33 +02:00
parent c38a1b4bb9
commit dc8bfab82e
5 changed files with 5 additions and 10 deletions

View File

@ -954,8 +954,7 @@ QTextStreamPrivate::PaddingResult QTextStreamPrivate::padding(int len) const
right = padSize - padSize/2;
break;
}
const PaddingResult result = { left, right };
return result;
return { left, right };
}
/*!

View File

@ -160,8 +160,7 @@ static ParsedDate getDateFromJulianDay(qint64 julianDay)
if (year <= 0)
--year ;
const ParsedDate result = { year, month, day };
return result;
return { year, month, day };
}
/*****************************************************************************

View File

@ -311,11 +311,10 @@ QSslCipher QSslSocketBackendPrivate::QSslCipher_from_SSL_CIPHER(SSL_CIPHER *ciph
// static
inline QSslErrorEntry QSslErrorEntry::fromStoreContext(X509_STORE_CTX *ctx) {
QSslErrorEntry result = {
return {
q_X509_STORE_CTX_get_error(ctx),
q_X509_STORE_CTX_get_error_depth(ctx)
};
return result;
}
// ### This list is shared between all threads, and protected by a

View File

@ -4420,8 +4420,7 @@ QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs(const QModelIn
for (const auto &index : indexes) {
const QRect current = q->visualRect(index);
if (current.intersects(viewportRect)) {
QItemViewPaintPair p = { current, index };
ret += p;
ret.append({current, index});
rect |= current;
}
}

View File

@ -663,8 +663,7 @@ QItemViewPaintPairs QListViewPrivate::draggablePaintPairs(const QModelIndexList
for (const auto &index : indexes) {
if (std::binary_search(visibleIndexes.cbegin(), visibleIndexes.cend(), index)) {
const QRect current = q->visualRect(index);
QItemViewPaintPair p = { current, index };
ret += p;
ret.append({current, index});
rect |= current;
}
}