Improve/redesign ingredients #13
|
@ -8,13 +8,8 @@ OpenRecipeDialog::OpenRecipeDialog(QWidget *parent) :
|
|||
ui->setupUi(this);
|
||||
|
||||
ui->recipeTableView->setModel(&this->recipeTableModel);
|
||||
ui->ingredientsListView->setModel(&this->ingredientsModel);
|
||||
ui->tagsListView->setModel(&this->tagsModel);
|
||||
|
||||
QObject::connect(ui->ingredientsListView->selectionModel(),
|
||||
SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
|
||||
this,
|
||||
SLOT(onIngredientsListViewSelectionChanged(QItemSelection)));
|
||||
QObject::connect(ui->tagsListView->selectionModel(),
|
||||
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this,
|
||||
|
@ -23,9 +18,7 @@ OpenRecipeDialog::OpenRecipeDialog(QWidget *parent) :
|
|||
|
||||
OpenRecipeDialog::OpenRecipeDialog(RecipeDatabase *recipeDB, QWidget *parent) : OpenRecipeDialog(parent){
|
||||
this->recipeDB = recipeDB;
|
||||
this->populateIngredientsList();
|
||||
this->populateTagsList();
|
||||
this->populateFoodGroupsList();
|
||||
this->populateRecipesTable(this->recipeDB->retrieveAllRecipes());
|
||||
}
|
||||
|
||||
|
@ -45,21 +38,10 @@ void OpenRecipeDialog::populateRecipesTable(vector<Recipe> recipes){
|
|||
ui->recipeTableView->show();
|
||||
}
|
||||
|
||||
void OpenRecipeDialog::populateIngredientsList(){
|
||||
this->ingredientsModel.setIngredients(this->recipeDB->retrieveAllIngredients());
|
||||
}
|
||||
|
||||
void OpenRecipeDialog::populateTagsList(){
|
||||
this->tagsModel.setTags(this->recipeDB->retrieveAllTags());
|
||||
}
|
||||
|
||||
void OpenRecipeDialog::populateFoodGroupsList(){
|
||||
for (string s : this->recipeDB->retrieveAllFoodGroups()){
|
||||
ui->foodGroupsListWidget->addItem(QString::fromStdString(s));
|
||||
}
|
||||
//ui->foodGroupsListWidget->show();
|
||||
}
|
||||
|
||||
void OpenRecipeDialog::on_deleteRecipeButton_clicked(){
|
||||
QItemSelectionModel *selectModel = ui->recipeTableView->selectionModel();
|
||||
if (!selectModel->hasSelection()){
|
||||
|
|
|
@ -30,14 +30,10 @@ class OpenRecipeDialog : public QDialog
|
|||
|
||||
void on_recipeTableView_doubleClicked(const QModelIndex &index);
|
||||
|
||||
void onIngredientsListViewSelectionChanged(const QItemSelection &selection);
|
||||
|
||||
void onTagsListViewSelectionChanged(const QItemSelection &selection);
|
||||
|
||||
void on_nameEdit_textChanged(const QString &arg1);
|
||||
|
||||
void on_foodGroupsListWidget_itemSelectionChanged();
|
||||
|
||||
void on_clearSearchButton_clicked();
|
||||
|
||||
void on_exitButton_clicked();
|
||||
|
@ -48,13 +44,10 @@ class OpenRecipeDialog : public QDialog
|
|||
RecipeTableModel recipeTableModel;
|
||||
Recipe selectedRecipe;
|
||||
|
||||
IngredientListModel ingredientsModel;
|
||||
TagListModel tagsModel;
|
||||
|
||||
void populateRecipesTable(vector<Recipe> recipes);
|
||||
void populateIngredientsList();
|
||||
void populateTagsList();
|
||||
void populateFoodGroupsList();
|
||||
};
|
||||
|
||||
#endif // OPENRECIPEDIALOG_H
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
|
@ -63,7 +63,7 @@
|
|||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="Tags">
|
||||
<attribute name="icon">
|
||||
|
@ -119,105 +119,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="ingredientsTab">
|
||||
<attribute name="icon">
|
||||
<iconset resource="../res.qrc">
|
||||
<normaloff>:/images/images/ingredients.png</normaloff>:/images/images/ingredients.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string/>
|
||||
</attribute>
|
||||
<attribute name="toolTip">
|
||||
<string>Ingredients</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListView" name="ingredientsListView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="isWrapping" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="foodGroups">
|
||||
<attribute name="icon">
|
||||
<iconset resource="../res.qrc">
|
||||
<normaloff>:/images/images/foodPyramid.png</normaloff>:/images/images/foodPyramid.png</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string/>
|
||||
</attribute>
|
||||
<attribute name="toolTip">
|
||||
<string>Food Groups</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="foodGroupsListWidget">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
Loading…
Reference in New Issue