Fixed author name not showing up.

This commit is contained in:
Andrew Lalis 2018-04-01 09:20:36 +02:00
parent 3c7156c264
commit 5095934931
2 changed files with 7 additions and 2 deletions

View File

@ -24,6 +24,7 @@ void MainWindow::loadFromRecipe(Recipe recipe){
setAuthorName("Click 'New' to get started."); setAuthorName("Click 'New' to get started.");
} else { } else {
setRecipeName(recipe.getName()); setRecipeName(recipe.getName());
setAuthorName(recipe.getAuthor());
setInstruction(recipe.getInstruction()); setInstruction(recipe.getInstruction());
setIngredients(recipe.getIngredients()); setIngredients(recipe.getIngredients());
if (recipe.getImage().isNull()){ if (recipe.getImage().isNull()){
@ -72,7 +73,11 @@ void MainWindow::setTags(vector<RecipeTag> tags){
} }
void MainWindow::setAuthorName(string name){ void MainWindow::setAuthorName(string name){
ui->authorLabel->setText(QString::fromStdString(name)); if (name.empty()){
ui->authorLabel->setText("");
} else {
ui->authorLabel->setText(QString::fromStdString("By "+name));
}
} }
void MainWindow::on_newButton_clicked(){ void MainWindow::on_newButton_clicked(){

View File

@ -373,7 +373,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>20</pointsize> <pointsize>16</pointsize>
</font> </font>
</property> </property>
<property name="text"> <property name="text">