mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-03 01:04:13 +02:00
003eda2cb8
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>
115 lines
3.7 KiB
C++
115 lines
3.7 KiB
C++
/*
|
|
Copyright 2006-2026 The QElectroTech Team
|
|
This file is part of QElectroTech.
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef TITLEBLOCKPROPERTIESWIDGET_H
|
|
#define TITLEBLOCKPROPERTIESWIDGET_H
|
|
|
|
#include "../autoNum/numerotationcontext.h"
|
|
#include "../qet.h"
|
|
#include "../qetproject.h"
|
|
#include "../titleblockproperties.h"
|
|
#include "diagramcontextwidget.h"
|
|
|
|
#include <QWidget>
|
|
|
|
class NumerotationContext;
|
|
class QETProject;
|
|
class QMenu;
|
|
class TitleBlockTemplatesCollection;
|
|
class TitleBlockTemplate;
|
|
|
|
namespace Ui {
|
|
class TitleBlockPropertiesWidget;
|
|
}
|
|
|
|
class TitleBlockPropertiesWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit TitleBlockPropertiesWidget(
|
|
const TitleBlockProperties &titleblock = TitleBlockProperties(),
|
|
bool current_date = false,
|
|
QETProject *project = nullptr,
|
|
QWidget *parent = nullptr);
|
|
explicit TitleBlockPropertiesWidget(
|
|
TitleBlockTemplatesCollection *tbt_collection,
|
|
const TitleBlockProperties &titleblock = TitleBlockProperties(),
|
|
bool current_date = false,
|
|
QETProject *project = nullptr,
|
|
QWidget *parent = nullptr);
|
|
explicit TitleBlockPropertiesWidget(
|
|
QList <TitleBlockTemplatesCollection *> tbt_collection,
|
|
const TitleBlockProperties &titleblock = TitleBlockProperties(),
|
|
bool current_date = false,
|
|
QETProject *project = nullptr,
|
|
QWidget *parent = nullptr);
|
|
~TitleBlockPropertiesWidget() override;
|
|
|
|
void setProperties(const TitleBlockProperties &properties);
|
|
TitleBlockProperties properties() const;
|
|
TitleBlockProperties propertiesAutoNum(QString autoNum) const;
|
|
TitleBlockTemplateLocation currentTitleBlockLocation () const;
|
|
void setPropertiesWithAutoNum(
|
|
const TitleBlockProperties &properties,
|
|
QString autoNum);
|
|
|
|
void setTitleBlockTemplatesVisible(const bool &visible);
|
|
void setReadOnly (const bool &ro);
|
|
|
|
static void addTemplateVariables(
|
|
DiagramContext &context,
|
|
const TitleBlockTemplate *tpl);
|
|
|
|
private:
|
|
void addCollection (
|
|
TitleBlockTemplatesCollection *tbt_collection);
|
|
QString currentTitleBlockTemplateName () const;
|
|
void initDialog(const bool ¤t_date, QETProject *project);
|
|
int getIndexFor (const QString &tbt_name,
|
|
const QET::QetCollection collection) const;
|
|
TitleBlockTemplate *templateForIndex (int index) const;
|
|
void addTemplateVariables (DiagramContext &context, int index) const;
|
|
|
|
private slots:
|
|
void editCurrentTitleBlockTemplate();
|
|
void duplicateCurrentTitleBlockTemplate();
|
|
void updateTemplateList();
|
|
void changeCurrentTitleBlockTemplate(int);
|
|
void on_m_date_now_pb_clicked();
|
|
void on_m_edit_autofolionum_pb_clicked();
|
|
|
|
signals:
|
|
void set_auto_page_num() const;
|
|
void openAutoNumFolioEditor (QString);
|
|
|
|
private:
|
|
Ui::TitleBlockPropertiesWidget *ui;
|
|
DiagramContextWidget *m_dcw;
|
|
QAction *m_tbt_edit, *m_tbt_duplicate;
|
|
QMenu *m_tbt_menu;
|
|
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
|