fix: Fallback font combos in the editor font options panel are not correctly inited.
fix: Ascii control chars font not correctly loaded when app start.
This commit is contained in:
parent
bc0d55b1bb
commit
255e09de89
|
@ -405,7 +405,8 @@ int main(int argc, char *argv[])
|
||||||
e.reason(),
|
e.reason(),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
// qDebug()<<"Load font"<<QFontDatabase::addApplicationFont(":/fonts/asciicontrol.ttf");
|
// qDebug()<<"Load font";
|
||||||
|
QFontDatabase::addApplicationFont(":/fonts/asciicontrol.ttf");
|
||||||
|
|
||||||
MainWindow mainWindow;
|
MainWindow mainWindow;
|
||||||
pMainWindow = &mainWindow;
|
pMainWindow = &mainWindow;
|
||||||
|
|
|
@ -24,6 +24,8 @@ EditorFontWidget::EditorFontWidget(const QString& name, const QString& group, QW
|
||||||
ui(new Ui::EditorFontWidget)
|
ui(new Ui::EditorFontWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->cbFallbackFont2->setEnabled(false);
|
||||||
|
ui->cbFallbackFont3->setEnabled(false);
|
||||||
connect(ui->chkFallbackFont2, &QCheckBox::stateChanged,
|
connect(ui->chkFallbackFont2, &QCheckBox::stateChanged,
|
||||||
this, &EditorFontWidget::onFallbackFontsCheckStateChanged);
|
this, &EditorFontWidget::onFallbackFontsCheckStateChanged);
|
||||||
connect(ui->chkFallbackFont3, &QCheckBox::stateChanged,
|
connect(ui->chkFallbackFont3, &QCheckBox::stateChanged,
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
Document::Document(const QFont& font, const QFont& nonAsciiFont, QObject *parent):
|
Document::Document(const QFont& font, QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
mFontMetrics(font),
|
mFontMetrics(font),
|
||||||
mTabSize(4),
|
mTabSize(4),
|
||||||
|
@ -669,8 +669,8 @@ void Document::loadFromFile(const QString& filename, const QByteArray& encoding,
|
||||||
} else if (line.endsWith("\n")){
|
} else if (line.endsWith("\n")){
|
||||||
line.remove(line.length()-1,1);
|
line.remove(line.length()-1,1);
|
||||||
}
|
}
|
||||||
// if (isBinaryContent(line))
|
if (isBinaryContent(line))
|
||||||
// throw BinaryFileError(tr("'%1' is a binaray File!").arg(filename));
|
throw BinaryFileError(tr("'%1' is a binaray File!").arg(filename));
|
||||||
if (allAscii) {
|
if (allAscii) {
|
||||||
allAscii = isTextAllAscii(line);
|
allAscii = isTextAllAscii(line);
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,7 +210,7 @@ class Document : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Document(const QFont& font, const QFont& nonAsciiFont, QObject* parent=nullptr);
|
explicit Document(const QFont& font, QObject* parent=nullptr);
|
||||||
Document(const Document&)=delete;
|
Document(const Document&)=delete;
|
||||||
Document& operator=(const Document&)=delete;
|
Document& operator=(const Document&)=delete;
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent),
|
||||||
mPainting = false;
|
mPainting = false;
|
||||||
mFontDummy = QFont("monospace",14);
|
mFontDummy = QFont("monospace",14);
|
||||||
mFontDummy.setStyleStrategy(QFont::PreferAntialias);
|
mFontDummy.setStyleStrategy(QFont::PreferAntialias);
|
||||||
mDocument = std::make_shared<Document>(mFontDummy, mFontDummy, this);
|
mDocument = std::make_shared<Document>(mFontDummy, this);
|
||||||
//fPlugins := TList.Create;
|
//fPlugins := TList.Create;
|
||||||
mMouseMoved = false;
|
mMouseMoved = false;
|
||||||
mMouseOrigin = QPoint(0,0);
|
mMouseOrigin = QPoint(0,0);
|
||||||
|
|
|
@ -724,15 +724,15 @@ QStringList absolutePaths(const QString &dirPath, const QStringList &relativePat
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bool isBinaryContent(const QByteArray &text)
|
bool isBinaryContent(const QByteArray &text)
|
||||||
// {
|
{
|
||||||
// for (char c:text) {
|
for (char c:text) {
|
||||||
// if (c>=0 && c<' ' && c!='\t' && c!='\n' && c!='\r') {
|
if (c==0) {
|
||||||
// return true;
|
return true;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
|
|
||||||
void clearQPlainTextEditFormat(QTextEdit *editor)
|
void clearQPlainTextEditFormat(QTextEdit *editor)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue