diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-01-20 10:20:23 (GMT) |
---|---|---|
committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-01-20 10:20:23 (GMT) |
commit | 3a4a3a1804a0a43dd23c97287fe8d302be323bdd (patch) | |
tree | 7ad3da8f4f104a687d4d8ace2660164859ec7e69 | |
parent | abb8248355783ad77b0a8099e8acd36a46dda7cc (diff) | |
download | swift-3a4a3a1804a0a43dd23c97287fe8d302be323bdd.zip swift-3a4a3a1804a0a43dd23c97287fe8d302be323bdd.tar.bz2 |
Fixed ListWidget description updating.
Change-Id: Ieaa34e9b1ef34baa01903af5d13fa0d60994f8e3
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.cpp | 12 | ||||
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.h | 1 |
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); |