qt5/6: 完成对构建 Notepad-- 的 Qt6 转化处理

This commit is contained in:
zinface 2023-02-28 02:18:55 +08:00
parent 72c7a78d24
commit ac7263ca71
15 changed files with 171 additions and 36 deletions

View File

@ -27,6 +27,7 @@ if(TRUE)
# target_link_libraries(${PROJECT_NAME} QSci)
target_link_QSci(${PROJECT_NAME})
if(USE_QT6)
target_link_qt6_Core5Compat(${PROJECT_NAME}) # : Qt6 使 Core5Compat Qt5
target_link_qt6_PrintSupport(${PROJECT_NAME})
# target_link_qt6_XmlPatterns(${PROJECT_NAME}) # Bug
else()

View File

@ -10,6 +10,7 @@
#include <functional>
#include <QDataStream>
#include <QtConcurrent>
#include <QRegExp>
CmpareMode::CmpareMode()
@ -281,7 +282,11 @@ quint32 CmpareMode::readLineFromFileWithUnicodeLe(uchar* m_fileFpr, const int fi
else if (mode == 2)
{
QString temp = lineInfo.unicodeStr;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
md4.addData(temp.replace(QRegExp("\\s"), QString("")).toUtf8());
#else
md4.addData(temp.replace(QRegularExpression("\\s"), QString("")).toUtf8());
#endif
}
};
@ -529,7 +534,11 @@ CODE_ID CmpareMode::readLineFromFile(uchar* m_fileFpr, const int fileLength, con
else if (mode == 2)
{
QString temp = lineInfo.unicodeStr;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
md4.addData(temp.replace(QRegExp("\\s"), QString("")).toUtf8());
#else
md4.addData(temp.replace(QRegularExpression("\\s"), QString("")).toUtf8());
#endif
}
};

View File

