diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index 21932c050..ef0d0bbb7 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -647,16 +647,14 @@ void DiagramView::editDiagramProperties() { BorderPropertiesWidget *border_infos = new BorderPropertiesWidget(border, &popup); border_infos -> setReadOnly(diagram_is_read_only); - TitleBlockPropertiesWidget *titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, &popup); + TitleBlockPropertiesWidget *titleblock_infos; if (QETProject *parent_project = scene -> project()) { - titleblock_infos -> setTitleBlockTemplatesCollection(parent_project -> embeddedTitleBlockTemplatesCollection()); - titleblock_infos -> setTitleBlockTemplatesVisible(true); - // we have to parse again the TitleBlockProperties object, since the - // first parsing did not know of our templates - titleblock_infos -> setProperties(titleblock); - // relay the signal that requires a title block template edition + titleblock_infos = new TitleBlockPropertiesWidget(parent_project -> embeddedTitleBlockTemplatesCollection(), titleblock, false, &popup); connect(titleblock_infos, SIGNAL(editTitleBlockTemplate(QString, bool)), this, SIGNAL(editTitleBlockTemplate(QString, bool))); } + else + titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, &popup); + titleblock_infos -> setReadOnly(diagram_is_read_only); ConductorPropertiesWidget *cpw = new ConductorPropertiesWidget(conductors); diff --git a/sources/ui/titleblockpropertieswidget.cpp b/sources/ui/titleblockpropertieswidget.cpp index 1d4123750..13278436a 100644 --- a/sources/ui/titleblockpropertieswidget.cpp +++ b/sources/ui/titleblockpropertieswidget.cpp @@ -39,6 +39,25 @@ TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(const TitleBlockPropertie setProperties(titleblock); } +/** + * @brief TitleBlockPropertiesWidget::TitleBlockPropertiesWidget + * default constructor with tempalte list + * @param tbt_collection template list + * @param titleblock properties to edit + * @param current_date if true, display the radio button "current date" + * @param parent parent widget + */ +TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock, bool current_date, QWidget *parent) : + QWidget(parent), + ui(new Ui::TitleBlockPropertiesWidget), + m_tbt_collection(nullptr) +{ + ui->setupUi(this); + initDialog(current_date); + setTitleBlockTemplatesCollection(tbt_collection); + setProperties(titleblock); +} + /** * @brief TitleBlockPropertiesWidget::~TitleBlockPropertiesWidget * destructor @@ -58,11 +77,12 @@ void TitleBlockPropertiesWidget::setProperties(const TitleBlockProperties &prope ui -> m_file_le -> setText (properties.filename); ui -> m_folio_le -> setText (properties.folio); - //About date - on_m_fixed_date_rb_toggled(ui->m_fixed_date_rb->isChecked()); - ui -> m_date_edit -> setDate(QDate::currentDate()); + //About date + ui -> m_date_now_pb -> setDisabled(true); + ui -> m_date_edit -> setDisabled(true); + ui -> m_date_edit -> setDate(QDate::currentDate()); - if (ui -> m_current_date_rb -> isVisible()) { + if (!ui -> m_current_date_rb -> isHidden()) { if(properties.useDate == TitleBlockProperties::CurrentDate) ui -> m_current_date_rb -> setChecked(true); else { @@ -175,6 +195,7 @@ void TitleBlockPropertiesWidget::setCurrentTitleBlockTemplateName (const QString */ void TitleBlockPropertiesWidget::setTitleBlockTemplatesCollection(TitleBlockTemplatesCollection *tbt_collection) { if (!tbt_collection) return; + setTitleBlockTemplatesVisible(true); if (m_tbt_collection && tbt_collection != m_tbt_collection) { // forget any connection with the previous collection disconnect(m_tbt_collection, 0, this, 0); @@ -272,13 +293,3 @@ void TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate(QString name) { void TitleBlockPropertiesWidget::on_m_date_now_pb_clicked() { ui -> m_date_edit -> setDate(QDate::currentDate()); } - -/** - * @brief TitleBlockPropertiesWidget::on_m_fixed_date_rb_toggled - * Disable widget related to fixed date, if radio button - * current date isn't checked - */ -void TitleBlockPropertiesWidget::on_m_fixed_date_rb_toggled(bool checked) { - ui -> m_date_edit -> setEnabled(checked); - ui -> m_date_now_pb -> setEnabled(checked); -} diff --git a/sources/ui/titleblockpropertieswidget.h b/sources/ui/titleblockpropertieswidget.h index 07ecb703f..4205941c9 100644 --- a/sources/ui/titleblockpropertieswidget.h +++ b/sources/ui/titleblockpropertieswidget.h @@ -35,6 +35,7 @@ class TitleBlockPropertiesWidget : public QWidget public: explicit TitleBlockPropertiesWidget(const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0); + explicit TitleBlockPropertiesWidget(TitleBlockTemplatesCollection *tbt_collection, const TitleBlockProperties &titleblock = TitleBlockProperties(), bool current_date = false, QWidget *parent = 0); ~TitleBlockPropertiesWidget(); void setProperties(const TitleBlockProperties &properties); @@ -56,7 +57,6 @@ class TitleBlockPropertiesWidget : public QWidget void updateTemplateList(); void changeCurrentTitleBlockTemplate(QString name); void on_m_date_now_pb_clicked(); - void on_m_fixed_date_rb_toggled(bool checked); signals: void editTitleBlockTemplate(const QString &, bool); diff --git a/sources/ui/titleblockpropertieswidget.ui b/sources/ui/titleblockpropertieswidget.ui index ad53f9483..a6bdd26d0 100644 --- a/sources/ui/titleblockpropertieswidget.ui +++ b/sources/ui/titleblockpropertieswidget.ui @@ -6,8 +6,8 @@ 0 0 - 508 - 567 + 449 + 387 @@ -35,7 +35,7 @@ - Informations du cartouche + Informations des cartouche false @@ -78,7 +78,7 @@ - + 0 0 @@ -280,5 +280,38 @@ associer le nom "volta" et la valeur "1745" remplacera %{vol - + + + m_fixed_date_rb + toggled(bool) + m_date_edit + setEnabled(bool) + + + 146 + 199 + + + 275 + 199 + + + + + m_fixed_date_rb + toggled(bool) + m_date_now_pb + setEnabled(bool) + + + 102 + 214 + + + 401 + 214 + + + +