mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 16:50:53 +01:00
Light change in user interface
When mouse over a element, coonductor, text, the graphic symbol draw his bounding box. and draw a tooltip with his name For conductor the conductor size change. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3490 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -33,7 +33,8 @@
|
||||
Element::Element(QGraphicsItem *parent, Diagram *scene) :
|
||||
QetGraphicsItem(parent),
|
||||
internal_connections_(false),
|
||||
must_highlight_(false)
|
||||
must_highlight_(false),
|
||||
bMouseOver(false)
|
||||
{
|
||||
Q_UNUSED(scene);
|
||||
|
||||
@@ -41,7 +42,7 @@ Element::Element(QGraphicsItem *parent, Diagram *scene) :
|
||||
uuid_ = QUuid::createUuid();
|
||||
setZValue(10);
|
||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
|
||||
setAcceptsHoverEvents(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,6 +107,8 @@ void Element::paint(QPainter *painter, const QStyleOptionGraphicsItem *options,
|
||||
|
||||
// Dessin du cadre de selection si necessaire
|
||||
if (isSelected()) drawSelection(painter, options);
|
||||
|
||||
if ( bMouseOver ) drawSelection(painter, options);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -540,3 +543,39 @@ bool comparPos(const Element *elmt1, const Element *elmt2) {
|
||||
return elmt1->y() <= elmt2->pos().y();
|
||||
return elmt1->pos().x() <= elmt2->pos().x();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
When mouse over element
|
||||
change bMouseOver to true (used in paint() function )
|
||||
@param e QGraphicsSceneHoverEvent
|
||||
*/
|
||||
void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
|
||||
Q_UNUSED(e);
|
||||
|
||||
bMouseOver = true;
|
||||
QString str_ToolTip = name();
|
||||
setToolTip( str_ToolTip );
|
||||
update();
|
||||
}
|
||||
|
||||
/**
|
||||
When mouse over element leave the position
|
||||
change bMouseOver to false(used in paint() function )
|
||||
@param e QGraphicsSceneHoverEvent
|
||||
*/
|
||||
void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
|
||||
Q_UNUSED(e);
|
||||
//qDebug() << "Leave mouse over";
|
||||
bMouseOver = false;
|
||||
update();
|
||||
}
|
||||
|
||||
/**
|
||||
Do nothing default function .
|
||||
@param e QGraphicsSceneHoverEvent
|
||||
*/
|
||||
void Element::hoverMoveEvent(QGraphicsSceneHoverEvent *e) {
|
||||
Q_UNUSED(e);
|
||||
QGraphicsItem::hoverMoveEvent(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user