Skip to content

Commit f458209

Browse files
committed
#3316 fix: more building with Qt 6.10+
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent 44eeaaa commit f458209

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/dialogs/updatedialog.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,11 @@ bool UpdateDialog::initializeMacOSUpdateProcess(const QString &releaseUrl) {
352352
}
353353

354354
// read the content of the updater script
355-
f.open(QFile::ReadOnly | QFile::Text);
355+
if (!f.open(QFile::ReadOnly | QFile::Text)) {
356+
qWarning() << "Failed to open file:" << f.fileName();
357+
return false;
358+
}
359+
356360
QTextStream ts(&f);
357361
QString scriptContent = ts.readAll();
358362
f.close();

src/entities/note.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4004,7 +4004,11 @@ bool Note::scaleDownImageFileIfNeeded(QFile &file) {
40044004
const QPixmap &pixmap = QPixmap::fromImage(
40054005
image.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation));
40064006

4007-
file.open(QIODevice::WriteOnly);
4007+
if (!file.open(QIODevice::WriteOnly)) {
4008+
qWarning() << "Failed to open file for writing:" << file.fileName();
4009+
return false;
4010+
}
4011+
40084012
pixmap.save(&file);
40094013
file.close();
40104014

src/mainwindow.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1552,10 +1552,12 @@ void MainWindow::initStyling() {
15521552
QFile f(QStringLiteral(":qdarkstyle/style.qss"));
15531553
if (!f.exists()) {
15541554
qWarning("Unable to set stylesheet, file not found!");
1555+
} else if (!f.open(QFile::ReadOnly | QFile::Text)) {
1556+
qWarning() << "Failed to open file:" << f.fileName();
15551557
} else {
1556-
f.open(QFile::ReadOnly | QFile::Text);
15571558
QTextStream ts(&f);
15581559
appStyleSheet = ts.readAll();
1560+
f.close();
15591561
}
15601562

15611563
// QTextEdit background color of qdarkstyle

0 commit comments

Comments
 (0)