Gui: Add functionality to enable/disable block shape cursor in text editor and console

This commit is contained in:
marioalexis
2022-01-26 00:07:47 -03:00
committed by wwmayer
parent 4b2e707018
commit ec167207bf
6 changed files with 88 additions and 16 deletions

View File

@@ -449,7 +449,9 @@ void TextEditor::OnChange(Base::Subject<const char*> &rCaller,const char* sReaso
QFont font(fontFamily, fontSize);
setFont(font);
} else {
lineNumberArea->setFont(font);
}
else {
QMap<QString, QColor>::ConstIterator it = d->colormap.find(QString::fromLatin1(sReason));
if (it != d->colormap.end()) {
QColor color = it.value();
@@ -475,12 +477,23 @@ void TextEditor::OnChange(Base::Subject<const char*> &rCaller,const char* sReaso
}
// Enables/Disables Line number in the Macro Editor from Edit->Preferences->Editor menu.
QRect cr = contentsRect();
bool show = hPrefGrp->GetBool( "EnableLineNumber", true );
if(show) {
lineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height()));
} else {
lineNumberArea->setGeometry(QRect(cr.left(), cr.top(), 0, cr.height()));
if (strcmp(sReason, "EnableLineNumber") == 0) {
QRect cr = contentsRect();
bool show = hPrefGrp->GetBool("EnableLineNumber", true);
if(show)
lineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height()));
else
lineNumberArea->setGeometry(QRect(cr.left(), cr.top(), 0, cr.height()));
}
if (strcmp(sReason, "EnableBlockCursor") == 0 ||
strcmp(sReason, "FontSize") == 0 ||
strcmp(sReason, "Font") == 0) {
bool block = hPrefGrp->GetBool("EnableBlockCursor", false);
if (block)
setCursorWidth(QFontMetrics(font()).averageCharWidth());
else
setCursorWidth(1);
}
}