aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/tabsettingswidget.cpp
diff options
context:
space:
mode:
authorLeandro Melo <leandro.melo@nokia.com>2011-08-17 12:31:15 +0200
committerhjk <qthjk@ovi.com>2011-08-18 10:09:17 +0200
commit3b0a43802e45affc7cfbef065d99720a1415e791 (patch)
tree87ddae4afd6b5abad5905dc1b4e673c580b53238 /src/plugins/texteditor/tabsettingswidget.cpp
parent7b90c8b0c533cdb8085420bf1e753518584df310 (diff)
Editors: Enhance smart backspace behavior
Adds a new smart backspace behavior option. Now it's also possible to simply unindent (like a backtab). This is particularly useful when the cursor is not inside an "indentation area" but the user still wants to go backwards by indent levels when possible (for example before a comment that appears after the code line). The option also allows the user to reach a new indent level which has not been seen so far in previous lines. The original follows indentation user setting will be lost with this patch, but we consider this ok for not very "significant" settings. Change-Id: I49efb6b0309d9b7d7ff2a589413446bc16fb753c Reviewed-on: http://codereview.qt.nokia.com/3105 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Robert Löhning <robert.loehning@nokia.com> Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins/texteditor/tabsettingswidget.cpp')
-rw-r--r--src/plugins/texteditor/tabsettingswidget.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/texteditor/tabsettingswidget.cpp b/src/plugins/texteditor/tabsettingswidget.cpp
index 60cc37caf8..fea3255cba 100644
--- a/src/plugins/texteditor/tabsettingswidget.cpp
+++ b/src/plugins/texteditor/tabsettingswidget.cpp
@@ -52,7 +52,7 @@ TabSettingsWidget::TabSettingsWidget(QWidget *parent) :
this, SLOT(slotSettingsChanged()));
connect(ui->autoIndent, SIGNAL(toggled(bool)),
this, SLOT(slotSettingsChanged()));
- connect(ui->smartBackspace, SIGNAL(toggled(bool)),
+ connect(ui->smartBackspaceBehavior, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotSettingsChanged()));
connect(ui->tabSize, SIGNAL(valueChanged(int)),
this, SLOT(slotSettingsChanged()));
@@ -77,7 +77,7 @@ void TabSettingsWidget::setSettings(const TextEditor::TabSettings& s)
ui->insertSpaces->setChecked(s.m_spacesForTabs);
ui->autoInsertSpaces->setChecked(s.m_autoSpacesForTabs);
ui->autoIndent->setChecked(s.m_autoIndent);
- ui->smartBackspace->setChecked(s.m_smartBackspace);
+ ui->smartBackspaceBehavior->setCurrentIndex(s.m_smartBackspaceBehavior);
ui->tabSize->setValue(s.m_tabSize);
ui->indentSize->setValue(s.m_indentSize);
ui->tabKeyBehavior->setCurrentIndex(s.m_tabKeyBehavior);
@@ -94,11 +94,13 @@ TabSettings TabSettingsWidget::settings() const
set.m_spacesForTabs = ui->insertSpaces->isChecked();
set.m_autoSpacesForTabs = ui->autoInsertSpaces->isChecked();
set.m_autoIndent = ui->autoIndent->isChecked();
- set.m_smartBackspace = ui->smartBackspace->isChecked();
+ set.m_smartBackspaceBehavior =
+ (TabSettings::SmartBackspaceBehavior)ui->smartBackspaceBehavior->currentIndex();
set.m_tabSize = ui->tabSize->value();
set.m_indentSize = ui->indentSize->value();
set.m_tabKeyBehavior = (TabSettings::TabKeyBehavior)(ui->tabKeyBehavior->currentIndex());
- set.m_continuationAlignBehavior = (TabSettings::ContinuationAlignBehavior)(ui->continuationAlignBehavior->currentIndex());
+ set.m_continuationAlignBehavior =
+ (TabSettings::ContinuationAlignBehavior)(ui->continuationAlignBehavior->currentIndex());
return set;
}
@@ -124,7 +126,7 @@ QString TabSettingsWidget::searchKeywords() const
<< sep << ui->insertSpaces->text()
<< sep << ui->autoInsertSpaces->text()
<< sep << ui->autoIndent->text()
- << sep << ui->smartBackspace->text()
+ << sep << ui->smartBackspaceLabel->text()
<< sep << ui->tabSizeLabel->text()
<< sep << ui->indentSizeLabel->text()
<< sep << ui->tabKeyBehaviorLabel->text()