mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-05-21 12:49:59 +02:00
Element editor : hover a primitve will highlight it with a blue halo
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3694 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -18,19 +18,22 @@
|
||||
#ifndef CUSTOM_ELEMENT_GRAPHIC_PART_H
|
||||
#define CUSTOM_ELEMENT_GRAPHIC_PART_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QGraphicsObject>
|
||||
#include "customelementpart.h"
|
||||
|
||||
class QETElementEditor;
|
||||
class QPainter;
|
||||
|
||||
|
||||
/**
|
||||
* @brief The CustomElementGraphicPart class
|
||||
* This class is the base for all home-made primitive like line, rectangle, ellipse etc....
|
||||
* It provides methods and enums to manage style attributes available for primitive (color, pen style, etc...)
|
||||
*/
|
||||
class CustomElementGraphicPart : public QObject, public CustomElementPart
|
||||
class CustomElementGraphicPart : public QGraphicsObject, public CustomElementPart
|
||||
{
|
||||
#define SHADOWS_HEIGHT 4.0
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
//Made this Q_ENUMS to be used by the Q_PROPERTY system.
|
||||
@@ -62,15 +65,18 @@ class CustomElementGraphicPart : public QObject, public CustomElementPart
|
||||
// constructors, destructor
|
||||
public:
|
||||
|
||||
CustomElementGraphicPart(QETElementEditor *editor);
|
||||
CustomElementGraphicPart(QETElementEditor *editor, QGraphicsItem *parent = 0);
|
||||
virtual ~CustomElementGraphicPart();
|
||||
|
||||
static void drawCross (const QPointF ¢er, QPainter *painter);
|
||||
|
||||
//Getter and setter
|
||||
LineStyle lineStyle () const {return _linestyle;}
|
||||
void setLineStyle (const LineStyle ls) {_linestyle = ls;}
|
||||
|
||||
LineWeight lineWeight () const {return _lineweight;}
|
||||
void setLineWeight (const LineWeight lw) {_lineweight = lw;}
|
||||
qreal penWeight () const;
|
||||
|
||||
Filling filling () const {return _filling;}
|
||||
void setFilling(const Filling f) {_filling = f;}
|
||||
@@ -92,8 +98,14 @@ class CustomElementGraphicPart : public QObject, public CustomElementPart
|
||||
void stylesFromXml(const QDomElement &);
|
||||
void resetStyles ();
|
||||
void applyStylesToQPainter(QPainter &) const;
|
||||
|
||||
void drawShadowShape (QPainter *painter);
|
||||
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
|
||||
// attributes
|
||||
bool m_hovered;
|
||||
private:
|
||||
LineStyle _linestyle;
|
||||
LineWeight _lineweight;
|
||||
|
||||
Reference in New Issue
Block a user