diff --git a/sources/ui/titleblockpropertieswidget.cpp b/sources/ui/titleblockpropertieswidget.cpp index 929b557c2..f0d99a61a 100644 --- a/sources/ui/titleblockpropertieswidget.cpp +++ b/sources/ui/titleblockpropertieswidget.cpp @@ -123,6 +123,8 @@ void TitleBlockPropertiesWidget::setProperties( ui -> m_folio_le -> setText (properties.folio); ui -> m_display_at_cb -> setCurrentIndex(properties.display_at == Qt::BottomEdge ? 0 : 1); ui->auto_page_cb->setCurrentText(properties.auto_page_num); + m_auto_page_num = properties.auto_page_num; + m_auto_page_num_picked = false; //About date ui -> m_date_now_pb -> setDisabled(true); @@ -216,7 +218,13 @@ TitleBlockProperties TitleBlockPropertiesWidget::properties() const prop.context = m_dcw -> context(); - prop.auto_page_num = ui->auto_page_cb->currentText(); + //The combo box cannot show "no folio numbering": it shows its + //placeholder entry, or the project's first numbering. Return what + //was set unless the user picked something else. + if (!m_auto_page_num_picked) + prop.auto_page_num = m_auto_page_num; + else if (ui->auto_page_cb->currentText() != tr("Créer un Folio Numérotation Auto")) + prop.auto_page_num = ui->auto_page_cb->currentText(); return prop; } @@ -376,6 +384,9 @@ void TitleBlockPropertiesWidget::initDialog( foreach (QString str, keys_2) { ui -> auto_page_cb -> addItem(str); } if (ui->auto_page_cb->currentText()==nullptr) ui->auto_page_cb->addItem(tr("Créer un Folio Numérotation Auto")); + //activated() is only emitted for a choice the user makes + connect(ui->auto_page_cb, qOverload(&QComboBox::activated), + this, [this]() { m_auto_page_num_picked = true; }); } else{ ui->auto_page_cb->hide(); diff --git a/sources/ui/titleblockpropertieswidget.h b/sources/ui/titleblockpropertieswidget.h index 0622da8a5..6736bfcdf 100644 --- a/sources/ui/titleblockpropertieswidget.h +++ b/sources/ui/titleblockpropertieswidget.h @@ -105,6 +105,10 @@ class TitleBlockPropertiesWidget : public QWidget QList m_tbt_collection_list; QList m_map_index_to_collection_type; QList keys_2; + /// auto_page_num as given to setProperties(), returned + /// unchanged unless the user picks another folio numbering + QString m_auto_page_num; + bool m_auto_page_num_picked = false; }; #endif // TITLEBLOCKPROPERTIESWIDGET_H