mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-25 00:39:58 +01:00
Move element display help line
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3592 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -494,8 +494,17 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
|
|||||||
return(element);
|
return(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialise link for this element
|
/**
|
||||||
void Element::initLink(QETProject *prj) {
|
* @brief Element::initLink
|
||||||
|
* Initialise the link between this element and other elements.
|
||||||
|
* This method can be call once because init the link according to
|
||||||
|
* uuid store in a private list, after link, the list is clear, so
|
||||||
|
* call another time do nothing.
|
||||||
|
*
|
||||||
|
* @param prj, ownership project of this element and other element to be linked
|
||||||
|
*/
|
||||||
|
void Element::initLink(QETProject *prj)
|
||||||
|
{
|
||||||
// if nothing to link return now
|
// if nothing to link return now
|
||||||
if (tmp_uuids_link.isEmpty()) return;
|
if (tmp_uuids_link.isEmpty()) return;
|
||||||
|
|
||||||
@@ -540,6 +549,23 @@ bool comparPos(const Element *elmt1, const Element *elmt2) {
|
|||||||
return elmt1->pos().x() <= elmt2->pos().x();
|
return elmt1->pos().x() <= elmt2->pos().x();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Element::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
QetGraphicsItem::mouseMoveEvent(event);
|
||||||
|
foreach (Terminal *t, terminals())
|
||||||
|
{
|
||||||
|
t -> drawHelpLine(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
{
|
||||||
|
QetGraphicsItem::mouseReleaseEvent(event);
|
||||||
|
foreach (Terminal *t, terminals())
|
||||||
|
{
|
||||||
|
t -> drawHelpLine(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When mouse over element
|
* When mouse over element
|
||||||
|
|||||||
@@ -42,9 +42,18 @@ class Element : public QetGraphicsItem {
|
|||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Enable the use of qgraphicsitem_cast to safely cast
|
||||||
|
* a QGraphicsItem into an Element.
|
||||||
|
* @return the QGraphicsItem type
|
||||||
|
*/
|
||||||
enum { Type = UserType + 1000 };
|
enum { Type = UserType + 1000 };
|
||||||
// this enum is use to know the kind of element and
|
virtual int type() const { return Type; }
|
||||||
// to use flag for element provider class
|
|
||||||
|
/**
|
||||||
|
* @brief The kind enum
|
||||||
|
* Used to know the kind of this element (master, slave, report ect...)
|
||||||
|
*/
|
||||||
enum kind {Simple = 1,
|
enum kind {Simple = 1,
|
||||||
NextReport = 2,
|
NextReport = 2,
|
||||||
PreviousReport = 4,
|
PreviousReport = 4,
|
||||||
@@ -58,17 +67,8 @@ class Element : public QetGraphicsItem {
|
|||||||
QPoint hotspot_coord;
|
QPoint hotspot_coord;
|
||||||
QPixmap preview;
|
QPixmap preview;
|
||||||
|
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
Enable the use of qgraphicsitem_cast to safely cast a QGraphicsItem into an
|
|
||||||
Element.
|
|
||||||
@return the QGraphicsItem type
|
|
||||||
*/
|
|
||||||
virtual int type() const { return Type; }
|
|
||||||
|
|
||||||
// pure virtual methods to be defined in derived classes
|
|
||||||
/// @return the list of terminals for this element
|
/// @return the list of terminals for this element
|
||||||
virtual QList<Terminal *> terminals() const = 0;
|
virtual QList<Terminal *> terminals() const = 0;
|
||||||
/// @return the list of conductors attached to this element
|
/// @return the list of conductors attached to this element
|
||||||
@@ -182,8 +182,11 @@ class Element : public QetGraphicsItem {
|
|||||||
void updatePixmap();
|
void updatePixmap();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent *event );
|
||||||
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent *event );
|
||||||
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * );
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * );
|
||||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * );
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_mouse_over;
|
bool m_mouse_over;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user