mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Wrap code for better readability
This commit is contained in:
@@ -49,13 +49,24 @@ void NumerotationContext::clear () {
|
||||
@param initialvalue
|
||||
@return true if value is append
|
||||
*/
|
||||
bool NumerotationContext::addValue(const QString &type, const QVariant &value, const int increase, const int initialvalue) {
|
||||
if (!keyIsAcceptable(type) && !value.canConvert(QVariant::String)) return false;
|
||||
if (keyIsNumber(type) && !value.canConvert(QVariant::Int)) return false;
|
||||
bool NumerotationContext::addValue(const QString &type,
|
||||
const QVariant &value,
|
||||
const int increase,
|
||||
const int initialvalue) {
|
||||
if (!keyIsAcceptable(type) && !value.canConvert(QVariant::String))
|
||||
return false;
|
||||
if (keyIsNumber(type) && !value.canConvert(QVariant::Int))
|
||||
return false;
|
||||
|
||||
QString valuestr = value.toString();
|
||||
valuestr.remove("|");
|
||||
content_ << type + "|" + valuestr + "|" + QString::number(increase) + "|" + QString::number(initialvalue);
|
||||
content_ << type
|
||||
+ "|"
|
||||
+ valuestr
|
||||
+ "|"
|
||||
+ QString::number(increase)
|
||||
+ "|"
|
||||
+ QString::number(initialvalue);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,10 @@ class NumerotationContext
|
||||
NumerotationContext ();
|
||||
NumerotationContext (QDomElement &);
|
||||
void clear();
|
||||
bool addValue(const QString &, const QVariant & = QVariant(1), const int = 1, const int = 0);
|
||||
bool addValue(const QString &,
|
||||
const QVariant & = QVariant(1),
|
||||
const int = 1,
|
||||
const int = 0);
|
||||
QString operator[] (const int &) const;
|
||||
void operator << (const NumerotationContext &);
|
||||
int size() const;
|
||||
|
||||
@@ -37,10 +37,18 @@ NumPartEditorW::NumPartEditorW(int type, QWidget *parent) :
|
||||
}
|
||||
|
||||
/**
|
||||
@brief NumPartEditorW::NumPartEditorW
|
||||
Constructor
|
||||
Build with value of @context at position i
|
||||
Build with value of context at position i
|
||||
@param context
|
||||
@param i
|
||||
@param type
|
||||
@param parent
|
||||
*/
|
||||
NumPartEditorW::NumPartEditorW (NumerotationContext &context, int i, int type, QWidget *parent):
|
||||
NumPartEditorW::NumPartEditorW (NumerotationContext &context,
|
||||
int i,
|
||||
int type,
|
||||
QWidget *parent):
|
||||
QWidget(parent),
|
||||
ui(new Ui::NumPartEditorW),
|
||||
intValidator (new QIntValidator(0,99999,this)),
|
||||
@@ -86,21 +94,40 @@ void NumPartEditorW::setVisibleItems()
|
||||
QStringList items;
|
||||
if (m_edited_type == 2)
|
||||
{
|
||||
items << tr("Chiffre 1") << tr("Chiffre 01")
|
||||
items << tr("Chiffre 1")
|
||||
<< tr("Chiffre 01")
|
||||
<< tr("Chiffre 001")
|
||||
<< tr("Texte");
|
||||
}
|
||||
else if (m_edited_type == 1)
|
||||
{
|
||||
items << tr("Chiffre 1") << tr("Chiffre 1 - Folio") << tr("Chiffre 01")
|
||||
<< tr("Chiffre 01 - Folio") << tr("Chiffre 001") << tr("Chiffre 001 - Folio")
|
||||
<< tr("Texte") << tr("N° folio") << tr("Folio") << tr("Installation") << tr("Locmach");
|
||||
items << tr("Chiffre 1")
|
||||
<< tr("Chiffre 1 - Folio")
|
||||
<< tr("Chiffre 01")
|
||||
<< tr("Chiffre 01 - Folio")
|
||||
<< tr("Chiffre 001")
|
||||
<< tr("Chiffre 001 - Folio")
|
||||
<< tr("Texte")
|
||||
<< tr("N° folio")
|
||||
<< tr("Folio")
|
||||
<< tr("Installation")
|
||||
<< tr("Locmach");
|
||||
}
|
||||
else
|
||||
items << tr("Chiffre 1") << tr("Chiffre 1 - Folio") << tr("Chiffre 01")
|
||||
<< tr("Chiffre 01 - Folio") << tr("Chiffre 001") << tr("Chiffre 001 - Folio")
|
||||
<< tr("Texte") << tr("N° folio") << tr("Folio") << tr("Installation") << tr("Locmach")
|
||||
<< tr("Element Line") << tr("Element Column") << tr("Element Prefix");
|
||||
items << tr("Chiffre 1")
|
||||
<< tr("Chiffre 1 - Folio")
|
||||
<< tr("Chiffre 01")
|
||||
<< tr("Chiffre 01 - Folio")
|
||||
<< tr("Chiffre 001")
|
||||
<< tr("Chiffre 001 - Folio")
|
||||
<< tr("Texte")
|
||||
<< tr("N° folio")
|
||||
<< tr("Folio")
|
||||
<< tr("Installation")
|
||||
<< tr("Locmach")
|
||||
<< tr("Element Line")
|
||||
<< tr("Element Column")
|
||||
<< tr("Element Prefix");
|
||||
ui->type_cb->insertItems(0,items);
|
||||
}
|
||||
|
||||
@@ -155,10 +182,17 @@ NumerotationContext NumPartEditorW::toNumContext() {
|
||||
type_str = "elementprefix";
|
||||
break;
|
||||
}
|
||||
if (type_str == "unitfolio" || type_str == "tenfolio" || type_str == "hundredfolio")
|
||||
nc.addValue(type_str, ui -> value_field -> displayText(), ui -> increase_spinBox -> value(), ui->value_field->displayText().toInt());
|
||||
if (type_str == "unitfolio"
|
||||
|| type_str == "tenfolio"
|
||||
|| type_str == "hundredfolio")
|
||||
nc.addValue(type_str,
|
||||
ui -> value_field -> displayText(),
|
||||
ui -> increase_spinBox -> value(),
|
||||
ui->value_field->displayText().toInt());
|
||||
else
|
||||
nc.addValue(type_str, ui -> value_field -> displayText(), ui -> increase_spinBox -> value());
|
||||
nc.addValue(type_str,
|
||||
ui -> value_field -> displayText(),
|
||||
ui -> increase_spinBox -> value());
|
||||
return nc;
|
||||
}
|
||||
|
||||
@@ -167,8 +201,13 @@ NumerotationContext NumPartEditorW::toNumContext() {
|
||||
@return true if value field isn't empty or if type is folio
|
||||
*/
|
||||
bool NumPartEditorW::isValid() {
|
||||
if (type_ == folio || type_ == idfolio || type_ == elementline || type_ == plant || type_ == locmach ||
|
||||
type_ == elementcolumn || type_ == elementprefix) {return true;}
|
||||
if (type_ == folio
|
||||
|| type_ == idfolio
|
||||
|| type_ == elementline
|
||||
|| type_ == plant
|
||||
|| type_ == locmach
|
||||
|| type_ == elementcolumn
|
||||
|| type_ == elementprefix) {return true;}
|
||||
else if(ui -> value_field -> text().isEmpty()) {return false;}
|
||||
else return true;
|
||||
}
|
||||
|
||||
@@ -657,9 +657,11 @@ void Createdxf::drawRectangle (const QString &fileName, double x1, double y1, do
|
||||
Conveniance function for draw rectangle
|
||||
@param filepath
|
||||
@param rect
|
||||
@param color
|
||||
@param colorcode
|
||||
*/
|
||||
void Createdxf::drawRectangle(const QString &filepath, const QRectF &rect, const int &colorcode) {
|
||||
void Createdxf::drawRectangle(const QString &filepath,
|
||||
const QRectF &rect,
|
||||
const int &colorcode) {
|
||||
drawRectangle(filepath, rect.bottomLeft().x() * xScale,
|
||||
sheetHeight - (rect.bottomLeft().y() * yScale),
|
||||
rect.width() * xScale,
|
||||
@@ -667,8 +669,24 @@ void Createdxf::drawRectangle(const QString &filepath, const QRectF &rect, const
|
||||
colorcode);
|
||||
}
|
||||
|
||||
/* draw arc in dx format */
|
||||
void Createdxf::drawArc(const QString& fileName,double x,double y,double rad,double startAngle,double endAngle,int color)
|
||||
/**
|
||||
@brief Createdxf::drawArc
|
||||
draw arc in dx format
|
||||
@param fileName
|
||||
@param x
|
||||
@param y
|
||||
@param rad
|
||||
@param startAngle
|
||||
@param endAngle
|
||||
@param color
|
||||
*/
|
||||
void Createdxf::drawArc(const QString& fileName,
|
||||
double x,
|
||||
double y,
|
||||
double rad,
|
||||
double startAngle,
|
||||
double endAngle,
|
||||
int color)
|
||||
{
|
||||
if (!fileName.isEmpty()) {
|
||||
QFile file(fileName);
|
||||
@@ -704,8 +722,24 @@ void Createdxf::drawArc(const QString& fileName,double x,double y,double rad,dou
|
||||
}
|
||||
}
|
||||
|
||||
/* draw simple text in dxf format without any alignment specified */
|
||||
void Createdxf::drawText(const QString& fileName, const QString& text,double x, double y, double height, double rotation, int colour)
|
||||
/**
|
||||
@brief Createdxf::drawText
|
||||
draw simple text in dxf format without any alignment specified
|
||||
@param fileName
|
||||
@param text
|
||||
@param x
|
||||
@param y
|
||||
@param height
|
||||
@param rotation
|
||||
@param colour
|
||||
*/
|
||||
void Createdxf::drawText(const QString& fileName,
|
||||
const QString& text,
|
||||
double x,
|
||||
double y,
|
||||
double height,
|
||||
double rotation,
|
||||
int colour)
|
||||
{
|
||||
if (!fileName.isEmpty()) {
|
||||
QFile file(fileName);
|
||||
@@ -744,8 +778,20 @@ void Createdxf::drawText(const QString& fileName, const QString& text,double x,
|
||||
/* draw aligned text in DXF Format */
|
||||
// leftAlign flag added. If the alignment requested is 'fit to width' and the text length is very small,
|
||||
// then the text is either centered or left-aligned, depnding on the value of leftAlign.
|
||||
void Createdxf::drawTextAligned(const QString& fileName, const QString& text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign, double xScale, int colour,
|
||||
bool leftAlign, float scale)
|
||||
void Createdxf::drawTextAligned(const QString& fileName,
|
||||
const QString& text,
|
||||
double x,
|
||||
double y,
|
||||
double height,
|
||||
double rotation,
|
||||
double oblique,
|
||||
int hAlign,
|
||||
int vAlign,
|
||||
double xAlign,
|
||||
double xScale,
|
||||
int colour,
|
||||
bool leftAlign,
|
||||
float scale)
|
||||
{
|
||||
Q_UNUSED(scale);
|
||||
|
||||
|
||||
@@ -534,7 +534,10 @@ QHash<QString, QString> projectDataBase::elementInfoToString(Element *elmt)
|
||||
@param caption
|
||||
@param dir
|
||||
*/
|
||||
void projectDataBase::exportDb(projectDataBase *db, QWidget *parent, const QString &caption, const QString &dir)
|
||||
void projectDataBase::exportDb(projectDataBase *db,
|
||||
QWidget *parent,
|
||||
const QString &caption,
|
||||
const QString &dir)
|
||||
{
|
||||
auto caption_ = caption;
|
||||
if (caption_.isEmpty()) {
|
||||
|
||||
@@ -42,7 +42,10 @@ class projectDataBase : public QObject
|
||||
public:
|
||||
projectDataBase(QETProject *project, QObject *parent = nullptr);
|
||||
private:
|
||||
projectDataBase(QETProject *project, const QString &connection_name, const QString &path, QObject *parent = nullptr);
|
||||
projectDataBase(QETProject *project,
|
||||
const QString &connection_name,
|
||||
const QString &path,
|
||||
QObject *parent = nullptr);
|
||||
public:
|
||||
virtual ~projectDataBase() override;
|
||||
|
||||
@@ -59,7 +62,8 @@ class projectDataBase : public QObject
|
||||
void dataBaseUpdated();
|
||||
|
||||
private:
|
||||
bool createDataBase(const QString &connection_name= QString(), const QString &name = QString());
|
||||
bool createDataBase(const QString &connection_name= QString(),
|
||||
const QString &name = QString());
|
||||
void createElementNomenclatureView();
|
||||
void createSummaryView();
|
||||
void populateDiagramTable();
|
||||
@@ -67,7 +71,8 @@ class projectDataBase : public QObject
|
||||
void populateElementInfoTable();
|
||||
void populateDiagramInfoTable();
|
||||
void prepareQuery();
|
||||
static QHash<QString, QString> elementInfoToString(Element *elmt);
|
||||
static QHash<QString, QString> elementInfoToString(
|
||||
Element *elmt);
|
||||
|
||||
private:
|
||||
QPointer<QETProject> m_project;
|
||||
@@ -81,7 +86,10 @@ class projectDataBase : public QObject
|
||||
m_insert_diagram_info_query;
|
||||
|
||||
public:
|
||||
static void exportDb(projectDataBase *db, QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString());
|
||||
static void exportDb(projectDataBase *db,
|
||||
QWidget *parent = nullptr,
|
||||
const QString &caption = QString(),
|
||||
const QString &dir = QString());
|
||||
};
|
||||
|
||||
#endif // PROJECTDATABASE_H
|
||||
|
||||
@@ -133,10 +133,12 @@ class Diagram : public QGraphicsScene
|
||||
protected:
|
||||
void drawBackground(QPainter *, const QRectF &) override;
|
||||
|
||||
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent (
|
||||
QGraphicsSceneMouseEvent *event) override;
|
||||
void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseReleaseEvent (
|
||||
QGraphicsSceneMouseEvent *event) override;
|
||||
void wheelEvent (QGraphicsSceneWheelEvent *event) override;
|
||||
void keyPressEvent (QKeyEvent *event) override;
|
||||
void keyReleaseEvent (QKeyEvent *) override;
|
||||
@@ -167,18 +169,30 @@ class Diagram : public QGraphicsScene
|
||||
|
||||
// methods related to XML import/export
|
||||
QDomDocument toXml(bool = true);
|
||||
bool initFromXml(QDomElement &, QPointF = QPointF(),
|
||||
bool = true, DiagramContent * = nullptr);
|
||||
bool fromXml(QDomDocument &, QPointF = QPointF(),
|
||||
bool = true, DiagramContent * = nullptr);
|
||||
bool fromXml(QDomElement &, QPointF = QPointF(),
|
||||
bool = true, DiagramContent * = nullptr);
|
||||
void folioSequentialsToXml(QHash<QString, QStringList>*,
|
||||
QDomElement *, const QString&,
|
||||
const QString&, QDomDocument *);
|
||||
void folioSequentialsFromXml(const QDomElement&, QHash<QString,
|
||||
QStringList>*, const QString&,
|
||||
const QString&, const QString&,
|
||||
bool initFromXml(QDomElement &,
|
||||
QPointF = QPointF(),
|
||||
bool = true,
|
||||
DiagramContent * = nullptr);
|
||||
bool fromXml(QDomDocument &,
|
||||
QPointF = QPointF(),
|
||||
bool = true,
|
||||
DiagramContent * = nullptr);
|
||||
bool fromXml(QDomElement &,
|
||||
QPointF = QPointF(),
|
||||
bool = true,
|
||||
DiagramContent * = nullptr);
|
||||
void folioSequentialsToXml(QHash<QString,
|
||||
QStringList>*,
|
||||
QDomElement *,
|
||||
const QString&,
|
||||
const QString&,
|
||||
QDomDocument *);
|
||||
void folioSequentialsFromXml(const QDomElement&,
|
||||
QHash<QString,
|
||||
QStringList>*,
|
||||
const QString&,
|
||||
const QString&,
|
||||
const QString&,
|
||||
const QString&);
|
||||
|
||||
void refreshContents();
|
||||
|
||||
@@ -181,8 +181,10 @@ class MoveConductorsTextsCommand : public QUndoCommand {
|
||||
public:
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
virtual void addTextMovement(ConductorTextItem *, const QPointF &,
|
||||
const QPointF &, bool = false);
|
||||
virtual void addTextMovement(ConductorTextItem *,
|
||||
const QPointF &,
|
||||
const QPointF &,
|
||||
bool = false);
|
||||
|
||||
private:
|
||||
void regenerateTextLabel();
|
||||
|
||||
@@ -88,7 +88,8 @@ QString DiagramPrintDialog::docName() const {
|
||||
@param options :
|
||||
@return the rectangle to be printed
|
||||
*/
|
||||
QRect DiagramPrintDialog::diagramRect(Diagram *diagram, const ExportProperties &options) const {
|
||||
QRect DiagramPrintDialog::diagramRect(Diagram *diagram,
|
||||
const ExportProperties &options) const {
|
||||
if (!diagram) return(QRect());
|
||||
|
||||
QRectF diagram_rect = diagram -> border_and_titleblock.borderAndTitleBlockRect();
|
||||
|
||||
@@ -49,22 +49,34 @@ class DiagramPrintDialog : public QWidget
|
||||
void setDocName(const QString &);
|
||||
QString docName() const;
|
||||
QRect diagramRect(Diagram *, const ExportProperties &) const;
|
||||
int pagesCount(Diagram *, const ExportProperties &, bool = false) const;
|
||||
int horizontalPagesCount(Diagram *, const ExportProperties &, bool = false) const;
|
||||
int verticalPagesCount(Diagram *, const ExportProperties &, bool = false) const;
|
||||
int pagesCount(Diagram *,
|
||||
const ExportProperties &,
|
||||
bool = false) const;
|
||||
int horizontalPagesCount(Diagram *,
|
||||
const ExportProperties &,
|
||||
bool = false) const;
|
||||
int verticalPagesCount(Diagram *,
|
||||
const ExportProperties &,
|
||||
bool = false) const;
|
||||
void exec();
|
||||
|
||||
private:
|
||||
void buildPrintTypeDialog();
|
||||
void buildDialog();
|
||||
void saveReloadDiagramParameters(Diagram *, const ExportProperties&, bool);
|
||||
void saveReloadDiagramParameters(Diagram *,
|
||||
const ExportProperties&,
|
||||
bool);
|
||||
void savePageSetupForCurrentPrinter();
|
||||
void loadPageSetupForCurrentPrinter();
|
||||
QString settingsSectionName(const QPrinter *);
|
||||
|
||||
private slots:
|
||||
void print(const QList<Diagram *> &, bool, const ExportProperties&);
|
||||
void printDiagram(Diagram *, bool, const ExportProperties &, QPainter *, QPrinter * = nullptr);
|
||||
void printDiagram(Diagram *,
|
||||
bool,
|
||||
const ExportProperties &,
|
||||
QPainter *,
|
||||
QPrinter * = nullptr);
|
||||
void updatePrintTypeDialog();
|
||||
void acceptPrintTypeDialog();
|
||||
void browseFilePrintTypeDialog();
|
||||
|
||||
@@ -28,7 +28,10 @@
|
||||
in the constructor of this class to avoid have several terminal
|
||||
of an element with the same uuid.
|
||||
*/
|
||||
PastePartsCommand::PastePartsCommand(ElementView *view, const ElementContent &content_to_paste, QUndoCommand *parent) :
|
||||
PastePartsCommand::PastePartsCommand(
|
||||
ElementView *view,
|
||||
const ElementContent &content_to_paste,
|
||||
QUndoCommand *parent) :
|
||||
ElementEditionCommand(view ? view -> scene() : nullptr, view, parent)
|
||||
{
|
||||
for (auto qgi : content_to_paste)
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
@param view
|
||||
@param parent : Parent command
|
||||
*/
|
||||
ElementEditionCommand::ElementEditionCommand(ElementScene *scene, ElementView *view, QUndoCommand *parent):
|
||||
ElementEditionCommand::ElementEditionCommand(ElementScene *scene,
|
||||
ElementView *view,
|
||||
QUndoCommand *parent):
|
||||
QUndoCommand(parent),
|
||||
m_scene(scene),
|
||||
m_view(view)
|
||||
@@ -41,7 +43,10 @@ ElementEditionCommand::ElementEditionCommand(ElementScene *scene, ElementView *v
|
||||
@param view
|
||||
@param parent : Parent command
|
||||
*/
|
||||
ElementEditionCommand::ElementEditionCommand(const QString &text, ElementScene *scene, ElementView *view, QUndoCommand *parent):
|
||||
ElementEditionCommand::ElementEditionCommand(const QString &text,
|
||||
ElementScene *scene,
|
||||
ElementView *view,
|
||||
QUndoCommand *parent):
|
||||
QUndoCommand(text, parent),
|
||||
m_scene(scene),
|
||||
m_view(view)
|
||||
@@ -543,7 +548,12 @@ void ScalePartsCommand::adjustText() {
|
||||
@param elmt_info : new info about type.
|
||||
@param parent : parent undo
|
||||
*/
|
||||
ChangePropertiesCommand::ChangePropertiesCommand(ElementScene *scene, const QString& type, const DiagramContext& info, const DiagramContext& elmt_info, QUndoCommand *parent) :
|
||||
ChangePropertiesCommand::ChangePropertiesCommand(
|
||||
ElementScene *scene,
|
||||
const QString& type,
|
||||
const DiagramContext& info,
|
||||
const DiagramContext& elmt_info,
|
||||
QUndoCommand *parent) :
|
||||
ElementEditionCommand(scene, nullptr, parent)
|
||||
{
|
||||
m_type << scene->m_elmt_type << type;
|
||||
|
||||
@@ -33,8 +33,13 @@ class ElementEditionCommand : public QUndoCommand
|
||||
{
|
||||
// constructors, destructor
|
||||
public:
|
||||
ElementEditionCommand(ElementScene * = nullptr, ElementView * = nullptr, QUndoCommand * = nullptr);
|
||||
ElementEditionCommand(const QString &, ElementScene * = nullptr, ElementView * = nullptr, QUndoCommand * = nullptr);
|
||||
ElementEditionCommand(ElementScene * = nullptr,
|
||||
ElementView * = nullptr,
|
||||
QUndoCommand * = nullptr);
|
||||
ElementEditionCommand(const QString &,
|
||||
ElementScene * = nullptr,
|
||||
ElementView * = nullptr,
|
||||
QUndoCommand * = nullptr);
|
||||
~ElementEditionCommand() override;
|
||||
private:
|
||||
ElementEditionCommand(const ElementEditionCommand &);
|
||||
@@ -259,7 +264,12 @@ class ScalePartsCommand : public ElementEditionCommand {
|
||||
|
||||
class ChangePropertiesCommand : public ElementEditionCommand {
|
||||
public:
|
||||
ChangePropertiesCommand (ElementScene *scene, const QString& type, const DiagramContext& info, const DiagramContext& elmt_info, QUndoCommand *parent=nullptr);
|
||||
ChangePropertiesCommand (
|
||||
ElementScene *scene,
|
||||
const QString& type,
|
||||
const DiagramContext& info,
|
||||
const DiagramContext& elmt_info,
|
||||
QUndoCommand *parent=nullptr);
|
||||
~ChangePropertiesCommand () override;
|
||||
|
||||
void undo() override;
|
||||
|
||||
@@ -80,11 +80,14 @@ QRectF ElementPrimitiveDecorator::boundingRect() const
|
||||
@param option :
|
||||
The option parameter provides style options for the item, such
|
||||
as its state, exposed area and its level-of-detail hints.
|
||||
@param The widget argument is optional. If provided, it points to the
|
||||
widget that is being painted on; otherwise, it is 0. For cached painting,
|
||||
widget is always 0.
|
||||
@param widget :
|
||||
The widget argument is optional. If provided,
|
||||
it points to the widget that is being painted on; otherwise, it is 0.
|
||||
For cached painting, widget is always 0.
|
||||
*/
|
||||
void ElementPrimitiveDecorator::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
void ElementPrimitiveDecorator::paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(widget)
|
||||
|
||||
@@ -50,7 +50,9 @@ class ElementPrimitiveDecorator : public QGraphicsObject
|
||||
// methods
|
||||
QRectF internalBoundingRect() const;
|
||||
QRectF boundingRect () const override;
|
||||
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget * = nullptr) override;
|
||||
void paint(QPainter *,
|
||||
const QStyleOptionGraphicsItem *,
|
||||
QWidget * = nullptr) override;
|
||||
int type() const override { return Type; }
|
||||
void setItems(const QList<QGraphicsItem *> &);
|
||||
void setItems(const QList<CustomElementPart *> &);
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
@param editor QETElement editor that belong this.
|
||||
@param parent
|
||||
*/
|
||||
CustomElementGraphicPart::CustomElementGraphicPart(QETElementEditor *editor, QGraphicsItem *parent) :
|
||||
CustomElementGraphicPart::CustomElementGraphicPart(QETElementEditor *editor,
|
||||
QGraphicsItem *parent) :
|
||||
QGraphicsObject (parent),
|
||||
CustomElementPart(editor),
|
||||
m_hovered (false),
|
||||
@@ -37,7 +38,9 @@ CustomElementGraphicPart::CustomElementGraphicPart(QETElementEditor *editor, QGr
|
||||
_color(BlackColor),
|
||||
_antialiased(false)
|
||||
{
|
||||
setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemSendsGeometryChanges);
|
||||
setFlags(QGraphicsItem::ItemIsSelectable
|
||||
| QGraphicsItem::ItemIsMovable
|
||||
| QGraphicsItem::ItemSendsGeometryChanges);
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
|
||||
@@ -54,13 +57,24 @@ CustomElementGraphicPart::~CustomElementGraphicPart() {}
|
||||
@param painter : painter to use for draw cross,
|
||||
the painter state is restored at end of this method.
|
||||
*/
|
||||
void CustomElementGraphicPart::drawCross(const QPointF ¢er, QPainter *painter)
|
||||
void CustomElementGraphicPart::drawCross(const QPointF ¢er,
|
||||
QPainter *painter)
|
||||
{
|
||||
painter -> save();
|
||||
painter -> setRenderHint(QPainter::Antialiasing, false);
|
||||
painter -> setPen((painter -> brush().color() == QColor(Qt::black) && painter -> brush().isOpaque()) ? Qt::yellow : Qt::blue);
|
||||
painter -> drawLine(QLineF(center.x() - 2.0, center.y(), center.x() + 2.0, center.y()));
|
||||
painter -> drawLine(QLineF(center.x(), center.y() - 2.0, center.x(), center.y() + 2.0));
|
||||
painter -> setPen((painter -> brush().color()
|
||||
== QColor(Qt::black)
|
||||
&& painter -> brush().isOpaque())
|
||||
? Qt::yellow
|
||||
: Qt::blue);
|
||||
painter -> drawLine(QLineF(center.x() - 2.0,
|
||||
center.y(),
|
||||
center.x() + 2.0,
|
||||
center.y()));
|
||||
painter -> drawLine(QLineF(center.x(),
|
||||
center.y() - 2.0,
|
||||
center.x(),
|
||||
center.y() + 2.0));
|
||||
painter -> restore();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,28 +46,230 @@ class CustomElementGraphicPart : public QGraphicsObject, public CustomElementPar
|
||||
|
||||
public:
|
||||
//Line style
|
||||
enum LineStyle {NormalStyle, DashedStyle, DottedStyle, DashdottedStyle};
|
||||
enum LineStyle {NormalStyle,
|
||||
DashedStyle,
|
||||
DottedStyle,
|
||||
DashdottedStyle};
|
||||
Q_ENUM (LineStyle)
|
||||
|
||||
//Line weight : invisible, 0px, 1px, 2px, 5px
|
||||
enum LineWeight {NoneWeight, ThinWeight, NormalWeight, UltraWeight, BigWeight};
|
||||
enum LineWeight {NoneWeight,
|
||||
ThinWeight,
|
||||
NormalWeight,
|
||||
UltraWeight,
|
||||
BigWeight};
|
||||
Q_ENUM (LineWeight)
|
||||
|
||||
//Filling color of the part : NoneFilling -> No filling (i.e. transparent)
|
||||
enum Filling { NoneFilling, BlackFilling, WhiteFilling, GreenFilling, RedFilling, BlueFilling, GrayFilling, BrunFilling, YellowFilling, CyanFilling, MagentaFilling, LightgrayFilling, OrangeFilling, PurpleFilling, HTMLPinkPinkFilling, HTMLPinkLightPinkFilling, HTMLPinkHotPinkFilling, HTMLPinkDeepPinkFilling, HTMLPinkPaleVioletRedFilling, HTMLPinkMediumVioletRedFilling, HTMLRedLightSalmonFilling, HTMLRedSalmonFilling, HTMLRedDarkSalmonFilling, HTMLRedLightCoralFilling, HTMLRedIndianRedFilling, HTMLRedCrimsonFilling, HTMLRedFirebrickFilling, HTMLRedDarkRedFilling, HTMLRedRedFilling, HTMLOrangeOrangeRedFilling, HTMLOrangeTomatoFilling, HTMLOrangeCoralFilling, HTMLOrangeDarkOrangeFilling, HTMLOrangeOrangeFilling, HTMLYellowYellowFilling, HTMLYellowLightYellowFilling, HTMLYellowLemonChiffonFilling, HTMLYellowLightGoldenrodYellowFilling, HTMLYellowPapayaWhipFilling, HTMLYellowMoccasinFilling, HTMLYellowPeachPuffFilling, HTMLYellowPaleGoldenrodFilling, HTMLYellowKhakiFilling, HTMLYellowDarkKhakiFilling, HTMLYellowGoldFilling, HTMLBrownCornsilkFilling, HTMLBrownBlanchedAlmondFilling, HTMLBrownBisqueFilling, HTMLBrownNavajoWhiteFilling, HTMLBrownWheatFilling, HTMLBrownBurlywoodFilling, HTMLBrownTanFilling, HTMLBrownRosyBrownFilling, HTMLBrownSandyBrownFilling, HTMLBrownGoldenrodFilling, HTMLBrownDarkGoldenrodFilling, HTMLBrownPeruFilling, HTMLBrownChocolateFilling, HTMLBrownSaddleBrownFilling, HTMLBrownSiennaFilling, HTMLBrownBrownFilling, HTMLBrownMaroonFilling, HTMLGreenDarkOliveGreenFilling, HTMLGreenOliveFilling, HTMLGreenOliveDrabFilling, HTMLGreenYellowGreenFilling, HTMLGreenLimeGreenFilling, HTMLGreenLimeFilling, HTMLGreenLawnGreenFilling, HTMLGreenChartreuseFilling, HTMLGreenGreenYellowFilling, HTMLGreenSpringGreenFilling, HTMLGreenMediumSpringGreenFilling, HTMLGreenLightGreenFilling, HTMLGreenPaleGreenFilling, HTMLGreenDarkSeaGreenFilling, HTMLGreenMediumAquamarineFilling, HTMLGreenMediumSeaGreenFilling, HTMLGreenSeaGreenFilling, HTMLGreenForestGreenFilling, HTMLGreenGreenFilling, HTMLGreenDarkGreenFilling, HTMLCyanAquaFilling, HTMLCyanCyanFilling, HTMLCyanLightCyanFilling, HTMLCyanPaleTurquoiseFilling, HTMLCyanAquamarineFilling, HTMLCyanTurquoiseFilling, HTMLCyanMediumTurquoiseFilling, HTMLCyanDarkTurquoiseFilling, HTMLCyanLightSeaGreenFilling, HTMLCyanCadetBlueFilling, HTMLCyanDarkCyanFilling, HTMLCyanTealFilling, HTMLBlueLightSteelBlueFilling, HTMLBluePowderBlueFilling, HTMLBlueLightBlueFilling, HTMLBlueSkyBlueFilling, HTMLBlueLightSkyBlueFilling, HTMLBlueDeepSkyBlueFilling, HTMLBlueDodgerBlueFilling, HTMLBlueCornflowerBlueFilling, HTMLBlueSteelBlueFilling, HTMLBlueRoyalBlueFilling, HTMLBlueBlueFilling, HTMLBlueMediumBlueFilling, HTMLBlueDarkBlueFilling, HTMLBlueNavyFilling, HTMLBlueMidnightBlueFilling, HTMLPurpleLavenderFilling, HTMLPurpleThistleFilling, HTMLPurplePlumFilling, HTMLPurpleVioletFilling, HTMLPurpleOrchidFilling, HTMLPurpleFuchsiaFilling, HTMLPurpleMagentaFilling, HTMLPurpleMediumOrchidFilling, HTMLPurpleMediumPurpleFilling, HTMLPurpleBlueVioletFilling, HTMLPurpleDarkVioletFilling, HTMLPurpleDarkOrchidFilling, HTMLPurpleDarkMagentaFilling, HTMLPurplePurpleFilling, HTMLPurpleIndigoFilling, HTMLPurpleDarkSlateBlueFilling, HTMLPurpleSlateBlueFilling, HTMLPurpleMediumSlateBlueFilling, HTMLWhiteWhiteFilling, HTMLWhiteSnowFilling, HTMLWhiteHoneydewFilling, HTMLWhiteMintCreamFilling, HTMLWhiteAzureFilling, HTMLWhiteAliceBlueFilling, HTMLWhiteGhostWhiteFilling, HTMLWhiteWhiteSmokeFilling, HTMLWhiteSeashellFilling, HTMLWhiteBeigeFilling, HTMLWhiteOldLaceFilling, HTMLWhiteFloralWhiteFilling, HTMLWhiteIvoryFilling, HTMLWhiteAntiqueWhiteFilling, HTMLWhiteLinenFilling, HTMLWhiteLavenderBlushFilling, HTMLWhiteMistyRoseFilling, HTMLGrayGainsboroFilling, HTMLGrayLightGrayFilling, HTMLGraySilverFilling, HTMLGrayDarkGrayFilling, HTMLGrayGrayFilling, HTMLGrayDimGrayFilling, HTMLGrayLightSlateGrayFilling, HTMLGraySlateGrayFilling, HTMLGrayDarkSlateGrayFilling, HTMLGrayBlackFilling, HorFilling, VerFilling, BdiagFilling, FdiagFilling};
|
||||
enum Filling { NoneFilling, BlackFilling, WhiteFilling,
|
||||
GreenFilling, RedFilling, BlueFilling,
|
||||
GrayFilling, BrunFilling, YellowFilling,
|
||||
CyanFilling, MagentaFilling, LightgrayFilling,
|
||||
OrangeFilling, PurpleFilling,
|
||||
HTMLPinkPinkFilling, HTMLPinkLightPinkFilling,
|
||||
HTMLPinkHotPinkFilling, HTMLPinkDeepPinkFilling,
|
||||
HTMLPinkPaleVioletRedFilling,
|
||||
HTMLPinkMediumVioletRedFilling,
|
||||
HTMLRedLightSalmonFilling, HTMLRedSalmonFilling,
|
||||
HTMLRedDarkSalmonFilling,
|
||||
HTMLRedLightCoralFilling,
|
||||
HTMLRedIndianRedFilling, HTMLRedCrimsonFilling,
|
||||
HTMLRedFirebrickFilling, HTMLRedDarkRedFilling,
|
||||
HTMLRedRedFilling, HTMLOrangeOrangeRedFilling,
|
||||
HTMLOrangeTomatoFilling, HTMLOrangeCoralFilling,
|
||||
HTMLOrangeDarkOrangeFilling,
|
||||
HTMLOrangeOrangeFilling, HTMLYellowYellowFilling,
|
||||
HTMLYellowLightYellowFilling,
|
||||
HTMLYellowLemonChiffonFilling,
|
||||
HTMLYellowLightGoldenrodYellowFilling,
|
||||
HTMLYellowPapayaWhipFilling,
|
||||
HTMLYellowMoccasinFilling,
|
||||
HTMLYellowPeachPuffFilling,
|
||||
HTMLYellowPaleGoldenrodFilling,
|
||||
HTMLYellowKhakiFilling,
|
||||
HTMLYellowDarkKhakiFilling,
|
||||
HTMLYellowGoldFilling, HTMLBrownCornsilkFilling,
|
||||
HTMLBrownBlanchedAlmondFilling,
|
||||
HTMLBrownBisqueFilling,
|
||||
HTMLBrownNavajoWhiteFilling,
|
||||
HTMLBrownWheatFilling, HTMLBrownBurlywoodFilling,
|
||||
HTMLBrownTanFilling, HTMLBrownRosyBrownFilling,
|
||||
HTMLBrownSandyBrownFilling,
|
||||
HTMLBrownGoldenrodFilling,
|
||||
HTMLBrownDarkGoldenrodFilling,
|
||||
HTMLBrownPeruFilling, HTMLBrownChocolateFilling,
|
||||
HTMLBrownSaddleBrownFilling,
|
||||
HTMLBrownSiennaFilling, HTMLBrownBrownFilling,
|
||||
HTMLBrownMaroonFilling,
|
||||
HTMLGreenDarkOliveGreenFilling,
|
||||
HTMLGreenOliveFilling, HTMLGreenOliveDrabFilling,
|
||||
HTMLGreenYellowGreenFilling,
|
||||
HTMLGreenLimeGreenFilling, HTMLGreenLimeFilling,
|
||||
HTMLGreenLawnGreenFilling,
|
||||
HTMLGreenChartreuseFilling,
|
||||
HTMLGreenGreenYellowFilling,
|
||||
HTMLGreenSpringGreenFilling,
|
||||
HTMLGreenMediumSpringGreenFilling,
|
||||
HTMLGreenLightGreenFilling,
|
||||
HTMLGreenPaleGreenFilling,
|
||||
HTMLGreenDarkSeaGreenFilling,
|
||||
HTMLGreenMediumAquamarineFilling,
|
||||
HTMLGreenMediumSeaGreenFilling,
|
||||
HTMLGreenSeaGreenFilling,
|
||||
HTMLGreenForestGreenFilling,
|
||||
HTMLGreenGreenFilling, HTMLGreenDarkGreenFilling,
|
||||
HTMLCyanAquaFilling, HTMLCyanCyanFilling,
|
||||
HTMLCyanLightCyanFilling,
|
||||
HTMLCyanPaleTurquoiseFilling,
|
||||
HTMLCyanAquamarineFilling,
|
||||
HTMLCyanTurquoiseFilling,
|
||||
HTMLCyanMediumTurquoiseFilling,
|
||||
HTMLCyanDarkTurquoiseFilling,
|
||||
HTMLCyanLightSeaGreenFilling,
|
||||
HTMLCyanCadetBlueFilling,
|
||||
HTMLCyanDarkCyanFilling, HTMLCyanTealFilling,
|
||||
HTMLBlueLightSteelBlueFilling,
|
||||
HTMLBluePowderBlueFilling,
|
||||
HTMLBlueLightBlueFilling, HTMLBlueSkyBlueFilling,
|
||||
HTMLBlueLightSkyBlueFilling,
|
||||
HTMLBlueDeepSkyBlueFilling,
|
||||
HTMLBlueDodgerBlueFilling,
|
||||
HTMLBlueCornflowerBlueFilling,
|
||||
HTMLBlueSteelBlueFilling,
|
||||
HTMLBlueRoyalBlueFilling, HTMLBlueBlueFilling,
|
||||
HTMLBlueMediumBlueFilling,
|
||||
HTMLBlueDarkBlueFilling, HTMLBlueNavyFilling,
|
||||
HTMLBlueMidnightBlueFilling,
|
||||
HTMLPurpleLavenderFilling,
|
||||
HTMLPurpleThistleFilling, HTMLPurplePlumFilling,
|
||||
HTMLPurpleVioletFilling, HTMLPurpleOrchidFilling,
|
||||
HTMLPurpleFuchsiaFilling,
|
||||
HTMLPurpleMagentaFilling,
|
||||
HTMLPurpleMediumOrchidFilling,
|
||||
HTMLPurpleMediumPurpleFilling,
|
||||
HTMLPurpleBlueVioletFilling,
|
||||
HTMLPurpleDarkVioletFilling,
|
||||
HTMLPurpleDarkOrchidFilling,
|
||||
HTMLPurpleDarkMagentaFilling,
|
||||
HTMLPurplePurpleFilling, HTMLPurpleIndigoFilling,
|
||||
HTMLPurpleDarkSlateBlueFilling,
|
||||
HTMLPurpleSlateBlueFilling,
|
||||
HTMLPurpleMediumSlateBlueFilling,
|
||||
HTMLWhiteWhiteFilling, HTMLWhiteSnowFilling,
|
||||
HTMLWhiteHoneydewFilling,
|
||||
HTMLWhiteMintCreamFilling, HTMLWhiteAzureFilling,
|
||||
HTMLWhiteAliceBlueFilling,
|
||||
HTMLWhiteGhostWhiteFilling,
|
||||
HTMLWhiteWhiteSmokeFilling,
|
||||
HTMLWhiteSeashellFilling, HTMLWhiteBeigeFilling,
|
||||
HTMLWhiteOldLaceFilling,
|
||||
HTMLWhiteFloralWhiteFilling,
|
||||
HTMLWhiteIvoryFilling,
|
||||
HTMLWhiteAntiqueWhiteFilling,
|
||||
HTMLWhiteLinenFilling,
|
||||
HTMLWhiteLavenderBlushFilling,
|
||||
HTMLWhiteMistyRoseFilling,
|
||||
HTMLGrayGainsboroFilling,
|
||||
HTMLGrayLightGrayFilling, HTMLGraySilverFilling,
|
||||
HTMLGrayDarkGrayFilling, HTMLGrayGrayFilling,
|
||||
HTMLGrayDimGrayFilling,
|
||||
HTMLGrayLightSlateGrayFilling,
|
||||
HTMLGraySlateGrayFilling,
|
||||
HTMLGrayDarkSlateGrayFilling,
|
||||
HTMLGrayBlackFilling, HorFilling, VerFilling,
|
||||
BdiagFilling, FdiagFilling};
|
||||
Q_ENUM (Filling)
|
||||
|
||||
//Line color
|
||||
enum Color {BlackColor, WhiteColor, GreenColor, RedColor, BlueColor, GrayColor, BrunColor, YellowColor, CyanColor, MagentaColor, LightgrayColor, OrangeColor, PurpleColor, HTMLPinkPinkColor, HTMLPinkLightPinkColor, HTMLPinkHotPinkColor, HTMLPinkDeepPinkColor, HTMLPinkPaleVioletRedColor, HTMLPinkMediumVioletRedColor, HTMLRedLightSalmonColor, HTMLRedSalmonColor, HTMLRedDarkSalmonColor, HTMLRedLightCoralColor, HTMLRedIndianRedColor, HTMLRedCrimsonColor, HTMLRedFirebrickColor, HTMLRedDarkRedColor, HTMLRedRedColor, HTMLOrangeOrangeRedColor, HTMLOrangeTomatoColor, HTMLOrangeCoralColor, HTMLOrangeDarkOrangeColor, HTMLOrangeOrangeColor, HTMLYellowYellowColor, HTMLYellowLightYellowColor, HTMLYellowLemonChiffonColor, HTMLYellowLightGoldenrodYellowColor, HTMLYellowPapayaWhipColor, HTMLYellowMoccasinColor, HTMLYellowPeachPuffColor, HTMLYellowPaleGoldenrodColor, HTMLYellowKhakiColor, HTMLYellowDarkKhakiColor, HTMLYellowGoldColor, HTMLBrownCornsilkColor, HTMLBrownBlanchedAlmondColor, HTMLBrownBisqueColor, HTMLBrownNavajoWhiteColor, HTMLBrownWheatColor, HTMLBrownBurlywoodColor, HTMLBrownTanColor, HTMLBrownRosyBrownColor, HTMLBrownSandyBrownColor, HTMLBrownGoldenrodColor, HTMLBrownDarkGoldenrodColor, HTMLBrownPeruColor, HTMLBrownChocolateColor, HTMLBrownSaddleBrownColor, HTMLBrownSiennaColor, HTMLBrownBrownColor, HTMLBrownMaroonColor, HTMLGreenDarkOliveGreenColor, HTMLGreenOliveColor, HTMLGreenOliveDrabColor, HTMLGreenYellowGreenColor, HTMLGreenLimeGreenColor, HTMLGreenLimeColor, HTMLGreenLawnGreenColor, HTMLGreenChartreuseColor, HTMLGreenGreenYellowColor, HTMLGreenSpringGreenColor, HTMLGreenMediumSpringGreenColor, HTMLGreenLightGreenColor, HTMLGreenPaleGreenColor, HTMLGreenDarkSeaGreenColor, HTMLGreenMediumAquamarineColor, HTMLGreenMediumSeaGreenColor, HTMLGreenSeaGreenColor, HTMLGreenForestGreenColor, HTMLGreenGreenColor, HTMLGreenDarkGreenColor, HTMLCyanAquaColor, HTMLCyanCyanColor, HTMLCyanLightCyanColor, HTMLCyanPaleTurquoiseColor, HTMLCyanAquamarineColor, HTMLCyanTurquoiseColor, HTMLCyanMediumTurquoiseColor, HTMLCyanDarkTurquoiseColor, HTMLCyanLightSeaGreenColor, HTMLCyanCadetBlueColor, HTMLCyanDarkCyanColor, HTMLCyanTealColor, HTMLBlueLightSteelBlueColor, HTMLBluePowderBlueColor, HTMLBlueLightBlueColor, HTMLBlueSkyBlueColor, HTMLBlueLightSkyBlueColor, HTMLBlueDeepSkyBlueColor, HTMLBlueDodgerBlueColor, HTMLBlueCornflowerBlueColor, HTMLBlueSteelBlueColor, HTMLBlueRoyalBlueColor, HTMLBlueBlueColor, HTMLBlueMediumBlueColor, HTMLBlueDarkBlueColor, HTMLBlueNavyColor, HTMLBlueMidnightBlueColor, HTMLPurpleLavenderColor, HTMLPurpleThistleColor, HTMLPurplePlumColor, HTMLPurpleVioletColor, HTMLPurpleOrchidColor, HTMLPurpleFuchsiaColor, HTMLPurpleMagentaColor, HTMLPurpleMediumOrchidColor, HTMLPurpleMediumPurpleColor, HTMLPurpleBlueVioletColor, HTMLPurpleDarkVioletColor, HTMLPurpleDarkOrchidColor, HTMLPurpleDarkMagentaColor, HTMLPurplePurpleColor, HTMLPurpleIndigoColor, HTMLPurpleDarkSlateBlueColor, HTMLPurpleSlateBlueColor, HTMLPurpleMediumSlateBlueColor, HTMLWhiteWhiteColor, HTMLWhiteSnowColor, HTMLWhiteHoneydewColor, HTMLWhiteMintCreamColor, HTMLWhiteAzureColor, HTMLWhiteAliceBlueColor, HTMLWhiteGhostWhiteColor, HTMLWhiteWhiteSmokeColor, HTMLWhiteSeashellColor, HTMLWhiteBeigeColor, HTMLWhiteOldLaceColor, HTMLWhiteFloralWhiteColor, HTMLWhiteIvoryColor, HTMLWhiteAntiqueWhiteColor, HTMLWhiteLinenColor, HTMLWhiteLavenderBlushColor, HTMLWhiteMistyRoseColor, HTMLGrayGainsboroColor, HTMLGrayLightGrayColor, HTMLGraySilverColor, HTMLGrayDarkGrayColor, HTMLGrayGrayColor, HTMLGrayDimGrayColor, HTMLGrayLightSlateGrayColor, HTMLGraySlateGrayColor, HTMLGrayDarkSlateGrayColor, HTMLGrayBlackColor, NoneColor};
|
||||
enum Color {
|
||||
BlackColor, WhiteColor, GreenColor, RedColor, BlueColor,
|
||||
GrayColor, BrunColor, YellowColor, CyanColor,
|
||||
MagentaColor, LightgrayColor, OrangeColor, PurpleColor,
|
||||
HTMLPinkPinkColor, HTMLPinkLightPinkColor,
|
||||
HTMLPinkHotPinkColor, HTMLPinkDeepPinkColor,
|
||||
HTMLPinkPaleVioletRedColor,
|
||||
HTMLPinkMediumVioletRedColor, HTMLRedLightSalmonColor,
|
||||
HTMLRedSalmonColor, HTMLRedDarkSalmonColor,
|
||||
HTMLRedLightCoralColor, HTMLRedIndianRedColor,
|
||||
HTMLRedCrimsonColor, HTMLRedFirebrickColor,
|
||||
HTMLRedDarkRedColor, HTMLRedRedColor,
|
||||
HTMLOrangeOrangeRedColor, HTMLOrangeTomatoColor,
|
||||
HTMLOrangeCoralColor, HTMLOrangeDarkOrangeColor,
|
||||
HTMLOrangeOrangeColor, HTMLYellowYellowColor,
|
||||
HTMLYellowLightYellowColor, HTMLYellowLemonChiffonColor,
|
||||
HTMLYellowLightGoldenrodYellowColor,
|
||||
HTMLYellowPapayaWhipColor, HTMLYellowMoccasinColor,
|
||||
HTMLYellowPeachPuffColor, HTMLYellowPaleGoldenrodColor,
|
||||
HTMLYellowKhakiColor, HTMLYellowDarkKhakiColor,
|
||||
HTMLYellowGoldColor, HTMLBrownCornsilkColor,
|
||||
HTMLBrownBlanchedAlmondColor, HTMLBrownBisqueColor,
|
||||
HTMLBrownNavajoWhiteColor, HTMLBrownWheatColor,
|
||||
HTMLBrownBurlywoodColor, HTMLBrownTanColor,
|
||||
HTMLBrownRosyBrownColor, HTMLBrownSandyBrownColor,
|
||||
HTMLBrownGoldenrodColor, HTMLBrownDarkGoldenrodColor,
|
||||
HTMLBrownPeruColor, HTMLBrownChocolateColor,
|
||||
HTMLBrownSaddleBrownColor, HTMLBrownSiennaColor,
|
||||
HTMLBrownBrownColor, HTMLBrownMaroonColor,
|
||||
HTMLGreenDarkOliveGreenColor, HTMLGreenOliveColor,
|
||||
HTMLGreenOliveDrabColor, HTMLGreenYellowGreenColor,
|
||||
HTMLGreenLimeGreenColor, HTMLGreenLimeColor,
|
||||
HTMLGreenLawnGreenColor, HTMLGreenChartreuseColor,
|
||||
HTMLGreenGreenYellowColor, HTMLGreenSpringGreenColor,
|
||||
HTMLGreenMediumSpringGreenColor,
|
||||
HTMLGreenLightGreenColor, HTMLGreenPaleGreenColor,
|
||||
HTMLGreenDarkSeaGreenColor,
|
||||
HTMLGreenMediumAquamarineColor,
|
||||
HTMLGreenMediumSeaGreenColor, HTMLGreenSeaGreenColor,
|
||||
HTMLGreenForestGreenColor, HTMLGreenGreenColor,
|
||||
HTMLGreenDarkGreenColor, HTMLCyanAquaColor,
|
||||
HTMLCyanCyanColor, HTMLCyanLightCyanColor,
|
||||
HTMLCyanPaleTurquoiseColor, HTMLCyanAquamarineColor,
|
||||
HTMLCyanTurquoiseColor, HTMLCyanMediumTurquoiseColor,
|
||||
HTMLCyanDarkTurquoiseColor, HTMLCyanLightSeaGreenColor,
|
||||
HTMLCyanCadetBlueColor, HTMLCyanDarkCyanColor,
|
||||
HTMLCyanTealColor, HTMLBlueLightSteelBlueColor,
|
||||
HTMLBluePowderBlueColor, HTMLBlueLightBlueColor,
|
||||
HTMLBlueSkyBlueColor, HTMLBlueLightSkyBlueColor,
|
||||
HTMLBlueDeepSkyBlueColor, HTMLBlueDodgerBlueColor,
|
||||
HTMLBlueCornflowerBlueColor, HTMLBlueSteelBlueColor,
|
||||
HTMLBlueRoyalBlueColor, HTMLBlueBlueColor,
|
||||
HTMLBlueMediumBlueColor, HTMLBlueDarkBlueColor,
|
||||
HTMLBlueNavyColor, HTMLBlueMidnightBlueColor,
|
||||
HTMLPurpleLavenderColor, HTMLPurpleThistleColor,
|
||||
HTMLPurplePlumColor, HTMLPurpleVioletColor,
|
||||
HTMLPurpleOrchidColor, HTMLPurpleFuchsiaColor,
|
||||
HTMLPurpleMagentaColor, HTMLPurpleMediumOrchidColor,
|
||||
HTMLPurpleMediumPurpleColor, HTMLPurpleBlueVioletColor,
|
||||
HTMLPurpleDarkVioletColor, HTMLPurpleDarkOrchidColor,
|
||||
HTMLPurpleDarkMagentaColor, HTMLPurplePurpleColor,
|
||||
HTMLPurpleIndigoColor, HTMLPurpleDarkSlateBlueColor,
|
||||
HTMLPurpleSlateBlueColor,
|
||||
HTMLPurpleMediumSlateBlueColor,
|
||||
HTMLWhiteWhiteColor, HTMLWhiteSnowColor,
|
||||
HTMLWhiteHoneydewColor, HTMLWhiteMintCreamColor,
|
||||
HTMLWhiteAzureColor, HTMLWhiteAliceBlueColor,
|
||||
HTMLWhiteGhostWhiteColor, HTMLWhiteWhiteSmokeColor,
|
||||
HTMLWhiteSeashellColor, HTMLWhiteBeigeColor,
|
||||
HTMLWhiteOldLaceColor, HTMLWhiteFloralWhiteColor,
|
||||
HTMLWhiteIvoryColor, HTMLWhiteAntiqueWhiteColor,
|
||||
HTMLWhiteLinenColor, HTMLWhiteLavenderBlushColor,
|
||||
HTMLWhiteMistyRoseColor, HTMLGrayGainsboroColor,
|
||||
HTMLGrayLightGrayColor, HTMLGraySilverColor,
|
||||
HTMLGrayDarkGrayColor, HTMLGrayGrayColor,
|
||||
HTMLGrayDimGrayColor, HTMLGrayLightSlateGrayColor,
|
||||
HTMLGraySlateGrayColor, HTMLGrayDarkSlateGrayColor,
|
||||
HTMLGrayBlackColor, NoneColor};
|
||||
Q_ENUM (Color)
|
||||
|
||||
// constructors, destructor
|
||||
public:
|
||||
|
||||
CustomElementGraphicPart(QETElementEditor *editor, QGraphicsItem *parent = nullptr);
|
||||
CustomElementGraphicPart(QETElementEditor *editor,
|
||||
QGraphicsItem *parent = nullptr);
|
||||
~CustomElementGraphicPart() override;
|
||||
|
||||
static void drawCross (const QPointF ¢er, QPainter *painter);
|
||||
static void drawCross (const QPointF ¢er,
|
||||
QPainter *painter);
|
||||
|
||||
//Getter and setter
|
||||
LineStyle lineStyle () const {return _linestyle;}
|
||||
@@ -89,11 +291,15 @@ class CustomElementGraphicPart : public QGraphicsObject, public CustomElementPar
|
||||
|
||||
|
||||
//Rediriged to QObject Q_PROPERTY system
|
||||
void setProperty (const char *name, const QVariant &value) override {QObject::setProperty(name, value);}
|
||||
QVariant property (const char *name) const override {return QObject::property(name);}
|
||||
void setProperty (const char *name,
|
||||
const QVariant &value) override {
|
||||
QObject::setProperty(name, value);}
|
||||
QVariant property (const char *name) const override {
|
||||
return QObject::property(name);}
|
||||
|
||||
virtual QPainterPath shadowShape ()const = 0;
|
||||
virtual void setHandlerColor(QPointF /*pos*/, const QColor &/*color*/) {}
|
||||
virtual void setHandlerColor(QPointF /*pos*/,
|
||||
const QColor &/*color*/) {}
|
||||
virtual void resetAllHandlerColor() {}
|
||||
|
||||
protected:
|
||||
@@ -103,13 +309,15 @@ class CustomElementGraphicPart : public QGraphicsObject, public CustomElementPar
|
||||
void applyStylesToQPainter(QPainter &) const;
|
||||
void drawShadowShape (QPainter *painter);
|
||||
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
||||
QVariant itemChange(GraphicsItemChange change,
|
||||
const QVariant &value) override;
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseReleaseEvent(
|
||||
QGraphicsSceneMouseEvent *event) override;
|
||||
|
||||
// attributes
|
||||
bool m_hovered;
|
||||
|
||||
@@ -36,15 +36,25 @@ PartText::PartText(QETElementEditor *editor, QGraphicsItem *parent) :
|
||||
setDefaultTextColor(Qt::black);
|
||||
setFont(QETApp::diagramTextsFont());
|
||||
real_font_size_ = font().pointSize();
|
||||
setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges | QGraphicsItem::ItemIsMovable);
|
||||
setFlags(QGraphicsItem::ItemIsSelectable
|
||||
| QGraphicsItem::ItemSendsGeometryChanges
|
||||
| QGraphicsItem::ItemIsMovable);
|
||||
setAcceptHoverEvents(true);
|
||||
setDefaultTextColor(Qt::black);
|
||||
setPlainText(QObject::tr("T", "default text when adding a text in the element editor"));
|
||||
setPlainText(QObject::tr(
|
||||
"T",
|
||||
"default text when adding a text in the element editor"));
|
||||
|
||||
adjustItemPosition(1);
|
||||
// adjust textfield position after line additions/deletions
|
||||
connect(document(), SIGNAL(blockCountChanged(int)), this, SLOT(adjustItemPosition(int)));
|
||||
connect(document(), SIGNAL(contentsChanged()), this, SLOT(adjustItemPosition()));
|
||||
connect(document(),
|
||||
SIGNAL(blockCountChanged(int)),
|
||||
this,
|
||||
SLOT(adjustItemPosition(int)));
|
||||
connect(document(),
|
||||
SIGNAL(contentsChanged()),
|
||||
this,
|
||||
SLOT(adjustItemPosition()));
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
|
||||
@@ -117,14 +117,19 @@ QList <Element *> ElementProvider::find(const int filter) const {
|
||||
and not already in all the chain of next/previous table of table (if set)
|
||||
If table and model are nullptr, return every tables
|
||||
*/
|
||||
QVector<QetGraphicsTableItem *> ElementProvider::table(QetGraphicsTableItem *table, QAbstractItemModel *model)
|
||||
QVector<QetGraphicsTableItem *> ElementProvider::table(
|
||||
QetGraphicsTableItem *table,
|
||||
QAbstractItemModel *model)
|
||||
{
|
||||
QVector<QetGraphicsTableItem *> v_;
|
||||
QVector<QetGraphicsTableItem *> linked_vector;
|
||||
|
||||
if (table)
|
||||
{
|
||||
auto linked_table = table->previousTable() ? table->previousTable() : table->nextTable(); //table can be inside a chain, at the head of a chain or alone
|
||||
//table can be inside a chain, at the head of a chain or alone
|
||||
auto linked_table = table->previousTable()
|
||||
? table->previousTable()
|
||||
: table->nextTable();
|
||||
while (linked_table) { //Go to the first table
|
||||
if (linked_table->previousTable())
|
||||
linked_table = linked_table->previousTable();
|
||||
|
||||
@@ -212,7 +212,10 @@ bool ElementsCollectionCache::fetchData(const ElementsLocation &location) {
|
||||
int state;
|
||||
Element *custom_elmt = ElementFactory::Instance() -> createElement(location, nullptr, &state);
|
||||
if (state) {
|
||||
qDebug() << "ElementsCollectionCache::fetchData() : Le chargement du composant" << qPrintable(location.toString()) << "a echoue avec le code d'erreur" << state;
|
||||
qDebug() << "ElementsCollectionCache::fetchData() : Le chargement du composant"
|
||||
<< qPrintable(location.toString())
|
||||
<< "a echoue avec le code d'erreur"
|
||||
<< state;
|
||||
} else {
|
||||
current_name_ = custom_elmt -> name();
|
||||
current_pixmap_ = custom_elmt -> pixmap();
|
||||
@@ -229,7 +232,8 @@ bool ElementsCollectionCache::fetchData(const ElementsLocation &location) {
|
||||
@param uuid : Element uuid
|
||||
@return True if the retrieval succeeded, false otherwise.
|
||||
*/
|
||||
bool ElementsCollectionCache::fetchNameFromCache(const QString &path, const QUuid &uuid)
|
||||
bool ElementsCollectionCache::fetchNameFromCache(const QString &path,
|
||||
const QUuid &uuid)
|
||||
{
|
||||
select_name_ -> bindValue(":path", path);
|
||||
select_name_ -> bindValue(":locale", locale_);
|
||||
@@ -257,7 +261,8 @@ bool ElementsCollectionCache::fetchNameFromCache(const QString &path, const QUui
|
||||
@param uuid : Element uuid
|
||||
@return True if the retrieval succeeded, false otherwise.
|
||||
*/
|
||||
bool ElementsCollectionCache::fetchPixmapFromCache(const QString &path, const QUuid &uuid)
|
||||
bool ElementsCollectionCache::fetchPixmapFromCache(const QString &path,
|
||||
const QUuid &uuid)
|
||||
{
|
||||
select_pixmap_ -> bindValue(":path", path);
|
||||
select_pixmap_ -> bindValue(":uuid", uuid.toString());
|
||||
@@ -287,7 +292,8 @@ bool ElementsCollectionCache::fetchPixmapFromCache(const QString &path, const QU
|
||||
@return True if the caching succeeded, false otherwise.
|
||||
@see name()
|
||||
*/
|
||||
bool ElementsCollectionCache::cacheName(const QString &path, const QUuid &uuid)
|
||||
bool ElementsCollectionCache::cacheName(const QString &path,
|
||||
const QUuid &uuid)
|
||||
{
|
||||
insert_name_ -> bindValue(":path", path);
|
||||
insert_name_ -> bindValue(":locale", locale_);
|
||||
@@ -309,7 +315,8 @@ bool ElementsCollectionCache::cacheName(const QString &path, const QUuid &uuid)
|
||||
@return True if the caching succeeded, false otherwise.
|
||||
@see pixmap()
|
||||
*/
|
||||
bool ElementsCollectionCache::cachePixmap(const QString &path, const QUuid &uuid)
|
||||
bool ElementsCollectionCache::cachePixmap(const QString &path,
|
||||
const QUuid &uuid)
|
||||
{
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
@@ -31,7 +31,8 @@ class ElementsCollectionCache : public QObject
|
||||
{
|
||||
public:
|
||||
// constructor, destructor
|
||||
ElementsCollectionCache(const QString &database_path, QObject * = nullptr);
|
||||
ElementsCollectionCache(const QString &database_path,
|
||||
QObject * = nullptr);
|
||||
~ElementsCollectionCache() override;
|
||||
|
||||
// methods
|
||||
@@ -46,8 +47,10 @@ class ElementsCollectionCache : public QObject
|
||||
bool fetchData(const ElementsLocation &);
|
||||
bool fetchNameFromCache(const QString &path, const QUuid &uuid);
|
||||
bool fetchPixmapFromCache(const QString &path, const QUuid &uuid);
|
||||
bool cacheName(const QString &path, const QUuid &uuid = QUuid::createUuid());
|
||||
bool cachePixmap(const QString &path, const QUuid &uuid = QUuid::createUuid());
|
||||
bool cacheName(const QString &path,
|
||||
const QUuid &uuid = QUuid::createUuid());
|
||||
bool cachePixmap(const QString &path,
|
||||
const QUuid &uuid = QUuid::createUuid());
|
||||
|
||||
// attributes
|
||||
private:
|
||||
|
||||
@@ -128,7 +128,9 @@ void ElementsPanel::panelContentChange() {
|
||||
@return
|
||||
Le QTreeWidgetItem insere le plus haut
|
||||
*/
|
||||
QTreeWidgetItem *ElementsPanel::addProject(QETProject *project, QTreeWidgetItem *parent_item, PanelOptions options)
|
||||
QTreeWidgetItem *ElementsPanel::addProject(QETProject *project,
|
||||
QTreeWidgetItem *parent_item,
|
||||
PanelOptions options)
|
||||
{
|
||||
Q_UNUSED(parent_item)
|
||||
Q_UNUSED(options)
|
||||
@@ -155,8 +157,16 @@ QTreeWidgetItem *ElementsPanel::addProject(QETProject *project, QTreeWidgetItem
|
||||
return(qtwi_project);
|
||||
}
|
||||
|
||||
QTreeWidgetItem *ElementsPanel::updateTemplatesCollectionItem(QTreeWidgetItem *tbt_collection_qtwi, TitleBlockTemplatesCollection *tbt_collection, PanelOptions options, bool freshly_created) {
|
||||
QTreeWidgetItem *tbtc_qtwi = GenericPanel::updateTemplatesCollectionItem(tbt_collection_qtwi, tbt_collection, options, freshly_created);
|
||||
QTreeWidgetItem *ElementsPanel::updateTemplatesCollectionItem(
|
||||
QTreeWidgetItem *tbt_collection_qtwi,
|
||||
TitleBlockTemplatesCollection *tbt_collection,
|
||||
PanelOptions options,
|
||||
bool freshly_created) {
|
||||
QTreeWidgetItem *tbtc_qtwi = GenericPanel::
|
||||
updateTemplatesCollectionItem(tbt_collection_qtwi,
|
||||
tbt_collection,
|
||||
options,
|
||||
freshly_created);
|
||||
if (tbt_collection && tbt_collection -> parentProject()) {
|
||||
tbtc_qtwi -> setText(0, tr("Cartouches embarqués"));
|
||||
tbtc_qtwi -> setStatusTip(0, tr("Double-cliquez pour réduire ou développer cette collection de cartouches embarquée", "Status tip"));
|
||||
@@ -164,12 +174,19 @@ QTreeWidgetItem *ElementsPanel::updateTemplatesCollectionItem(QTreeWidgetItem *t
|
||||
return(tbtc_qtwi);
|
||||
}
|
||||
|
||||
QTreeWidgetItem *ElementsPanel::updateTemplateItem(QTreeWidgetItem *tb_template_qtwi, const TitleBlockTemplateLocation &tb_template, PanelOptions options, bool freshly_created) {
|
||||
QTreeWidgetItem *item = GenericPanel::updateTemplateItem(tb_template_qtwi, tb_template, options, freshly_created);
|
||||
QTreeWidgetItem *ElementsPanel::updateTemplateItem(
|
||||
QTreeWidgetItem *tb_template_qtwi,
|
||||
const TitleBlockTemplateLocation &tb_template,
|
||||
PanelOptions options,
|
||||
bool freshly_created) {
|
||||
QTreeWidgetItem *item = GenericPanel::updateTemplateItem(
|
||||
tb_template_qtwi,
|
||||
tb_template,
|
||||
options,
|
||||
freshly_created);
|
||||
item -> setStatusTip(
|
||||
0,
|
||||
tr(
|
||||
"Glissez-déposez ce modèle de cartouche sur un folio pour l'y appliquer.",
|
||||
tr("Glissez-déposez ce modèle de cartouche sur un folio pour l'y appliquer.",
|
||||
"Status tip displayed when selecting a title block template"
|
||||
)
|
||||
);
|
||||
@@ -179,13 +196,15 @@ QTreeWidgetItem *ElementsPanel::updateTemplateItem(QTreeWidgetItem *tb_template_
|
||||
/**
|
||||
@return true if \a item matches the filter, false otherwise
|
||||
*/
|
||||
bool ElementsPanel::matchesFilter(const QTreeWidgetItem *item, const QString& filter) const {
|
||||
bool ElementsPanel::matchesFilter(const QTreeWidgetItem *item,
|
||||
const QString& filter) const {
|
||||
if (!item) return(false);
|
||||
|
||||
// no filter => we consider the item matches
|
||||
if (filter.isEmpty()) return(true);
|
||||
|
||||
bool item_matches = item -> text(0).contains(filter, Qt::CaseInsensitive);
|
||||
bool item_matches = item -> text(0).contains(filter,
|
||||
Qt::CaseInsensitive);
|
||||
|
||||
return(item_matches);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,8 @@ ImportElementTextPattern::ImportElementTextPattern(Element *elmt):
|
||||
|
||||
if(!exist)
|
||||
{
|
||||
QMessageBox::information(parentWidget(),
|
||||
QMessageBox::information(
|
||||
parentWidget(),
|
||||
QObject::tr("Configuration de textes"),
|
||||
QObject::tr("Aucune configuration de textes existante."));
|
||||
return;
|
||||
@@ -166,9 +167,12 @@ ImportElementTextPattern::ImportElementTextPattern(Element *elmt):
|
||||
@param erase
|
||||
@return
|
||||
*/
|
||||
QString ImportElementTextPattern::getName(const QStringList& list, bool *ok, bool *erase) const
|
||||
QString ImportElementTextPattern::getName(const QStringList& list,
|
||||
bool *ok,
|
||||
bool *erase) const
|
||||
{
|
||||
return ImportElementTextPatternDialog::getItem(parentWidget(),
|
||||
return ImportElementTextPatternDialog::getItem(
|
||||
parentWidget(),
|
||||
QObject::tr("Sélectionner une configuration de textes"),
|
||||
QObject::tr("Sélectionner la configuration de textes à ajouter à l'élément"),
|
||||
list,
|
||||
|
||||
@@ -45,7 +45,9 @@ class ImportElementTextPattern
|
||||
ImportElementTextPattern(Element *elmt);
|
||||
|
||||
private:
|
||||
QString getName(const QStringList& list, bool *ok, bool *erase) const;
|
||||
QString getName(const QStringList& list,
|
||||
bool *ok,
|
||||
bool *erase) const;
|
||||
QWidget *parentWidget() const;
|
||||
void apply(QString name, bool erase = false) const;
|
||||
|
||||
|
||||
@@ -418,9 +418,19 @@ void ExportDialog::generateDxf(Diagram *diagram,
|
||||
if (epw -> exportProperties().draw_border) {
|
||||
double bx0 = Diagram::margin * Createdxf::xScale;
|
||||
double by0 = Diagram::margin * Createdxf::yScale;
|
||||
Createdxf::drawRectangle(file_path, bx0, -by0, double(width)*Createdxf::xScale, double(height)*Createdxf::yScale, 0);
|
||||
Createdxf::drawRectangle(
|
||||
file_path,
|
||||
bx0,
|
||||
-by0,
|
||||
double(width)*Createdxf::xScale,
|
||||
double(height)*Createdxf::yScale,
|
||||
0);
|
||||
}
|
||||
diagram -> border_and_titleblock.drawDxf(width, height, keep_aspect_ratio, file_path, 0);
|
||||
diagram -> border_and_titleblock.drawDxf(width,
|
||||
height,
|
||||
keep_aspect_ratio,
|
||||
file_path,
|
||||
0);
|
||||
|
||||
// Build the lists of elements.
|
||||
QList<Element *> list_elements;
|
||||
|
||||
@@ -117,7 +117,8 @@ QPixmap ElementPictureFactory::pixmap(const ElementsLocation &location)
|
||||
@param location
|
||||
@return The primtive used to draw the element at location
|
||||
*/
|
||||
ElementPictureFactory::primitives ElementPictureFactory::getPrimitives(const ElementsLocation &location)
|
||||
ElementPictureFactory::primitives ElementPictureFactory::getPrimitives(
|
||||
const ElementsLocation &location)
|
||||
{
|
||||
if(!m_primitives_H.contains(location.uuid()))
|
||||
build(location);
|
||||
@@ -143,7 +144,9 @@ ElementPictureFactory::~ElementPictureFactory() {
|
||||
draw on it and store it in m_pictures_H and m_low_pictures_H
|
||||
@return
|
||||
*/
|
||||
bool ElementPictureFactory::build(const ElementsLocation &location, QPicture *picture, QPicture *low_picture)
|
||||
bool ElementPictureFactory::build(const ElementsLocation &location,
|
||||
QPicture *picture,
|
||||
QPicture *low_picture)
|
||||
{
|
||||
QDomElement dom = location.xml();
|
||||
|
||||
|
||||
@@ -65,7 +65,8 @@ QETProject *ProjectConfigPage::project() const {
|
||||
@param read_values
|
||||
@return the former project
|
||||
*/
|
||||
QETProject *ProjectConfigPage::setProject(QETProject *new_project, bool read_values) {
|
||||
QETProject *ProjectConfigPage::setProject(QETProject *new_project,
|
||||
bool read_values) {
|
||||
if (new_project == m_project) return(m_project);
|
||||
|
||||
QETProject *former_project = m_project;
|
||||
@@ -222,7 +223,8 @@ void ProjectMainConfigPage::adjustReadOnly() {
|
||||
@param project : project to edit
|
||||
@param parent : parent widget
|
||||
*/
|
||||
ProjectAutoNumConfigPage::ProjectAutoNumConfigPage (QETProject *project, QWidget *parent) :
|
||||
ProjectAutoNumConfigPage::ProjectAutoNumConfigPage (QETProject *project,
|
||||
QWidget *parent) :
|
||||
ProjectConfigPage(project, parent)
|
||||
{
|
||||
initWidgets();
|
||||
@@ -626,5 +628,5 @@ void ProjectAutoNumConfigPage::removeContextFolio() {
|
||||
*/
|
||||
void ProjectAutoNumConfigPage::changeToTab(int i)
|
||||
{
|
||||
Q_UNUSED(i);
|
||||
qDebug()<<"Q_UNUSED"<<i;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,8 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage {
|
||||
|
||||
//Methods
|
||||
public:
|
||||
ProjectAutoNumConfigPage (QETProject *project, QWidget *parent = nullptr);
|
||||
ProjectAutoNumConfigPage (QETProject *project,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
QString title() const override;
|
||||
QIcon icon() const override;
|
||||
|
||||
@@ -899,7 +899,10 @@ void ProjectView::updateTabTitle(DiagramView *diagram_view)
|
||||
{
|
||||
QString formula = diagram->border_and_titleblock.folio();
|
||||
autonum::sequentialNumbers seq;
|
||||
title = autonum::AssignVariables::formulaToLabel(formula, seq, diagram);
|
||||
title = autonum::AssignVariables::formulaToLabel(
|
||||
formula,
|
||||
seq,
|
||||
diagram);
|
||||
}
|
||||
else
|
||||
title = QString::number(diagram->folioIndex() + 1);
|
||||
|
||||
@@ -190,13 +190,19 @@ void ProjectDBModel::setQuery(const QString &query)
|
||||
if (m_project)
|
||||
{
|
||||
if (rm_) {
|
||||
disconnect(m_project->dataBase(), &projectDataBase::dataBaseUpdated, this, &ProjectDBModel::dataBaseUpdated);
|
||||
disconnect(m_project->dataBase(),
|
||||
&projectDataBase::dataBaseUpdated,
|
||||
this,
|
||||
&ProjectDBModel::dataBaseUpdated);
|
||||
}
|
||||
m_project->dataBase()->updateDB();
|
||||
if (rm_) {
|
||||
setHeaderString();
|
||||
fillValue();
|
||||
connect(m_project->dataBase(), &projectDataBase::dataBaseUpdated, this, &ProjectDBModel::dataBaseUpdated);
|
||||
connect(m_project->dataBase(),
|
||||
&projectDataBase::dataBaseUpdated,
|
||||
this,
|
||||
&ProjectDBModel::dataBaseUpdated);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1504,7 +1504,8 @@ QPainterPath Conductor::path() const
|
||||
to other conductor in the same potential,
|
||||
the other values of property stay unmodified
|
||||
*/
|
||||
void Conductor::setPropertyToPotential(const ConductorProperties &property, bool only_text)
|
||||
void Conductor::setPropertyToPotential(const ConductorProperties &property,
|
||||
bool only_text)
|
||||
{
|
||||
setProperties(property);
|
||||
QSet <Conductor *> potential_list = relatedPotentialConductors();
|
||||
|
||||
@@ -46,13 +46,18 @@ bool sorting(QGraphicsItem *qgia, QGraphicsItem *qgib)
|
||||
@param name :
|
||||
@param parent :
|
||||
*/
|
||||
ElementTextItemGroup::ElementTextItemGroup(const QString &name, Element *parent) :
|
||||
ElementTextItemGroup::ElementTextItemGroup(const QString &name,
|
||||
Element *parent) :
|
||||
QGraphicsItemGroup(parent),
|
||||
m_name(name),
|
||||
m_parent_element(parent)
|
||||
{
|
||||
setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable);
|
||||
connect(parent, &Element::linkedElementChanged, this, &ElementTextItemGroup::updateXref);
|
||||
setFlags(QGraphicsItem::ItemIsSelectable
|
||||
| QGraphicsItem::ItemIsMovable);
|
||||
connect(parent,
|
||||
&Element::linkedElementChanged,
|
||||
this,
|
||||
&ElementTextItemGroup::updateXref);
|
||||
}
|
||||
|
||||
ElementTextItemGroup::~ElementTextItemGroup()
|
||||
|
||||
@@ -81,7 +81,9 @@ class ElementTextItemGroup : public QObject, public QGraphicsItemGroup
|
||||
void fromXml(QDomElement &dom_element);
|
||||
static QString xmlTaggName() {return QString("texts_group");}
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||
void paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget) override;
|
||||
QRectF boundingRect() const override;
|
||||
void setRotation(qreal angle);
|
||||
void setPos(const QPointF &pos);
|
||||
@@ -90,8 +92,10 @@ class ElementTextItemGroup : public QObject, public QGraphicsItemGroup
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseReleaseEvent(
|
||||
QGraphicsSceneMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent(
|
||||
QGraphicsSceneMouseEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
@param qgi : parent QGraphicItem
|
||||
@param state : int used to know if the creation of element have error
|
||||
*/
|
||||
MasterElement::MasterElement(const ElementsLocation &location, QGraphicsItem *qgi, int *state) :
|
||||
MasterElement::MasterElement(const ElementsLocation &location,
|
||||
QGraphicsItem *qgi,
|
||||
int *state) :
|
||||
Element(location, qgi, state, Element::Master)
|
||||
{}
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
@param conductor : conductor to edit propertie
|
||||
@param parent : parent widget
|
||||
*/
|
||||
ConductorPropertiesDialog::ConductorPropertiesDialog(Conductor *conductor, QWidget *parent) :
|
||||
ConductorPropertiesDialog::ConductorPropertiesDialog(Conductor *conductor,
|
||||
QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ConductorPropertiesDialog)
|
||||
{
|
||||
@@ -58,11 +59,13 @@ ConductorPropertiesDialog::~ConductorPropertiesDialog()
|
||||
@param conductor : conductor to edit propertie
|
||||
@param parent : parent widget
|
||||
*/
|
||||
void ConductorPropertiesDialog::PropertiesDialog(Conductor *conductor, QWidget *parent)
|
||||
void ConductorPropertiesDialog::PropertiesDialog(Conductor *conductor,
|
||||
QWidget *parent)
|
||||
{
|
||||
ConductorPropertiesDialog cpd (conductor, parent);
|
||||
|
||||
if (cpd.exec() == QDialog::Rejected || cpd.properties() == conductor->properties()) return;
|
||||
if (cpd.exec() == QDialog::Rejected
|
||||
|| cpd.properties() == conductor->properties()) return;
|
||||
|
||||
QVariant old_value, new_value;
|
||||
old_value.setValue(conductor->properties());
|
||||
|
||||
@@ -34,8 +34,10 @@ class ConductorPropertiesDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ConductorPropertiesDialog (Conductor *conductor, QWidget *parent = nullptr);
|
||||
static void PropertiesDialog (Conductor *conductor, QWidget *parent = nullptr);
|
||||
explicit ConductorPropertiesDialog (Conductor *conductor,
|
||||
QWidget *parent = nullptr);
|
||||
static void PropertiesDialog (Conductor *conductor,
|
||||
QWidget *parent = nullptr);
|
||||
~ConductorPropertiesDialog() override;
|
||||
|
||||
ConductorProperties properties() const;
|
||||
|
||||
@@ -43,7 +43,9 @@ ConductorPropertiesWidget::ConductorPropertiesWidget(QWidget *parent) :
|
||||
@param properties : properties to edit
|
||||
@param parent : parent widget
|
||||
*/
|
||||
ConductorPropertiesWidget::ConductorPropertiesWidget(const ConductorProperties &properties, QWidget *parent) :
|
||||
ConductorPropertiesWidget::ConductorPropertiesWidget(
|
||||
const ConductorProperties &properties,
|
||||
QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ConductorPropertiesWidget)
|
||||
{
|
||||
@@ -66,7 +68,8 @@ ConductorPropertiesWidget::~ConductorPropertiesWidget()
|
||||
Set the properties
|
||||
@param properties
|
||||
*/
|
||||
void ConductorPropertiesWidget::setProperties(const ConductorProperties &properties)
|
||||
void ConductorPropertiesWidget::setProperties(
|
||||
const ConductorProperties &properties)
|
||||
{
|
||||
if (m_properties == properties)
|
||||
return;
|
||||
|
||||
@@ -34,7 +34,9 @@ class ConductorPropertiesWidget : public QWidget
|
||||
|
||||
public:
|
||||
explicit ConductorPropertiesWidget(QWidget *parent = nullptr);
|
||||
explicit ConductorPropertiesWidget(const ConductorProperties &properties, QWidget *parent = nullptr);
|
||||
explicit ConductorPropertiesWidget(
|
||||
const ConductorProperties &properties,
|
||||
QWidget *parent = nullptr);
|
||||
~ConductorPropertiesWidget() override;
|
||||
|
||||
//METHODS
|
||||
|
||||
@@ -32,8 +32,10 @@ class DiagramPropertiesEditorDockWidget : public PropertiesEditorDockWidget
|
||||
void setDiagram(Diagram *diagram);
|
||||
|
||||
private: //Make this method private because only this class manage the editor widget.
|
||||
bool addEditor(PropertiesEditorWidget *editor, int index = 0) { return PropertiesEditorDockWidget::addEditor(editor, index); }
|
||||
bool removeEditor(PropertiesEditorWidget *editor) { return PropertiesEditorDockWidget::removeEditor(editor); }
|
||||
bool addEditor(PropertiesEditorWidget *editor,int index = 0)
|
||||
{return PropertiesEditorDockWidget::addEditor(editor,index); }
|
||||
bool removeEditor(PropertiesEditorWidget *editor)
|
||||
{ return PropertiesEditorDockWidget::removeEditor(editor); }
|
||||
|
||||
private slots:
|
||||
void selectionChanged();
|
||||
|
||||
@@ -66,8 +66,12 @@ class DynamicElementTextModel : public QStandardItemModel
|
||||
DynamicElementTextItem *textFromIndex(const QModelIndex &index) const;
|
||||
DynamicElementTextItem *textFromItem(QStandardItem *item) const;
|
||||
QModelIndex indexFromText(DynamicElementTextItem *text) const;
|
||||
QUndoCommand *undoForEditedText(DynamicElementTextItem *deti, QUndoCommand *parent_undo = nullptr) const;
|
||||
QUndoCommand *undoForEditedGroup(ElementTextItemGroup *group, QUndoCommand *parent_undo = nullptr) const;
|
||||
QUndoCommand *undoForEditedText(
|
||||
DynamicElementTextItem *deti,
|
||||
QUndoCommand *parent_undo = nullptr) const;
|
||||
QUndoCommand *undoForEditedGroup(
|
||||
ElementTextItemGroup *group,
|
||||
QUndoCommand *parent_undo = nullptr) const;
|
||||
|
||||
ElementTextItemGroup *groupFromIndex(const QModelIndex &index) const;
|
||||
ElementTextItemGroup *groupFromItem(QStandardItem *item) const;
|
||||
@@ -75,8 +79,16 @@ class DynamicElementTextModel : public QStandardItemModel
|
||||
bool indexIsText(const QModelIndex &index) const;
|
||||
bool indexIsGroup(const QModelIndex &index) const;
|
||||
|
||||
bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override;
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
|
||||
bool canDropMimeData(const QMimeData *data,
|
||||
Qt::DropAction action,
|
||||
int row,
|
||||
int column,
|
||||
const QModelIndex &parent) const override;
|
||||
bool dropMimeData(const QMimeData *data,
|
||||
Qt::DropAction action,
|
||||
int row,
|
||||
int column,
|
||||
const QModelIndex &parent) override;
|
||||
QMimeData *mimeData(const QModelIndexList &indexes) const override;
|
||||
QStringList mimeTypes() const override;
|
||||
|
||||
@@ -89,22 +101,29 @@ class DynamicElementTextModel : public QStandardItemModel
|
||||
void removeText(DynamicElementTextItem *deti);
|
||||
void addGroup(ElementTextItemGroup *group);
|
||||
void removeGroup(ElementTextItemGroup *group);
|
||||
void addTextToGroup(DynamicElementTextItem *deti, ElementTextItemGroup *group);
|
||||
void removeTextFromGroup(DynamicElementTextItem *deti, ElementTextItemGroup *group);
|
||||
void enableSourceText(DynamicElementTextItem *deti, DynamicElementTextItem::TextFrom tf );
|
||||
void addTextToGroup(DynamicElementTextItem *deti,
|
||||
ElementTextItemGroup *group);
|
||||
void removeTextFromGroup(DynamicElementTextItem *deti,
|
||||
ElementTextItemGroup *group);
|
||||
void enableSourceText(DynamicElementTextItem *deti,
|
||||
DynamicElementTextItem::TextFrom tf );
|
||||
void enableGroupRotationAndPos(ElementTextItemGroup *group);
|
||||
void itemDataChanged(QStandardItem *qsi);
|
||||
void setConnection(DynamicElementTextItem *deti, bool set);
|
||||
void setConnection(ElementTextItemGroup *group, bool set);
|
||||
void updateDataFromText(DynamicElementTextItem *deti, DynamicElementTextModel::ValueType type);
|
||||
void updateDataFromGroup(ElementTextItemGroup *group, DynamicElementTextModel::ValueType type);
|
||||
void updateDataFromText(DynamicElementTextItem *deti,
|
||||
DynamicElementTextModel::ValueType type);
|
||||
void updateDataFromGroup(ElementTextItemGroup *group,
|
||||
DynamicElementTextModel::ValueType type);
|
||||
|
||||
private:
|
||||
QPointer<Element> m_element;
|
||||
QHash <DynamicElementTextItem *, QStandardItem *> m_texts_list;
|
||||
QHash <ElementTextItemGroup *, QStandardItem *> m_groups_list;
|
||||
QHash <DynamicElementTextItem *, QList<QMetaObject::Connection>> m_hash_text_connect;
|
||||
QHash <ElementTextItemGroup *, QList<QMetaObject::Connection>> m_hash_group_connect;
|
||||
QHash <DynamicElementTextItem *,
|
||||
QList<QMetaObject::Connection>> m_hash_text_connect;
|
||||
QHash <ElementTextItemGroup *,
|
||||
QList<QMetaObject::Connection>> m_hash_group_connect;
|
||||
bool m_block_dataChanged = false;
|
||||
};
|
||||
|
||||
@@ -115,8 +134,12 @@ class DynamicTextItemDelegate : public QStyledItemDelegate
|
||||
public:
|
||||
DynamicTextItemDelegate(QObject *parent = Q_NULLPTR);
|
||||
|
||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
||||
QWidget *createEditor(QWidget *parent,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override;
|
||||
void setModelData(QWidget *editor,
|
||||
QAbstractItemModel *model,
|
||||
const QModelIndex &index) const override;
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
|
||||
@@ -41,15 +41,25 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector
|
||||
{
|
||||
Terminal *terminal_1 = conductor->terminal1;
|
||||
Terminal *terminal_2 = conductor->terminal2;
|
||||
//We temporarily remove the conductor of his two terminals, to get the two existing potential
|
||||
//We temporarily remove the conductor of his two terminals,
|
||||
//to get the two existing potential
|
||||
terminal_1->removeConductor(conductor);
|
||||
terminal_2->removeConductor(conductor);
|
||||
|
||||
getPotential(terminal_1, m_seq_num_1, m_conductor_number_1, m_properties_list_1, m_conductors_list_1);
|
||||
getPotential(terminal_2, m_seq_num_2, m_conductor_number_2, m_properties_list_2, m_conductors_list_2);
|
||||
getPotential(terminal_1,
|
||||
m_seq_num_1,
|
||||
m_conductor_number_1,
|
||||
m_properties_list_1,
|
||||
m_conductors_list_1);
|
||||
getPotential(terminal_2,
|
||||
m_seq_num_2,
|
||||
m_conductor_number_2,
|
||||
m_properties_list_2,
|
||||
m_conductors_list_2);
|
||||
|
||||
//There isn't a potential at terminal 1 or 2.
|
||||
if (m_conductor_number_1 == 0 && m_conductor_number_2 == 0) return;
|
||||
if (m_conductor_number_1 == 0
|
||||
&& m_conductor_number_2 == 0) return;
|
||||
|
||||
//Re-add conductor to his terminals.
|
||||
terminal_1->addConductor(conductor);
|
||||
@@ -69,7 +79,11 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector
|
||||
@param properties_list
|
||||
@param c_list
|
||||
*/
|
||||
void getPotential(Terminal *terminal, autonum::sequentialNumbers &seq_num , int &number, QList<ConductorProperties> &properties_list, QList<Conductor*> &c_list)
|
||||
void getPotential(
|
||||
Terminal *terminal,
|
||||
autonum::sequentialNumbers &seq_num ,
|
||||
int &number, QList<ConductorProperties> &properties_list,
|
||||
QList<Conductor*> &c_list)
|
||||
{
|
||||
Conductor *conductor_in_potential = nullptr;
|
||||
|
||||
@@ -105,7 +119,8 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector
|
||||
if (!conductor_in_potential)
|
||||
return;
|
||||
seq_num = conductor_in_potential->sequenceNum();
|
||||
number = conductor_in_potential->relatedPotentialConductors().size()+1; //We add +1 because conductor_in_potential isn't count by relatedPotentialConductors
|
||||
//We add +1 because conductor_in_potential isn't count by relatedPotentialConductors
|
||||
number = conductor_in_potential->relatedPotentialConductors().size()+1;
|
||||
|
||||
c_list = conductor_in_potential->relatedPotentialConductors().values();
|
||||
c_list.append(conductor_in_potential);
|
||||
|
||||
Reference in New Issue
Block a user