Ported now to Qt 6
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Syping 2020-09-28 05:33:04 +02:00
parent f9129f8364
commit 678425a7c5
17 changed files with 172 additions and 37 deletions

View file

@ -22,13 +22,17 @@
#include "StandardPaths.h"
#include <QtGlobal>
#include <QStringBuilder>
#include <QDesktopWidget>
#include <QApplication>
#include <QSettings>
#include <QScreen>
#include <QDebug>
#include <QRect>
#include <QDir>
#if QT_VERSION < 0x050000
#include <QDesktopWidget>
#endif
#include <iostream>
using namespace std;

View file

@ -62,7 +62,9 @@ void DatabaseThread::scanCrewReference(const QStringList &crewList, const int &r
QNetworkAccessManager *netManager = new QNetworkAccessManager();
QNetworkRequest netRequest(AppEnv::getCrewFetchingUrl(crewID));
#if QT_VERSION >= 0x050600
#if QT_VERSION < 0x060000
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
#endif
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
netRequest.setRawHeader("Accept", "text/html");
@ -135,7 +137,9 @@ void DatabaseThread::scanCrewMembersList(const QStringList &crewList, const int
QNetworkAccessManager *netManager = new QNetworkAccessManager();
QNetworkRequest netRequest(AppEnv::getPlayerFetchingUrl(crewID, currentPage));
#if QT_VERSION >= 0x050600
#if QT_VERSION < 0x060000
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
#endif
#endif
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
netRequest.setRawHeader("Accept", "application/json");

View file

@ -1,6 +1,6 @@
/*****************************************************************************
* gta5view Grand Theft Auto V Profile Viewer
* Copyright (C) 2016-2018 Syping
* Copyright (C) 2016-2020 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,9 +35,11 @@ QMap<QString, QString> GlobalString::getGlobalMap()
{
QMap<QString, QString> globalMap;
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
#if QT_VERSION < 0x060000
globalFile.setIniCodec("UTF-8");
#endif
globalFile.beginGroup("Global");
for (QString globalStr : globalFile.childKeys())
for (const QString &globalStr : globalFile.childKeys())
{
globalMap[globalStr] = globalFile.value(globalStr, globalStr).toString();
}
@ -49,7 +51,9 @@ QString GlobalString::getString(QString valueStr, bool *ok)
{
QString globalString = valueStr;
QSettings globalFile(getLanguageFile(), QSettings::IniFormat);
#if QT_VERSION < 0x060000
globalFile.setIniCodec("UTF-8");
#endif
globalFile.beginGroup("Global");
QStringList globalStrList = globalFile.childKeys();
if (globalStrList.contains(valueStr))

View file

@ -33,6 +33,10 @@
#include "AppEnv.h"
#include "config.h"
#if QT_VERSION < 0x060000
#include <QDesktopWidget>
#endif
#ifdef Q_OS_WIN
#if QT_VERSION >= 0x050200
#include <QtWinExtras/QtWin>
@ -41,7 +45,6 @@
#endif
#include <QStringBuilder>
#include <QDesktopWidget>
#include <QJsonDocument>
#include <QApplication>
#include <QFontMetrics>
@ -81,7 +84,11 @@
#define picPath picture->getPictureFilePath()
#define picTitl StringParser::escapeString(picture->getPictureTitle())
#define plyrsList picture->getSnapmaticProperties().playersList
#if QT_VERSION >= 0x060000
#define created QLocale().toString(picture->getSnapmaticProperties().createdDateTime, QLocale::ShortFormat)
#else
#define created picture->getSnapmaticProperties().createdDateTime.toString(Qt::DefaultLocaleShortDate)
#endif
PictureDialog::PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent) :
QDialog(parent), profileDB(profileDB), crewDB(crewDB),
@ -745,7 +752,11 @@ void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
{
if (button == Qt::LeftButton)
{
#if QT_VERSION >= 0x060000
QRect desktopRect = QApplication::screenAt(pos())->geometry();
#else
QRect desktopRect = QApplication::desktop()->screenGeometry(this);
#endif
PictureWidget *pictureWidget = new PictureWidget(this); // Work!
pictureWidget->setObjectName("PictureWidget");
#if QT_VERSION >= 0x050600

View file

@ -23,19 +23,19 @@
#include "StandardPaths.h"
#include "SidebarGenerator.h"
#include <QStringBuilder>
#include <QDesktopWidget>
#include <QApplication>
#include <QMessageBox>
#include <QFileDialog>
#include <QSettings>
#include <QRegExp>
#include <QDebug>
#if QT_VERSION < 0x050000
#include <QDesktopWidget>
#endif
#if QT_VERSION >= 0x050000
#include <QSaveFile>
#include <QScreen>
#else
#include <QDesktopWidget>
#endif
PictureExport::PictureExport()

View file

@ -19,7 +19,6 @@
#include "PictureDialog.h"
#include "PictureWidget.h"
#include "UiModLabel.h"
#include <QDesktopWidget>
#include <QApplication>
#include <QHBoxLayout>
#include <QKeyEvent>
@ -27,6 +26,10 @@
#include <QEvent>
#include <QDebug>
#if QT_VERSION < 0x060000
#include <QDesktopWidget>
#endif
PictureWidget::PictureWidget(QWidget *parent) : QDialog(parent)
{
installEventFilter(this);
@ -98,12 +101,21 @@ void PictureWidget::setImage(QImage image_)
void PictureWidget::updateWindowSize(int screenID)
{
#if QT_VERSION >= 0x060000
Q_UNUSED(screenID)
QRect desktopRect = QApplication::screenAt(pos())->geometry();
move(desktopRect.x(), desktopRect.y());
resize(desktopRect.width(), desktopRect.height());
showFullScreen();
pictureLabel->setPixmap(QPixmap::fromImage(image.scaled(desktopRect.width(), desktopRect.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation)));
#else
if (screenID == QApplication::desktop()->screenNumber(this))
{
QRect desktopRect = QApplication::desktop()->screenGeometry(this);
this->move(desktopRect.x(), desktopRect.y());
this->resize(desktopRect.width(), desktopRect.height());
this->showFullScreen();
move(desktopRect.x(), desktopRect.y());
resize(desktopRect.width(), desktopRect.height());
showFullScreen();
pictureLabel->setPixmap(QPixmap::fromImage(image.scaled(desktopRect.width(), desktopRect.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation)));
}
#endif
}

View file

@ -52,7 +52,6 @@
#include <QClipboard>
#include <QFileInfo>
#include <QPainter>
#include <QRegExp>
#include <QAction>
#include <QDebug>
#include <QColor>
@ -272,10 +271,10 @@ void ProfileInterface::insertSnapmaticIPI(QWidget *widget)
#else
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
#endif
int picIndex = pictureKeyList.indexOf(QRegExp(widgetKey));
int picIndex = pictureKeyList.indexOf(widgetKey);
ui->vlSnapmatic->insertWidget(picIndex, proWidget);
qApp->processEvents();
QApplication::processEvents();
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
}
}
@ -293,10 +292,10 @@ void ProfileInterface::insertSavegameIPI(QWidget *widget)
#else
qSort(savegameKeyList.begin(), savegameKeyList.end());
#endif
int sgdIndex = savegameKeyList.indexOf(QRegExp(widgetKey));
int sgdIndex = savegameKeyList.indexOf(widgetKey);
ui->vlSavegame->insertWidget(sgdIndex, proWidget);
qApp->processEvents();
QApplication::processEvents();
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
}
}
@ -326,7 +325,7 @@ void ProfileInterface::dialogNextPictureRequested(QWidget *dialog)
}
else
{
picIndex = pictureKeyList.indexOf(QRegExp(widgetKey));
picIndex = pictureKeyList.indexOf(widgetKey);
}
picIndex++;
if (pictureKeyList.length() > picIndex)
@ -365,7 +364,7 @@ void ProfileInterface::dialogPreviousPictureRequested(QWidget *dialog)
}
else
{
picIndex = pictureKeyList.indexOf(QRegExp(widgetKey));
picIndex = pictureKeyList.indexOf(widgetKey);
}
if (picIndex > 0)
{
@ -408,7 +407,7 @@ void ProfileInterface::sortingProfileInterface()
ui->vlSavegame->setEnabled(true);
ui->vlSnapmatic->setEnabled(true);
qApp->processEvents();
QApplication::processEvents();
}
void ProfileInterface::profileLoaded_p()
@ -772,7 +771,11 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
cEnough++;
}
spJson.createdDateTime = importDateTime;
#if QT_VERSION >= 0x060000
spJson.createdTimestamp = QString::number(spJson.createdDateTime.toSecsSinceEpoch()).toUInt();
#else
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
#endif
picture->setSnapmaticProperties(spJson);
picture->setPicFileName(QString("PGTA5%1").arg(QString::number(spJson.uid)));
picture->setPictureTitle(customImageTitle);
@ -826,7 +829,11 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
cEnough++;
}
spJson.createdDateTime = importDateTime;
#if QT_VERSION >= 0x060000
spJson.createdTimestamp = QString::number(spJson.createdDateTime.toSecsSinceEpoch()).toUInt();
#else
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
#endif
picture->setSnapmaticProperties(spJson);
picture->setPicFileName(QString("PGTA5%1").arg(QString::number(spJson.uid)));
picture->setPictureTitle(importDialog->getImageTitle());
@ -1071,7 +1078,11 @@ bool ProfileInterface::importImage(QImage *snapmaticImage, QDateTime importDateT
cEnough++;
}
spJson.createdDateTime = importDateTime;
#if QT_VERSION >= 0x060000
spJson.createdTimestamp = QString::number(spJson.createdDateTime.toSecsSinceEpoch()).toUInt();
#else
spJson.createdTimestamp = spJson.createdDateTime.toTime_t();
#endif
picture->setSnapmaticProperties(spJson);
picture->setPicFileName(QString("PGTA5%1").arg(QString::number(spJson.uid)));
picture->setPictureTitle(importDialog->getImageTitle());
@ -1115,7 +1126,11 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, bool wa
// Update Snapmatic uid
snapmaticProperties.uid = getRandomUid();
snapmaticProperties.createdDateTime = QDateTime::currentDateTime();
#if QT_VERSION >= 0x060000
snapmaticProperties.createdTimestamp = QString::number(snapmaticProperties.createdDateTime.toSecsSinceEpoch()).toUInt();
#else
snapmaticProperties.createdTimestamp = snapmaticProperties.createdDateTime.toTime_t();
#endif
bool fExists = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid));
bool fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".bak");
bool fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".hidden");
@ -1152,7 +1167,11 @@ bool ProfileInterface::importSnapmaticPicture(SnapmaticPicture *picture, bool wa
// Update Snapmatic uid
snapmaticProperties.uid = getRandomUid();
snapmaticProperties.createdDateTime = QDateTime::currentDateTime();
#if QT_VERSION >= 0x060000
snapmaticProperties.createdTimestamp = QString::number(snapmaticProperties.createdDateTime.toSecsSinceEpoch()).toUInt();
#else
snapmaticProperties.createdTimestamp = snapmaticProperties.createdDateTime.toTime_t();
#endif
bool fExists = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid));
bool fExistsBackup = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".bak");
bool fExistsHidden = QFile::exists(profileFolder % "/PGTA5" % QString::number(snapmaticProperties.uid) % ".hidden");
@ -2046,7 +2065,7 @@ void ProfileInterface::massTool(MassTool tool)
else
{
picture->emitUpdate();
qApp->processEvents();
QApplication::processEvents();
}
}
pbDialog.close();
@ -2145,7 +2164,7 @@ void ProfileInterface::massTool(MassTool tool)
else
{
picture->emitUpdate();
qApp->processEvents();
QApplication::processEvents();
}
}
pbDialog.close();
@ -2198,7 +2217,7 @@ preSelectionCrewID:
}
if (crewList.contains(QString::number(crewID)))
{
indexNum = crewList.indexOf(QRegExp(QString::number(crewID)));
indexNum = crewList.indexOf(QString::number(crewID));
}
QString newCrew = QInputDialog::getItem(this, QApplication::translate("SnapmaticEditor", "Snapmatic Crew"), QApplication::translate("SnapmaticEditor", "New Snapmatic crew:"), itemList, indexNum, true, &ok, windowFlags()^Qt::Dialog^Qt::WindowMinMaxButtonsHint);
if (ok && !newCrew.isEmpty())
@ -2276,7 +2295,7 @@ preSelectionCrewID:
else
{
picture->emitUpdate();
qApp->processEvents();
QApplication::processEvents();
}
}
pbDialog.close();
@ -2379,7 +2398,7 @@ preSelectionTitle:
else
{
picture->emitUpdate();
qApp->processEvents();
QApplication::processEvents();
}
}
pbDialog.close();

View file

@ -20,7 +20,6 @@
#include "StringParser.h"
#include "SavegameData.h"
#include <QStringBuilder>
#include <QTextCodec>
#include <QByteArray>
#include <QDebug>
#include <QFile>

View file

@ -23,7 +23,6 @@
#include "StringParser.h"
#include "AppEnv.h"
#include "config.h"
#include <QStringListIterator>
#include <QStringBuilder>
#include <QTextDocument>
#include <QInputDialog>
@ -438,7 +437,7 @@ void SnapmaticEditor::on_labCrew_linkActivated(const QString &link)
}
if (crewList.contains(QString::number(crewID)))
{
indexNum = crewList.indexOf(QRegExp(QString::number(crewID)));
indexNum = crewList.indexOf(QString::number(crewID));
}
QString newCrew = QInputDialog::getItem(this, tr("Snapmatic Crew"), tr("New Snapmatic crew:"), itemList, indexNum, true, &ok, windowFlags());
if (ok && !newCrew.isEmpty())

View file

@ -22,7 +22,6 @@
#include <QJsonObject>
#include <QStringList>
#include <QVariantMap>
#include <QTextCodec>
#include <QJsonArray>
#include <QFileInfo>
#include <QPainter>
@ -33,6 +32,10 @@
#include <QSize>
#include <QFile>
#if QT_VERSION < 0x060000
#include <QTextCodec>
#endif
#if QT_VERSION >= 0x050000
#include <QSaveFile>
#else
@ -994,7 +997,11 @@ void SnapmaticPicture::parseJsonContent()
bool timestampOk;
QDateTime createdTimestamp;
localProperties.createdTimestamp = jsonMap["creat"].toUInt(&timestampOk);
#if QT_VERSION >= 0x060000
createdTimestamp.setSecsSinceEpoch(QString::number(localProperties.createdTimestamp).toLongLong());
#else
createdTimestamp.setTime_t(localProperties.createdTimestamp);
#endif
localProperties.createdDateTime = createdTimestamp;
if (!timestampOk) { jsonError = true; }
}
@ -1418,7 +1425,12 @@ bool SnapmaticPicture::verifyTitleChar(const QChar &titleChar)
QString SnapmaticPicture::parseTitleString(const QByteArray &commitBytes, int maxLength)
{
Q_UNUSED(maxLength)
#if QT_VERSION >= 0x060000
QStringDecoder strDecoder = QStringDecoder(QStringDecoder::Utf16LE);
QString retStr = strDecoder(commitBytes);
#else
QString retStr = QTextCodec::codecForName("UTF-16LE")->toUnicode(commitBytes).trimmed();
#endif
retStr.remove(QChar('\x00'));
return retStr;
}

View file

@ -19,7 +19,6 @@
#include "StringParser.h"
#include <QTextDocument>
#include <QLibraryInfo>
#include <QTextCodec>
#include <QByteArray>
#include <QFileInfo>
#include <QString>

View file

@ -63,7 +63,11 @@ void TranslationClass::loadTranslation(QApplication *app)
{
app->installTranslator(&inQtTranslator);
}
#if QT_VERSION <= 0x060000
QLocale::setDefault(QLocale(currentLanguage));
#else
QLocale::setDefault(currentLanguage);
#endif
isLangLoaded = true;
return;
}
@ -147,7 +151,11 @@ void TranslationClass::loadTranslation(QApplication *app)
{
app->installTranslator(&inQtTranslator);
}
#if QT_VERSION <= 0x060000
QLocale::setDefault(QLocale(currentLanguage));
#else
QLocale::setDefault(currentLanguage);
#endif
isLangLoaded = true;
}
}
@ -176,7 +184,11 @@ void TranslationClass::loadTranslation(QApplication *app)
{
app->installTranslator(&inQtTranslator);
}
#if QT_VERSION <= 0x060000
QLocale::setDefault(QLocale(currentLanguage));
#else
QLocale::setDefault(currentLanguage);
#endif
isLangLoaded = true;
}
else
@ -195,7 +207,11 @@ void TranslationClass::loadTranslation(QApplication *app)
{
app->installTranslator(&inQtTranslator);
}
#if QT_VERSION <= 0x060000
QLocale::setDefault(QLocale(currentLanguage));
#else
QLocale::setDefault(currentLanguage);
#endif
isLangLoaded = true;
}
}
@ -219,7 +235,11 @@ void TranslationClass::loadTranslation(QApplication *app)
{
app->installTranslator(&inQtTranslator);
}
#if QT_VERSION <= 0x060000
QLocale::setDefault(QLocale(currentLanguage));
#else
QLocale::setDefault(currentLanguage);
#endif
isLangLoaded = true;
}
else if (!trLoadSuccess)
@ -236,7 +256,11 @@ void TranslationClass::loadTranslation(QApplication *app)
{
app->installTranslator(&inQtTranslator);
}
#if QT_VERSION <= 0x060000
QLocale::setDefault(QLocale(currentLanguage));
#else
QLocale::setDefault(currentLanguage);
#endif
isLangLoaded = true;
}
}

View file

@ -212,7 +212,10 @@ isEqual(QT_MAJOR_VERSION, 4): GTA5SYNC_RCC = $$[QT_INSTALL_BINS]/rcc
# QT5 ONLY STUFF
isEqual(QT_MAJOR_VERSION, 5): RESOURCES += res/tr_qt5.qrc
isEqual(QT_MAJOR_VERSION, 5): GTA5SYNC_RCC = $$[QT_HOST_BINS]/rcc
# QT5+ ONLY STUFF
greaterThan(QT_MAJOR_VERSION, 4): GTA5SYNC_RCC = $$[QT_HOST_BINS]/rcc
# RESOURCE COMPILATION

View file

@ -31,7 +31,6 @@
#include "IconLoader.h"
#include "AppEnv.h"
#include "config.h"
#include <QDesktopWidget>
#include <QStringBuilder>
#include <QSignalMapper>
#include <QStyleFactory>
@ -54,6 +53,10 @@
#include <QFont>
#include <QFile>
#if QT_VERSION < 0x060000
#include <QDesktopWidget>
#endif
#ifdef Q_OS_WIN
#include "windows.h"
#include <iostream>
@ -70,8 +73,10 @@
int main(int argc, char *argv[])
{
#if QT_VERSION >= 0x050600
#if QT_VERSION < 0x060000
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif
#endif
QApplication a(argc, argv);
a.setApplicationName(GTA5SYNC_APPSTR);

View file

@ -1,6 +1,6 @@
/*****************************************************************************
* gta5view Grand Theft Auto V Profile Viewer
* Copyright (C) 2017 Syping
* Copyright (C) 2017-2020 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,7 +17,6 @@
*****************************************************************************/
#include "JSHighlighter.h"
#include <QRegExp>
JSHighlighter::JSHighlighter(QTextDocument *parent) :
QSyntaxHighlighter(parent)
@ -31,34 +30,61 @@ JSHighlighter::JSHighlighter(QTextDocument *parent) :
keywordPatterns << "\\btrue\\b" << "\\bfalse\\b";
for (QString pattern : keywordPatterns)
{
#if QT_VERSION >= 0x050000
rule.pattern = QRegularExpression(pattern);
#else
rule.pattern = QRegExp(pattern);
#endif
rule.format = keywordFormat;
highlightingRules.append(rule);
}
QBrush doubleBrush(QColor::fromRgb(66, 137, 244));
doubleFormat.setForeground(doubleBrush);
#if QT_VERSION >= 0x050000
rule.pattern = QRegularExpression("[+-]?\\d*\\.?\\d+");
#else
rule.pattern = QRegExp("[+-]?\\d*\\.?\\d+");
#endif
rule.format = doubleFormat;
highlightingRules.append(rule);
QBrush quotationBrush(QColor::fromRgb(66, 244, 104));
quotationFormat.setForeground(quotationBrush);
#if QT_VERSION >= 0x050000
rule.pattern = QRegularExpression("\"[^\"]*\"");
#else
rule.pattern = QRegExp("\"[^\"]*\"");
#endif
rule.format = quotationFormat;
highlightingRules.append(rule);
QBrush objectBrush(QColor::fromRgb(255, 80, 80));
objectFormat.setForeground(objectBrush);
#if QT_VERSION >= 0x050000
rule.pattern = QRegularExpression("\"[^\"]*\"(?=:)");
#else
rule.pattern = QRegExp("\"[^\"]*\"(?=:)");
#endif
rule.format = objectFormat;
highlightingRules.append(rule);
}
void JSHighlighter::highlightBlock(const QString &text)
{
for (HighlightingRule rule : highlightingRules)
#if QT_VERSION >= 0x050000
for (const HighlightingRule &rule : qAsConst(highlightingRules))
#else
for (const HighlightingRule &rule : highlightingRules)
#endif
{
#if QT_VERSION >= 0x050000
QRegularExpressionMatchIterator matchIterator = rule.pattern.globalMatch(text);
while (matchIterator.hasNext()) {
QRegularExpressionMatch match = matchIterator.next();
setFormat(match.capturedStart(), match.capturedLength(), rule.format);
}
#else
QRegExp expression(rule.pattern);
int index = expression.indexIn(text);
while (index >= 0)
@ -67,6 +93,7 @@ void JSHighlighter::highlightBlock(const QString &text)
setFormat(index, length, rule.format);
index = expression.indexIn(text, index + length);
}
#endif
}
setCurrentBlockState(0);
}

View file

@ -1,6 +1,6 @@
/*****************************************************************************
* gta5view Grand Theft Auto V Profile Viewer
* Copyright (C) 2017 Syping
* Copyright (C) 2017-2020 Syping
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,10 +24,15 @@
#include <QTextDocument>
#include <QTextFormat>
#include <QStringList>
#include <QRegExp>
#include <QVector>
#include <QHash>
#if QT_VERSION >= 0x050000
#include <QRegularExpression>
#else
#include <QRegExp>
#endif
class QTextDocument;
class JSHighlighter : public QSyntaxHighlighter
@ -37,7 +42,11 @@ class JSHighlighter : public QSyntaxHighlighter
public:
struct HighlightingRule
{
#if QT_VERSION >= 0x050000
QRegularExpression pattern;
#else
QRegExp pattern;
#endif
QTextCharFormat format;
};
QVector<HighlightingRule> highlightingRules;

View file

@ -80,7 +80,11 @@ void UiModWidget::paintEvent(QPaintEvent *paintEvent)
{
Q_UNUSED(paintEvent)
QStyleOption opt;
#if QT_VERSION <= 0x060000
opt.initFrom(this);
#else
opt.init(this);
#endif
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}