mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-03 17:34:12 +02:00
Fix Project properties saving the Page Num placeholder as a numbering name
In Projet > Propriétés du projet > Nouveau folio, the Page Num box shows a "Créer un Folio Numérotation Auto" entry when the project has no folio auto-numbering. Pressing OK, even without touching anything, returned that entry's text as the numbering's name: it was saved in the project as auto_page_num (in the interface's language), and since it differed from the stored empty value the project was marked modified. When the project has numberings, an empty stored value cannot be shown at all, so the first numbering came back instead. Return the stored value unless the user picks an entry (activated() is only emitted for a user's choice), and never return the placeholder. Checked in the GUI on grafcet, schema_indus and Projet_vierge: after OK with no edit and Ctrl+S, master saves auto_page_num="Créer un Folio Numérotation Auto"; this branch keeps auto_page_num="". An edited field on the same page (default author) is still saved. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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();
|
||||
|
||||
Reference in New Issue
Block a user