mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Clean some code (related to element editor)
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3631 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -18,18 +18,42 @@
|
|||||||
#include "customelementgraphicpart.h"
|
#include "customelementgraphicpart.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Ecrit les attributs de style dans un element XML
|
* @brief CustomElementGraphicPart::CustomElementGraphicPart
|
||||||
@param qde L'element XML a modifier
|
* Default constructor.
|
||||||
|
* @param editor QETElement editor that belong this.
|
||||||
*/
|
*/
|
||||||
void CustomElementGraphicPart::stylesToXml(QDomElement &qde) const {
|
CustomElementGraphicPart::CustomElementGraphicPart(QETElementEditor *editor) :
|
||||||
|
CustomElementPart(editor),
|
||||||
|
_linestyle(NormalStyle),
|
||||||
|
_lineweight(NormalWeight),
|
||||||
|
_filling(NoneFilling),
|
||||||
|
_color(BlackColor),
|
||||||
|
_antialiased(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CustomElementGraphicPart::~CustomElementGraphicPart
|
||||||
|
* Destructor
|
||||||
|
*/
|
||||||
|
CustomElementGraphicPart::~CustomElementGraphicPart() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief CustomElementGraphicPart::stylesToXml
|
||||||
|
* Write the curent style to xml element.
|
||||||
|
* The style are stored like this:
|
||||||
|
* name-of-style:value;name-of-style:value
|
||||||
|
* Each style separate by ; and name-style/value are separate by :
|
||||||
|
* @param qde : QDOmElement used to write the style.
|
||||||
|
*/
|
||||||
|
void CustomElementGraphicPart::stylesToXml(QDomElement &qde) const
|
||||||
|
{
|
||||||
QString css_like_styles;
|
QString css_like_styles;
|
||||||
|
|
||||||
css_like_styles += "line-style:";
|
css_like_styles += "line-style:";
|
||||||
if (_linestyle == DashedStyle) css_like_styles += "dashed";
|
if (_linestyle == DashedStyle) css_like_styles += "dashed";
|
||||||
if (_linestyle == DottedStyle) css_like_styles += "dotted";
|
else if (_linestyle == DottedStyle) css_like_styles += "dotted";
|
||||||
if (_linestyle == DashdottedStyle)css_like_styles += "dashdotted";
|
else if (_linestyle == DashdottedStyle) css_like_styles += "dashdotted";
|
||||||
else if (_linestyle == NormalStyle) css_like_styles += "normal";
|
else if (_linestyle == NormalStyle) css_like_styles += "normal";
|
||||||
|
|
||||||
css_like_styles += ";line-weight:";
|
css_like_styles += ";line-weight:";
|
||||||
if (_lineweight == NoneWeight) css_like_styles += "none";
|
if (_lineweight == NoneWeight) css_like_styles += "none";
|
||||||
@@ -44,73 +68,86 @@ void CustomElementGraphicPart::stylesToXml(QDomElement &qde) const {
|
|||||||
else if (_filling == BlackFilling) css_like_styles += "black";
|
else if (_filling == BlackFilling) css_like_styles += "black";
|
||||||
else if (_filling == WhiteFilling) css_like_styles += "white";
|
else if (_filling == WhiteFilling) css_like_styles += "white";
|
||||||
else if (_filling == GreenFilling) css_like_styles += "green";
|
else if (_filling == GreenFilling) css_like_styles += "green";
|
||||||
else if (_filling == BlueFilling) css_like_styles += "blue";
|
else if (_filling == BlueFilling) css_like_styles += "blue";
|
||||||
else if (_filling == RedFilling) css_like_styles += "red";
|
else if (_filling == RedFilling) css_like_styles += "red";
|
||||||
|
|
||||||
|
|
||||||
css_like_styles += ";color:";
|
css_like_styles += ";color:";
|
||||||
if (_color == WhiteColor) css_like_styles += "white";
|
if (_color == WhiteColor) css_like_styles += "white";
|
||||||
else if (_color == BlackColor) css_like_styles += "black";
|
else if (_color == BlackColor) css_like_styles += "black";
|
||||||
else if (_color == GreenColor) css_like_styles += "green";
|
else if (_color == GreenColor) css_like_styles += "green";
|
||||||
else if (_color == RedColor) css_like_styles += "red";
|
else if (_color == RedColor) css_like_styles += "red";
|
||||||
else if (_color == BlueColor) css_like_styles += "blue";
|
else if (_color == BlueColor) css_like_styles += "blue";
|
||||||
|
|
||||||
qde.setAttribute("style", css_like_styles);
|
qde.setAttribute("style", css_like_styles);
|
||||||
qde.setAttribute("antialias", _antialiased ? "true" : "false");
|
qde.setAttribute("antialias", _antialiased ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Lit les attributs de style depuis un element XML
|
* @brief CustomElementGraphicPart::stylesFromXml
|
||||||
@param qde L'element XML a analyser
|
* Read the style used by this, from a xml element.
|
||||||
*/
|
* @param qde : QDomElement used to read the style
|
||||||
void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde) {
|
*/
|
||||||
|
void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
|
||||||
|
{
|
||||||
resetStyles();
|
resetStyles();
|
||||||
|
|
||||||
// recupere la liste des couples style / valeur
|
//Get the list of pair style/value
|
||||||
QStringList styles = qde.attribute("style").split(";", QString::SkipEmptyParts);
|
QStringList styles = qde.attribute("style").split(";", QString::SkipEmptyParts);
|
||||||
|
|
||||||
// analyse chaque couple
|
//Check each pair of style
|
||||||
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
|
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
|
||||||
foreach (QString style, styles) {
|
foreach (QString style, styles)
|
||||||
|
{
|
||||||
if (!rx.exactMatch(style)) continue;
|
if (!rx.exactMatch(style)) continue;
|
||||||
QString style_name = rx.cap(1);
|
QString style_name = rx.cap(1);
|
||||||
QString style_value = rx.cap(2);
|
QString style_value = rx.cap(2);
|
||||||
if (style_name == "line-style") {
|
if (style_name == "line-style")
|
||||||
if (style_value == "dashed") _linestyle = DashedStyle;
|
{
|
||||||
if (style_value == "dotted") _linestyle = DottedStyle;
|
if (style_value == "dashed") _linestyle = DashedStyle;
|
||||||
if (style_value == "dashdotted") _linestyle = DashdottedStyle;
|
else if (style_value == "dotted") _linestyle = DottedStyle;
|
||||||
else if (style_value == "normal") _linestyle = NormalStyle;
|
else if (style_value == "dashdotted") _linestyle = DashdottedStyle;
|
||||||
// il n'y a pas de else car les valeurs non conformes sont ignorees (idem par la suite)
|
else if (style_value == "normal") _linestyle = NormalStyle;
|
||||||
} else if (style_name == "line-weight") {
|
}
|
||||||
|
else if (style_name == "line-weight")
|
||||||
|
{
|
||||||
if (style_value == "none") _lineweight = NoneWeight;
|
if (style_value == "none") _lineweight = NoneWeight;
|
||||||
else if (style_value == "thin") _lineweight = ThinWeight;
|
else if (style_value == "thin") _lineweight = ThinWeight;
|
||||||
else if (style_value == "normal") _lineweight = NormalWeight;
|
else if (style_value == "normal") _lineweight = NormalWeight;
|
||||||
else if (style_value == "hight") _lineweight = UltraWeight;
|
else if (style_value == "hight") _lineweight = UltraWeight;
|
||||||
else if (style_value == "eleve") _lineweight = BigWeight;
|
else if (style_value == "eleve") _lineweight = BigWeight;
|
||||||
} else if (style_name == "filling") {
|
}
|
||||||
|
else if (style_name == "filling")
|
||||||
|
{
|
||||||
if (style_value == "white") _filling = WhiteFilling;
|
if (style_value == "white") _filling = WhiteFilling;
|
||||||
else if (style_value == "black") _filling = BlackFilling;
|
else if (style_value == "black") _filling = BlackFilling;
|
||||||
else if (style_value == "red") _filling = RedFilling;
|
else if (style_value == "red") _filling = RedFilling;
|
||||||
else if (style_value == "green") _filling = GreenFilling;
|
else if (style_value == "green") _filling = GreenFilling;
|
||||||
else if (style_value == "blue") _filling = BlueFilling;
|
else if (style_value == "blue") _filling = BlueFilling;
|
||||||
else if (style_value == "none") _filling = NoneFilling;
|
else if (style_value == "none") _filling = NoneFilling;
|
||||||
} else if (style_name == "color") {
|
}
|
||||||
|
else if (style_name == "color")
|
||||||
|
{
|
||||||
if (style_value == "black") _color = BlackColor;
|
if (style_value == "black") _color = BlackColor;
|
||||||
else if (style_value == "white") _color = WhiteColor;
|
else if (style_value == "white") _color = WhiteColor;
|
||||||
else if (style_value == "green") _color = GreenColor;
|
else if (style_value == "green") _color = GreenColor;
|
||||||
else if (style_value == "red") _color = RedColor;
|
else if (style_value == "red") _color = RedColor;
|
||||||
else if (style_value == "blue") _color = BlueColor;
|
else if (style_value == "blue") _color = BlueColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Get antialiasing
|
||||||
// recupere l'antialiasing
|
|
||||||
_antialiased = qde.attribute("antialias") == "true";
|
_antialiased = qde.attribute("antialias") == "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remet les styles par defaut
|
* @brief CustomElementGraphicPart::resetStyles
|
||||||
*/
|
* Reset the curent style to default,
|
||||||
void CustomElementGraphicPart::resetStyles() {
|
* same style of default constructor
|
||||||
|
*/
|
||||||
|
void CustomElementGraphicPart::resetStyles()
|
||||||
|
{
|
||||||
_linestyle = NormalStyle;
|
_linestyle = NormalStyle;
|
||||||
_lineweight = NormalWeight;
|
_lineweight = NormalWeight;
|
||||||
_filling = NoneFilling;
|
_filling = NoneFilling;
|
||||||
@@ -119,58 +156,49 @@ void CustomElementGraphicPart::resetStyles() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Applique les styles a un Qpainter
|
* @brief CustomElementGraphicPart::applyStylesToQPainter
|
||||||
@param painter QPainter a modifier
|
* Apply the current style to the QPainter
|
||||||
*/
|
* @param painter
|
||||||
void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const {
|
*/
|
||||||
// recupere le QPen et la QBrush du QPainter
|
void CustomElementGraphicPart::applyStylesToQPainter(QPainter &painter) const
|
||||||
|
{
|
||||||
|
//Get the pen and brush
|
||||||
QPen pen = painter.pen();
|
QPen pen = painter.pen();
|
||||||
QBrush brush = painter.brush();
|
QBrush brush = painter.brush();
|
||||||
|
|
||||||
// applique le style de trait
|
//Apply pen style
|
||||||
if (_linestyle == DashedStyle) pen.setStyle(Qt::DashLine);
|
if (_linestyle == DashedStyle) pen.setStyle(Qt::DashLine);
|
||||||
if (_linestyle == DashdottedStyle) pen.setStyle(Qt::DashDotLine);
|
else if (_linestyle == DashdottedStyle) pen.setStyle(Qt::DashDotLine);
|
||||||
if (_linestyle == DottedStyle) pen.setStyle(Qt::DotLine);
|
else if (_linestyle == DottedStyle) pen.setStyle(Qt::DotLine);
|
||||||
else if (_linestyle == NormalStyle) pen.setStyle(Qt::SolidLine);
|
else if (_linestyle == NormalStyle) pen.setStyle(Qt::SolidLine);
|
||||||
|
|
||||||
// applique l'epaisseur de trait
|
//Apply pen width
|
||||||
if (_lineweight == NoneWeight) pen.setColor(QColor(0, 0, 0, 0));
|
if (_lineweight == NoneWeight) pen.setColor(QColor(0, 0, 0, 0));
|
||||||
else if (_lineweight == ThinWeight) pen.setWidth(0);
|
else if (_lineweight == ThinWeight) pen.setWidth(0);
|
||||||
else if (_lineweight == NormalWeight) pen.setWidthF(1.0);
|
else if (_lineweight == NormalWeight) pen.setWidthF(1.0);
|
||||||
else if (_lineweight == UltraWeight) pen.setWidthF(2.0);
|
else if (_lineweight == UltraWeight) pen.setWidthF(2.0);
|
||||||
else if (_lineweight == BigWeight) pen.setWidthF(5.0);
|
else if (_lineweight == BigWeight) pen.setWidthF(5.0);
|
||||||
|
|
||||||
|
//Apply brush color
|
||||||
|
if (_filling == NoneFilling) brush.setStyle(Qt::NoBrush);
|
||||||
// applique le remplissage
|
else
|
||||||
if (_filling == NoneFilling) {
|
{
|
||||||
brush.setStyle(Qt::NoBrush);
|
|
||||||
} else if (_filling == BlackFilling) {
|
|
||||||
brush.setStyle(Qt::SolidPattern);
|
brush.setStyle(Qt::SolidPattern);
|
||||||
brush.setColor(Qt::black);
|
if (_filling == BlackFilling) brush.setColor(Qt::black);
|
||||||
} else if (_filling == WhiteFilling) {
|
else if (_filling == WhiteFilling) brush.setColor(Qt::white);
|
||||||
brush.setStyle(Qt::SolidPattern);
|
else if (_filling == GreenFilling) brush.setColor(Qt::green);
|
||||||
brush.setColor(Qt::white);
|
else if (_filling == RedFilling) brush.setColor(Qt::red);
|
||||||
} else if (_filling == GreenFilling) {
|
else if (_filling == BlueFilling) brush.setColor(Qt::blue);
|
||||||
brush.setStyle(Qt::SolidPattern);
|
|
||||||
brush.setColor(Qt::green);
|
|
||||||
} else if (_filling == RedFilling) {
|
|
||||||
brush.setStyle(Qt::SolidPattern);
|
|
||||||
brush.setColor(Qt::red);
|
|
||||||
} else if (_filling == BlueFilling) {
|
|
||||||
brush.setStyle(Qt::SolidPattern);
|
|
||||||
brush.setColor(Qt::blue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// applique la couleur de trait
|
//Apply pen color
|
||||||
if (_color == WhiteColor) pen.setColor(QColor(255, 255, 255, pen.color().alpha()));
|
if (_color == WhiteColor) pen.setColor(QColor(255, 255, 255, pen.color().alpha()));
|
||||||
else if (_color == BlackColor) pen.setColor(QColor( 0, 0, 0, pen.color().alpha()));
|
else if (_color == BlackColor) pen.setColor(QColor( 0, 0, 0, pen.color().alpha()));
|
||||||
else if (_color == GreenColor) pen.setColor(QColor(Qt::green));
|
else if (_color == GreenColor) pen.setColor(QColor(Qt::green));
|
||||||
else if (_color == RedColor) pen.setColor(QColor(Qt::red));
|
else if (_color == RedColor) pen.setColor(QColor(Qt::red));
|
||||||
else if (_color == BlueColor) pen.setColor(QColor(Qt::blue));
|
else if (_color == BlueColor) pen.setColor(QColor(Qt::blue));
|
||||||
|
|
||||||
|
//Apply antialiasing
|
||||||
// applique l'antialiasing
|
|
||||||
painter.setRenderHint(QPainter::Antialiasing, _antialiased);
|
painter.setRenderHint(QPainter::Antialiasing, _antialiased);
|
||||||
painter.setRenderHint(QPainter::TextAntialiasing, _antialiased);
|
painter.setRenderHint(QPainter::TextAntialiasing, _antialiased);
|
||||||
painter.setRenderHint(QPainter::SmoothPixmapTransform, _antialiased);
|
painter.setRenderHint(QPainter::SmoothPixmapTransform, _antialiased);
|
||||||
|
|||||||
@@ -17,116 +17,90 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef CUSTOM_ELEMENT_GRAPHIC_PART_H
|
#ifndef CUSTOM_ELEMENT_GRAPHIC_PART_H
|
||||||
#define CUSTOM_ELEMENT_GRAPHIC_PART_H
|
#define CUSTOM_ELEMENT_GRAPHIC_PART_H
|
||||||
#include <QPainter>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "customelementpart.h"
|
#include "customelementpart.h"
|
||||||
#include "styleeditor.h"
|
|
||||||
class QETElementEditor;
|
class QETElementEditor;
|
||||||
typedef CustomElementGraphicPart CEGP;
|
class QPainter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class represents an element visual/geometric primitive. It provides
|
* @brief The CustomElementGraphicPart class
|
||||||
methods to manage style attributes common to most primitives.
|
* 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 {
|
*/
|
||||||
Q_OBJECT
|
class CustomElementGraphicPart : public QObject, public CustomElementPart
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
//Made this Q_ENUMS to be used by the Q_PROPERTY system.
|
||||||
|
Q_ENUMS (LineStyle)
|
||||||
|
Q_ENUMS (LineWeight)
|
||||||
|
Q_ENUMS (Filling)
|
||||||
|
Q_ENUMS (Color)
|
||||||
|
|
||||||
|
Q_PROPERTY(LineStyle line_style READ lineStyle WRITE setLineStyle)
|
||||||
|
Q_PROPERTY(LineWeight line_weight READ lineWeight WRITE setLineWeight)
|
||||||
|
Q_PROPERTY(Filling filling READ filling WRITE setFilling)
|
||||||
|
Q_PROPERTY(Color color READ color WRITE setColor)
|
||||||
|
Q_PROPERTY(bool antialias READ antialiased WRITE setAntialiased)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// This enum lists the various line styles available to draw primitives.
|
//Line style
|
||||||
Q_ENUMS(LineStyle)
|
enum LineStyle {NormalStyle, DashedStyle, DottedStyle, DashdottedStyle};
|
||||||
enum LineStyle {
|
|
||||||
NormalStyle, ///< Normal line
|
|
||||||
DashedStyle, ///< Dashed line
|
|
||||||
DottedStyle, ///< Dotted line
|
|
||||||
DashdottedStyle ///< Dashdotted line
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This enum lists the various line weights available to draw primitives.
|
|
||||||
Q_ENUMS(LineWeight)
|
|
||||||
enum LineWeight {
|
|
||||||
NoneWeight, ///< Invisible line
|
|
||||||
ThinWeight, ///< Thin line
|
|
||||||
NormalWeight, ///< Normal line 1px
|
|
||||||
UltraWeight, ///< Normal line 2px
|
|
||||||
BigWeight ///< Big Line
|
|
||||||
|
|
||||||
};
|
//Line weight : invisible, 0px, 1px, 2px, 5px
|
||||||
|
enum LineWeight {NoneWeight, ThinWeight, NormalWeight, UltraWeight, BigWeight};
|
||||||
|
|
||||||
|
//Filling color of the part : NoneFilling -> No filling (i.e. transparent)
|
||||||
|
enum Filling { NoneFilling, BlackFilling, WhiteFilling, GreenFilling, RedFilling, BlueFilling};
|
||||||
|
|
||||||
|
//Line color
|
||||||
|
enum Color {BlackColor, WhiteColor, GreenColor, RedColor, BlueColor};
|
||||||
|
|
||||||
/// This enum lists the various filling colors available to draw primitives.
|
|
||||||
Q_ENUMS(Filling)
|
// constructors, destructor
|
||||||
enum Filling {
|
|
||||||
NoneFilling, ///< No filling (i.e. transparent)
|
|
||||||
BlackFilling, ///< Black filling
|
|
||||||
WhiteFilling, ///< White filling
|
|
||||||
GreenFilling, ///< Green filling
|
|
||||||
RedFilling, ///< Red filling
|
|
||||||
BlueFilling ///< Green filling
|
|
||||||
};
|
|
||||||
|
|
||||||
/// This enum lists the various line colors available to draw primitives.
|
|
||||||
Q_ENUMS(Color)
|
|
||||||
enum Color {
|
|
||||||
BlackColor, ///< Black line
|
|
||||||
WhiteColor, ///< White line
|
|
||||||
GreenColor, ///< Green line
|
|
||||||
RedColor, ///< Red line
|
|
||||||
BlueColor ///< Blue line
|
|
||||||
};
|
|
||||||
|
|
||||||
// constructors, destructor
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
Constructor
|
|
||||||
@param editor Element editor this primitive lives in.
|
|
||||||
*/
|
|
||||||
CustomElementGraphicPart(QETElementEditor *editor) :
|
|
||||||
CustomElementPart(editor),
|
|
||||||
_linestyle(NormalStyle),
|
|
||||||
_lineweight(NormalWeight),
|
|
||||||
_filling(NoneFilling),
|
|
||||||
_color(BlackColor),
|
|
||||||
_antialiased(false)
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Destructor
|
|
||||||
virtual ~CustomElementGraphicPart() {
|
|
||||||
};
|
|
||||||
|
|
||||||
// attributes
|
|
||||||
private:
|
|
||||||
LineStyle _linestyle;
|
|
||||||
LineWeight _lineweight;
|
|
||||||
Filling _filling ;
|
|
||||||
Color _color;
|
|
||||||
bool _antialiased;
|
|
||||||
|
|
||||||
// methods
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// PROPERTY
|
CustomElementGraphicPart(QETElementEditor *editor);
|
||||||
Q_PROPERTY(LineStyle line_style READ lineStyle WRITE setLineStyle)
|
virtual ~CustomElementGraphicPart();
|
||||||
LineStyle lineStyle() const {return _linestyle;}
|
|
||||||
void setLineStyle(const LineStyle ls) {_linestyle = ls;}
|
//Getter and setter
|
||||||
Q_PROPERTY(LineWeight line_weight READ lineWeight WRITE setLineWeight)
|
LineStyle lineStyle () const {return _linestyle;}
|
||||||
LineWeight lineWeight() const {return _lineweight;}
|
void setLineStyle (const LineStyle ls) {_linestyle = ls;}
|
||||||
void setLineWeight(const LineWeight lw) {_lineweight = lw;}
|
|
||||||
Q_PROPERTY(Filling filling READ filling WRITE setFilling)
|
LineWeight lineWeight () const {return _lineweight;}
|
||||||
Filling filling() const {return _filling;}
|
void setLineWeight (const LineWeight lw) {_lineweight = lw;}
|
||||||
void setFilling(const Filling f) {_filling = f;}
|
|
||||||
Q_PROPERTY(Color color READ color WRITE setColor)
|
Filling filling () const {return _filling;}
|
||||||
Color color() const {return _color;}
|
void setFilling(const Filling f) {_filling = f;}
|
||||||
void setColor(const Color c) {_color = c;}
|
|
||||||
Q_PROPERTY(bool antialias READ antialiased WRITE setAntialiased)
|
Color color () const {return _color;}
|
||||||
bool antialiased() const {return _antialiased;}
|
void setColor(const Color c) {_color = c;}
|
||||||
|
|
||||||
|
bool antialiased () const {return _antialiased;}
|
||||||
void setAntialiased(const bool b) {_antialiased = b;}
|
void setAntialiased(const bool b) {_antialiased = b;}
|
||||||
|
//End of getter and setter
|
||||||
virtual void setProperty(const char *name, const QVariant &value) {QObject::setProperty(name, value);}
|
|
||||||
virtual QVariant property(const char *name) const {return QObject::property(name);}
|
|
||||||
|
//Rediriged to QObject Q_PROPERTY system
|
||||||
|
virtual void setProperty (const char *name, const QVariant &value) {QObject::setProperty(name, value);}
|
||||||
|
virtual QVariant property (const char *name) const {return QObject::property(name);}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void stylesToXml(QDomElement &) const;
|
void stylesToXml (QDomElement &) const;
|
||||||
void stylesFromXml(const QDomElement &);
|
void stylesFromXml(const QDomElement &);
|
||||||
void resetStyles();
|
void resetStyles ();
|
||||||
void applyStylesToQPainter(QPainter &) const;
|
void applyStylesToQPainter(QPainter &) const;
|
||||||
|
|
||||||
|
// attributes
|
||||||
|
private:
|
||||||
|
LineStyle _linestyle;
|
||||||
|
LineWeight _lineweight;
|
||||||
|
Filling _filling ;
|
||||||
|
Color _color;
|
||||||
|
bool _antialiased;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef CustomElementGraphicPart CEGP;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "elementscene.h"
|
#include "elementscene.h"
|
||||||
#include "editorcommands.h"
|
#include "editorcommands.h"
|
||||||
#include "qetmessagebox.h"
|
#include "qetmessagebox.h"
|
||||||
|
#include "styleeditor.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "rectangleeditor.h"
|
#include "rectangleeditor.h"
|
||||||
#include "partrectangle.h"
|
#include "partrectangle.h"
|
||||||
|
#include "styleeditor.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
|
|||||||
Reference in New Issue
Block a user