Adding support for image selection in add recipe dialog.
This commit is contained in:
parent
cb3be5e1e2
commit
041d56e1a9
|
@ -54,4 +54,5 @@ FORMS += gui/mainwindow.ui \
|
|||
DISTFILES += \
|
||||
.gitignore
|
||||
|
||||
RESOURCES +=
|
||||
RESOURCES += \
|
||||
images.qrc
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -336,6 +336,24 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QWidget" name="ingredientsAndImagePanel" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<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="QWidget" name="ingredientsPanel" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
|
@ -377,21 +395,8 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="ingredientsSubPanel" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<item>
|
||||
<widget class="QListView" name="ingredientsListView">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="batchSize">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight|Qt::AlignTop">
|
||||
<widget class="QWidget" name="addIngredientPanel" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<property name="spacing">
|
||||
|
@ -586,6 +591,56 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="ingredientsListView">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="batchSize">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QWidget" name="imagePanel" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<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="QLabel" name="imageDisplayLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<RCC>
|
||||
<qresource prefix="/images">
|
||||
<file>images/no_image.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
|
@ -53,6 +53,10 @@ bool IngredientListModel::addIngredient(RecipeIngredient ri){
|
|||
return true;
|
||||
}
|
||||
|
||||
void IngredientListModel::deleteIngredient(int index){
|
||||
this->ingredients.erase(this->ingredients.begin() + index);
|
||||
}
|
||||
|
||||
vector<RecipeIngredient> IngredientListModel::getIngredients(){
|
||||
return this->ingredients;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,10 @@ bool TagListModel::addTag(RecipeTag tag){
|
|||
return true;
|
||||
}
|
||||
|
||||
void TagListModel::deleteTag(int index){
|
||||
this->tags.erase(this->tags.begin() + index);
|
||||
}
|
||||
|
||||
vector<RecipeTag> TagListModel::getTags(){
|
||||
return this->tags;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue