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