diff --git a/src/Gui/DlgEditor.ui b/src/Gui/DlgEditor.ui
index 368d445417..b51c1c0279 100644
--- a/src/Gui/DlgEditor.ui
+++ b/src/Gui/DlgEditor.ui
@@ -187,7 +187,7 @@
9
- -
+
-
Qt::TabFocus
@@ -209,6 +209,28 @@
+ -
+
+
+ Qt::TabFocus
+
+
+ The cursor shape will be a block
+
+
+ Enable block cursor
+
+
+ false
+
+
+ EnableBlockCursor
+
+
+ Editor
+
+
+
-
@@ -377,6 +399,7 @@
fontFamily
EnableLineNumber
+ EnableBlockCursor
EnableFolding
tabSize
indentSize
diff --git a/src/Gui/DlgEditorImp.cpp b/src/Gui/DlgEditorImp.cpp
index 561467b863..5e80939d26 100644
--- a/src/Gui/DlgEditorImp.cpp
+++ b/src/Gui/DlgEditorImp.cpp
@@ -174,6 +174,7 @@ void DlgSettingsEditorImp::on_colorButton_changed()
void DlgSettingsEditorImp::saveSettings()
{
ui->EnableLineNumber->onSave();
+ ui->EnableBlockCursor->onSave();
ui->EnableFolding->onSave();
ui->tabSize->onSave();
ui->indentSize->onSave();
@@ -194,6 +195,7 @@ void DlgSettingsEditorImp::saveSettings()
void DlgSettingsEditorImp::loadSettings()
{
ui->EnableLineNumber->onRestore();
+ ui->EnableBlockCursor->onRestore();
ui->EnableFolding->onRestore();
ui->tabSize->onRestore();
ui->indentSize->onRestore();
diff --git a/src/Gui/DlgGeneral.ui b/src/Gui/DlgGeneral.ui
index 58315e57a2..01ca2f8c44 100644
--- a/src/Gui/DlgGeneral.ui
+++ b/src/Gui/DlgGeneral.ui
@@ -582,6 +582,25 @@ horizontal space in Python console
+ -
+
+
+ The cursor shape will be a block
+
+
+ Enable block cursor
+
+
+ false
+
+
+ PythonBlockCursor
+
+
+ General
+
+
+
@@ -608,6 +627,7 @@ horizontal space in Python console
RecentFiles
SplashScreen
PythonWordWrap
+ PythonBlockCursor
diff --git a/src/Gui/DlgGeneralImp.cpp b/src/Gui/DlgGeneralImp.cpp
index 5052ea1a4e..726f2a2fe6 100644
--- a/src/Gui/DlgGeneralImp.cpp
+++ b/src/Gui/DlgGeneralImp.cpp
@@ -144,6 +144,7 @@ void DlgGeneralImp::saveSettings()
ui->RecentFiles->onSave();
ui->SplashScreen->onSave();
ui->PythonWordWrap->onSave();
+ ui->PythonBlockCursor->onSave();
QWidget* pc = DockWindowManager::instance()->getDockWindow("Python console");
PythonConsole *pcPython = qobject_cast(pc);
@@ -209,6 +210,7 @@ void DlgGeneralImp::loadSettings()
ui->RecentFiles->onRestore();
ui->SplashScreen->onRestore();
ui->PythonWordWrap->onRestore();
+ ui->PythonBlockCursor->onRestore();
// search for the language files
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("General");
diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp
index 7fd9cbf6cf..e1402f4a26 100644
--- a/src/Gui/PythonConsole.cpp
+++ b/src/Gui/PythonConsole.cpp
@@ -488,14 +488,15 @@ void PythonConsole::OnChange( Base::Subject &rCaller,const char* sR
{
Q_UNUSED(rCaller);
ParameterGrp::handle hPrefGrp = getWindowParameter();
+ ParameterGrp::handle hPrefGen = App::GetApplication().GetUserParameter().
+ GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("General");
- bool pythonWordWrap = App::GetApplication().GetUserParameter().
- GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("General")->GetBool("PythonWordWrap", true);
-
- if (pythonWordWrap) {
- this->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
- } else {
- this->setWordWrapMode(QTextOption::NoWrap);
+ if (strcmp(sReason, "PythonWordWrap") == 0) {
+ bool pythonWordWrap = hPrefGen->GetBool("PythonWordWrap", true);
+ if (pythonWordWrap)
+ setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
+ else
+ setWordWrapMode(QTextOption::NoWrap);
}
if (strcmp(sReason, "FontSize") == 0 || strcmp(sReason, "Font") == 0) {
@@ -511,7 +512,8 @@ void PythonConsole::OnChange( Base::Subject &rCaller,const char* sR
#else
setTabStopDistance(width);
#endif
- } else {
+ }
+ else {
QMap::ConstIterator it = d->colormap.find(QString::fromLatin1(sReason));
if (it != d->colormap.end()) {
QColor color = it.value();
@@ -523,6 +525,16 @@ void PythonConsole::OnChange( Base::Subject &rCaller,const char* sR
pythonSyntax->setColor(QString::fromLatin1(sReason), color);
}
}
+
+ if (strcmp(sReason, "PythonBlockCursor") == 0 ||
+ strcmp(sReason, "FontSize") == 0 ||
+ strcmp(sReason, "Font") == 0) {
+ bool block = hPrefGen->GetBool("PythonBlockCursor", false);
+ if (block)
+ setCursorWidth(QFontMetrics(font()).averageCharWidth());
+ else
+ setCursorWidth(1);
+ }
}
/**
diff --git a/src/Gui/TextEdit.cpp b/src/Gui/TextEdit.cpp
index a694c57c66..f832dd2dc2 100644
--- a/src/Gui/TextEdit.cpp
+++ b/src/Gui/TextEdit.cpp
@@ -449,7 +449,9 @@ void TextEditor::OnChange(Base::Subject &rCaller,const char* sReaso
QFont font(fontFamily, fontSize);
setFont(font);
- } else {
+ lineNumberArea->setFont(font);
+ }
+ else {
QMap::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 &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);
}
}