add back indent guide, misc tweaks
This commit is contained in:
@@ -174,9 +174,12 @@ void MainWindow::setupActions()
|
||||
QAction *toggleIndentGuideAction = new QAction(this);
|
||||
toggleIndentGuideAction->setText("Toggle Indent Guide");
|
||||
toggleIndentGuideAction->setIcon(QIcon::fromTheme(u"show-guides"_s));
|
||||
toggleIndentGuideAction->setCheckable(true);
|
||||
toggleIndentGuideAction->setChecked(m_indentGuidesEnabled);
|
||||
actionCollection()->addAction(u"toggle_indent_guide"_s, toggleIndentGuideAction);
|
||||
connect(toggleIndentGuideAction, &QAction::triggered, this, [this](){
|
||||
// m_editor->setIndentationGuides(!m_editor->indentationGuides());
|
||||
connect(toggleIndentGuideAction, &QAction::toggled, this, [this](bool checked){
|
||||
m_indentGuidesEnabled = checked;
|
||||
applySettingsToAllEditors();
|
||||
});
|
||||
|
||||
QAction *toggleEditorDarkThemeAction = new QAction(this);
|
||||
@@ -235,6 +238,7 @@ void MainWindow::applyLexer(const QString &lexerName)
|
||||
void MainWindow::newFile()
|
||||
{
|
||||
m_tabWidget->newDocument();
|
||||
updateActions();
|
||||
}
|
||||
|
||||
void MainWindow::openFile()
|
||||
@@ -295,6 +299,7 @@ void MainWindow::applySettingsToEditor(SciEdit *editor)
|
||||
editor->setTabWidth(AppSettings::tabWidth());
|
||||
editor->setEditorFont(AppSettings::editorFont());
|
||||
editor->applyTheme(AppSettings::editorDarkTheme());
|
||||
editor->setIndentationGuides(m_indentGuidesEnabled ? SC_IV_LOOKBOTH : SC_IV_NONE);
|
||||
}
|
||||
|
||||
void MainWindow::applySettingsToAllEditors()
|
||||
@@ -366,6 +371,10 @@ void MainWindow::updateActions()
|
||||
copyAction->setEnabled(hasEditor);
|
||||
}
|
||||
if (QAction *pasteAction = actionCollection()->action(KStandardAction::name(KStandardAction::Paste))) {
|
||||
pasteAction->setEnabled(hasEditor);
|
||||
pasteAction->setEnabled(hasEditor && m_tabWidget->currentEditor()->canPaste());
|
||||
}
|
||||
if (QAction *indentGuideAction = actionCollection()->action(QStringLiteral("toggle_indent_guide"))) {
|
||||
indentGuideAction->setEnabled(hasEditor);
|
||||
indentGuideAction->setChecked(m_indentGuidesEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user