remove pre-Qt 5.15 stuff (#405)

This commit is contained in:
Cyano Hao 2024-04-28 16:46:01 +08:00 committed by GitHub
parent 85384f6809
commit 8b80e2a77d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
30 changed files with 26 additions and 266 deletions

View File

@ -1,7 +1,6 @@
QT += core gui printsupport network svg xml widgets
# without `c++14` old versions of qmake will explicitly set `-std=gnu++98`
CONFIG += c++14 c++17
CONFIG += c++17
CONFIG += nokey
# uncomment the following line to enable vcs (git) support

View File

@ -37,15 +37,9 @@
#endif
CompilerManager::CompilerManager(QObject *parent) : QObject(parent),
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
mCompileMutex(),
mBackgroundSyntaxCheckMutex(),
mRunnerMutex()
#else
mCompileMutex(QMutex::Recursive),
mBackgroundSyntaxCheckMutex(QMutex::Recursive),
mRunnerMutex(QMutex::Recursive)
#endif
{
mCompiler = nullptr;
mBackgroundSyntaxChecker = nullptr;

View File

@ -104,15 +104,9 @@ private:
Compiler* mBackgroundSyntaxChecker;
Runner* mRunner;
PNonExclusiveTemporaryFileOwner mTempFileOwner;
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QRecursiveMutex mCompileMutex;
QRecursiveMutex mBackgroundSyntaxCheckMutex;
QRecursiveMutex mRunnerMutex;
#else
QMutex mCompileMutex;
QMutex mBackgroundSyntaxCheckMutex;
QMutex mRunnerMutex;
#endif
};
class CompileError : public BaseError {

View File

@ -1108,11 +1108,7 @@ bool Debugger::executing() const
}
DebuggerClient::DebuggerClient(Debugger* debugger, QObject *parent) : QThread(parent),
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
mCmdQueueMutex(),
#else
mCmdQueueMutex(QMutex::Recursive),
#endif
mStartSemaphore(0)
{
mDebugger = debugger;
@ -2469,11 +2465,7 @@ void MemoryModel::updateMemory(const QStringList &value)
QList<PMemoryLine> newModel;
for (int i=0;i<value.length();i++) {
QString line = value[i].trimmed();
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QStringList dataLst = line.split(delimiter,Qt::SkipEmptyParts);
#else
QStringList dataLst = line.split(delimiter,QString::SkipEmptyParts);
#endif
PMemoryLine memoryLine = std::make_shared<MemoryLine>();
memoryLine->startAddress = -1;
if (dataLst.length()>0) {

View File

@ -595,11 +595,7 @@ signals:
bool hasMore);
void varsValueUpdated();
protected:
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QRecursiveMutex mCmdQueueMutex;
#else
QMutex mCmdQueueMutex;
#endif
bool mCmdRunning;

View File

@ -3564,7 +3564,6 @@ void Editor::showCompletion(const QString& preWord,bool autoComplete, CodeComple
// Position it at the top of the next line
QPoint popupPos = mapToGlobal(displayCoordToPixels(displayXY()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QSize desktopSize = screen()->virtualSize();
if (desktopSize.height() - popupPos.y() < mCompletionPopup->height() && popupPos.y() > mCompletionPopup->height())
popupPos-=QPoint(0, mCompletionPopup->height()+2);
@ -3574,9 +3573,6 @@ void Editor::showCompletion(const QString& preWord,bool autoComplete, CodeComple
if (desktopSize.width() - popupPos.x() < mCompletionPopup->width() ) {
popupPos.setX(std::max(0, desktopSize.width()-mCompletionPopup->width())-10);
}
#else
popupPos+=QPoint(0,textHeight()+2);
#endif
mCompletionPopup->move(popupPos);
@ -4560,13 +4556,8 @@ void Editor::cancelHoverLink()
QSize Editor::calcCompletionPopupSize()
{
#if QT_VERSION_MAJOR==5 && QT_VERSION_MINOR < 15
int screenHeight = qApp->primaryScreen()->size().height();
int screenWidth = qApp->primaryScreen()->size().width();
#else
int screenHeight = screen()->size().height();
int screenWidth = screen()->size().width();
#endif
int popWidth = std::min(pSettings->codeCompletion().widthInColumns() * charWidth(),
screenWidth / 2) + 4;
int popHeight = std::min(pSettings->codeCompletion().heightInLines() * textHeight(),

View File

@ -413,12 +413,8 @@ int main(int argc, char *argv[])
MainWindow mainWindow;
pMainWindow = &mainWindow;
#if QT_VERSION_MAJOR==5 && QT_VERSION_MINOR < 15
setScreenDPI(qApp->primaryScreen()->logicalDotsPerInch());
#else
if (mainWindow.screen())
setScreenDPI(mainWindow.screen()->logicalDotsPerInch());
#endif
mainWindow.show();
if (app.arguments().count()>1) {
QStringList filesToOpen = app.arguments();

View File

@ -4645,12 +4645,7 @@ void MainWindow::onFilesViewCreateFile()
fileName = QString("untitled%1").arg(count)+suffix;
}
QFile file(dir.filePath(fileName));
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
file.open(QFile::NewOnly);
#else
// workaround: try create but do not truncate
file.open(QFile::ReadWrite);
#endif
file.close();
QModelIndex newIndex = mFileSystemModel.index(dir.filePath(fileName));
connect(&mFileSystemModel,&QFileSystemModel::directoryLoaded,
@ -7716,19 +7711,11 @@ void MainWindow::doFilesViewRemoveFile(const QModelIndex &index)
+ tr("Do you really want to delete it?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes)
return;
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
if (!QFile::moveToTrash(dir.absolutePath()))
dir.removeRecursively();
#else
dir.removeRecursively();
#endif
} else {
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
if (!QFile::moveToTrash(mFileSystemModel.filePath(index)))
QFile::remove(mFileSystemModel.filePath(index));
#else
QFile::remove(mFileSystemModel.filePath(index));
#endif
}
}

View File

@ -39,11 +39,7 @@ static QString calcFullname(const QString& parentName, const QString& name) {
}
CppParser::CppParser(QObject *parent) : QObject(parent),
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
mMutex()
#else
mMutex(QMutex::Recursive)
#endif
{
mParserId = cppParserCount.fetchAndAddRelaxed(1);
mLanguage = ParserLanguage::CPlusPlus;
@ -6659,12 +6655,7 @@ void CppParser::setLanguage(ParserLanguage newLanguage)
mCppTypeKeywords = CppTypeKeywords;
#ifdef ENABLE_SDCC
if (mLanguage == ParserLanguage::SDCC) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
mCppKeywords.insert(SDCCKeywords);
#else
for (auto &k : SDCCKeywords.keys())
mCppKeywords[k] = SDCCKeywords[k];
#endif
mCppTypeKeywords.unite(SDCCTypeKeywords);
}
#endif

View File

@ -729,11 +729,7 @@ private:
#ifdef QT_DEBUG
int mLastIndex;
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QRecursiveMutex mMutex;
#else
QMutex mMutex;
#endif
QMap<QString,KeywordType> mCppKeywords;
QSet<QString> mCppTypeKeywords;
};

View File

@ -195,12 +195,7 @@ void CppPreprocessor::dumpDefinesTo(const QString &fileName) const
for (const PDefine& define:mDefines) {
stream<<QString("%1 %2 %3 %4 %5\n")
.arg(define->name,define->args,define->value)
.arg(define->hardCoded).arg(define->formatValue)
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
<<Qt::endl;
#else
<<endl;
#endif
.arg(define->hardCoded).arg(define->formatValue)<<Qt::endl;
}
}
}
@ -211,25 +206,10 @@ void CppPreprocessor::dumpIncludesListTo(const QString &fileName) const
if (file.open(QIODevice::WriteOnly|QIODevice::Truncate)) {
QTextStream stream(&file);
for (const PParsedFileInfo& fileInfo:mFileInfos) {
stream<<fileInfo->fileName()<<" : "
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
<<Qt::endl;
#else
<<endl;
#endif
stream<<"\t**includes:**"
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
<<Qt::endl;
#else
<<endl;
#endif
stream<<fileInfo->fileName()<<" : "<<Qt::endl;
stream<<"\t**includes:**"<<Qt::endl;
foreach (const QString& s,fileInfo->includes()) {
stream<<"\t--"+s
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
<<Qt::endl;
#else
<<endl;
#endif
stream<<"\t--"+s<<Qt::endl;
}
}
}

View File

@ -83,12 +83,7 @@ void CppTokenizer::dumpTokens(const QString &fileName)
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
QTextStream stream(&file);
foreach (const PToken& token,mTokenList) {
stream<<QString("%1,%2,%3").arg(token->line).arg(token->text).arg(token->matchIndex)
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
<<Qt::endl;
#else
<<endl;
#endif
stream<<QString("%1,%2,%3").arg(token->line).arg(token->text).arg(token->matchIndex)<<Qt::endl;
}
}
}

View File

@ -84,12 +84,7 @@ void StatementModel::dumpAll(const QString &logFile)
.arg(statement->fileName)
.arg(statement->line)
.arg(statement->definitionFileName)
.arg(statement->definitionLine)<<
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::endl;
#else
endl;
#endif
.arg(statement->definitionLine)<<Qt::endl;
}
}
}
@ -130,27 +125,12 @@ void StatementModel::dumpStatementMap(StatementMap &map, QTextStream &out, int l
.arg(statement->line)
.arg(statement->definitionFileName)
.arg(statement->definitionLine);
out
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
<<Qt::endl;
#else
<<endl;
#endif
out<<Qt::endl;
if (statement->children.isEmpty())
continue;
out<<indent<<statement->command<<" {"
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
<<Qt::endl;
#else
<<endl;
#endif
out<<indent<<statement->command<<" {"<<Qt::endl;
dumpStatementMap(statement->children,out,level+1);
out<<indent<<"}"
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
<<Qt::endl;
#else
<<endl;
#endif
out<<indent<<"}"<<Qt::endl;
}
}

