REFAC(deprecated): Use QFlag default constructor

Qt 5.15 has introduced a default constructor for a QFlag that will be
equivalent of setting it equal to a zero literal (setting it to no
flag).
This commit is contained in:
Robert Adam 2020-06-10 18:47:03 +02:00
parent 62c215e924
commit 0fcafd86e7
2 changed files with 13 additions and 2 deletions

View File

@ -104,7 +104,13 @@ QFlags<ChanACL::Perm> ChanACL::effectivePermissions(ServerUser *p, Channel *chan
return static_cast<Permissions>(All &~ (Speak|Whisper));
}
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
// Qt 5.15 introduced a default constructor that initializes the flags to be set to no flags
Permissions granted;
#else
// Before Qt 5.15 we have emulate the default constructor by assigning a literal zero
Permissions granted = 0;
#endif
if (cache) {
QHash<Channel *, Permissions> *h = cache->value(p);

View File

@ -3198,9 +3198,14 @@ void MainWindow::serverDisconnected(QAbstractSocket::SocketError err, QString re
g.l->log(Log::ServerDisconnected, tr("Disconnected from server."));
}
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
// Qt 5.15 introduced a default constructor that initializes the flags to be set to no flags
Qt::WindowFlags wf;
#elif defined(Q_OS_MAC)
Qt::WindowFlags wf = Qt::Sheet;
#else
// Before Qt 5.15 we have emulate the default constructor by assigning a literal zero
Qt::WindowFlags wf = 0;
#ifdef Q_OS_MAC
wf = Qt::Sheet;
#endif
bool matched = true;