mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 22:00:35 +01:00
Add name property to terminal
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2617 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -32,8 +32,10 @@ const qreal Terminal::terminalSize = 4.0;
|
||||
Methode privee pour initialiser la borne.
|
||||
@param pf position du point d'amarrage pour un conducteur
|
||||
@param o orientation de la borne : Qt::Horizontal ou Qt::Vertical
|
||||
@param number of terminal
|
||||
@param name of terminal
|
||||
*/
|
||||
void Terminal::init(QPointF pf, QET::Orientation o, QString number) {
|
||||
void Terminal::init(QPointF pf, QET::Orientation o, QString number, QString name, bool hiddenName) {
|
||||
// definition du pount d'amarrage pour un conducteur
|
||||
dock_conductor_ = pf;
|
||||
|
||||
@@ -52,6 +54,9 @@ void Terminal::init(QPointF pf, QET::Orientation o, QString number) {
|
||||
}
|
||||
// Number of terminal
|
||||
number_terminal_ = number;
|
||||
// Name of terminal
|
||||
name_terminal_ = name;
|
||||
name_terminal_hidden = hiddenName;
|
||||
// par defaut : pas de conducteur
|
||||
|
||||
// QRectF null
|
||||
@@ -76,7 +81,7 @@ Terminal::Terminal(QPointF pf, QET::Orientation o, Element *e, Diagram *s) :
|
||||
parent_element_(e),
|
||||
hovered_color_(Terminal::neutralColor)
|
||||
{
|
||||
init(pf, o, "_");
|
||||
init(pf, o, "_", "_", false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +97,7 @@ Terminal::Terminal(qreal pf_x, qreal pf_y, QET::Orientation o, Element *e, Diagr
|
||||
parent_element_(e),
|
||||
hovered_color_(Terminal::neutralColor)
|
||||
{
|
||||
init(QPointF(pf_x, pf_y), o, "_");
|
||||
init(QPointF(pf_x, pf_y), o, "_", "_", false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,15 +105,17 @@ Terminal::Terminal(qreal pf_x, qreal pf_y, QET::Orientation o, Element *e, Diagr
|
||||
@param pf position du point d'amarrage pour un conducteur
|
||||
@param o orientation de la borne : Qt::Horizontal ou Qt::Vertical
|
||||
@param num number of terminal (ex 3 - 4 for NO)
|
||||
@param name of terminal
|
||||
@param hiddenName hide or show the name
|
||||
@param e Element auquel cette borne appartient
|
||||
@param s Scene sur laquelle figure cette borne
|
||||
*/
|
||||
Terminal::Terminal(QPointF pf, QET::Orientation o, QString num, Element *e, Diagram *s) :
|
||||
Terminal::Terminal(QPointF pf, QET::Orientation o, QString num, QString name, bool hiddenName, Element *e, Diagram *s) :
|
||||
QGraphicsItem(e, s),
|
||||
parent_element_(e),
|
||||
hovered_color_(Terminal::neutralColor)
|
||||
{
|
||||
init(pf, o, num);
|
||||
init(pf, o, num, name, hiddenName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,6 +159,15 @@ void Terminal::setNumber(QString number) {
|
||||
number_terminal_ = number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Terminal::setName
|
||||
* @param name
|
||||
*/
|
||||
void Terminal::setName(QString name, bool hiddenName) {
|
||||
name_terminal_ = name;
|
||||
name_terminal_hidden = hiddenName;
|
||||
}
|
||||
|
||||
/**
|
||||
Attribue un conductor a la borne
|
||||
@param f Le conducteur a rattacher a cette borne
|
||||
|
||||
@@ -33,7 +33,7 @@ class Terminal : public QGraphicsItem {
|
||||
public:
|
||||
Terminal(QPointF, QET::Orientation, Element * = 0, Diagram * = 0);
|
||||
Terminal(qreal, qreal, QET::Orientation, Element * = 0, Diagram * = 0);
|
||||
Terminal(QPointF, QET::Orientation, QString number, Element * = 0, Diagram * = 0);
|
||||
Terminal(QPointF, QET::Orientation, QString number, QString name, bool hiddenName, Element * = 0, Diagram * = 0);
|
||||
virtual ~Terminal();
|
||||
|
||||
private:
|
||||
@@ -63,7 +63,9 @@ class Terminal : public QGraphicsItem {
|
||||
QET::Orientation orientation() const;
|
||||
QPointF dockConductor() const;
|
||||
QString number() const;
|
||||
QString name() const;
|
||||
void setNumber(QString number);
|
||||
void setName(QString name, bool hiddenName);
|
||||
void updateConductor();
|
||||
bool isLinkedTo(Terminal *);
|
||||
bool canBeLinkedTo(Terminal *);
|
||||
@@ -121,9 +123,12 @@ class Terminal : public QGraphicsItem {
|
||||
QColor hovered_color_;
|
||||
/// Number of Terminal
|
||||
QString number_terminal_;
|
||||
/// Name of Terminal
|
||||
QString name_terminal_;
|
||||
bool name_terminal_hidden;
|
||||
|
||||
private:
|
||||
void init(QPointF, QET::Orientation, QString number);
|
||||
void init(QPointF, QET::Orientation, QString number, QString name, bool hiddenName);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -148,4 +153,11 @@ inline QString Terminal::number() const {
|
||||
return(number_terminal_);
|
||||
}
|
||||
|
||||
/**
|
||||
@return the name of terminal.
|
||||
*/
|
||||
inline QString Terminal::name() const {
|
||||
return(name_terminal_);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user