fix: warnings when compiling with Qt 6.10 (#6422)

This commit is contained in:
nerix
2025-10-05 15:18:54 +02:00
committed by GitHub
parent 2c44a2efd2
commit 38a3bf2ef8
17 changed files with 105 additions and 24 deletions
+6 -1
View File
@@ -2,6 +2,7 @@
#include "Application.hpp"
#include "common/Args.hpp"
#include "common/QLogging.hpp"
#include "controllers/commands/CommandController.hpp"
#include "controllers/hotkeys/HotkeyController.hpp"
#include "singletons/Settings.hpp"
@@ -47,7 +48,11 @@ SettingsDialog::SettingsDialog(QWidget *parent)
this->resize(915, 600);
this->themeChangedEvent();
QFile styleFile(":/qss/settings.qss");
styleFile.open(QFile::ReadOnly);
if (!styleFile.open(QFile::ReadOnly))
{
assert(false && "Resources not loaded");
qCWarning(chatterinoWidget) << "Resources not loaded";
}
QString stylesheet = QString::fromUtf8(styleFile.readAll());
this->setStyleSheet(stylesheet);
+11 -2
View File
@@ -158,7 +158,11 @@ AboutPage::AboutPage()
auto l = contributors.emplace<FlowLayout>();
QFile contributorsFile(":/contributors.txt");
contributorsFile.open(QFile::ReadOnly);
if (!contributorsFile.open(QFile::ReadOnly))
{
assert(false && "Resources not loaded");
qCWarning(chatterinoWidget) << "Resources not loaded";
}
QTextStream stream(&contributorsFile);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@@ -265,7 +269,12 @@ void AboutPage::addLicense(QFormLayout *form, const QString &name,
auto *edit = new QTextEdit;
QFile file(licenseLink);
file.open(QIODevice::ReadOnly);
if (!file.open(QIODevice::ReadOnly))
{
assert(false && "License not found");
qCWarning(chatterinoWidget)
<< "License not found" << licenseLink;
}
edit->setText(file.readAll());
edit->setReadOnly(true);
+9 -2
View File
@@ -12,6 +12,7 @@
#include <QColor>
#include <QHeaderView>
#include <QLabel>
#include <QMessageBox>
#include <QPushButton>
#include <QStandardItemModel>
#include <QTableView>
@@ -105,9 +106,15 @@ CommandPage::CommandPage()
auto *button = new QPushButton("Import commands from Chatterino 1");
this->view->addCustomButton(button);
QObject::connect(button, &QPushButton::clicked, this, [] {
QObject::connect(button, &QPushButton::clicked, this, [this] {
QFile c1settings(c1settingsPath());
c1settings.open(QIODevice::ReadOnly);
if (!c1settings.open(QIODevice::ReadOnly))
{
QMessageBox::warning(
this, "Chatterino 1 Importer",
"Failed to read settings: " + c1settings.errorString());
return;
}
for (const auto &line :
QString(c1settings.readAll())
.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts))