mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
titleblockpropertieswidget : edit and duplicate titleblock work in every case.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4618 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -120,8 +120,6 @@ class DiagramView : public QGraphicsView
|
|||||||
void findElementRequired(const ElementsLocation &);
|
void findElementRequired(const ElementsLocation &);
|
||||||
/// Signal emitted when users wish to edit an element from the diagram
|
/// Signal emitted when users wish to edit an element from the diagram
|
||||||
void editElementRequired(const ElementsLocation &);
|
void editElementRequired(const ElementsLocation &);
|
||||||
/// Signal emitted when users want to edit and/or duplicate an existing title block template
|
|
||||||
void editTitleBlockTemplate(const QString &, bool);
|
|
||||||
/// Signal emmitted when diagram must be show
|
/// Signal emmitted when diagram must be show
|
||||||
void showDiagram (Diagram *);
|
void showDiagram (Diagram *);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2006-2016 The QElectroTech Team
|
Copyright 2006-2016 The QElectroTech Team
|
||||||
This file is part of QElectroTech.
|
This file is part of QElectroTech.
|
||||||
@@ -20,13 +18,11 @@
|
|||||||
#ifndef PROJECTCONFIGPAGES_H
|
#ifndef PROJECTCONFIGPAGES_H
|
||||||
#define PROJECTCONFIGPAGES_H
|
#define PROJECTCONFIGPAGES_H
|
||||||
#include "configpage.h"
|
#include "configpage.h"
|
||||||
#include <QtWidgets>
|
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QETProject;
|
class QETProject;
|
||||||
class BorderPropertiesWidget;
|
class BorderPropertiesWidget;
|
||||||
class TitleBlockPropertiesWidget;
|
|
||||||
class ConductorPropertiesWidget;
|
class ConductorPropertiesWidget;
|
||||||
class DiagramContextWidget;
|
class DiagramContextWidget;
|
||||||
class ReportPropertieWidget;
|
class ReportPropertieWidget;
|
||||||
@@ -37,6 +33,8 @@ class QPushButton;
|
|||||||
class FolioAutonumberingW;
|
class FolioAutonumberingW;
|
||||||
class ElementAutonumberingW;
|
class ElementAutonumberingW;
|
||||||
class AutoNumberingManagementW;
|
class AutoNumberingManagementW;
|
||||||
|
class QTabWidget;
|
||||||
|
class QScrollArea;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class, derived from ConfigPage, aims at providing the basic skeleton
|
This class, derived from ConfigPage, aims at providing the basic skeleton
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ void ProjectView::setProject(QETProject *project) {
|
|||||||
@return la liste des schemas ouverts dans le projet
|
@return la liste des schemas ouverts dans le projet
|
||||||
*/
|
*/
|
||||||
QList<DiagramView *> ProjectView::diagrams() const {
|
QList<DiagramView *> ProjectView::diagrams() const {
|
||||||
return(diagrams_);
|
return(m_diagram_view_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -406,27 +406,26 @@ void ProjectView::addNewDiagramFolioList() {
|
|||||||
* @param front: true add page at front
|
* @param front: true add page at front
|
||||||
* false add page at back
|
* false add page at back
|
||||||
*/
|
*/
|
||||||
void ProjectView::addDiagram(DiagramView *diagram) {
|
void ProjectView::addDiagram(DiagramView *diagram_view) {
|
||||||
if (!diagram) return;
|
if (!diagram_view) return;
|
||||||
|
|
||||||
// check diagram isn't present in the project
|
// check diagram isn't present in the project
|
||||||
if (diagram_ids_.values().contains(diagram)) return;
|
if (diagram_ids_.values().contains(diagram_view)) return;
|
||||||
|
|
||||||
// Add new tab for the diagram
|
// Add new tab for the diagram
|
||||||
m_tab -> addTab(diagram, QET::Icons::Diagram, diagram -> title());
|
m_tab -> addTab(diagram_view, QET::Icons::Diagram, diagram_view -> title());
|
||||||
diagram -> setFrameStyle(QFrame::Plain | QFrame::NoFrame);
|
diagram_view -> setFrameStyle(QFrame::Plain | QFrame::NoFrame);
|
||||||
|
|
||||||
diagrams_ << diagram;
|
m_diagram_view_list << diagram_view;
|
||||||
|
|
||||||
rebuildDiagramsMap();
|
rebuildDiagramsMap();
|
||||||
connect(diagram, SIGNAL(showDiagram(Diagram*)), this, SLOT(showDiagram(Diagram*)));
|
connect(diagram_view, SIGNAL(showDiagram(Diagram*)), this, SLOT(showDiagram(Diagram*)));
|
||||||
connect(diagram, SIGNAL(titleChanged(DiagramView *, const QString &)), this, SLOT(updateTabTitle(DiagramView *, const QString &)));
|
connect(diagram_view, SIGNAL(titleChanged(DiagramView *, const QString &)), this, SLOT(updateTabTitle(DiagramView *, const QString &)));
|
||||||
connect(diagram, SIGNAL(findElementRequired(const ElementsLocation &)), this, SIGNAL(findElementRequired(const ElementsLocation &)));
|
connect(diagram_view, SIGNAL(findElementRequired(const ElementsLocation &)), this, SIGNAL(findElementRequired(const ElementsLocation &)));
|
||||||
connect(diagram, SIGNAL(editElementRequired(const ElementsLocation &)), this, SIGNAL(editElementRequired(const ElementsLocation &)));
|
connect(diagram_view, SIGNAL(editElementRequired(const ElementsLocation &)), this, SIGNAL(editElementRequired(const ElementsLocation &)));
|
||||||
connect(diagram, SIGNAL(editTitleBlockTemplate(const QString &, bool)), this, SLOT(editTitleBlockTemplateRequired(const QString &, bool)));
|
|
||||||
|
|
||||||
// signal diagram was added
|
// signal diagram was added
|
||||||
emit(diagramAdded(diagram));
|
emit(diagramAdded(diagram_view));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -456,7 +455,7 @@ void ProjectView::removeDiagram(DiagramView *diagram_view) {
|
|||||||
// enleve le DiagramView des onglets
|
// enleve le DiagramView des onglets
|
||||||
int diagram_tab_id = diagram_ids_.key(diagram_view);
|
int diagram_tab_id = diagram_ids_.key(diagram_view);
|
||||||
m_tab -> removeTab(diagram_tab_id);
|
m_tab -> removeTab(diagram_tab_id);
|
||||||
diagrams_.removeAll(diagram_view);
|
m_diagram_view_list.removeAll(diagram_view);
|
||||||
rebuildDiagramsMap();
|
rebuildDiagramsMap();
|
||||||
|
|
||||||
// supprime le DiagramView, puis le Diagram
|
// supprime le DiagramView, puis le Diagram
|
||||||
@@ -961,22 +960,6 @@ void ProjectView::tabMoved(int from, int to) {
|
|||||||
emit(diagramOrderChanged(this, from, to));
|
emit(diagramOrderChanged(this, from, to));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Require the edition of the \a template_name title blocke template.
|
|
||||||
@param template_name Name of the tempalte to be edited
|
|
||||||
@param duplicate If true, this methd will ask the user for a template name
|
|
||||||
in order to duplicate the \a template_name template
|
|
||||||
*/
|
|
||||||
void ProjectView::editTitleBlockTemplateRequired(const QString &template_name, bool duplicate) {
|
|
||||||
if (!m_project) return;
|
|
||||||
emit(
|
|
||||||
editTitleBlockTemplate(
|
|
||||||
m_project -> embeddedTitleBlockTemplatesCollection() -> location(template_name),
|
|
||||||
duplicate
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@param diagram Schema a trouver
|
@param diagram Schema a trouver
|
||||||
@return le DiagramView correspondant au schema passe en parametre, ou 0 si
|
@return le DiagramView correspondant au schema passe en parametre, ou 0 si
|
||||||
@@ -998,7 +981,7 @@ void ProjectView::rebuildDiagramsMap() {
|
|||||||
// vide la map
|
// vide la map
|
||||||
diagram_ids_.clear();
|
diagram_ids_.clear();
|
||||||
|
|
||||||
foreach(DiagramView *diagram_view, diagrams_) {
|
foreach(DiagramView *diagram_view, m_diagram_view_list) {
|
||||||
int dv_idx = m_tab -> indexOf(diagram_view);
|
int dv_idx = m_tab -> indexOf(diagram_view);
|
||||||
if (dv_idx == -1) continue;
|
if (dv_idx == -1) continue;
|
||||||
diagram_ids_.insert(dv_idx, diagram_view);
|
diagram_ids_.insert(dv_idx, diagram_view);
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ class ProjectView : public QWidget {
|
|||||||
void updateWindowTitle();
|
void updateWindowTitle();
|
||||||
void updateTabTitle(DiagramView *, const QString &);
|
void updateTabTitle(DiagramView *, const QString &);
|
||||||
void tabMoved(int, int);
|
void tabMoved(int, int);
|
||||||
void editTitleBlockTemplateRequired(const QString &, bool);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void diagramAdded(DiagramView *);
|
void diagramAdded(DiagramView *);
|
||||||
@@ -111,7 +110,6 @@ class ProjectView : public QWidget {
|
|||||||
// relayed signals
|
// relayed signals
|
||||||
void findElementRequired(const ElementsLocation &);
|
void findElementRequired(const ElementsLocation &);
|
||||||
void editElementRequired(const ElementsLocation &);
|
void editElementRequired(const ElementsLocation &);
|
||||||
void editTitleBlockTemplate(const TitleBlockTemplateLocation &, bool);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initActions();
|
void initActions();
|
||||||
@@ -145,7 +143,7 @@ class ProjectView : public QWidget {
|
|||||||
QLabel *fallback_label_;
|
QLabel *fallback_label_;
|
||||||
QTabWidget *m_tab;
|
QTabWidget *m_tab;
|
||||||
QMap<int, DiagramView *> diagram_ids_;
|
QMap<int, DiagramView *> diagram_ids_;
|
||||||
QList<DiagramView *> diagrams_;
|
QList<DiagramView *> m_diagram_view_list;
|
||||||
};
|
};
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(ProjectView::ProjectSaveOptions)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(ProjectView::ProjectSaveOptions)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1194,6 +1194,7 @@ void QETApp::configureQET() {
|
|||||||
// cree le dialogue
|
// cree le dialogue
|
||||||
ConfigDialog cd;
|
ConfigDialog cd;
|
||||||
cd.setWindowTitle(tr("Configurer QElectroTech", "window title"));
|
cd.setWindowTitle(tr("Configurer QElectroTech", "window title"));
|
||||||
|
cd.setWindowModality(Qt::WindowModal);
|
||||||
cd.addPage(new GeneralConfigurationPage());
|
cd.addPage(new GeneralConfigurationPage());
|
||||||
cd.addPage(new NewDiagramPage());
|
cd.addPage(new NewDiagramPage());
|
||||||
cd.addPage(new ExportConfigPage());
|
cd.addPage(new ExportConfigPage());
|
||||||
|
|||||||
@@ -1501,7 +1501,6 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view)
|
|||||||
//Manage request for edit or find element and titleblock
|
//Manage request for edit or find element and titleblock
|
||||||
connect(project_view, SIGNAL(findElementRequired(const ElementsLocation &)), this, SLOT(findElementInPanel(const ElementsLocation &)));
|
connect(project_view, SIGNAL(findElementRequired(const ElementsLocation &)), this, SLOT(findElementInPanel(const ElementsLocation &)));
|
||||||
connect(project_view, SIGNAL(editElementRequired(const ElementsLocation &)), this, SLOT(editElementInEditor(const ElementsLocation &)));
|
connect(project_view, SIGNAL(editElementRequired(const ElementsLocation &)), this, SLOT(editElementInEditor(const ElementsLocation &)));
|
||||||
connect(project_view, SIGNAL(editTitleBlockTemplate(const TitleBlockTemplateLocation &, bool)), QETApp::instance(), SLOT(openTitleBlockTemplate(TitleBlockTemplateLocation, bool)));
|
|
||||||
|
|
||||||
// display error messages sent by the project view
|
// display error messages sent by the project view
|
||||||
connect(project_view, SIGNAL(errorEncountered(QString)), this, SLOT(showError(const QString &)));
|
connect(project_view, SIGNAL(errorEncountered(QString)), this, SLOT(showError(const QString &)));
|
||||||
|
|||||||
@@ -54,12 +54,12 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare
|
|||||||
|
|
||||||
//Title block widget
|
//Title block widget
|
||||||
TitleBlockPropertiesWidget *titleblock_infos;
|
TitleBlockPropertiesWidget *titleblock_infos;
|
||||||
if (QETProject *parent_project = diagram -> project()) {
|
|
||||||
|
if (QETProject *parent_project = diagram -> project())
|
||||||
titleblock_infos = new TitleBlockPropertiesWidget(parent_project -> embeddedTitleBlockTemplatesCollection(), titleblock, false, diagram->project(), this);
|
titleblock_infos = new TitleBlockPropertiesWidget(parent_project -> embeddedTitleBlockTemplatesCollection(), titleblock, false, diagram->project(), this);
|
||||||
connect(titleblock_infos, SIGNAL(editTitleBlockTemplate(QString, bool)), diagram->views().first(), SIGNAL(editTitleBlockTemplate(QString, bool)));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, diagram->project(), this);
|
titleblock_infos = new TitleBlockPropertiesWidget(titleblock, false, diagram->project(), this);
|
||||||
|
|
||||||
titleblock_infos -> setReadOnly(diagram_is_read_only);
|
titleblock_infos -> setReadOnly(diagram_is_read_only);
|
||||||
connect(titleblock_infos,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(editAutoFolioNum()));
|
connect(titleblock_infos,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(editAutoFolioNum()));
|
||||||
titleblock_infos->setMinimumSize(590,480); //Minimum Size needed for correct display
|
titleblock_infos->setMinimumSize(590,480); //Minimum Size needed for correct display
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ ProjectPropertiesDialog::~ProjectPropertiesDialog () {
|
|||||||
* execute this dialog.
|
* execute this dialog.
|
||||||
*/
|
*/
|
||||||
void ProjectPropertiesDialog::exec() {
|
void ProjectPropertiesDialog::exec() {
|
||||||
|
m_properties_dialog->setWindowModality(Qt::WindowModal);
|
||||||
m_properties_dialog -> exec();
|
m_properties_dialog -> exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "templatescollection.h"
|
#include "templatescollection.h"
|
||||||
#include "qeticons.h"
|
#include "qeticons.h"
|
||||||
#include "titleblocktemplate.h"
|
#include "titleblocktemplate.h"
|
||||||
|
#include "qetapp.h"
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -216,6 +217,20 @@ TitleBlockProperties TitleBlockPropertiesWidget::propertiesAutoNum(QString autoN
|
|||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TitleBlockTemplateLocation TitleBlockPropertiesWidget::currentTitleBlockLocation() const
|
||||||
|
{
|
||||||
|
QET::QetCollection qc = m_map_index_to_collection_type.at(ui->m_tbt_cb->currentIndex());
|
||||||
|
TitleBlockTemplatesCollection *collection = nullptr;
|
||||||
|
foreach (TitleBlockTemplatesCollection *c, m_tbt_collection_list)
|
||||||
|
if (c -> collection() == qc)
|
||||||
|
collection = c;
|
||||||
|
|
||||||
|
if (!collection)
|
||||||
|
return TitleBlockTemplateLocation();
|
||||||
|
|
||||||
|
return collection->location(currentTitleBlockTemplateName());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief TitleBlockPropertiesWidget::setTitleBlockTemplatesVisible
|
* @brief TitleBlockPropertiesWidget::setTitleBlockTemplatesVisible
|
||||||
* if true, title block template combo box and menu button is visible
|
* if true, title block template combo box and menu button is visible
|
||||||
@@ -313,11 +328,11 @@ int TitleBlockPropertiesWidget::getIndexFor(const QString &tbt_name, const QET::
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TitleBlockPropertiesWidget::editCurrentTitleBlockTemplate() {
|
void TitleBlockPropertiesWidget::editCurrentTitleBlockTemplate() {
|
||||||
emit(editTitleBlockTemplate(currentTitleBlockTemplateName(), false));
|
QETApp::instance()->openTitleBlockTemplate(currentTitleBlockLocation(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleBlockPropertiesWidget::duplicateCurrentTitleBlockTemplate() {
|
void TitleBlockPropertiesWidget::duplicateCurrentTitleBlockTemplate() {
|
||||||
emit(editTitleBlockTemplate(currentTitleBlockTemplateName(), true));
|
QETApp::instance()->openTitleBlockTemplate(currentTitleBlockLocation(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class TitleBlockPropertiesWidget : public QWidget
|
|||||||
void setProperties(const TitleBlockProperties &properties);
|
void setProperties(const TitleBlockProperties &properties);
|
||||||
TitleBlockProperties properties() const;
|
TitleBlockProperties properties() const;
|
||||||
TitleBlockProperties propertiesAutoNum(QString autoNum) const;
|
TitleBlockProperties propertiesAutoNum(QString autoNum) const;
|
||||||
|
TitleBlockTemplateLocation currentTitleBlockLocation () const;
|
||||||
void setPropertiesWithAutoNum(const TitleBlockProperties &properties, QString autoNum);
|
void setPropertiesWithAutoNum(const TitleBlockProperties &properties, QString autoNum);
|
||||||
|
|
||||||
void setTitleBlockTemplatesVisible(const bool &visible);
|
void setTitleBlockTemplatesVisible(const bool &visible);
|
||||||
@@ -67,7 +68,6 @@ class TitleBlockPropertiesWidget : public QWidget
|
|||||||
void on_m_edit_autofolionum_pb_clicked();
|
void on_m_edit_autofolionum_pb_clicked();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void editTitleBlockTemplate(const QString &, bool);
|
|
||||||
void set_auto_page_num() const;
|
void set_auto_page_num() const;
|
||||||
void openAutoNumFolioEditor (QString);
|
void openAutoNumFolioEditor (QString);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user