View File

@ -538,12 +538,8 @@ bool Project::internalRemoveUnit(PProjectUnit& unit, bool doClose , bool removeF
}
if (removeFile) {
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
if (!QFile::moveToTrash(unit->fileName()))
QFile::remove(unit->fileName());
#else
QFile::remove(unit->fileName());
#endif
}
//if not fUnits.GetItem(index).fNew then
@ -1635,13 +1631,7 @@ void Project::checkProjectFileForUpdate(SimpleIni &ini)
if (!oldRes.isEmpty()) {
QFile::copy(mFilename,mFilename+".bak");
QStringList sl;
sl = oldRes.split(';',
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::SkipEmptyParts
#else
QString::SkipEmptyParts
#endif
);
sl = oldRes.split(';', Qt::SkipEmptyParts);
for (int i=0;i<sl.count();i++){
const QString& s = sl[i];
QByteArray groupName = toByteArray(QString("Unit%1").arg(uCount+i));
@ -1992,42 +1982,12 @@ void Project::loadOptions(SimpleIni& ini)
mOptions.cppCompilerCmd = fromByteArray(ini.GetValue("Project", "CppCompiler", "")).replace(";CONFIG_LINE;","\n");
mOptions.linkerCmd = fromByteArray(ini.GetValue("Project", "Linker", "")).replace(";CONFIG_LINE;","\n");
mOptions.resourceCmd = fromByteArray(ini.GetValue("Project", "ResourceCommand", "")).replace(";CONFIG_LINE;","\n");
mOptions.binDirs = absolutePaths(fromByteArray(ini.GetValue("Project", "Bins", "")).split(";",
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::SkipEmptyParts
#else
QString::SkipEmptyParts
#endif
));
mOptions.libDirs = absolutePaths(fromByteArray(ini.GetValue("Project", "Libs", "")).split(";",
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::SkipEmptyParts
#else
QString::SkipEmptyParts
#endif
));
mOptions.includeDirs = absolutePaths(fromByteArray(ini.GetValue("Project", "Includes", "")).split(";",
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::SkipEmptyParts
#else
QString::SkipEmptyParts
#endif
));
mOptions.binDirs = absolutePaths(fromByteArray(ini.GetValue("Project", "Bins", "")).split(";", Qt::SkipEmptyParts));
mOptions.libDirs = absolutePaths(fromByteArray(ini.GetValue("Project", "Libs", "")).split(";", Qt::SkipEmptyParts));
mOptions.includeDirs = absolutePaths(fromByteArray(ini.GetValue("Project", "Includes", "")).split(";", Qt::SkipEmptyParts));
mOptions.privateResource = fromByteArray(ini.GetValue("Project", "PrivateResource", ""));
mOptions.resourceIncludes = absolutePaths(fromByteArray(ini.GetValue("Project", "ResourceIncludes", "")).split(";",
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::SkipEmptyParts
#else
QString::SkipEmptyParts
#endif
));
mOptions.makeIncludes = absolutePaths(fromByteArray(ini.GetValue("Project", "MakeIncludes", "")).split(";",
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::SkipEmptyParts
#else
QString::SkipEmptyParts
#endif
));
mOptions.resourceIncludes = absolutePaths(fromByteArray(ini.GetValue("Project", "ResourceIncludes", "")).split(";", Qt::SkipEmptyParts));
mOptions.makeIncludes = absolutePaths(fromByteArray(ini.GetValue("Project", "MakeIncludes", "")).split(";", Qt::SkipEmptyParts));
mOptions.isCpp = ini.GetBoolValue("Project", "IsCpp", false);
mOptions.folderForOutput = generateAbsolutePath(directory(), fromByteArray(ini.GetValue("Project", "ExeOutput", "")));
mOptions.folderForObjFiles = generateAbsolutePath(directory(), fromByteArray(ini.GetValue("Project", "ObjectOutput", "")));
@ -2041,13 +2001,7 @@ void Project::loadOptions(SimpleIni& ini)
mOptions.usePrecompiledHeader = ini.GetBoolValue("Project", "UsePrecompiledHeader", false);
mOptions.precompiledHeader = generateAbsolutePath(directory(),fromByteArray(ini.GetValue("Project", "PrecompiledHeader", "")));
mOptions.cmdLineArgs = fromByteArray(ini.GetValue("Project", "CommandLine", ""));
mFolders = fromByteArray(ini.GetValue("Project", "Folders", "")).split(";",
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::SkipEmptyParts
#else
QString::SkipEmptyParts
#endif
);
mFolders = fromByteArray(ini.GetValue("Project", "Folders", "")).split(";", Qt::SkipEmptyParts);
mOptions.includeVersionInfo = ini.GetBoolValue("Project", "IncludeVersionInfo", false);
mOptions.supportXPThemes = ini.GetBoolValue("Project", "SupportXPThemes", false);
mOptions.compilerSet = ini.GetLongValue("Project", "CompilerSet", pSettings->compilerSets().defaultIndex());

View File

@ -115,36 +115,12 @@ void ProjectTemplate::readTemplateFile(const QString &fileName)
mOptions.icon = mIni->GetValue("Project", "Icon", "");
mOptions.type = static_cast<ProjectType>(mIni->GetLongValue("Project", "Type", 0)); // default = gui
mOptions.includeDirs = fromByteArray(mIni->GetValue("Project", "Includes", "")).split(";",
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::SkipEmptyParts
#else
QString::SkipEmptyParts
#endif
);
mOptions.binDirs = fromByteArray(mIni->GetValue("Project", "Bins", "")).split(";",
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::SkipEmptyParts
#else
QString::SkipEmptyParts
#endif
);
mOptions.includeDirs = fromByteArray(mIni->GetValue("Project", "Includes", "")).split(";", Qt::SkipEmptyParts);
mOptions.binDirs = fromByteArray(mIni->GetValue("Project", "Bins", "")).split(";", Qt::SkipEmptyParts);
mOptions.libDirs = fromByteArray(mIni->GetValue("Project", "Libs", "")).split(";",
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::SkipEmptyParts
#else
QString::SkipEmptyParts
#endif
);
mOptions.libDirs = fromByteArray(mIni->GetValue("Project", "Libs", "")).split(";", Qt::SkipEmptyParts);
mOptions.resourceIncludes = fromByteArray(mIni->GetValue("Project", "ResourceIncludes", "")).split(";",
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::SkipEmptyParts
#else
QString::SkipEmptyParts
#endif
);
mOptions.resourceIncludes = fromByteArray(mIni->GetValue("Project", "ResourceIncludes", "")).split(";", Qt::SkipEmptyParts);
mOptions.compilerCmd = fromByteArray(mIni->GetValue("Project", "Compiler", ""));
mOptions.cppCompilerCmd = fromByteArray(mIni->GetValue("Project", "CppCompiler", ""));
mOptions.linkerCmd = fromByteArray(mIni->GetValue("Project", "Linker",""));

View File

@ -147,12 +147,7 @@ void ProjectGeneralWidget::doSave()
project->options().isCpp = ui->cbDefaultCpp->isChecked();
project->options().supportXPThemes = ui->cbSupportXPTheme->isChecked();
if (mIconPath.isEmpty()
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|| ui->lbIcon->pixmap(Qt::ReturnByValue).isNull()) {
#else
|| !ui->lbIcon->pixmap() || ui->lbIcon->pixmap()->isNull()) {
#endif
if (mIconPath.isEmpty() || ui->lbIcon->pixmap(Qt::ReturnByValue).isNull()) {
project->options().icon = "";
} else {
QString iconPath = generateAbsolutePath(project->directory(),"app.ico");
@ -168,11 +163,7 @@ void ProjectGeneralWidget::doSave()
}
}
if (!mIconPath.endsWith(".ico",PATH_SENSITIVITY) && QImageWriter::supportedImageFormats().contains("ico")) {
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
ui->lbIcon->pixmap(Qt::ReturnByValue).save(iconPath,"ico");
#else
ui->lbIcon->pixmap()->save(iconPath,"ico");
#endif
} else
copyFile(mIconPath, iconPath,true);
}

View File

@ -24,11 +24,7 @@
static QRegularExpression todoReg("\\b(todo|fixme)\\b", QRegularExpression::CaseInsensitiveOption);
TodoParser::TodoParser(QObject *parent) : QObject(parent),
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
mMutex()
#else
mMutex(QMutex::Recursive)
#endif
{
mThread = nullptr;
}

View File

@ -100,11 +100,7 @@ public:
private:
TodoThread* mThread;
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QRecursiveMutex mMutex;
#else
QMutex mMutex;
#endif
};
using PTodoParser = std::shared_ptr<TodoParser>;

