From 95778429f66f201a78e5cba73c288163bde1ceb7 Mon Sep 17 00:00:00 2001 From: freemind Date: Thu, 12 Feb 2015 22:47:47 +0000 Subject: [PATCH] Fixed number of options not being updated in ShowMenu editor. --- editor/actions/show_menu_editorwidget.cpp | 21 +++++++++++++-------- editor/actions/show_menu_editorwidget.h | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/editor/actions/show_menu_editorwidget.cpp b/editor/actions/show_menu_editorwidget.cpp index 4964d0a..285dcae 100644 --- a/editor/actions/show_menu_editorwidget.cpp +++ b/editor/actions/show_menu_editorwidget.cpp @@ -88,6 +88,7 @@ void ShowMenuEditorWidget::updateData(Action * action) int index = menu->objects().size() >= 2 ? menu->objects().size()-2 : 0; mChooseNumberOfOptions->setCurrentIndex(index); + setNumberOfOptions(menu->objects().size()); for(int i=0; i < objects.size(); i++) { if (i < mTextEdits.size()) @@ -204,14 +205,7 @@ void ShowMenuEditorWidget::onNumberOfOptionsChanged(int index) if (! ok) return; - for(int i=1; i < number+1; i++) { - this->setRowHidden(i, model()->index(i, 0).parent(), false); - } - - for(int i=number+1; i < model()->rowCount(); i++) { - this->setRowHidden(i, model()->index(i, 0).parent(), true); - } - + this->setNumberOfOptions(number); menu->setNumberOfOptions(number); } @@ -228,3 +222,14 @@ void ShowMenuEditorWidget::onConditionChanged() menu->setCondition(index, textEdit->toPlainText()); } } + +void ShowMenuEditorWidget::setNumberOfOptions(int number) +{ + for(int i=1; i < number+1; i++) { + this->setRowHidden(i, model()->index(i, 0).parent(), false); + } + + for(int i=number+1; i < model()->rowCount(); i++) { + this->setRowHidden(i, model()->index(i, 0).parent(), true); + } +} diff --git a/editor/actions/show_menu_editorwidget.h b/editor/actions/show_menu_editorwidget.h index 135f2e4..5f9e947 100644 --- a/editor/actions/show_menu_editorwidget.h +++ b/editor/actions/show_menu_editorwidget.h @@ -41,6 +41,7 @@ class ShowMenuEditorWidget : public ActionEditorWidget private: int widgetIndex(QObject*); + void setNumberOfOptions(int); signals: