Skip to content

Commit

Permalink
Qt6 Compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Qu committed Dec 6, 2024
1 parent 77189c0 commit 43c4553
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
14 changes: 8 additions & 6 deletions RedPandaIDE/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,14 @@ MainWindow::MainWindow(QWidget *parent)
{
ui->setupUi(this);

/** Qt 6.8.0 fix: Crash when debug **/
QFont font(pSettings->environment().interfaceFont());
font.setPixelSize(pointToPixel(pSettings->environment().interfaceFontSize()));
font.setStyleStrategy(QFont::PreferAntialias);
qApp->setFont(font);
this->setFont(font);
/** Msys2 MinGW 64 Qt 6.8.0 fix: Crash when debug **/
#if defined(QT_DEBUG) && defined(Q_OS_WINDOWS) && QT_VERSION_MAJOR == 6
QFont font(pSettings->environment().interfaceFont());
font.setPixelSize(pointToPixel(pSettings->environment().interfaceFontSize()));
font.setStyleStrategy(QFont::PreferAntialias);
qApp->setFont(font);
this->setFont(font);
#endif
/** **/

ui->cbProblemCaseValidateType->blockSignals(true);
Expand Down
26 changes: 13 additions & 13 deletions RedPandaIDE/problems/freeprojectsetformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,40 @@ QList<POJProblem> importFreeProblemSet(const QString &filename)
switch (xml.tokenType()) {
case QXmlStreamReader::TokenType::StartElement:
currentEleName = xml.name().toString();
if (xml.name()=="item") {
if (xml.name() == QLatin1String("item")) {
currentProblem=std::make_shared<OJProblem>();
} else if (currentProblem &&
(xml.name()=="test_input")) {
(xml.name() == QLatin1String("test_input"))) {
currentCase = std::make_shared<OJProblemCase>();
foreach (const QXmlStreamAttribute& attr, xml.attributes()) {
if (attr.name() == "name") {
if (attr.name() == QLatin1String("name")) {
currentCase->name = attr.value().toString().trimmed();
break;
}
}
currentCase->name = QObject::tr("Problem Case %1").arg(currentProblem->cases.count()+1);
} else if (currentProblem &&
xml.name()=="time_limit") {
xml.name()==QLatin1String("time_limit")) {
currentEleName = xml.name().toString();
foreach (const QXmlStreamAttribute& attr, xml.attributes()) {
if (attr.name() == "unit") {
if (attr.value()=="ms")
if (attr.name() == QLatin1String("unit")) {
if (attr.value()==QLatin1String("ms"))
currentProblem->timeLimitUnit = ProblemTimeLimitUnit::Milliseconds;
else if (attr.value()=="s")
else if (attr.value()==QLatin1String("s"))
currentProblem->timeLimitUnit = ProblemTimeLimitUnit::Seconds;
break;
}
}
} else if (currentProblem &&
xml.name()=="memory_limit") {
xml.name()==QLatin1String("memory_limit")) {
currentEleName = xml.name().toString();
foreach (const QXmlStreamAttribute& attr, xml.attributes()) {
if (attr.name() == "unit") {
if (attr.value()=="mb")
if (attr.name() == QLatin1String("unit")) {
if (attr.value()==QLatin1String("mb"))
currentProblem->memoryLimitUnit = ProblemMemoryLimitUnit::MB;
else if (attr.value()=="kb")
else if (attr.value()==QLatin1String("kb"))
currentProblem->memoryLimitUnit = ProblemMemoryLimitUnit::KB;
else if (attr.value()=="gb")
else if (attr.value()==QLatin1String("gb"))
currentProblem->memoryLimitUnit = ProblemMemoryLimitUnit::GB;
break;
}
Expand All @@ -63,7 +63,7 @@ QList<POJProblem> importFreeProblemSet(const QString &filename)
break;
case QXmlStreamReader::TokenType::EndElement:
currentEleName.clear();
if (currentProblem && xml.name()=="item") {
if (currentProblem && xml.name()==QLatin1String("item")) {
problems.append(currentProblem);
currentProblem.reset();
}
Expand Down
2 changes: 1 addition & 1 deletion libs/redpanda_qt_utils/qt_utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ QString extractRelativePath(const QString &base, const QString &dest)

QString localizePath(const QString &path)
{
if (QDir::separator() == "/")
if (QDir::separator() == '/')
return path;
QString result = path;
result.replace("/",QDir::separator());
Expand Down

0 comments on commit 43c4553

Please sign in to comment.