mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Diagram : Constructor need a QETProject
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3564 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -41,20 +41,23 @@ const qreal Diagram::margin = 5.0;
|
||||
|
||||
// static variable to keep track of present background color of the diagram.
|
||||
QColor Diagram::background_color = Qt::white;
|
||||
|
||||
/**
|
||||
Constructeur
|
||||
@param parent Le QObject parent du schema
|
||||
*/
|
||||
Diagram::Diagram(QObject *parent) :
|
||||
QGraphicsScene(parent),
|
||||
project_(0),
|
||||
diagram_qet_version_(-1),
|
||||
draw_grid_(true),
|
||||
use_border_(true),
|
||||
draw_terminals_(true),
|
||||
draw_colored_conductors_(true),
|
||||
read_only_(false)
|
||||
* @brief Diagram::Diagram
|
||||
* Constructor
|
||||
* @param project : The project of this diagram and also parent QObject
|
||||
*/
|
||||
Diagram::Diagram(QETProject *project) :
|
||||
QGraphicsScene (project),
|
||||
project_ (nullptr),
|
||||
diagram_qet_version_ (-1),
|
||||
draw_grid_ (true),
|
||||
use_border_ (true),
|
||||
draw_terminals_ (true),
|
||||
draw_colored_conductors_ (true),
|
||||
read_only_ (false)
|
||||
{
|
||||
setProject(project);
|
||||
qgi_manager_ = new QGIManager(this);
|
||||
setBackgroundBrush(Qt::white);
|
||||
conductor_setter_ = new QGraphicsLineItem(0, 0);
|
||||
@@ -66,18 +69,12 @@ Diagram::Diagram(QObject *parent) :
|
||||
conductor_setter_ -> setPen(t);
|
||||
conductor_setter_ -> setLine(QLineF(QPointF(0.0, 0.0), QPointF(0.0, 0.0)));
|
||||
|
||||
// initialise les objets gerant les deplacements
|
||||
elements_mover_ = new ElementsMover(); // deplacements d'elements/conducteurs/textes
|
||||
element_texts_mover_ = new ElementTextsMover(); // deplacements d'ElementTextItem
|
||||
//Init object for manage movement
|
||||
elements_mover_ = new ElementsMover();
|
||||
element_texts_mover_ = new ElementTextsMover();
|
||||
|
||||
connect(
|
||||
&border_and_titleblock, SIGNAL(needTitleBlockTemplate(const QString &)),
|
||||
this, SLOT(setTitleBlockTemplate(const QString &))
|
||||
);
|
||||
connect(
|
||||
&border_and_titleblock, SIGNAL(diagramTitleChanged(const QString &)),
|
||||
this, SLOT(titleChanged(const QString &))
|
||||
);
|
||||
connect(&border_and_titleblock, SIGNAL(needTitleBlockTemplate(const QString &)), this, SLOT(setTitleBlockTemplate(const QString &)));
|
||||
connect(&border_and_titleblock, SIGNAL(diagramTitleChanged(const QString &)), this, SLOT(titleChanged(const QString &)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1203,18 +1200,24 @@ QETProject *Diagram::project() const {
|
||||
|
||||
/**
|
||||
* @brief Diagram::setProject
|
||||
* @param project: set parent project of this diagram or 0 if this diagram haven't got a parent project
|
||||
* Set parent project of this diagram, project also become the parent QObject of this diagram
|
||||
* @param project new project
|
||||
*/
|
||||
void Diagram::setProject(QETProject *project) {
|
||||
if (project_) {
|
||||
disconnect (project_, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
|
||||
disconnect (project_, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
|
||||
void Diagram::setProject(QETProject *project)
|
||||
{
|
||||
if (project_ == project) return;
|
||||
|
||||
if (project_)
|
||||
{
|
||||
disconnect (project_, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
|
||||
disconnect (project_, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
|
||||
}
|
||||
|
||||
project_ = project;
|
||||
if (project_) {
|
||||
connect (project_, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
|
||||
connect (project_, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
|
||||
}
|
||||
setParent (project);
|
||||
|
||||
connect (project_, SIGNAL(reportPropertiesChanged(QString)), this, SIGNAL(reportPropertiesChanged(QString)));
|
||||
connect (project_, SIGNAL(XRefPropertiesChanged()), this, SIGNAL(XRefPropertiesChanged()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,16 +47,16 @@ class ElementTextsMover;
|
||||
This class represents an electric diagram. It manages its various child
|
||||
elements, conductors and texts and handles their graphic rendering.
|
||||
*/
|
||||
class Diagram : public QGraphicsScene {
|
||||
class Diagram : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
// constructors, destructor
|
||||
// constructors, destructor
|
||||
public:
|
||||
Diagram(QObject * = 0);
|
||||
virtual ~Diagram();
|
||||
|
||||
Diagram(QETProject *project);
|
||||
virtual ~Diagram();
|
||||
private:
|
||||
Diagram(const Diagram &diagram);
|
||||
Diagram(const Diagram &diagram);
|
||||
|
||||
// ATTRIBUTES
|
||||
public:
|
||||
|
||||
@@ -24,16 +24,12 @@ qreal DiagramFolioList::colWidths[4] = {0.1, 0.55, 0.2, 0.15};
|
||||
/**
|
||||
* @brief DiagramFolioList::DiagramFolioList
|
||||
* Constructor
|
||||
* @param project QETproject *: The project from which this constructor was called. Important to setProject().
|
||||
* @param parent parent QObject
|
||||
* @param project : The project of this diagram and also parent QObject
|
||||
*/
|
||||
DiagramFolioList::DiagramFolioList( QETProject *project, QObject *parent) : Diagram(parent) {
|
||||
if (project) {
|
||||
setProject(project);
|
||||
id = project -> getFolioSheetsQuantity();
|
||||
}
|
||||
else
|
||||
id = 0;
|
||||
DiagramFolioList::DiagramFolioList( QETProject *project) :
|
||||
Diagram(project)
|
||||
{
|
||||
id = project -> getFolioSheetsQuantity();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
class DiagramFolioList : public Diagram
|
||||
{
|
||||
public:
|
||||
DiagramFolioList( QETProject *project = 0, QObject *parent = 0);
|
||||
DiagramFolioList(QETProject *project);
|
||||
virtual ~DiagramFolioList();
|
||||
virtual QList<QLineF *> lines() const {return list_lines_;}
|
||||
virtual QList<QRectF *> rectangles() const {return list_rectangles_;}
|
||||
|
||||
@@ -902,7 +902,7 @@ Diagram *QETProject::addNewDiagram() {
|
||||
if (isReadOnly()) return(0);
|
||||
|
||||
// cree un nouveau schema
|
||||
Diagram *diagram = new Diagram();
|
||||
Diagram *diagram = new Diagram(this);
|
||||
|
||||
// lui transmet les parametres par defaut
|
||||
diagram -> border_and_titleblock.importBorder(defaultBorderProperties());
|
||||
@@ -1120,8 +1120,7 @@ void QETProject::readDiagramsXml() {
|
||||
dlgWaiting->setProgressBar(i+1);
|
||||
if (diagram_nodes.at(i).isElement()) {
|
||||
QDomElement diagram_xml_element = diagram_nodes.at(i).toElement();
|
||||
Diagram *diagram = new Diagram();
|
||||
diagram -> setProject(this);
|
||||
Diagram *diagram = new Diagram(this);
|
||||
bool diagram_loading = diagram -> initFromXml(diagram_xml_element);
|
||||
if (diagram_loading) {
|
||||
dlgWaiting->setDetail( diagram->title() );
|
||||
|
||||
Reference in New Issue
Block a user