View File

@ -26,11 +26,7 @@
#include "../iconsmanager.h"
ClassBrowserModel::ClassBrowserModel(QObject *parent):QAbstractItemModel(parent),
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
mMutex()
#else
mMutex(QMutex::Recursive)
#endif
{
mClassBrowserType = ProjectClassBrowserType::CurrentFile;
mRoot = new ClassBrowserNode();

View File

@ -86,11 +86,7 @@ private:
PCppParser mParser;
bool mUpdating;
int mUpdateCount;
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QRecursiveMutex mMutex;
#else
QMutex mMutex;
#endif
QString mCurrentFile;
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
ProjectClassBrowserType mClassBrowserType;

View File

@ -32,11 +32,7 @@
CodeCompletionPopup::CodeCompletionPopup(QWidget *parent) :
QWidget(parent),
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
mMutex()
#else
mMutex(QMutex::Recursive)
#endif
{
setWindowFlags(Qt::Popup);
mListView = new CodeCompletionListView(this);

View File

@ -183,11 +183,7 @@ private:
QSet<QString> mAddedStatements;
QString mMemberPhrase;
QString mMemberOperator;
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QRecursiveMutex mMutex;
#else
QMutex mMutex;
#endif
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
CodeCompletionListItemDelegate* mDelegate;

View File

@ -31,9 +31,7 @@ NewProjectDialog::NewProjectDialog(QWidget *parent) :
{
setWindowFlag(Qt::WindowContextHelpButtonHint,false);
ui->setupUi(this);
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
ui->lstTemplates->setItemAlignment(Qt::AlignCenter);
#endif
mTemplatesTabBar = new QTabBar(this);
mTemplatesTabBar->setExpanding(false);
ui->verticalLayout->insertWidget(0,mTemplatesTabBar);

View File

@ -2,8 +2,7 @@ TEMPLATE = lib
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
# without `c++14` old versions of qmake will explicitly set `-std=gnu++98`
CONFIG += c++14 c++17
CONFIG += c++17
CONFIG += nokey
CONFIG += staticlib
contains(QMAKE_HOST.arch, x86_64):{

View File

@ -36,11 +36,7 @@ Document::Document(const QFont& font, QObject *parent):
mForceMonospace{false},
mSetLineWidthLockCount{0},
mMaxLineChangedInSetLinesWidth{false},
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
mMutex{}
#else
mMutex{QMutex::Recursive}
#endif
{
mAppendNewLineAtEOF = true;
mNewlineType = NewlineType::Windows;

View File

@ -621,11 +621,7 @@ private:
int mSetLineWidthLockCount;
bool mMaxLineChangedInSetLinesWidth;
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QRecursiveMutex mMutex;
#else
QMutex mMutex;
#endif
friend class QSynEditPainter;
};

View File

@ -147,11 +147,7 @@ QString RTFExporter::getFormatName()
QString RTFExporter::getHeader()
{
QFontMetrics fm(mFont);
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
int tabWidth = mTabSize * fm.horizontalAdvance("M")*72*20/fm.fontDpi();
#else
int tabWidth = mTabSize * fm.horizontalAdvance("M")*72*20/96;
#endif
QString result = QString("{\\rtf1\\ansi\\deff0\\deftab%1").arg(tabWidth) + getFontTable();
// all the colors

View File

@ -1565,14 +1565,7 @@ void ASMSyntaxer::initData()
Instructions.insert("vxorps",QObject::tr("Bitwise Logical XOR for Single-Precision Floating-Point Values."));
Instructions.insert("vpclmulqdq",QObject::tr("Carry-Less Multiplication Quadword, Requires PCLMULQDQ CPUID-flag."));
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
InstructionNames=QSet<QString>(Instructions.keyBegin(),Instructions.keyEnd());
#else
InstructionNames.clear();
foreach(const QString& s,Instructions.keys()) {
InstructionNames.insert(s);
}
#endif
}
}

View File

@ -400,12 +400,7 @@ bool stringsToFile(const QStringList &list, const QString &fileName)
return false;
QTextStream stream(&file);
for (const QString& s:list) {
stream<<s
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
<<Qt::endl;
#else
<<endl;
#endif
stream<<s<<Qt::endl;
}
return true;
}

View File

@ -3,8 +3,7 @@ QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
# without `c++14` old versions of qmake will explicitly set `-std=gnu++98`
CONFIG += c++14 c++17
CONFIG += c++17
CONFIG += nokey
CONFIG += staticlib