mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-03 17:34:12 +02:00
Merge pull request #1239 from ispyisail/fix/project-properties-page-num-placeholder
Fix Project properties saving the Page Num placeholder as a numbering
This commit is contained in:
@@ -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<int>(&QComboBox::activated),
|
||||
this, [this]() { m_auto_page_num_picked = true; });
|
||||
}
|
||||
else{
|
||||
ui->auto_page_cb->hide();
|
||||
|
||||
@@ -105,6 +105,10 @@ class TitleBlockPropertiesWidget : public QWidget
|
||||
QList <TitleBlockTemplatesCollection *> m_tbt_collection_list;
|
||||
QList <QET::QetCollection> m_map_index_to_collection_type;
|
||||
QList <QString> 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
|
||||
|
||||
Reference in New Issue
Block a user