Is there a "new" style for casting?
Solved
General and Desktop
-
@saber said in Is there a "new" style for casting?:
add that enm
Please don't there is NOTHING to add to the enum! Simply remove the "default" inside the switch. Please read the link I posted more carefully, it is explained there.
-
Hi @saber,
the "Unterminated conditional directive" could be either QTCREATORBUG-18801 or QTCREATORBUG-20883
Regards,
-
i found new issue
QString DiskInfo::getDiskName() const { QDir blocks("/sys/block"); for (const QFileInfo entryInfo : blocks.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot)) { if (QFile::exists(QString("%1/device").arg(entryInfo.absoluteFilePath()))) { return entryInfo.baseName(); } } return QString(); }
here qt telling me
warning: loop variable 'entryInfo' of type 'const QFileInfo' creates a copy from type 'const QFileInfo'
-
@saber
In general, when you have a new question, post in a new thread. Since this thread is marked as "solved", people may not look.To your question: You loop through a list of QFileInfo objects. Your code copies the QFileInfo for every loop, which is unnecessary. Instead, you can use a const reference:
for (const QFileInfo& entryInfo : blocks.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot))
-
@Asperamanca thanks.it sloved.