mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-16 14:50:00 +01:00
Fix indentation code
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2020 QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
Copyright 2006-2020 QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "projectdbmodel.h"
|
||||
#include "projectdatabase.h"
|
||||
@@ -30,8 +30,8 @@
|
||||
* @param parent : parent QObject
|
||||
*/
|
||||
ProjectDBModel::ProjectDBModel(QETProject *project, QObject *parent) :
|
||||
QAbstractTableModel(parent),
|
||||
m_project(project)
|
||||
QAbstractTableModel(parent),
|
||||
m_project(project)
|
||||
{
|
||||
connect(m_project->dataBase(), &projectDataBase::dataBaseUpdated, this, &ProjectDBModel::dataBaseUpdated);
|
||||
}
|
||||
@@ -41,13 +41,13 @@ ProjectDBModel::ProjectDBModel(QETProject *project, QObject *parent) :
|
||||
* @param other_model
|
||||
*/
|
||||
ProjectDBModel::ProjectDBModel(const ProjectDBModel &other_model) :
|
||||
QAbstractTableModel(other_model.parent())
|
||||
QAbstractTableModel(other_model.parent())
|
||||
{
|
||||
this->setParent(other_model.parent());
|
||||
m_project = other_model.m_project;
|
||||
this->setParent(other_model.parent());
|
||||
m_project = other_model.m_project;
|
||||
connect(m_project->dataBase(), &projectDataBase::dataBaseUpdated, this, &ProjectDBModel::dataBaseUpdated);
|
||||
m_index_0_0_data = other_model.m_index_0_0_data;
|
||||
setQuery(other_model.queryString());
|
||||
m_index_0_0_data = other_model.m_index_0_0_data;
|
||||
setQuery(other_model.queryString());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,10 +58,10 @@ ProjectDBModel::ProjectDBModel(const ProjectDBModel &other_model) :
|
||||
*/
|
||||
int ProjectDBModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_record.count();
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_record.count();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,14 +72,14 @@ int ProjectDBModel::rowCount(const QModelIndex &parent) const
|
||||
*/
|
||||
int ProjectDBModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
if (m_record.count()) {
|
||||
return m_record.first().count();
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
if (m_record.count()) {
|
||||
return m_record.first().count();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,14 +94,14 @@ int ProjectDBModel::columnCount(const QModelIndex &parent) const
|
||||
*/
|
||||
bool ProjectDBModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)
|
||||
{
|
||||
if (orientation == Qt::Vertical) {
|
||||
return false;
|
||||
}
|
||||
auto hash_ = m_header_data.value(section);
|
||||
hash_.insert(role, value);
|
||||
m_header_data.insert(section, hash_);
|
||||
emit headerDataChanged(orientation, section, section);
|
||||
return true;
|
||||
if (orientation == Qt::Vertical) {
|
||||
return false;
|
||||
}
|
||||
auto hash_ = m_header_data.value(section);
|
||||
hash_.insert(role, value);
|
||||
m_header_data.insert(section, hash_);
|
||||
emit headerDataChanged(orientation, section, section);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,19 +114,19 @@ bool ProjectDBModel::setHeaderData(int section, Qt::Orientation orientation, con
|
||||
*/
|
||||
QVariant ProjectDBModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (orientation == Qt::Vertical) {
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if (m_header_data.contains(section))
|
||||
{
|
||||
auto hash_ = m_header_data.value(section);
|
||||
if (role == Qt::DisplayRole && !hash_.contains(Qt::DisplayRole)) { //special case to have the same behavior as Qt
|
||||
return hash_.value(Qt::EditRole);
|
||||
}
|
||||
return m_header_data.value(section).value(role);
|
||||
}
|
||||
return QVariant();
|
||||
if (orientation == Qt::Vertical) {
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if (m_header_data.contains(section))
|
||||
{
|
||||
auto hash_ = m_header_data.value(section);
|
||||
if (role == Qt::DisplayRole && !hash_.contains(Qt::DisplayRole)) { //special case to have the same behavior as Qt
|
||||
return hash_.value(Qt::EditRole);
|
||||
}
|
||||
return m_header_data.value(section).value(role);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,12 +139,12 @@ QVariant ProjectDBModel::headerData(int section, Qt::Orientation orientation, in
|
||||
*/
|
||||
bool ProjectDBModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (!index.isValid() || index.row() != 0 || index.column() != 0) {
|
||||
return false;
|
||||
}
|
||||
m_index_0_0_data.insert(role, value);
|
||||
emit dataChanged(index, index, QVector<int>(role));
|
||||
return true;
|
||||
if (!index.isValid() || index.row() != 0 || index.column() != 0) {
|
||||
return false;
|
||||
}
|
||||
m_index_0_0_data.insert(role, value);
|
||||
emit dataChanged(index, index, QVector<int>(role));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,21 +156,21 @@ bool ProjectDBModel::setData(const QModelIndex &index, const QVariant &value, in
|
||||
*/
|
||||
QVariant ProjectDBModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if (index.row() == 0 &&
|
||||
index.column() == 0 &&
|
||||
role != Qt::DisplayRole) {
|
||||
return m_index_0_0_data.value(role);
|
||||
}
|
||||
|
||||
if (role == Qt::DisplayRole) {
|
||||
QVariant v(m_record.at(index.row()).at(index.column()));
|
||||
return v;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if (index.row() == 0 &&
|
||||
index.column() == 0 &&
|
||||
role != Qt::DisplayRole) {
|
||||
return m_index_0_0_data.value(role);
|
||||
}
|
||||
|
||||
if (role == Qt::DisplayRole) {
|
||||
QVariant v(m_record.at(index.row()).at(index.column()));
|
||||
return v;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,29 +180,29 @@ QVariant ProjectDBModel::data(const QModelIndex &index, int role) const
|
||||
*/
|
||||
void ProjectDBModel::setQuery(const QString &query)
|
||||
{
|
||||
auto rm_ = m_query != query;
|
||||
if (rm_) {
|
||||
emit beginResetModel();
|
||||
}
|
||||
|
||||
m_query = query;
|
||||
|
||||
if (m_project)
|
||||
{
|
||||
if (rm_) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (rm_) {
|
||||
emit endResetModel();
|
||||
}
|
||||
auto rm_ = m_query != query;
|
||||
if (rm_) {
|
||||
emit beginResetModel();
|
||||
}
|
||||
|
||||
m_query = query;
|
||||
|
||||
if (m_project)
|
||||
{
|
||||
if (rm_) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if (rm_) {
|
||||
emit endResetModel();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,11 +210,11 @@ void ProjectDBModel::setQuery(const QString &query)
|
||||
* @return the current query used by this model
|
||||
*/
|
||||
QString ProjectDBModel::queryString() const {
|
||||
return m_query;
|
||||
return m_query;
|
||||
}
|
||||
|
||||
QETProject *ProjectDBModel::project() const {
|
||||
return m_project.data();
|
||||
return m_project.data();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,42 +226,42 @@ QETProject *ProjectDBModel::project() const {
|
||||
*/
|
||||
QDomElement ProjectDBModel::toXml(QDomDocument &document) const
|
||||
{
|
||||
auto dom_element = document.createElement(xmlTagName());
|
||||
|
||||
//Identifier
|
||||
auto dom_identifier = document.createElement("identifier");
|
||||
auto dom_identifier_text = document.createTextNode(m_identifier);
|
||||
dom_identifier.appendChild(dom_identifier_text);
|
||||
dom_element.appendChild(dom_identifier);
|
||||
|
||||
//query
|
||||
auto dom_query = document.createElement("query");
|
||||
auto dom_query_text = document.createTextNode(m_query);
|
||||
dom_query.appendChild(dom_query_text);
|
||||
dom_element.appendChild(dom_query);
|
||||
|
||||
//Add index 0,0 data
|
||||
auto index_00 = document.createElement("index00");
|
||||
index_00.setAttribute("font", m_index_0_0_data.value(Qt::FontRole).toString());
|
||||
auto me = QMetaEnum::fromType<Qt::Alignment>();
|
||||
index_00.setAttribute("alignment", me.valueToKey(m_index_0_0_data.value(Qt::TextAlignmentRole).toInt()));
|
||||
dom_element.appendChild(index_00);
|
||||
index_00.setAttribute("margins", m_index_0_0_data.value(Qt::UserRole+1).toString());
|
||||
|
||||
//header data
|
||||
QHash<int, QList<int>> horizontal_;
|
||||
for (auto key : m_header_data.keys())
|
||||
{
|
||||
//We save all data except the display role, because he was generated in the fly
|
||||
auto list = m_header_data.value(key).keys();
|
||||
list.removeAll(Qt::DisplayRole);
|
||||
|
||||
horizontal_.insert(key, list);
|
||||
}
|
||||
|
||||
dom_element.appendChild(QETXML::modelHeaderDataToXml(document, this, horizontal_, QHash<int, QList<int>>()));
|
||||
|
||||
return dom_element;
|
||||
auto dom_element = document.createElement(xmlTagName());
|
||||
|
||||
//Identifier
|
||||
auto dom_identifier = document.createElement("identifier");
|
||||
auto dom_identifier_text = document.createTextNode(m_identifier);
|
||||
dom_identifier.appendChild(dom_identifier_text);
|
||||
dom_element.appendChild(dom_identifier);
|
||||
|
||||
//query
|
||||
auto dom_query = document.createElement("query");
|
||||
auto dom_query_text = document.createTextNode(m_query);
|
||||
dom_query.appendChild(dom_query_text);
|
||||
dom_element.appendChild(dom_query);
|
||||
|
||||
//Add index 0,0 data
|
||||
auto index_00 = document.createElement("index00");
|
||||
index_00.setAttribute("font", m_index_0_0_data.value(Qt::FontRole).toString());
|
||||
auto me = QMetaEnum::fromType<Qt::Alignment>();
|
||||
index_00.setAttribute("alignment", me.valueToKey(m_index_0_0_data.value(Qt::TextAlignmentRole).toInt()));
|
||||
dom_element.appendChild(index_00);
|
||||
index_00.setAttribute("margins", m_index_0_0_data.value(Qt::UserRole+1).toString());
|
||||
|
||||
//header data
|
||||
QHash<int, QList<int>> horizontal_;
|
||||
for (auto key : m_header_data.keys())
|
||||
{
|
||||
//We save all data except the display role, because he was generated in the fly
|
||||
auto list = m_header_data.value(key).keys();
|
||||
list.removeAll(Qt::DisplayRole);
|
||||
|
||||
horizontal_.insert(key, list);
|
||||
}
|
||||
|
||||
dom_element.appendChild(QETXML::modelHeaderDataToXml(document, this, horizontal_, QHash<int, QList<int>>()));
|
||||
|
||||
return dom_element;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,22 +271,22 @@ QDomElement ProjectDBModel::toXml(QDomDocument &document) const
|
||||
*/
|
||||
void ProjectDBModel::fromXml(const QDomElement &element)
|
||||
{
|
||||
if (element.tagName() != xmlTagName())
|
||||
return;
|
||||
|
||||
setIdentifier(element.firstChildElement("identifier").text());
|
||||
setQuery(element.firstChildElement("query").text());
|
||||
|
||||
//Index 0,0
|
||||
auto index_00 = element.firstChildElement("index00");
|
||||
QFont font_;
|
||||
font_.fromString(index_00.attribute("font"));
|
||||
m_index_0_0_data.insert(Qt::FontRole, font_);
|
||||
auto me = QMetaEnum::fromType<Qt::Alignment>();
|
||||
m_index_0_0_data.insert(Qt::TextAlignmentRole, me.keyToValue(index_00.attribute("alignment").toStdString().data()));
|
||||
m_index_0_0_data.insert(Qt::UserRole+1, index_00.attribute("margins"));
|
||||
|
||||
QETXML::modelHeaderDataFromXml(element.firstChildElement("header_data"), this);
|
||||
if (element.tagName() != xmlTagName())
|
||||
return;
|
||||
|
||||
setIdentifier(element.firstChildElement("identifier").text());
|
||||
setQuery(element.firstChildElement("query").text());
|
||||
|
||||
//Index 0,0
|
||||
auto index_00 = element.firstChildElement("index00");
|
||||
QFont font_;
|
||||
font_.fromString(index_00.attribute("font"));
|
||||
m_index_0_0_data.insert(Qt::FontRole, font_);
|
||||
auto me = QMetaEnum::fromType<Qt::Alignment>();
|
||||
m_index_0_0_data.insert(Qt::TextAlignmentRole, me.keyToValue(index_00.attribute("alignment").toStdString().data()));
|
||||
m_index_0_0_data.insert(Qt::UserRole+1, index_00.attribute("margins"));
|
||||
|
||||
QETXML::modelHeaderDataFromXml(element.firstChildElement("header_data"), this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -304,39 +304,39 @@ void ProjectDBModel::setIdentifier(const QString &identifier) {
|
||||
*/
|
||||
void ProjectDBModel::dataBaseUpdated()
|
||||
{
|
||||
auto original_record = m_record;
|
||||
fillValue();
|
||||
auto new_record = m_record;
|
||||
m_record = original_record;
|
||||
|
||||
//This a very special case, if this nomenclature model is added
|
||||
//befor any element, column count return 0, so in this case we emit column inserted
|
||||
if (new_record.size() != m_record.size())
|
||||
{
|
||||
emit beginResetModel();
|
||||
m_record = new_record;
|
||||
emit endResetModel();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_record = new_record;
|
||||
auto row = m_record.size();
|
||||
auto col = row ? m_record.first().count() : 1;
|
||||
|
||||
emit dataChanged(this->index(0,0), this->index(row-1, col-1), QVector<int>(Qt::DisplayRole));
|
||||
}
|
||||
auto original_record = m_record;
|
||||
fillValue();
|
||||
auto new_record = m_record;
|
||||
m_record = original_record;
|
||||
|
||||
//This a very special case, if this nomenclature model is added
|
||||
//befor any element, column count return 0, so in this case we emit column inserted
|
||||
if (new_record.size() != m_record.size())
|
||||
{
|
||||
emit beginResetModel();
|
||||
m_record = new_record;
|
||||
emit endResetModel();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_record = new_record;
|
||||
auto row = m_record.size();
|
||||
auto col = row ? m_record.first().count() : 1;
|
||||
|
||||
emit dataChanged(this->index(0,0), this->index(row-1, col-1), QVector<int>(Qt::DisplayRole));
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectDBModel::setHeaderString()
|
||||
{
|
||||
auto q = m_project->dataBase()->newQuery(m_query);
|
||||
auto record = q.record();
|
||||
|
||||
|
||||
for (auto i=0 ; i<record.count() ; ++i)
|
||||
{
|
||||
auto field_name = record.fieldName(i);
|
||||
QString header_name;
|
||||
|
||||
|
||||
if (field_name == "position") {
|
||||
header_name = tr("Position");
|
||||
} else if (field_name == "diagram_position") {
|
||||
@@ -357,12 +357,12 @@ void ProjectDBModel::setHeaderString()
|
||||
void ProjectDBModel::fillValue()
|
||||
{
|
||||
m_record.clear();
|
||||
|
||||
|
||||
auto query_ = m_project->dataBase()->newQuery(m_query);
|
||||
if (!query_.exec()) {
|
||||
qDebug() << "Query error : " << query_.lastError();
|
||||
}
|
||||
|
||||
|
||||
while (query_.next())
|
||||
{
|
||||
QStringList record_;
|
||||
|
||||
@@ -581,27 +581,27 @@ bool Conductor::valideXml(QDomElement &e){
|
||||
if (!e.hasAttribute("terminal2")) return(false);
|
||||
|
||||
bool conv_ok;
|
||||
// parse l'abscisse
|
||||
if (e.hasAttribute("element1")) {
|
||||
if (QUuid(e.attribute("element1")).isNull())
|
||||
return false;
|
||||
if (QUuid(e.attribute("terminal1")).isNull())
|
||||
return false;
|
||||
} else {
|
||||
e.attribute("terminal1").toInt(&conv_ok);
|
||||
if (!conv_ok) return(false);
|
||||
}
|
||||
// parse l'abscisse
|
||||
if (e.hasAttribute("element1")) {
|
||||
if (QUuid(e.attribute("element1")).isNull())
|
||||
return false;
|
||||
if (QUuid(e.attribute("terminal1")).isNull())
|
||||
return false;
|
||||
} else {
|
||||
e.attribute("terminal1").toInt(&conv_ok);
|
||||
if (!conv_ok) return(false);
|
||||
}
|
||||
|
||||
// parse l'ordonnee
|
||||
if (e.hasAttribute("element2")) {
|
||||
if (QUuid(e.attribute("element2")).isNull())
|
||||
return false;
|
||||
if (QUuid(e.attribute("terminal2")).isNull())
|
||||
return false;
|
||||
} else {
|
||||
e.attribute("terminal2").toInt(&conv_ok);
|
||||
if (!conv_ok) return(false);
|
||||
}
|
||||
if (e.hasAttribute("element2")) {
|
||||
if (QUuid(e.attribute("element2")).isNull())
|
||||
return false;
|
||||
if (QUuid(e.attribute("terminal2")).isNull())
|
||||
return false;
|
||||
} else {
|
||||
e.attribute("terminal2").toInt(&conv_ok);
|
||||
if (!conv_ok) return(false);
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -130,22 +130,22 @@ void ConductorTextItem::forceRotateByUser(bool rotate_by_user) {
|
||||
*/
|
||||
void ConductorTextItem::setPos(const QPointF &pos)
|
||||
{
|
||||
/*
|
||||
* In some condition the conductor text item is outside the border of folio in the left.
|
||||
* They cause a margin on the left of folio and in most case this margin is unwanted and annoying the user.
|
||||
* If the text is empty and the scene position is outside the border (left and top),
|
||||
* we can say that this position, is unwanted by user.
|
||||
* So we move this text item to the top left of the bounding rect of parent conductors, because we sure this position is wanted by user.
|
||||
*/
|
||||
DiagramTextItem::setPos(pos);
|
||||
if(toPlainText().isEmpty() && (scenePos().x() < 0 || scenePos().y() < 0))
|
||||
{
|
||||
Conductor *cond = parentConductor();
|
||||
if(cond)
|
||||
DiagramTextItem::setPos(cond->boundingRect().topLeft());
|
||||
else
|
||||
DiagramTextItem::setPos(0,0);
|
||||
}
|
||||
/*
|
||||
* In some condition the conductor text item is outside the border of folio in the left.
|
||||
* They cause a margin on the left of folio and in most case this margin is unwanted and annoying the user.
|
||||
* If the text is empty and the scene position is outside the border (left and top),
|
||||
* we can say that this position, is unwanted by user.
|
||||
* So we move this text item to the top left of the bounding rect of parent conductors, because we sure this position is wanted by user.
|
||||
*/
|
||||
DiagramTextItem::setPos(pos);
|
||||
if(toPlainText().isEmpty() && (scenePos().x() < 0 || scenePos().y() < 0))
|
||||
{
|
||||
Conductor *cond = parentConductor();
|
||||
if(cond)
|
||||
DiagramTextItem::setPos(cond->boundingRect().topLeft());
|
||||
else
|
||||
DiagramTextItem::setPos(0,0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -632,27 +632,27 @@ QRectF CrossRefItem::drawContact(QPainter &painter, int flags, Element *elmt)
|
||||
// for delay on contact
|
||||
if (flags &DelayOn) {
|
||||
if (flags &NO) {
|
||||
painter.drawLine(12, offset+8, 12, offset+11);
|
||||
QRectF r(9.5, offset+9, 5, 3);
|
||||
painter.drawArc(r, 180*16, 180*16);
|
||||
painter.drawLine(12, offset+8, 12, offset+11);
|
||||
QRectF r(9.5, offset+9, 5, 3);
|
||||
painter.drawArc(r, 180*16, 180*16);
|
||||
}
|
||||
if (flags &NC) {
|
||||
painter.drawLine(QPointF(12.5, offset+5), QPointF(12.5, offset+8));
|
||||
QRectF r(10, offset+6, 5, 3);
|
||||
painter.drawArc(r, 180*16, 180*16);
|
||||
if (flags &NC) {
|
||||
painter.drawLine(QPointF(12.5, offset+5), QPointF(12.5, offset+8));
|
||||
QRectF r(10, offset+6, 5, 3);
|
||||
painter.drawArc(r, 180*16, 180*16);
|
||||
}
|
||||
}
|
||||
// for delay off contact
|
||||
// for delay off contact
|
||||
else if ( flags &DelayOff){
|
||||
if (flags &NO) {
|
||||
painter.drawLine(12, offset+8, 12, offset+9.5);
|
||||
QRectF r(9.5, offset+9.5, 5, 3);
|
||||
painter.drawArc(r, 0, 180*16);
|
||||
}
|
||||
painter.drawLine(12, offset+8, 12, offset+9.5);
|
||||
QRectF r(9.5, offset+9.5, 5, 3);
|
||||
painter.drawArc(r, 0, 180*16);
|
||||
}
|
||||
if (flags &NC) {
|
||||
painter.drawLine(QPointF(12.5, offset+5), QPointF(12.5, offset+7));
|
||||
QRectF r(10, offset+7.5, 5, 3);
|
||||
painter.drawArc(r, 0, 180*16);
|
||||
painter.drawLine(QPointF(12.5, offset+5), QPointF(12.5, offset+7));
|
||||
QRectF r(10, offset+7.5, 5, 3);
|
||||
painter.drawArc(r, 0, 180*16);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1045,18 +1045,18 @@ void DynamicElementTextItem::updateLabel()
|
||||
(m_text_from == CompositeText && m_composite_text.contains("%{label}")))
|
||||
{
|
||||
DiagramContext dc;
|
||||
Element *element = elementUseForInfo();
|
||||
if(element) {
|
||||
dc = element->elementInformations();
|
||||
}
|
||||
Element *element = elementUseForInfo();
|
||||
if(element) {
|
||||
dc = element->elementInformations();
|
||||
}
|
||||
|
||||
|
||||
if(m_text_from == ElementInfo && element) {
|
||||
setPlainText(element->actualLabel());
|
||||
if(m_text_from == ElementInfo && element) {
|
||||
setPlainText(element->actualLabel());
|
||||
}
|
||||
else if (m_text_from == CompositeText) {
|
||||
else if (m_text_from == CompositeText) {
|
||||
setPlainText(autonum::AssignVariables::replaceVariable(m_composite_text, dc));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1377,23 +1377,23 @@ void Element::initLink(QETProject *prj)
|
||||
|
||||
QString Element::linkTypeToString() const
|
||||
{
|
||||
switch (m_link_type)
|
||||
{
|
||||
case Simple:
|
||||
return "Simple";
|
||||
case NextReport :
|
||||
return "NextReport";
|
||||
case PreviousReport:
|
||||
return "PreviousReport";
|
||||
case Master:
|
||||
return "Master";
|
||||
case Slave:
|
||||
return "Slave";
|
||||
case Terminale:
|
||||
return "Terminale";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
switch (m_link_type)
|
||||
{
|
||||
case Simple:
|
||||
return "Simple";
|
||||
case NextReport :
|
||||
return "NextReport";
|
||||
case PreviousReport:
|
||||
return "PreviousReport";
|
||||
case Master:
|
||||
return "Master";
|
||||
case Slave:
|
||||
return "Slave";
|
||||
case Terminale:
|
||||
return "Terminale";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -366,24 +366,24 @@ void QetShapeItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
*/
|
||||
QVariant QetShapeItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == ItemSelectedHasChanged)
|
||||
{
|
||||
if (value.toBool() == true) { //If this is selected, wa add handlers.
|
||||
if (change == ItemSelectedHasChanged)
|
||||
{
|
||||
if (value.toBool() == true) { //If this is selected, wa add handlers.
|
||||
addHandler();
|
||||
}
|
||||
else //Else this is deselected, we remove handlers
|
||||
{
|
||||
if(!m_handler_vector.isEmpty())
|
||||
{
|
||||
qDeleteAll(m_handler_vector);
|
||||
m_handler_vector.clear();
|
||||
}
|
||||
}
|
||||
else //Else this is deselected, we remove handlers
|
||||
{
|
||||
if(!m_handler_vector.isEmpty())
|
||||
{
|
||||
qDeleteAll(m_handler_vector);
|
||||
m_handler_vector.clear();
|
||||
}
|
||||
m_resize_mode = 1;
|
||||
}
|
||||
}
|
||||
else if (change == ItemPositionHasChanged) {
|
||||
}
|
||||
}
|
||||
else if (change == ItemPositionHasChanged) {
|
||||
adjusteHandlerPos();
|
||||
}
|
||||
}
|
||||
else if (change == ItemSceneHasChanged)
|
||||
{
|
||||
if (!scene()) //This is removed from scene, then we deselect this, and so, the handlers is also removed.
|
||||
@@ -391,8 +391,8 @@ QVariant QetShapeItem::itemChange(QGraphicsItem::GraphicsItemChange change, cons
|
||||
setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
return QGraphicsItem::itemChange(change, value);
|
||||
|
||||
return QGraphicsItem::itemChange(change, value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user