fix: build on both qt < and >= 6.10.0

This commit is contained in:
Bruno Alexandre Rosa 2025-10-10 15:29:02 -03:00
parent 3ae4a7d8a7
commit 1a62ee2e57
8 changed files with 57 additions and 27 deletions

View file

@ -51,7 +51,11 @@ void Logger::openLogfileSession()
}
fileHandle.setFileName(LOGGER_FILENAME);
fileHandle.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
const auto result = fileHandle.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text);
if (!result) {
std::cerr << "Error: Failed to open log file: " << fileHandle.errorString().toStdString() << std::endl;
return;
}
fileStream.setDevice(&fileHandle);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
fileStream << "Log session started at " << QDateTime::currentDateTime().toString() << Qt::endl;