2014-02-22 17:24:20 +00:00
|
|
|
/*
|
2025-01-04 13:37:40 +01:00
|
|
|
Copyright 2006-2025 The QElectroTech Team
|
2014-02-22 17:24:20 +00:00
|
|
|
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/>.
|
|
|
|
*/
|
2014-02-18 20:44:54 +00:00
|
|
|
#ifndef MASTERELEMENT_H
|
|
|
|
#define MASTERELEMENT_H
|
|
|
|
|
2018-08-23 19:41:58 +00:00
|
|
|
#include "element.h"
|
2014-07-21 20:44:32 +00:00
|
|
|
|
|
|
|
class CrossRefItem;
|
2014-10-28 15:45:28 +00:00
|
|
|
|
|
|
|
/**
|
2020-08-16 11:19:36 +02:00
|
|
|
@brief The MasterElement class
|
|
|
|
This class is a custom element, with extended behavior
|
|
|
|
to be a master element. Master element can be linked with slave element
|
|
|
|
and display a cross ref item for know with what other element he is linked
|
|
|
|
*/
|
2018-08-23 19:41:58 +00:00
|
|
|
class MasterElement : public Element
|
2014-02-18 20:44:54 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2020-09-07 22:03:40 +02:00
|
|
|
|
2014-02-18 20:44:54 +00:00
|
|
|
public:
|
2020-09-07 22:03:40 +02:00
|
|
|
explicit MasterElement(
|
|
|
|
const ElementsLocation &,
|
|
|
|
QGraphicsItem * = nullptr,
|
|
|
|
int * = nullptr);
|
2017-08-05 02:10:01 +00:00
|
|
|
~MasterElement() override;
|
2014-10-28 15:45:28 +00:00
|
|
|
|
2017-08-05 02:10:01 +00:00
|
|
|
void linkToElement (Element *elmt) override;
|
|
|
|
void unlinkAllElements () override;
|
|
|
|
void unlinkElement (Element *elmt) override;
|
|
|
|
void initLink (QETProject *project) override;
|
2018-02-01 18:42:26 +00:00
|
|
|
QRectF XrefBoundingRect() const;
|
2018-01-19 12:17:20 +00:00
|
|
|
|
|
|
|
protected:
|
2020-09-07 22:03:40 +02:00
|
|
|
QVariant itemChange(
|
|
|
|
GraphicsItemChange change,
|
|
|
|
const QVariant &value) override;
|
2014-02-18 20:44:54 +00:00
|
|
|
|
2014-10-31 10:22:46 +00:00
|
|
|
private:
|
2018-01-19 12:17:20 +00:00
|
|
|
void xrefPropertiesChanged();
|
|
|
|
void aboutDeleteXref ();
|
2014-10-31 10:22:46 +00:00
|
|
|
|
2014-03-03 17:31:45 +00:00
|
|
|
private:
|
2018-01-19 12:17:20 +00:00
|
|
|
CrossRefItem *m_Xref_item = nullptr;
|
|
|
|
bool m_first_scene_change = true;
|
2014-02-18 20:44:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MASTERELEMENT_H
|