diff --git a/RecipeDB.pro b/RecipeDB.pro index 0071690..c2c8a98 100644 --- a/RecipeDB.pro +++ b/RecipeDB.pro @@ -54,4 +54,5 @@ FORMS += gui/mainwindow.ui \ DISTFILES += \ .gitignore -RESOURCES += +RESOURCES += \ + images.qrc diff --git a/gui/newrecipedialog.cpp b/gui/newrecipedialog.cpp index 7405d09..2b4123f 100644 --- a/gui/newrecipedialog.cpp +++ b/gui/newrecipedialog.cpp @@ -101,3 +101,11 @@ void NewRecipeDialog::on_addTagButton_clicked(){ //Add a tag to the list of those prepared to be added. this->tagsListModel.addTag(this->tags[ui->tagsComboBox->currentIndex()]); } + +void NewRecipeDialog::on_deleteTagButton_clicked(){ + QModelIndexList indexList = ui->tagsListView->selectedIndexes(); + for (QModelIndexList::iterator it = indexList.begin(); it != indexList.end(); ++it){ + QModelIndex i = *it; + this->tagsListModel.deleteTag(i.row()); + } +} diff --git a/gui/newrecipedialog.ui b/gui/newrecipedialog.ui index 78e7f57..0a0875c 100644 --- a/gui/newrecipedialog.ui +++ b/gui/newrecipedialog.ui @@ -336,23 +336,11 @@ - - - - 0 - 0 - - - - background-color: rgb(245, 245, 255); - - + + 0 - - QLayout::SetMaximumSize - 0 @@ -366,64 +354,53 @@ 0 - - - Ingredients + + + + 0 + 0 + - - Qt::AlignCenter + + background-color: rgb(245, 245, 255); - - - - - + + + 0 + + + QLayout::SetMaximumSize + + + 0 + + + 0 + + + 0 + + + 0 + - - - background-color: rgb(255, 255, 255); + + + Ingredients - - QFrame::NoFrame - - - 100 + + Qt::AlignCenter - - - - - 5 - - - 0 - - - 0 - - - 0 - - - 0 - + + + - - - Add Ingredient - - - Qt::AlignCenter - - - - - - + + - 2 + 5 0 @@ -438,149 +415,193 @@ 0 - - - - 0 - 0 - + + + Add Ingredient - - + + Qt::AlignCenter - - - New + + + + 2 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + + + + + + + New + + + + + + + + + + + 0 + 36 + + + + 2 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + Noto Sans CJK KR + 14 + 50 + false + false + + + + Amount + + + + + + + + 0 + 0 + + + + 10000.000000000000000 + + + 1.000000000000000 + + + + + + + + + + New + + + + + + + + + + + 0 + 0 + + + + false + + + Qt::AlignCenter + + + Comments + + + false + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Add + + + + + + + Delete + + + + - - - - 0 - 36 - + + + background-color: rgb(255, 255, 255); - - - 2 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - Noto Sans CJK KR - 14 - 50 - false - false - - - - Amount - - - - - - - - 0 - 0 - - - - 10000.000000000000000 - - - 1.000000000000000 - - - - - - - - - - New - - - - - - - - - - - 0 - 0 - + + QFrame::NoFrame - - false + + 100 - - Qt::AlignCenter - - - Comments - - - false - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Add - - - - - - - Delete - - - - @@ -589,6 +610,40 @@ + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + true + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + diff --git a/images.qrc b/images.qrc new file mode 100644 index 0000000..6634926 --- /dev/null +++ b/images.qrc @@ -0,0 +1,5 @@ + + + images/no_image.png + + diff --git a/images/no_image.png b/images/no_image.png new file mode 100644 index 0000000..d9a708d Binary files /dev/null and b/images/no_image.png differ diff --git a/model/recipe/ingredients/ingredientlistmodel.cpp b/model/recipe/ingredients/ingredientlistmodel.cpp index 1370bc7..360d48c 100644 --- a/model/recipe/ingredients/ingredientlistmodel.cpp +++ b/model/recipe/ingredients/ingredientlistmodel.cpp @@ -53,6 +53,10 @@ bool IngredientListModel::addIngredient(RecipeIngredient ri){ return true; } +void IngredientListModel::deleteIngredient(int index){ + this->ingredients.erase(this->ingredients.begin() + index); +} + vector IngredientListModel::getIngredients(){ return this->ingredients; } diff --git a/model/recipe/tags/taglistmodel.cpp b/model/recipe/tags/taglistmodel.cpp index dd70b3f..4555cd7 100644 --- a/model/recipe/tags/taglistmodel.cpp +++ b/model/recipe/tags/taglistmodel.cpp @@ -39,6 +39,10 @@ bool TagListModel::addTag(RecipeTag tag){ return true; } +void TagListModel::deleteTag(int index){ + this->tags.erase(this->tags.begin() + index); +} + vector TagListModel::getTags(){ return this->tags; }