@ -6,6 +6,7 @@
#include <QTableWidgetItem>
#include <QFileDialog>
#include <QRegExp>
BatchFindReplace::BatchFindReplace(QWidget *parent)
: QMainWindow(parent), m_curEditWin(nullptr), m_editTabWidget(nullptr)
@ -98,7 +99,11 @@ void BatchFindReplace::appendToFindReplaceTable(QStringList& findKeyword)
bool BatchFindReplace::tranInputKeyword(QString& findKeyWord, QStringList& outputKeyWordList)
{
//把空白字符,空格或者\t \r\n 等字符进行替换为空格
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QRegExp re("\\s");
#else
QRegularExpression re("\\s");
#endif
findKeyWord.replace(re, QString(" "));
//再进行空格分隔处理
@ -266,7 +271,9 @@ void BatchFindReplace::on_export()
if (!fileName.isEmpty())
{
QSettings setting(fileName, QSettings::IniFormat);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
setting.setIniCodec("UTF-8");
#endif
int rowNums = ui.findReplaceTable->rowCount();
@ -312,7 +319,9 @@ void BatchFindReplace::on_import()
QFileInfo fi(fileNameList[0]);
QSettings setting(fi.filePath(), QSettings::IniFormat);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
setting.setIniCodec("UTF-8");
#endif
ui.findKeywordEdit->setPlainText(setting.value("find").toStringList().join(" "));
ui.replaceKeywordEdit->setPlainText(setting.value("replace").toStringList().join(" "));

View File

@ -535,7 +535,9 @@ void initFileTypeLangMap()
//把新语言tagName,和关联ext单独存放起来ext_tag.ini。只读取一个文件就能获取所有避免遍历慢
QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag是存在所有tag ext的文件
QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
QStringList keys = qs.allKeys();
//LangType lexId = L_USER_TXT;
@ -4730,7 +4732,11 @@ void CCNotePad::initFileListDockWin()
}
});
m_dockFileListWin->setAttribute(Qt::WA_DeleteOnClose);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
m_dockFileListWin->layout()->setMargin(0);
#else
m_dockFileListWin->layout()->setContentsMargins(0, 0, 0, 0);
#endif
m_dockFileListWin->layout()->setSpacing(0);
//暂时不提供关闭因为关闭后需要同步菜单的check状态
@ -5150,7 +5156,11 @@ void CCNotePad::saveTabEdit(int tabIndex)
if (pEdit != nullptr)
{
//如果是新建的文件,则弹出保存对话框,进行保存
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (pEdit->property(Edit_File_New) >= 0)
#else
if (pEdit->property(Edit_File_New).toString().length() >= 0)
#endif
{
QString filter("Text files (*.txt);;XML files (*.xml);;h files (*.h);;cpp file(*.cpp);;All types(*.*)");
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), QString(), filter);
@ -5317,7 +5327,11 @@ void CCNotePad::slot_actionSaveAsFile_toggle(bool /*checked*/)
if (pEdit != nullptr)
{
//如果是新建的文件,则弹出保存对话框,进行保存
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (pEdit->property(Edit_File_New) >= 0)
#else
if (pEdit->property(Edit_File_New).toString().length() >= 0)
#endif
{
QString filter("Text files (*.txt);;XML files (*.xml);;h files (*.h);;cpp file(*.cpp);;All types(*.*)");
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File As ..."),QString(), filter);
@ -5619,7 +5633,11 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs)
//把文件记录到qs中去
//index一定不能重复。n表示新建
//如果是新建的文件
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (pEdit->property(Edit_File_New) >= 0)
#else
if (pEdit->property(Edit_File_New).toString().length() >= 0)
#endif
{
//不再保存新建的非脏文件。因为一定是空的,意义不大
//qs.setValue(QString("%1").arg(index), QString("%1|1").arg(fileName));
@ -5639,7 +5657,11 @@ void CCNotePad::saveTempFile(ScintillaEditView* pEdit,int index, QSettings& qs)
}
//如果是新建的文件
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (pEdit->property(Edit_File_New) >= 0)
#else
if (pEdit->property(Edit_File_New).toString().length() >= 0)
#endif
{
QString qsSavePath = qs.fileName();
@ -5771,7 +5793,9 @@ void CCNotePad::closeAllFileStatic()
{
QString tempFileList = QString("notepad/temp/list");
QSettings qs(QSettings::IniFormat, QSettings::UserScope, tempFileList);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
QString qsSavePath = qs.fileName();
QFileInfo fi(qsSavePath);
QDir saveDir = fi.dir();
@ -6312,7 +6336,9 @@ int CCNotePad::initFindWindow(FindTabIndex type)
//从历史查找记录文件中加载
QString searchHistory = QString("notepad/searchHistory");//历史查找记录
QSettings qs(QSettings::IniFormat, QSettings::UserScope, searchHistory);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
if (qs.contains("keys"))
{
@ -6412,7 +6438,9 @@ void CCNotePad::slot_saveSearchHistory()
//从历史查找记录文件中加载
QString searchHistory = QString("notepad/searchHistory");//历史查找记录
QSettings qs(QSettings::IniFormat, QSettings::UserScope, searchHistory);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
if (s_findHistroy.count() > 15)
{
@ -6639,7 +6667,11 @@ void CCNotePad::initFindResultDockWin()
m_dockSelectTreeWin = new QDockWidget(tr("Find result"), this);
connect(m_dockSelectTreeWin, &QDockWidget::dockLocationChanged, this, &CCNotePad::slot_findResultPosChangeed);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
m_dockSelectTreeWin->layout()->setMargin(0);
#else
m_dockSelectTreeWin->layout()->setContentsMargins(0, 0, 0, 0);
#endif
m_dockSelectTreeWin->layout()->setSpacing(0);
//暂时不提供关闭因为关闭后需要同步菜单的check状态
@ -8111,7 +8143,9 @@ int CCNotePad::restoreLastFiles()
QString tempFileList = QString("notepad/temp/list");
QSettings qs(QSettings::IniFormat, QSettings::UserScope, tempFileList);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
QStringList fileList = qs.allKeys();
//从小到大排序一下。这里是按照ASCII排序不得行。

View File

@ -1,4 +1,5 @@
#include "draglineedit.h"
#include <QFile>
DragLineEdit::DragLineEdit(QWidget *parent)
: QLineEdit(parent)

View File

@ -11,6 +11,7 @@
#include <QtConcurrent>
#include <QInputDialog>
#include <QDragEnterEvent>
#include <QTextCodec>
const int ITEM_CODE = Qt::UserRole + 1;

View File

@ -208,12 +208,20 @@ void FindResultWin::slot_selectAll()
//遍历下面的子节点
int i = 0;
QModelIndex childMi;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
childMi = sectionItem.child(i, 0);
#else
childMi = sectionItem.model()->index(i, 0);
#endif
while (childMi.isValid())
{
++i;
ui.resultTreeView->selectionModel()->select(childMi, QItemSelectionModel::Select);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
childMi = sectionItem.child(i, 0);
#else
childMi = sectionItem.model()->index(i, 0);
#endif
}
return i+1;
};
@ -226,12 +234,20 @@ void FindResultWin::slot_selectAll()
//遍历根节点下面每一个section
{
int i = 0;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QModelIndex section = rootItem.child(i, 0);
#else
QModelIndex section = rootItem.model()->index(i, 0);
#endif
while (section.isValid() && !section.data(ResultItemEditor).isNull())
{
++i;
selectCount += selectSection(section);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
section = firstRootItem.child(i, 0);
#else
section = firstRootItem.model()->index(i, 0);
#endif
}
}
@ -255,12 +271,20 @@ void FindResultWin::slot_selectSection()
//遍历下面的子节点
int i = 0;
QModelIndex childMi;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
childMi = sectionItem.child(i, 0);
#else
childMi = sectionItem.model()->index(i, 0);
#endif
while (childMi.isValid())
{
++i;
ui.resultTreeView->selectionModel()->select(childMi, QItemSelectionModel::Select);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
childMi = sectionItem.child(i, 0);
#else
childMi = sectionItem.model()->index(i, 0);
#endif
}
return i+1;
};
@ -453,7 +477,11 @@ QString FindResultWin::highlightFindText(FindRecord& record)
head = QString("<font style='font-size:14px;'>%1</font>").arg(head);
src = QString("<font style='font-size:14px;background-color:#ffffbf'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped());
tail = QString(utf8bytes.mid(tailStart));
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (tail > MAX_TAIL_LENGTH)
#else
if (tail.size() > MAX_TAIL_LENGTH)
#endif
{
tail = (tail.mid(0, MAX_TAIL_LENGTH) + "...").toHtmlEscaped();
}
@ -488,7 +516,11 @@ QString FindResultWin::highlightFindText(FindRecord& record)
src = QString("<font style='font-size:14px;font-weight:bold;color:#ffaa00'>%1</font>").arg(QString(utf8bytes.mid(targetStart, targetLens)).toHtmlEscaped());
QString tailContens = QString(utf8bytes.mid(tailStart));
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (tailContens > MAX_TAIL_LENGTH)
#else
if (tailContens.size() > MAX_TAIL_LENGTH)
#endif
{
tailContens = (tailContens.mid(0, MAX_TAIL_LENGTH) + "...").toHtmlEscaped();
}

View File

@ -621,8 +621,13 @@ bool readBase(const QChar * str, int * value, int base, int size)
current = str[i];
if (current >= 'A')
{
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
current = current.digitValue() & 0xdf;
current = current.digitValue() - ('A' - '0' - 10);
#else
current = QChar(current.digitValue() & 0xdf);
current = QChar(current.digitValue() - ('A' - '0' - 10));
#endif
}
else if (current > '9')
return false;

View File

@ -7,6 +7,7 @@
#include <QHeaderView>
#include <QSettings>
#include <QMessageBox>
#include <QFile>
int ITEM_CHANGED = Qt::UserRole;
int ITEM_LEX_ID = Qt::UserRole + 1; //对应的语法lexer的 ID
@ -113,7 +114,9 @@ void LangExtSet::slot_save()
QString userLangFile = QString("notepad/tag_ext");
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
for (int i = 0; i < rowNums; ++i)
{
@ -180,7 +183,9 @@ void LangExtSet::loadExtRelevanceToMagr()
{
QString userLangFile = QString("notepad/tag_ext");//自定义语言中不能有.字符,否则可能有错,后续要检查
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
if (!QFile::exists(qs.fileName()))
{

View File

@ -30,7 +30,9 @@ bool LangStyleDefine::readLangSetFile(QString langName, bool isLoadToUI)
{
QString userLangFile = QString("notepad/userlang/%1").arg(langName);//自定义语言中不能有.字符,否则可能有错,后续要检查
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
qDebug() << qs.fileName();
if (!qs.contains("mz"))
@ -160,7 +162,9 @@ void LangStyleDefine::slot_save()
//把新语言tagName,和关联ext单独存放起来。后面只读取一个文件就能获取所有避免遍历慢
QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag是存在所有tag ext的文件
QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
QStringList extList = ui.extNameLe->text().trimmed().split(" ");
extList.append(QString::number(motherLangs)); //最后一个是mother lexer
@ -201,7 +205,9 @@ void LangStyleDefine::slot_delete()
{
QString userLangFile = QString("notepad/userlang/%1").arg(name);//自定义语言中不能有.字符,否则可能有错,后续要检查
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
//删除userlang下面的tag.ini
QFile::remove(qs.fileName());
@ -211,7 +217,9 @@ void LangStyleDefine::slot_delete()
//把新语言在ext_tag中的关联文件记录也删除
QString extsFile = QString("notepad/userlang/ext_tag");//ext_tag是存在所有tag ext的文件
QSettings qs(QSettings::IniFormat, QSettings::UserScope, extsFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
QStringList extList = qs.value(name).toStringList();
//更新当前ExtLexerManager::getInstance()。如果不更新,就要重启软件才能生效

View File

@ -50,7 +50,9 @@ void NddSetting::init()
QString qsSetPath = qs.fileName();
s_nddSet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
s_nddSet->setIniCodec("UTF-8");
#endif
bool initOk = true;
auto initNddSet = []() {
@ -341,6 +343,8 @@ void NddSetting::winPosInit()
QString qsSetPath = qs.fileName();
s_winPosSet = new QSettings(QSettings::IniFormat, QSettings::UserScope, settingDir);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
s_winPosSet->setIniCodec("UTF-8");
#endif
}
}

View File

@ -382,7 +382,7 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
QsciLexer *pLexer = ScintillaEditView::createLexer(index);
if (nullptr != pLexer)
{
switch (flag)
{
case GLOBAL_FONT:
@ -390,9 +390,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
//非全局修改所有的语法对应样式
if (index != L_GLOBAL)
{
for (int i = 0; i <= 255; ++i)
{
if (!pLexer->description(i).isEmpty())
for (int i = 0; i <= 255; ++i)
{
if (!pLexer->description(i).isEmpty())
{
oldfont = pLexer->font(i);
oldfont.setFamily(m_curStyleData.font.family());
@ -423,9 +423,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
//非全局修改所有的语法对应样式
if (index != L_GLOBAL)
{
for (int i = 0; i <= 255; ++i)
{
if (!pLexer->description(i).isEmpty())
for (int i = 0; i <= 255; ++i)
{
if (!pLexer->description(i).isEmpty())
{
oldfont = pLexer->font(i);
oldfont.setPointSize(m_curStyleData.font.pointSize());
@ -453,9 +453,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
break;
case GLOBAL_FONT_BOLD:
{
for (int i = 0; i <= 255; ++i)
{
if (!pLexer->description(i).isEmpty())
for (int i = 0; i <= 255; ++i)
{
if (!pLexer->description(i).isEmpty())
{
oldfont = pLexer->font(i);
oldfont.setBold(m_curStyleData.font.bold());
@ -466,9 +466,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
break;
case GLOBAL_FONT_UNDERLINE:
{
for (int i = 0; i <= 255; ++i)
{
if (!pLexer->description(i).isEmpty())
for (int i = 0; i <= 255; ++i)
{
if (!pLexer->description(i).isEmpty())
{
oldfont = pLexer->font(i);
oldfont.setUnderline(m_curStyleData.font.underline());
@ -479,9 +479,9 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
break;
case GLOBAL_FONT_ITALIC:
{
for (int i = 0; i <= 255; ++i)
{
if (!pLexer->description(i).isEmpty())
for (int i = 0; i <= 255; ++i)
{
if (!pLexer->description(i).isEmpty())
{
oldfont = pLexer->font(i);
oldfont.setItalic(m_curStyleData.font.italic());
@ -504,10 +504,10 @@ void QtLangSet::updateAllLangeStyleWithGlobal(GLOBAL_STYLE_SET flag)
break;
default:
break;
}
}
saveLangeSet(pLexer);
}
}
delete pLexer;
}
@ -558,7 +558,7 @@ void QtLangSet::restoreOriginLangAllStyle()
{
QFile::remove(qs.fileName());
}
delete pLexer;
pLexer = nullptr;
@ -605,12 +605,12 @@ void QtLangSet::restoreOriginLangOneStyle(GLOBAL_STYLE_SET flag)
QsciLexer *pLexer = ScintillaEditView::createLexer(index);
QsciLexer *pOriginLexer = ScintillaEditView::createLexer(index,"",true);
if (nullptr != pLexer)
{
for (int i = 0; i <= 255; ++i)
{
if (!pLexer->description(i).isEmpty())
{
{
for (int i = 0; i <= 255; ++i)
{
if (!pLexer->description(i).isEmpty())
{
switch (flag)
{
case GLOBAL_FONT:
@ -666,11 +666,11 @@ void QtLangSet::restoreOriginLangOneStyle(GLOBAL_STYLE_SET flag)
break;
default:
break;
}
}
}
}
}
saveLangeSet(pLexer);
}
}
delete pLexer;
delete pOriginLexer;
}
@ -826,7 +826,9 @@ bool QtLangSet::readLangSetFile(QString langName,QString &keyword, QString &moth
{
QString userLangFile = QString("notepad/userlang/%1").arg(langName);//自定义语言中不能有.字符,否则可能有错,后续要检查
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
//qDebug() << qs.fileName();
if (!qs.contains("mz"))
@ -954,15 +956,15 @@ void QtLangSet::slot_itemSelect(QListWidgetItem *item)
ExtLexerManager::getInstance()->getExtlistByLangTag(langName, extList);
ui.extFileType->setText(extList.join(','));
for (int i = 0; i <= 255; ++i)
{
QString desc = pLexer->description(i);
if (!desc.isEmpty())
{
for (int i = 0; i <= 255; ++i)
{
QString desc = pLexer->description(i);
if (!desc.isEmpty())
{
QListWidgetItem *itemtemp = new QListWidgetItem(desc);
itemtemp->setData(Qt::UserRole, i);
ui.styleListWidget->addItem(itemtemp);
}
itemtemp->setData(Qt::UserRole, i);
ui.styleListWidget->addItem(itemtemp);
}
}
}

View File

@ -2607,7 +2607,11 @@ void ScintillaEditView::changeCase(const TextCaseType & caseToConvert, QString&
else if (caseToConvert == TITLECASE_FORCE)
strToConvert[i] = strToConvert[i].toLower();
//An exception
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if ((i < 2) ? false : (strToConvert[i - 1] == L'\'' && (strToConvert[i - 2].isLetter())))
#else
if ((i < 2) ? false : (strToConvert[i - 1] == '\'' && (strToConvert[i - 2].isLetter())))
#endif
strToConvert[i] = strToConvert[i].toLower();
}
}
@ -2635,11 +2639,19 @@ void ScintillaEditView::changeCase(const TextCaseType & caseToConvert, QString&
wasEolR = false;
wasEolN = false;
//An exception
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
if (strToConvert[i] == L'i' &&
#else
if (strToConvert[i] == 'i' &&
#endif
((i < 1) ? false : (strToConvert[i - 1].isSpace() || strToConvert[i - 1] == '(' || strToConvert[i - 1] == '"')) && \
((i + 1 == nbChars) ? false : (strToConvert[i + 1].isSpace() || strToConvert[i + 1] == '\'')))
{
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
strToConvert[i] = L'I';
#else
strToConvert[i] = 'I';
#endif
}
}
else if (strToConvert[i] == '.' || strToConvert[i] == '!' || strToConvert[i] == '?')
@ -3308,7 +3320,11 @@ bool isUrlQueryDelimiter(QChar const c)
void scanToUrlEnd(QString & text, int textLen, int start, int* distance)
{
int p = start;
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
QChar q = 0;
#else
QChar q(0);
#endif
enum { sHostAndPath, sQuery, sQueryAfterDelimiter, sQueryQuotes, sQueryAfterQuotes, sFragment } s = sHostAndPath;
while (p < textLen)
{

View File

@ -139,7 +139,9 @@ void ShortcutKeyMgr::loadUserDefSet()
{
QString userDefFile = QString("notepad/shortcuttab");
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userDefFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
QStringList keys = qs.allKeys();
@ -164,7 +166,9 @@ bool ShortcutKeyMgr::ModifyShortCutKey(QString initTag, QString keySeqStr)
{
QString userDefFile = QString("notepad/shortcuttab");
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userDefFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
if (s_shortcutKeysMap->contains(initTag))
{

View File

@ -24,7 +24,9 @@ bool UserLexDef::readUserSettings(QString langTagName)
QString userLangFile = QString("notepad/userlang/%1").arg(langTagName);
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
if (!qs.contains(QString("mz")))
{
@ -93,7 +95,9 @@ bool UserLexDef::writeUserSettings(QString langTagName)
QString userLangFile = QString("notepad/userlang/%1").arg(langTagName);
QSettings qs(QSettings::IniFormat, QSettings::UserScope, userLangFile);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qs.setIniCodec("UTF-8");
#endif
qs.clear();
qs.setValue("mz", langTagName);