From 21d7fd92c583edeac274a942229f45464f283f85 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Wed, 26 Jan 2022 23:24:38 -0300 Subject: [PATCH] Gui: Add option to enable/disable text cursor blinking --- src/Gui/Application.cpp | 4 ++++ src/Gui/DlgGeneral.ui | 22 +++++++++++++++++++++- src/Gui/DlgGeneralImp.cpp | 5 +++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index a2589a8d14..ffb025dcae 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -2099,6 +2099,10 @@ void Application::runApplication(void) mainApp.installEventFilter(filter); } + // set text cursor blinking state + int blinkTime = hGrp->GetBool("EnableCursorBlinking", true) ? -1 : 0; + qApp->setCursorFlashTime(blinkTime); + { QWindow window; window.setSurfaceType(QWindow::OpenGLSurface); diff --git a/src/Gui/DlgGeneral.ui b/src/Gui/DlgGeneral.ui index 01ca2f8c44..254f6a0e34 100644 --- a/src/Gui/DlgGeneral.ui +++ b/src/Gui/DlgGeneral.ui @@ -342,7 +342,7 @@ 0 - + Background of the main window will consist of tiles of a special image. @@ -353,6 +353,25 @@ See the FreeCAD Wiki for details about the image. + + + + The text cursor will be blinking + + + Enable cursor blinking + + + true + + + EnableCursorBlinking + + + General + + + @@ -625,6 +644,7 @@ horizontal space in Python console Languages RecentFiles + EnableCursorBlinking SplashScreen PythonWordWrap PythonBlockCursor diff --git a/src/Gui/DlgGeneralImp.cpp b/src/Gui/DlgGeneralImp.cpp index 726f2a2fe6..0e50826e55 100644 --- a/src/Gui/DlgGeneralImp.cpp +++ b/src/Gui/DlgGeneralImp.cpp @@ -142,6 +142,7 @@ void DlgGeneralImp::saveSettings() ui->SubstituteDecimal->onSave(); ui->RecentFiles->onSave(); + ui->EnableCursorBlinking->onSave(); ui->SplashScreen->onSave(); ui->PythonWordWrap->onSave(); ui->PythonBlockCursor->onSave(); @@ -174,6 +175,9 @@ void DlgGeneralImp::saveSettings() hGrp->SetInt("ToolbarIconSize", pixel); getMainWindow()->setIconSize(QSize(pixel,pixel)); + int blinkTime = hGrp->GetBool("EnableCursorBlinking", true) ? -1 : 0; + qApp->setCursorFlashTime(blinkTime); + hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/DockWindows"); bool treeView=false, propertyView=false, comboView=true; switch(ui->treeMode->currentIndex()) { @@ -208,6 +212,7 @@ void DlgGeneralImp::loadSettings() ui->SubstituteDecimal->onRestore(); ui->RecentFiles->onRestore(); + ui->EnableCursorBlinking->onRestore(); ui->SplashScreen->onRestore(); ui->PythonWordWrap->onRestore(); ui->PythonBlockCursor->onRestore();