summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/QtUI/QtHighlightEditor.cpp12
-rw-r--r--Swift/QtUI/QtHighlightEditor.h1
2 files changed, 4 insertions, 9 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp
index 6fa5406..c7ccf60 100644
--- a/Swift/QtUI/QtHighlightEditor.cpp
+++ b/Swift/QtUI/QtHighlightEditor.cpp
@@ -254,7 +254,10 @@ void QtHighlightEditor::updateRuleDescription()
HighlightRule rule = ruleFromDialog();
const std::string description = formatNaturalDescription(rule);
ui_.ruleDescription->setText(P2QSTRING(description));
- ui_.listWidget->item(getSelectedRow())->setText(P2QSTRING(description));
+
+ if (ui_.listWidget->currentItem()) {
+ ui_.listWidget->currentItem()->setText(P2QSTRING(description));
+ }
}
void QtHighlightEditor::enableDialog(bool state)
@@ -321,13 +324,6 @@ int QtHighlightEditor::getSelectedRow() const
return -1;
}
-void QtHighlightEditor::setRowText(int row, const std::string &text)
-{
- if (row>=0 && row<ui_.listWidget->count()) {
- ui_.listWidget->item(row)->setText(P2QSTRING(text));
- }
-}
-
HighlightRule QtHighlightEditor::ruleFromDialog()
{
HighlightRule rule;
diff --git a/Swift/QtUI/QtHighlightEditor.h b/Swift/QtUI/QtHighlightEditor.h
index 6cdb9d3..2c3a819 100644
--- a/Swift/QtUI/QtHighlightEditor.h
+++ b/Swift/QtUI/QtHighlightEditor.h
@@ -49,7 +49,6 @@ namespace Swift {
void selectRow(int row);
int getSelectedRow() const;
- void setRowText(int row, const std::string &text);
HighlightRule ruleFromDialog();
void ruleToDialog(const HighlightRule& rule);