Skip to content

Commit

Permalink
Fixed number of options not being updated in ShowMenu editor.
Browse files Browse the repository at this point in the history
  • Loading branch information
fr33mind committed Feb 12, 2015
1 parent 363aa90 commit 9577842
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
21 changes: 13 additions & 8 deletions editor/actions/show_menu_editorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}
}
1 change: 1 addition & 0 deletions editor/actions/show_menu_editorwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ShowMenuEditorWidget : public ActionEditorWidget

private:
int widgetIndex(QObject*);
void setNumberOfOptions(int);

signals:

Expand Down

0 comments on commit 9577842

Please sign in to comment.