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

View File

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

View File

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

View File

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

View File

@ -595,11 +595,7 @@ signals:
bool hasMore); bool hasMore);
void varsValueUpdated(); void varsValueUpdated();
protected: protected:
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QRecursiveMutex mCmdQueueMutex; QRecursiveMutex mCmdQueueMutex;
#else
QMutex mCmdQueueMutex;
#endif
bool mCmdRunning; 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 // Position it at the top of the next line
QPoint popupPos = mapToGlobal(displayCoordToPixels(displayXY())); QPoint popupPos = mapToGlobal(displayCoordToPixels(displayXY()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QSize desktopSize = screen()->virtualSize(); QSize desktopSize = screen()->virtualSize();
if (desktopSize.height() - popupPos.y() < mCompletionPopup->height() && popupPos.y() > mCompletionPopup->height()) if (desktopSize.height() - popupPos.y() < mCompletionPopup->height() && popupPos.y() > mCompletionPopup->height())
popupPos-=QPoint(0, mCompletionPopup->height()+2); 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() ) { if (desktopSize.width() - popupPos.x() < mCompletionPopup->width() ) {
popupPos.setX(std::max(0, desktopSize.width()-mCompletionPopup->width())-10); popupPos.setX(std::max(0, desktopSize.width()-mCompletionPopup->width())-10);
} }
#else
popupPos+=QPoint(0,textHeight()+2);
#endif
mCompletionPopup->move(popupPos); mCompletionPopup->move(popupPos);
@ -4560,13 +4556,8 @@ void Editor::cancelHoverLink()
QSize Editor::calcCompletionPopupSize() 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 screenHeight = screen()->size().height();
int screenWidth = screen()->size().width(); int screenWidth = screen()->size().width();
#endif
int popWidth = std::min(pSettings->codeCompletion().widthInColumns() * charWidth(), int popWidth = std::min(pSettings->codeCompletion().widthInColumns() * charWidth(),
screenWidth / 2) + 4; screenWidth / 2) + 4;
int popHeight = std::min(pSettings->codeCompletion().heightInLines() * textHeight(), int popHeight = std::min(pSettings->codeCompletion().heightInLines() * textHeight(),

View File

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

View File

@ -4645,12 +4645,7 @@ void MainWindow::onFilesViewCreateFile()
fileName = QString("untitled%1").arg(count)+suffix; fileName = QString("untitled%1").arg(count)+suffix;
} }
QFile file(dir.filePath(fileName)); QFile file(dir.filePath(fileName));
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
file.open(QFile::NewOnly); file.open(QFile::NewOnly);
#else
// workaround: try create but do not truncate
file.open(QFile::ReadWrite);
#endif
file.close(); file.close();
QModelIndex newIndex = mFileSystemModel.index(dir.filePath(fileName)); QModelIndex newIndex = mFileSystemModel.index(dir.filePath(fileName));
connect(&mFileSystemModel,&QFileSystemModel::directoryLoaded, connect(&mFileSystemModel,&QFileSystemModel::directoryLoaded,
@ -7716,19 +7711,11 @@ void MainWindow::doFilesViewRemoveFile(const QModelIndex &index)
+ tr("Do you really want to delete it?"), + tr("Do you really want to delete it?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes) QMessageBox::Yes | QMessageBox::No, QMessageBox::No)!=QMessageBox::Yes)
return; return;
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
if (!QFile::moveToTrash(dir.absolutePath())) if (!QFile::moveToTrash(dir.absolutePath()))
dir.removeRecursively(); dir.removeRecursively();
#else
dir.removeRecursively();
#endif
} else { } else {
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
if (!QFile::moveToTrash(mFileSystemModel.filePath(index))) if (!QFile::moveToTrash(mFileSystemModel.filePath(index)))
QFile::remove(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), CppParser::CppParser(QObject *parent) : QObject(parent),
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
mMutex() mMutex()
#else
mMutex(QMutex::Recursive)
#endif
{ {
mParserId = cppParserCount.fetchAndAddRelaxed(1); mParserId = cppParserCount.fetchAndAddRelaxed(1);
mLanguage = ParserLanguage::CPlusPlus; mLanguage = ParserLanguage::CPlusPlus;
@ -6659,12 +6655,7 @@ void CppParser::setLanguage(ParserLanguage newLanguage)
mCppTypeKeywords = CppTypeKeywords; mCppTypeKeywords = CppTypeKeywords;
#ifdef ENABLE_SDCC #ifdef ENABLE_SDCC
if (mLanguage == ParserLanguage::SDCC) { if (mLanguage == ParserLanguage::SDCC) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
mCppKeywords.insert(SDCCKeywords); mCppKeywords.insert(SDCCKeywords);
#else
for (auto &k : SDCCKeywords.keys())
mCppKeywords[k] = SDCCKeywords[k];
#endif
mCppTypeKeywords.unite(SDCCTypeKeywords); mCppTypeKeywords.unite(SDCCTypeKeywords);
} }
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -147,11 +147,7 @@ QString RTFExporter::getFormatName()
QString RTFExporter::getHeader() QString RTFExporter::getHeader()
{ {
QFontMetrics fm(mFont); QFontMetrics fm(mFont);
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
int tabWidth = mTabSize * fm.horizontalAdvance("M")*72*20/fm.fontDpi(); 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(); QString result = QString("{\\rtf1\\ansi\\deff0\\deftab%1").arg(tabWidth) + getFontTable();
// all the colors // 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("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.")); Instructions.insert("vpclmulqdq",QObject::tr("Carry-Less Multiplication Quadword, Requires PCLMULQDQ CPUID-flag."));
#endif #endif
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
InstructionNames=QSet<QString>(Instructions.keyBegin(),Instructions.keyEnd()); 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; return false;
QTextStream stream(&file); QTextStream stream(&file);
for (const QString& s:list) { for (const QString& s:list) {
stream<<s stream<<s<<Qt::endl;
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
<<Qt::endl;
#else
<<endl;
#endif
} }
return true; return true;
} }

View File

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