mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Replace foreach function by for, please try and report problem
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4900 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -101,7 +101,7 @@ ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, Element
|
|||||||
if (source_dir == destination_dir)
|
if (source_dir == destination_dir)
|
||||||
copy_itself = true;
|
copy_itself = true;
|
||||||
|
|
||||||
foreach(QString str, source_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
|
for (QString str : source_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
|
||||||
{
|
{
|
||||||
if (copy_itself)
|
if (copy_itself)
|
||||||
{
|
{
|
||||||
@@ -118,7 +118,7 @@ ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, Element
|
|||||||
|
|
||||||
//Copy all elements found in source_dir to destination_dir
|
//Copy all elements found in source_dir to destination_dir
|
||||||
source_dir.setNameFilters(QStringList() << "*.elmt");
|
source_dir.setNameFilters(QStringList() << "*.elmt");
|
||||||
foreach(QString str, source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
|
for (QString str: source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
|
||||||
{
|
{
|
||||||
ElementsLocation sub_source(source.fileSystemPath() + "/" + str);
|
ElementsLocation sub_source(source.fileSystemPath() + "/" + str);
|
||||||
copyElement(sub_source, created_location);
|
copyElement(sub_source, created_location);
|
||||||
@@ -211,7 +211,7 @@ ElementsLocation ECHSXmlToFile::copyDirectory(ElementsLocation &source, Elements
|
|||||||
XmlElementCollection *project_collection = source.projectCollection();
|
XmlElementCollection *project_collection = source.projectCollection();
|
||||||
|
|
||||||
QStringList directories_names = project_collection->directoriesNames( project_collection->directory(source.collectionPath(false)) );
|
QStringList directories_names = project_collection->directoriesNames( project_collection->directory(source.collectionPath(false)) );
|
||||||
foreach(QString name, directories_names)
|
for (QString name : directories_names)
|
||||||
{
|
{
|
||||||
ElementsLocation sub_source_dir(source.projectCollectionPath() + "/" + name);
|
ElementsLocation sub_source_dir(source.projectCollectionPath() + "/" + name);
|
||||||
copyDirectory(sub_source_dir, created_location);
|
copyDirectory(sub_source_dir, created_location);
|
||||||
@@ -219,7 +219,7 @@ ElementsLocation ECHSXmlToFile::copyDirectory(ElementsLocation &source, Elements
|
|||||||
|
|
||||||
//Create all elements found in source to destination
|
//Create all elements found in source to destination
|
||||||
QStringList elements_names = project_collection->elementsNames( project_collection->directory(source.collectionPath(false))) ;
|
QStringList elements_names = project_collection->elementsNames( project_collection->directory(source.collectionPath(false))) ;
|
||||||
foreach (QString name, elements_names)
|
for (QString name : elements_names)
|
||||||
{
|
{
|
||||||
ElementsLocation source_element(source.projectCollectionPath() + "/" + name);
|
ElementsLocation source_element(source.projectCollectionPath() + "/" + name);
|
||||||
copyElement(source_element, created_location);
|
copyElement(source_element, created_location);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ ElementCollectionItem *ElementCollectionItem::lastItemForPath(const QString &pat
|
|||||||
if (str_list.isEmpty()) return nullptr;
|
if (str_list.isEmpty()) return nullptr;
|
||||||
|
|
||||||
ElementCollectionItem *return_eci = this;
|
ElementCollectionItem *return_eci = this;
|
||||||
foreach (QString str, str_list)
|
for (QString str: str_list)
|
||||||
{
|
{
|
||||||
ElementCollectionItem *eci = return_eci->childWithCollectionName(str);
|
ElementCollectionItem *eci = return_eci->childWithCollectionName(str);
|
||||||
if (!eci)
|
if (!eci)
|
||||||
@@ -74,7 +74,7 @@ ElementCollectionItem *ElementCollectionItem::lastItemForPath(const QString &pat
|
|||||||
ElementCollectionItem *ElementCollectionItem::childWithCollectionName(QString name) const
|
ElementCollectionItem *ElementCollectionItem::childWithCollectionName(QString name) const
|
||||||
{
|
{
|
||||||
rowCount();
|
rowCount();
|
||||||
foreach (QStandardItem *qsi, directChilds()) {
|
for (QStandardItem *qsi: directChilds()) {
|
||||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||||
if (eci->name() == name)
|
if (eci->name() == name)
|
||||||
return eci;
|
return eci;
|
||||||
@@ -128,7 +128,7 @@ int ElementCollectionItem::rowForInsertItem(const QString &name)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ElementCollectionItem *eci, child)
|
for (ElementCollectionItem *eci: child)
|
||||||
if (eci->name() > name)
|
if (eci->name() > name)
|
||||||
return model()->indexFromItem(eci).row();
|
return model()->indexFromItem(eci).row();
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ ElementCollectionItem *ElementCollectionItem::itemAtPath(const QString &path)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
ElementCollectionItem *match_eci = this;
|
ElementCollectionItem *match_eci = this;
|
||||||
foreach (QString str, str_list) {
|
for (QString str: str_list) {
|
||||||
ElementCollectionItem *eci = match_eci->childWithCollectionName(str);
|
ElementCollectionItem *eci = match_eci->childWithCollectionName(str);
|
||||||
if (!eci)
|
if (!eci)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -166,7 +166,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::elementsDirectChild() cons
|
|||||||
{
|
{
|
||||||
QList <ElementCollectionItem *> element_child;
|
QList <ElementCollectionItem *> element_child;
|
||||||
|
|
||||||
foreach (QStandardItem *qsi, directChilds()) {
|
for (QStandardItem *qsi: directChilds()) {
|
||||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||||
if (eci->isElement())
|
if (eci->isElement())
|
||||||
element_child.append(eci);
|
element_child.append(eci);
|
||||||
@@ -183,7 +183,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::directoriesDirectChild() c
|
|||||||
{
|
{
|
||||||
QList <ElementCollectionItem *> dir_child;
|
QList <ElementCollectionItem *> dir_child;
|
||||||
|
|
||||||
foreach (QStandardItem *qsi, directChilds()) {
|
for (QStandardItem *qsi: directChilds()) {
|
||||||
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
|
||||||
if (eci->isDir())
|
if (eci->isDir())
|
||||||
dir_child.append(eci);
|
dir_child.append(eci);
|
||||||
@@ -200,7 +200,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::elementsChild() const
|
|||||||
{
|
{
|
||||||
QList <ElementCollectionItem *> list = elementsDirectChild();
|
QList <ElementCollectionItem *> list = elementsDirectChild();
|
||||||
|
|
||||||
foreach (ElementCollectionItem *eci, directoriesChild())
|
for (ElementCollectionItem *eci: directoriesChild())
|
||||||
list.append(eci->elementsDirectChild());
|
list.append(eci->elementsDirectChild());
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
@@ -214,7 +214,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::directoriesChild() const
|
|||||||
{
|
{
|
||||||
QList<ElementCollectionItem *> list = directoriesDirectChild();
|
QList<ElementCollectionItem *> list = directoriesDirectChild();
|
||||||
QList<ElementCollectionItem *> child_list;
|
QList<ElementCollectionItem *> child_list;
|
||||||
foreach (ElementCollectionItem *eci, list) {
|
for (ElementCollectionItem *eci: list) {
|
||||||
child_list.append(eci->directoriesChild());
|
child_list.append(eci->directoriesChild());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ void ElementsCollectionModel::loadCollections(bool common_collection, bool custo
|
|||||||
list.append(items());
|
list.append(items());
|
||||||
|
|
||||||
|
|
||||||
foreach (QETProject *project, projects) {
|
for (QETProject *project: projects) {
|
||||||
addProject(project, false);
|
addProject(project, false);
|
||||||
list.append(projectItems(project));
|
list.append(projectItems(project));
|
||||||
}
|
}
|
||||||
@@ -310,7 +310,7 @@ void ElementsCollectionModel::addLocation(ElementsLocation location)
|
|||||||
for (int i=0 ; i<rowCount() ; i++)
|
for (int i=0 ; i<rowCount() ; i++)
|
||||||
child_list.append(static_cast<ElementCollectionItem *>(item(i)));
|
child_list.append(static_cast<ElementCollectionItem *>(item(i)));
|
||||||
|
|
||||||
foreach(ElementCollectionItem *eci, child_list) {
|
for (ElementCollectionItem *eci: child_list) {
|
||||||
|
|
||||||
if (eci->type() == FileElementCollectionItem::Type) {
|
if (eci->type() == FileElementCollectionItem::Type) {
|
||||||
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci);
|
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci);
|
||||||
@@ -393,14 +393,14 @@ void ElementsCollectionModel::highlightUnusedElement()
|
|||||||
{
|
{
|
||||||
QList <ElementsLocation> unused;
|
QList <ElementsLocation> unused;
|
||||||
|
|
||||||
foreach (QETProject *project, m_project_list)
|
for (QETProject *project: m_project_list)
|
||||||
unused.append(project->unusedElements());
|
unused.append(project->unusedElements());
|
||||||
|
|
||||||
QBrush brush;
|
QBrush brush;
|
||||||
brush.setStyle(Qt::Dense4Pattern);
|
brush.setStyle(Qt::Dense4Pattern);
|
||||||
brush.setColor(Qt::red);
|
brush.setColor(Qt::red);
|
||||||
|
|
||||||
foreach (ElementsLocation location, unused) {
|
for (ElementsLocation location: unused) {
|
||||||
QModelIndex index = indexFromLocation(location);
|
QModelIndex index = indexFromLocation(location);
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
QStandardItem *qsi = itemFromIndex(index);
|
QStandardItem *qsi = itemFromIndex(index);
|
||||||
@@ -452,7 +452,7 @@ QList<ElementCollectionItem *> ElementsCollectionModel::projectItems(QETProject
|
|||||||
void ElementsCollectionModel::hideElement()
|
void ElementsCollectionModel::hideElement()
|
||||||
{
|
{
|
||||||
m_hide_element = true;
|
m_hide_element = true;
|
||||||
foreach(ElementCollectionItem *eci, items()) {
|
for (ElementCollectionItem *eci: items()) {
|
||||||
if (eci->isElement()) {
|
if (eci->isElement()) {
|
||||||
removeRow(eci->row(), indexFromItem(eci).parent());
|
removeRow(eci->row(), indexFromItem(eci).parent());
|
||||||
}
|
}
|
||||||
@@ -473,7 +473,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l
|
|||||||
for (int i=0 ; i<rowCount() ; i++)
|
for (int i=0 ; i<rowCount() ; i++)
|
||||||
child_list.append(static_cast<ElementCollectionItem *>(item(i)));
|
child_list.append(static_cast<ElementCollectionItem *>(item(i)));
|
||||||
|
|
||||||
foreach(ElementCollectionItem *eci, child_list) {
|
foreach (ElementCollectionItem *eci, child_list) {
|
||||||
|
|
||||||
ElementCollectionItem *match_eci = nullptr;
|
ElementCollectionItem *match_eci = nullptr;
|
||||||
|
|
||||||
@@ -514,7 +514,7 @@ void ElementsCollectionModel::elementIntegratedToCollection(QString path)
|
|||||||
QETProject *project = nullptr;
|
QETProject *project = nullptr;
|
||||||
|
|
||||||
//Get the owner project of the collection
|
//Get the owner project of the collection
|
||||||
foreach (QETProject *prj, m_project_list) {
|
for (QETProject *prj: m_project_list) {
|
||||||
if (prj->embeddedElementCollection() == collection) {
|
if (prj->embeddedElementCollection() == collection) {
|
||||||
project = prj;
|
project = prj;
|
||||||
}
|
}
|
||||||
@@ -547,7 +547,7 @@ void ElementsCollectionModel::itemRemovedFromCollection(QString path)
|
|||||||
QETProject *project = nullptr;
|
QETProject *project = nullptr;
|
||||||
|
|
||||||
//Get the owner project of the collection
|
//Get the owner project of the collection
|
||||||
foreach (QETProject *prj, m_project_list) {
|
for (QETProject *prj: m_project_list) {
|
||||||
if (prj->embeddedElementCollection() == collection) {
|
if (prj->embeddedElementCollection() == collection) {
|
||||||
project = prj;
|
project = prj;
|
||||||
}
|
}
|
||||||
@@ -575,7 +575,7 @@ void ElementsCollectionModel::updateItem(QString path)
|
|||||||
QETProject *project = nullptr;
|
QETProject *project = nullptr;
|
||||||
|
|
||||||
//Get the owner project of the collection
|
//Get the owner project of the collection
|
||||||
foreach (QETProject *prj, m_project_list) {
|
for (QETProject *prj: m_project_list) {
|
||||||
if (prj->embeddedElementCollection() == collection) {
|
if (prj->embeddedElementCollection() == collection) {
|
||||||
project = prj;
|
project = prj;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ void ElementsCollectionWidget::editElement()
|
|||||||
QETApp *app = QETApp::instance();
|
QETApp *app = QETApp::instance();
|
||||||
app->openElementLocations(QList<ElementsLocation>() << location);
|
app->openElementLocations(QList<ElementsLocation>() << location);
|
||||||
|
|
||||||
foreach (QETElementEditor *element_editor, app->elementEditors())
|
for (QETElementEditor *element_editor: app->elementEditors())
|
||||||
connect(element_editor, &QETElementEditor::saveToLocation, this, &ElementsCollectionWidget::locationWasSaved);
|
connect(element_editor, &QETElementEditor::saveToLocation, this, &ElementsCollectionWidget::locationWasSaved);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,7 +442,7 @@ void ElementsCollectionWidget::newElement()
|
|||||||
elmt_wizard.preselectedLocation(loc);
|
elmt_wizard.preselectedLocation(loc);
|
||||||
elmt_wizard.exec();
|
elmt_wizard.exec();
|
||||||
|
|
||||||
foreach (QETElementEditor *element_editor, QETApp::instance()->elementEditors())
|
for (QETElementEditor *element_editor: QETApp::instance()->elementEditors())
|
||||||
connect(element_editor, &QETElementEditor::saveToLocation, this, &ElementsCollectionWidget::locationWasSaved);
|
connect(element_editor, &QETElementEditor::saveToLocation, this, &ElementsCollectionWidget::locationWasSaved);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,12 +609,12 @@ void ElementsCollectionWidget::search()
|
|||||||
hideCollection(true);
|
hideCollection(true);
|
||||||
QStringList text_list = text.split("+", QString::SkipEmptyParts);
|
QStringList text_list = text.split("+", QString::SkipEmptyParts);
|
||||||
QModelIndexList match_index;
|
QModelIndexList match_index;
|
||||||
foreach (QString txt, text_list) {
|
for (QString txt: text_list) {
|
||||||
match_index << m_model->match(m_showed_index.isValid() ? m_model->index(0,0,m_showed_index) : m_model->index(0,0),
|
match_index << m_model->match(m_showed_index.isValid() ? m_model->index(0,0,m_showed_index) : m_model->index(0,0),
|
||||||
Qt::DisplayRole, QVariant(txt), -1, Qt::MatchContains | Qt::MatchRecursive);
|
Qt::DisplayRole, QVariant(txt), -1, Qt::MatchContains | Qt::MatchRecursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(QModelIndex index, match_index)
|
for (QModelIndex index: match_index)
|
||||||
showAndExpandItem(index);
|
showAndExpandItem(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
|
|||||||
QDir dir (fileSystemPath());
|
QDir dir (fileSystemPath());
|
||||||
|
|
||||||
//Get all directory in this directory.
|
//Get all directory in this directory.
|
||||||
foreach(QString str, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
|
for (QString str: dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
|
||||||
{
|
{
|
||||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||||
appendRow(feci);
|
appendRow(feci);
|
||||||
@@ -311,7 +311,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
|
|||||||
|
|
||||||
//Get all elmt file in this directory
|
//Get all elmt file in this directory
|
||||||
dir.setNameFilters(QStringList() << "*.elmt");
|
dir.setNameFilters(QStringList() << "*.elmt");
|
||||||
foreach(QString str, dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
|
for (QString str: dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
|
||||||
{
|
{
|
||||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||||
appendRow(feci);
|
appendRow(feci);
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ QDomElement XmlElementCollection::child(const QDomElement &parent_element, const
|
|||||||
|
|
||||||
if (found_dom_element.isEmpty()) return QDomElement();
|
if (found_dom_element.isEmpty()) return QDomElement();
|
||||||
|
|
||||||
foreach (QDomElement elmt, found_dom_element)
|
for (QDomElement elmt: found_dom_element)
|
||||||
if (elmt.attribute("name") == child_name)
|
if (elmt.attribute("name") == child_name)
|
||||||
return elmt;
|
return elmt;
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ QDomElement XmlElementCollection::child(const QString &path) const
|
|||||||
if (path_list.isEmpty()) return QDomElement();
|
if (path_list.isEmpty()) return QDomElement();
|
||||||
|
|
||||||
QDomElement parent_element = root();
|
QDomElement parent_element = root();
|
||||||
foreach (QString str, path_list)
|
for (QString str: path_list)
|
||||||
{
|
{
|
||||||
QDomElement child_element = child(parent_element, str);
|
QDomElement child_element = child(parent_element, str);
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ QStringList XmlElementCollection::directoriesNames(const QDomElement &parent_ele
|
|||||||
QList <QDomElement> childs = directories(parent_element);
|
QList <QDomElement> childs = directories(parent_element);
|
||||||
QStringList names;
|
QStringList names;
|
||||||
|
|
||||||
foreach (QDomElement child, childs)
|
for (QDomElement child: childs)
|
||||||
{
|
{
|
||||||
QString name = child.attribute("name");
|
QString name = child.attribute("name");
|
||||||
if (!name.isEmpty())
|
if (!name.isEmpty())
|
||||||
@@ -239,7 +239,7 @@ QStringList XmlElementCollection::elementsNames(const QDomElement &parent_elemen
|
|||||||
QList <QDomElement> childs = elements(parent_element);
|
QList <QDomElement> childs = elements(parent_element);
|
||||||
QStringList names;
|
QStringList names;
|
||||||
|
|
||||||
foreach (QDomElement child, childs)
|
for (QDomElement child: childs)
|
||||||
{
|
{
|
||||||
QString name = child.attribute("name");
|
QString name = child.attribute("name");
|
||||||
if (!name.isEmpty())
|
if (!name.isEmpty())
|
||||||
@@ -325,7 +325,7 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
|
|||||||
if (!dir.exists())
|
if (!dir.exists())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
foreach(QString str, splitted_path) {
|
for (QString str: splitted_path) {
|
||||||
QDomElement child_element = child(parent_element, str);
|
QDomElement child_element = child(parent_element, str);
|
||||||
|
|
||||||
//Child doesn't exist, we create it
|
//Child doesn't exist, we create it
|
||||||
@@ -369,7 +369,7 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
|
|||||||
}
|
}
|
||||||
else if (location.isProject()) {
|
else if (location.isProject()) {
|
||||||
QString path;
|
QString path;
|
||||||
foreach(QString str, splitted_path) {
|
for (QString str: splitted_path) {
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
path = str;
|
path = str;
|
||||||
else
|
else
|
||||||
@@ -585,7 +585,7 @@ QList<ElementsLocation> XmlElementCollection::elementsLocation(QDomElement dom_e
|
|||||||
//get element childs
|
//get element childs
|
||||||
QList <QDomElement> element_list = elements(dom_element);
|
QList <QDomElement> element_list = elements(dom_element);
|
||||||
|
|
||||||
foreach (QDomElement elmt, element_list) {
|
for (QDomElement elmt: element_list) {
|
||||||
ElementsLocation location = domToLocation(elmt);
|
ElementsLocation location = domToLocation(elmt);
|
||||||
if (location.exist())
|
if (location.exist())
|
||||||
location_list << location;
|
location_list << location;
|
||||||
@@ -594,7 +594,7 @@ QList<ElementsLocation> XmlElementCollection::elementsLocation(QDomElement dom_e
|
|||||||
//get directory childs
|
//get directory childs
|
||||||
QList <QDomElement> directory_list = directories(dom_element);
|
QList <QDomElement> directory_list = directories(dom_element);
|
||||||
|
|
||||||
foreach (QDomElement dir, directory_list) {
|
for (QDomElement dir: directory_list) {
|
||||||
ElementsLocation location = domToLocation(dir);
|
ElementsLocation location = domToLocation(dir);
|
||||||
if (location.exist())
|
if (location.exist())
|
||||||
location_list << location;
|
location_list << location;
|
||||||
@@ -638,7 +638,7 @@ ElementsLocation XmlElementCollection::domToLocation(QDomElement dom_element) co
|
|||||||
*/
|
*/
|
||||||
void XmlElementCollection::cleanUnusedElement()
|
void XmlElementCollection::cleanUnusedElement()
|
||||||
{
|
{
|
||||||
foreach (ElementsLocation loc, m_project->unusedElements())
|
for (ElementsLocation loc: m_project->unusedElements())
|
||||||
removeElement(loc.collectionPath(false));
|
removeElement(loc.collectionPath(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,7 +705,7 @@ ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, E
|
|||||||
if (deep_copy)
|
if (deep_copy)
|
||||||
{
|
{
|
||||||
//Append all directories of source to the new created directory
|
//Append all directories of source to the new created directory
|
||||||
foreach(QString str, source_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
|
for (QString str: source_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
|
||||||
{
|
{
|
||||||
ElementsLocation sub_source(source.fileSystemPath() + "/" + str);
|
ElementsLocation sub_source(source.fileSystemPath() + "/" + str);
|
||||||
copyDirectory(sub_source, created_location);
|
copyDirectory(sub_source, created_location);
|
||||||
@@ -713,7 +713,7 @@ ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, E
|
|||||||
|
|
||||||
//Append all elements of source to the new created directory
|
//Append all elements of source to the new created directory
|
||||||
source_dir.setNameFilters(QStringList() << "*.elmt");
|
source_dir.setNameFilters(QStringList() << "*.elmt");
|
||||||
foreach(QString str, source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
|
for (QString str: source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
|
||||||
{
|
{
|
||||||
ElementsLocation sub_source(source.fileSystemPath() + "/" + str);
|
ElementsLocation sub_source(source.fileSystemPath() + "/" + str);
|
||||||
copyElement(sub_source, created_location);
|
copyElement(sub_source, created_location);
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element)
|
|||||||
QList <QDomElement> dom_category = m_project->embeddedElementCollection()->directories(m_dom_element);
|
QList <QDomElement> dom_category = m_project->embeddedElementCollection()->directories(m_dom_element);
|
||||||
std::sort(dom_category.begin(), dom_category.end(), [](QDomElement a, QDomElement b){return (a.attribute("name") < b.attribute("name"));});
|
std::sort(dom_category.begin(), dom_category.end(), [](QDomElement a, QDomElement b){return (a.attribute("name") < b.attribute("name"));});
|
||||||
|
|
||||||
foreach (QDomElement element, dom_category)
|
for (QDomElement element: dom_category)
|
||||||
{
|
{
|
||||||
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem();
|
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem();
|
||||||
appendRow(xpeci);
|
appendRow(xpeci);
|
||||||
@@ -242,7 +242,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element)
|
|||||||
QList <QDomElement> dom_elements = m_project->embeddedElementCollection()->elements(m_dom_element);
|
QList <QDomElement> dom_elements = m_project->embeddedElementCollection()->elements(m_dom_element);
|
||||||
std::sort(dom_elements.begin(), dom_elements.end(), [](QDomElement a, QDomElement b){return (a.attribute("name") < b.attribute("name"));});
|
std::sort(dom_elements.begin(), dom_elements.end(), [](QDomElement a, QDomElement b){return (a.attribute("name") < b.attribute("name"));});
|
||||||
|
|
||||||
foreach (QDomElement element, dom_elements)
|
for (QDomElement element: dom_elements)
|
||||||
{
|
{
|
||||||
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem();
|
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem();
|
||||||
appendRow(xpeci);
|
appendRow(xpeci);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ PropertiesEditorDockWidget::~PropertiesEditorDockWidget()
|
|||||||
*/
|
*/
|
||||||
void PropertiesEditorDockWidget::clear()
|
void PropertiesEditorDockWidget::clear()
|
||||||
{
|
{
|
||||||
foreach (PropertiesEditorWidget *editor, m_editor_list)
|
for (PropertiesEditorWidget *editor: m_editor_list)
|
||||||
{
|
{
|
||||||
m_editor_list.removeOne(editor);
|
m_editor_list.removeOne(editor);
|
||||||
ui->m_main_vlayout->removeWidget(editor);
|
ui->m_main_vlayout->removeWidget(editor);
|
||||||
@@ -64,7 +64,7 @@ void PropertiesEditorDockWidget::clear()
|
|||||||
*/
|
*/
|
||||||
void PropertiesEditorDockWidget::apply()
|
void PropertiesEditorDockWidget::apply()
|
||||||
{
|
{
|
||||||
foreach(PropertiesEditorWidget *editor, m_editor_list)
|
for (PropertiesEditorWidget *editor: m_editor_list)
|
||||||
editor->apply();
|
editor->apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ void PropertiesEditorDockWidget::apply()
|
|||||||
*/
|
*/
|
||||||
void PropertiesEditorDockWidget::reset()
|
void PropertiesEditorDockWidget::reset()
|
||||||
{
|
{
|
||||||
foreach(PropertiesEditorWidget *editor, m_editor_list)
|
for (PropertiesEditorWidget *editor: m_editor_list)
|
||||||
editor->reset();
|
editor->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ void QetGraphicsHandlerUtility::drawHandler(QPainter *painter, const QPointF &po
|
|||||||
* @param color2
|
* @param color2
|
||||||
*/
|
*/
|
||||||
void QetGraphicsHandlerUtility::drawHandler(QPainter *painter, const QVector<QPointF> &points) {
|
void QetGraphicsHandlerUtility::drawHandler(QPainter *painter, const QVector<QPointF> &points) {
|
||||||
foreach(QPointF point, points)
|
for (QPointF point: points)
|
||||||
drawHandler(painter, point);
|
drawHandler(painter, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ bool QetGraphicsHandlerUtility::pointIsInHandler(const QPointF &point, const QPo
|
|||||||
*/
|
*/
|
||||||
int QetGraphicsHandlerUtility::pointIsHoverHandler(const QPointF &point, const QVector<QPointF> &vector) const
|
int QetGraphicsHandlerUtility::pointIsHoverHandler(const QPointF &point, const QVector<QPointF> &vector) const
|
||||||
{
|
{
|
||||||
foreach (QPointF key_point, vector)
|
for (QPointF key_point: vector)
|
||||||
if (pointIsInHandler(point, key_point))
|
if (pointIsInHandler(point, key_point))
|
||||||
return vector.indexOf(key_point);
|
return vector.indexOf(key_point);
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ QVector<QRectF> QetGraphicsHandlerUtility::handlerRect(const QVector<QPointF> &v
|
|||||||
{
|
{
|
||||||
QVector <QRectF> rect_vector;
|
QVector <QRectF> rect_vector;
|
||||||
|
|
||||||
foreach(QPointF point, vector)
|
for (QPointF point: vector)
|
||||||
rect_vector << getRect(point);
|
rect_vector << getRect(point);
|
||||||
|
|
||||||
return rect_vector;
|
return rect_vector;
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ QDomElement NumerotationContext::toXml(QDomDocument &d, QString str) {
|
|||||||
*/
|
*/
|
||||||
void NumerotationContext::fromXml(QDomElement &e) {
|
void NumerotationContext::fromXml(QDomElement &e) {
|
||||||
clear();
|
clear();
|
||||||
foreach(QDomElement qde, QET::findInDomElement(e, "part")) addValue(qde.attribute("type"), qde.attribute("value"), qde.attribute("increase").toInt(), qde.attribute("initialvalue").toInt());
|
for (QDomElement qde: QET::findInDomElement(e, "part")) addValue(qde.attribute("type"), qde.attribute("value"), qde.attribute("increase").toInt(), qde.attribute("initialvalue").toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -106,21 +106,21 @@ void AutoNumberingDockWidget::setContext() {
|
|||||||
ui->m_conductor_cb->addItem("");
|
ui->m_conductor_cb->addItem("");
|
||||||
QList <QString> keys_conductor = m_project->conductorAutoNum().keys();
|
QList <QString> keys_conductor = m_project->conductorAutoNum().keys();
|
||||||
if (!keys_conductor.isEmpty()) {
|
if (!keys_conductor.isEmpty()) {
|
||||||
foreach (QString str, keys_conductor) { ui->m_conductor_cb-> addItem(str); }
|
for (QString str: keys_conductor) { ui->m_conductor_cb-> addItem(str); }
|
||||||
}
|
}
|
||||||
|
|
||||||
//Element Combobox
|
//Element Combobox
|
||||||
ui->m_element_cb->addItem("");
|
ui->m_element_cb->addItem("");
|
||||||
QList <QString> keys_element = m_project->elementAutoNum().keys();
|
QList <QString> keys_element = m_project->elementAutoNum().keys();
|
||||||
if (!keys_element.isEmpty()) {
|
if (!keys_element.isEmpty()) {
|
||||||
foreach (QString str, keys_element) {ui->m_element_cb -> addItem(str);}
|
for (QString str: keys_element) {ui->m_element_cb -> addItem(str);}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Folio Combobox
|
//Folio Combobox
|
||||||
ui->m_folio_cb->addItem("");
|
ui->m_folio_cb->addItem("");
|
||||||
QList <QString> keys_folio = m_project->folioAutoNum().keys();
|
QList <QString> keys_folio = m_project->folioAutoNum().keys();
|
||||||
if (!keys_folio.isEmpty()) {
|
if (!keys_folio.isEmpty()) {
|
||||||
foreach (QString str, keys_folio) { ui->m_folio_cb -> addItem(str);}
|
for (QString str: keys_folio) { ui->m_folio_cb -> addItem(str);}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->setActive();
|
this->setActive();
|
||||||
@@ -178,7 +178,7 @@ void AutoNumberingDockWidget::conductorAutoNumChanged() {
|
|||||||
ui->m_conductor_cb->addItem("");
|
ui->m_conductor_cb->addItem("");
|
||||||
QList <QString> keys_conductor = m_project->conductorAutoNum().keys();
|
QList <QString> keys_conductor = m_project->conductorAutoNum().keys();
|
||||||
if (!keys_conductor.isEmpty()) {
|
if (!keys_conductor.isEmpty()) {
|
||||||
foreach (QString str, keys_conductor) { ui->m_conductor_cb-> addItem(str); }
|
for (QString str: keys_conductor) { ui->m_conductor_cb-> addItem(str); }
|
||||||
}
|
}
|
||||||
setActive();
|
setActive();
|
||||||
}
|
}
|
||||||
@@ -209,7 +209,7 @@ void AutoNumberingDockWidget::elementAutoNumChanged() {
|
|||||||
ui->m_element_cb->addItem("");
|
ui->m_element_cb->addItem("");
|
||||||
QList <QString> keys_element = m_project->elementAutoNum().keys();
|
QList <QString> keys_element = m_project->elementAutoNum().keys();
|
||||||
if (!keys_element.isEmpty()) {
|
if (!keys_element.isEmpty()) {
|
||||||
foreach (QString str, keys_element) {ui->m_element_cb -> addItem(str);}
|
for (QString str: keys_element) {ui->m_element_cb -> addItem(str);}
|
||||||
}
|
}
|
||||||
setActive();
|
setActive();
|
||||||
}
|
}
|
||||||
@@ -237,7 +237,7 @@ void AutoNumberingDockWidget::folioAutoNumChanged() {
|
|||||||
ui->m_folio_cb->addItem("");
|
ui->m_folio_cb->addItem("");
|
||||||
QList <QString> keys_folio = m_project->folioAutoNum().keys();
|
QList <QString> keys_folio = m_project->folioAutoNum().keys();
|
||||||
if (!keys_folio.isEmpty()) {
|
if (!keys_folio.isEmpty()) {
|
||||||
foreach (QString str, keys_folio) { ui->m_folio_cb -> addItem(str);}
|
for (QString str: keys_folio) { ui->m_folio_cb -> addItem(str);}
|
||||||
}
|
}
|
||||||
setActive();
|
setActive();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ void AutoNumberingManagementW::on_m_apply_folios_rb_clicked() {
|
|||||||
if (ui->m_from_folios_cb->count()<=0) {
|
if (ui->m_from_folios_cb->count()<=0) {
|
||||||
ui->m_from_folios_cb->clear();
|
ui->m_from_folios_cb->clear();
|
||||||
ui->m_from_folios_cb->addItem("");
|
ui->m_from_folios_cb->addItem("");
|
||||||
foreach (Diagram *diagram, project_->diagrams()){
|
for (Diagram *diagram: project_->diagrams()){
|
||||||
if (diagram->title() != "")
|
if (diagram->title() != "")
|
||||||
ui->m_from_folios_cb->addItem(diagram->title(),diagram->folioIndex());
|
ui->m_from_folios_cb->addItem(diagram->title(),diagram->folioIndex());
|
||||||
else ui->m_from_folios_cb->addItem(QString::number(diagram->folioIndex()),diagram->folioIndex());
|
else ui->m_from_folios_cb->addItem(QString::number(diagram->folioIndex()),diagram->folioIndex());
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ FolioAutonumberingW::~FolioAutonumberingW()
|
|||||||
* construct autonums in the comboBox selected in the @autonum_chooser QcomboBox
|
* construct autonums in the comboBox selected in the @autonum_chooser QcomboBox
|
||||||
*/
|
*/
|
||||||
void FolioAutonumberingW::setContext(QList <QString> autonums) {
|
void FolioAutonumberingW::setContext(QList <QString> autonums) {
|
||||||
foreach (QString str, autonums) { ui->m_autonums_cb->addItem(str);}
|
for (QString str: autonums) { ui->m_autonums_cb->addItem(str);}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,7 +123,7 @@ void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked() {
|
|||||||
if (ui->m_from_cb->count()<=0){
|
if (ui->m_from_cb->count()<=0){
|
||||||
ui->m_from_cb->clear();
|
ui->m_from_cb->clear();
|
||||||
ui->m_from_cb->addItem("");
|
ui->m_from_cb->addItem("");
|
||||||
foreach (Diagram *diagram, project_->diagrams()){
|
for (Diagram *diagram: project_->diagrams()){
|
||||||
ui->m_from_cb->addItem(diagram->title());
|
ui->m_from_cb->addItem(diagram->title());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ void SelectAutonumW::setContext(const NumerotationContext &context) {
|
|||||||
*/
|
*/
|
||||||
NumerotationContext SelectAutonumW::toNumContext() const {
|
NumerotationContext SelectAutonumW::toNumContext() const {
|
||||||
NumerotationContext nc;
|
NumerotationContext nc;
|
||||||
foreach (NumPartEditorW *npew, num_part_list_) nc << npew -> toNumContext();
|
for (NumPartEditorW *npew: num_part_list_) nc << npew -> toNumContext();
|
||||||
return nc;
|
return nc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ void SelectAutonumW::applyEnableOnContextChanged(QString) {
|
|||||||
void SelectAutonumW::applyEnable(bool b) {
|
void SelectAutonumW::applyEnable(bool b) {
|
||||||
if (b){
|
if (b){
|
||||||
bool valid= true;
|
bool valid= true;
|
||||||
foreach (NumPartEditorW *npe, num_part_list_) if (!npe -> isValid()) valid= false;
|
for (NumPartEditorW *npe: num_part_list_) if (!npe -> isValid()) valid= false;
|
||||||
ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(valid);
|
ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(valid);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -692,7 +692,7 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock(const DiagramContext &i
|
|||||||
// Our final DiagramContext is the initial one (which is supposed to bring
|
// Our final DiagramContext is the initial one (which is supposed to bring
|
||||||
// project-wide properties), overridden by the "additional fields" one...
|
// project-wide properties), overridden by the "additional fields" one...
|
||||||
DiagramContext context = initial_context;
|
DiagramContext context = initial_context;
|
||||||
foreach (QString key, additional_fields_.keys()) {
|
for (QString key: additional_fields_.keys()) {
|
||||||
context.addValue(key, additional_fields_[key]);
|
context.addValue(key, additional_fields_[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void ConductorAutoNumerotation::applyText(QString t)
|
|||||||
if (!m_parent_undo)
|
if (!m_parent_undo)
|
||||||
undo->setText(QObject::tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
|
undo->setText(QObject::tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
|
||||||
|
|
||||||
foreach (Conductor *cond, conductor_list)
|
for (Conductor *cond: conductor_list)
|
||||||
{
|
{
|
||||||
ConductorProperties cp2 = cond -> properties();
|
ConductorProperties cp2 = cond -> properties();
|
||||||
old_value.setValue(cp2);
|
old_value.setValue(cp2);
|
||||||
@@ -107,7 +107,7 @@ void ConductorAutoNumerotation::numeratePotential()
|
|||||||
{
|
{
|
||||||
ConductorProperties cp = conductor_list.first()->properties();
|
ConductorProperties cp = conductor_list.first()->properties();
|
||||||
bool properties_equal = true;
|
bool properties_equal = true;
|
||||||
foreach (const Conductor *conductor, conductor_list)
|
for (const Conductor *conductor: conductor_list)
|
||||||
{
|
{
|
||||||
if (conductor->properties() != cp)
|
if (conductor->properties() != cp)
|
||||||
properties_equal = false;
|
properties_equal = false;
|
||||||
@@ -122,7 +122,7 @@ void ConductorAutoNumerotation::numeratePotential()
|
|||||||
|
|
||||||
QStringList text_list;
|
QStringList text_list;
|
||||||
QStringList formula_list;
|
QStringList formula_list;
|
||||||
foreach (const Conductor *cc, conductor_list)
|
for (const Conductor *cc: conductor_list)
|
||||||
{
|
{
|
||||||
ConductorProperties cp = cc->properties();
|
ConductorProperties cp = cc->properties();
|
||||||
text_list << cp.text;
|
text_list << cp.text;
|
||||||
@@ -134,7 +134,7 @@ void ConductorAutoNumerotation::numeratePotential()
|
|||||||
if (QET::eachStrIsEqual(text_list) && QET::eachStrIsEqual(formula_list))
|
if (QET::eachStrIsEqual(text_list) && QET::eachStrIsEqual(formula_list))
|
||||||
{
|
{
|
||||||
QList<ConductorProperties> cp_list;
|
QList<ConductorProperties> cp_list;
|
||||||
foreach(Conductor *c, conductor_list)
|
for (Conductor *c: conductor_list)
|
||||||
cp_list<<c->properties();
|
cp_list<<c->properties();
|
||||||
|
|
||||||
ConductorProperties cp = m_conductor->properties();
|
ConductorProperties cp = m_conductor->properties();
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ ConductorProfile::ConductorProfile(Conductor *conductor) {
|
|||||||
ConductorProfile::ConductorProfile(const ConductorProfile &c) {
|
ConductorProfile::ConductorProfile(const ConductorProfile &c) {
|
||||||
beginOrientation = c.beginOrientation;
|
beginOrientation = c.beginOrientation;
|
||||||
endOrientation = c.endOrientation;
|
endOrientation = c.endOrientation;
|
||||||
foreach(ConductorSegmentProfile *csp, c.segments) {
|
for (ConductorSegmentProfile *csp: c.segments) {
|
||||||
segments << new ConductorSegmentProfile(*csp);
|
segments << new ConductorSegmentProfile(*csp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ ConductorProfile &ConductorProfile::operator=(const ConductorProfile &c) {
|
|||||||
// copie les informations de l'autre profil de conducteur
|
// copie les informations de l'autre profil de conducteur
|
||||||
beginOrientation = c.beginOrientation;
|
beginOrientation = c.beginOrientation;
|
||||||
endOrientation = c.endOrientation;
|
endOrientation = c.endOrientation;
|
||||||
foreach(ConductorSegmentProfile *csp, c.segments) {
|
for (ConductorSegmentProfile *csp: c.segments) {
|
||||||
segments << new ConductorSegmentProfile(*csp);
|
segments << new ConductorSegmentProfile(*csp);
|
||||||
}
|
}
|
||||||
return(*this);
|
return(*this);
|
||||||
@@ -75,14 +75,14 @@ bool ConductorProfile::isNull() const {
|
|||||||
|
|
||||||
/// supprime les segments du profil de conducteur
|
/// supprime les segments du profil de conducteur
|
||||||
void ConductorProfile::setNull() {
|
void ConductorProfile::setNull() {
|
||||||
foreach(ConductorSegmentProfile *csp, segments) delete csp;
|
for (ConductorSegmentProfile *csp: segments) delete csp;
|
||||||
segments.clear();
|
segments.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @return la largeur occupee par le conducteur
|
/// @return la largeur occupee par le conducteur
|
||||||
qreal ConductorProfile::width() const {
|
qreal ConductorProfile::width() const {
|
||||||
qreal width = 0.0;
|
qreal width = 0.0;
|
||||||
foreach(ConductorSegmentProfile *csp, segments) {
|
for (ConductorSegmentProfile *csp: segments) {
|
||||||
if (csp -> isHorizontal) width += csp -> length;
|
if (csp -> isHorizontal) width += csp -> length;
|
||||||
}
|
}
|
||||||
return(width);
|
return(width);
|
||||||
@@ -91,7 +91,7 @@ qreal ConductorProfile::width() const {
|
|||||||
/// @return la hauteur occupee par le conducteur
|
/// @return la hauteur occupee par le conducteur
|
||||||
qreal ConductorProfile::height() const{
|
qreal ConductorProfile::height() const{
|
||||||
qreal height = 0.0;
|
qreal height = 0.0;
|
||||||
foreach(ConductorSegmentProfile *csp, segments) {
|
for (ConductorSegmentProfile *csp: segments) {
|
||||||
if (!csp -> isHorizontal) height += csp -> length;
|
if (!csp -> isHorizontal) height += csp -> length;
|
||||||
}
|
}
|
||||||
return(height);
|
return(height);
|
||||||
@@ -104,7 +104,7 @@ qreal ConductorProfile::height() const{
|
|||||||
uint ConductorProfile::segmentsCount(QET::ConductorSegmentType type) const {
|
uint ConductorProfile::segmentsCount(QET::ConductorSegmentType type) const {
|
||||||
if (type == QET::Both) return(segments.count());
|
if (type == QET::Both) return(segments.count());
|
||||||
uint nb_seg = 0;
|
uint nb_seg = 0;
|
||||||
foreach(ConductorSegmentProfile *csp, segments) {
|
for (ConductorSegmentProfile *csp: segments) {
|
||||||
if (type == QET::Horizontal && csp -> isHorizontal) ++ nb_seg;
|
if (type == QET::Horizontal && csp -> isHorizontal) ++ nb_seg;
|
||||||
else if (type == QET::Vertical && !csp -> isHorizontal) ++ nb_seg;
|
else if (type == QET::Vertical && !csp -> isHorizontal) ++ nb_seg;
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ uint ConductorProfile::segmentsCount(QET::ConductorSegmentType type) const {
|
|||||||
/// @return les segments horizontaux de ce profil
|
/// @return les segments horizontaux de ce profil
|
||||||
QList<ConductorSegmentProfile *> ConductorProfile::horizontalSegments() {
|
QList<ConductorSegmentProfile *> ConductorProfile::horizontalSegments() {
|
||||||
QList<ConductorSegmentProfile *> segments_list;
|
QList<ConductorSegmentProfile *> segments_list;
|
||||||
foreach(ConductorSegmentProfile *csp, segments) {
|
for (ConductorSegmentProfile *csp: segments) {
|
||||||
if (csp -> isHorizontal) segments_list << csp;
|
if (csp -> isHorizontal) segments_list << csp;
|
||||||
}
|
}
|
||||||
return(segments_list);
|
return(segments_list);
|
||||||
@@ -123,7 +123,7 @@ QList<ConductorSegmentProfile *> ConductorProfile::horizontalSegments() {
|
|||||||
/// @return les segments verticaux de ce profil
|
/// @return les segments verticaux de ce profil
|
||||||
QList<ConductorSegmentProfile *> ConductorProfile::verticalSegments() {
|
QList<ConductorSegmentProfile *> ConductorProfile::verticalSegments() {
|
||||||
QList<ConductorSegmentProfile *> segments_list;
|
QList<ConductorSegmentProfile *> segments_list;
|
||||||
foreach(ConductorSegmentProfile *csp, segments) {
|
for (ConductorSegmentProfile *csp: segments) {
|
||||||
if (!csp -> isHorizontal) segments_list << csp;
|
if (!csp -> isHorizontal) segments_list << csp;
|
||||||
}
|
}
|
||||||
return(segments_list);
|
return(segments_list);
|
||||||
@@ -136,7 +136,7 @@ void ConductorProfile::fromConductor(Conductor *conductor) {
|
|||||||
// supprime les segments precedents
|
// supprime les segments precedents
|
||||||
setNull();
|
setNull();
|
||||||
|
|
||||||
foreach(ConductorSegment *conductor_segment, conductor -> segmentsList()) {
|
for (ConductorSegment *conductor_segment: conductor -> segmentsList()) {
|
||||||
segments << new ConductorSegmentProfile(conductor_segment);
|
segments << new ConductorSegmentProfile(conductor_segment);
|
||||||
}
|
}
|
||||||
beginOrientation = conductor -> terminal1 -> orientation();
|
beginOrientation = conductor -> terminal1 -> orientation();
|
||||||
@@ -150,7 +150,7 @@ void ConductorProfile::fromConductor(Conductor *conductor) {
|
|||||||
*/
|
*/
|
||||||
QDebug &operator<<(QDebug d, ConductorProfile &t) {
|
QDebug &operator<<(QDebug d, ConductorProfile &t) {
|
||||||
d << "ConductorProfile {";
|
d << "ConductorProfile {";
|
||||||
foreach(ConductorSegmentProfile *csp, t.segments) {
|
for (ConductorSegmentProfile *csp: t.segments) {
|
||||||
d << "CSP" << (csp -> isHorizontal ? "horizontal" : "vertical") << ":" << csp -> length << ",";
|
d << "CSP" << (csp -> isHorizontal ? "horizontal" : "vertical") << ":" << csp -> length << ",";
|
||||||
}
|
}
|
||||||
d << "}";
|
d << "}";
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
bool equal = true;
|
bool equal = true;
|
||||||
//Color
|
//Color
|
||||||
QColor c_value = list.first().color;
|
QColor c_value = list.first().color;
|
||||||
foreach(ConductorProperties cp, list)
|
for (ConductorProperties cp: list)
|
||||||
{
|
{
|
||||||
if (cp.color != c_value)
|
if (cp.color != c_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -423,7 +423,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
|
|
||||||
//text
|
//text
|
||||||
QString s_value = list.first().text;
|
QString s_value = list.first().text;
|
||||||
foreach(ConductorProperties cp, list)
|
for (ConductorProperties cp: list)
|
||||||
{
|
{
|
||||||
if (cp.text != s_value)
|
if (cp.text != s_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -434,7 +434,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
|
|
||||||
//formula
|
//formula
|
||||||
s_value = list.first().m_formula;
|
s_value = list.first().m_formula;
|
||||||
foreach(ConductorProperties cp, list)
|
for (ConductorProperties cp: list)
|
||||||
{
|
{
|
||||||
if (cp.m_formula != s_value)
|
if (cp.m_formula != s_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -445,7 +445,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
|
|
||||||
//function
|
//function
|
||||||
s_value = list.first().m_function;
|
s_value = list.first().m_function;
|
||||||
foreach(ConductorProperties cp, list)
|
for (ConductorProperties cp: list)
|
||||||
{
|
{
|
||||||
if (cp.m_function != s_value)
|
if (cp.m_function != s_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -456,7 +456,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
|
|
||||||
//Tension protocol
|
//Tension protocol
|
||||||
s_value = list.first().m_tension_protocol;
|
s_value = list.first().m_tension_protocol;
|
||||||
foreach(ConductorProperties cp, list)
|
for (ConductorProperties cp: list)
|
||||||
{
|
{
|
||||||
if (cp.m_tension_protocol != s_value)
|
if (cp.m_tension_protocol != s_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -467,7 +467,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
|
|
||||||
//text size
|
//text size
|
||||||
int i_value = list.first().text_size;
|
int i_value = list.first().text_size;
|
||||||
foreach(ConductorProperties cp, list)
|
for (ConductorProperties cp: list)
|
||||||
{
|
{
|
||||||
if (cp.text_size != i_value)
|
if (cp.text_size != i_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -478,7 +478,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
|
|
||||||
//conductor size
|
//conductor size
|
||||||
double d_value = list.first().cond_size;
|
double d_value = list.first().cond_size;
|
||||||
foreach(ConductorProperties cp, list)
|
for (ConductorProperties cp: list)
|
||||||
{
|
{
|
||||||
if (cp.cond_size != d_value)
|
if (cp.cond_size != d_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -489,7 +489,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
|
|
||||||
//show text
|
//show text
|
||||||
bool b_value = list.first().m_show_text;
|
bool b_value = list.first().m_show_text;
|
||||||
foreach(ConductorProperties cp, list)
|
for (ConductorProperties cp: list)
|
||||||
{
|
{
|
||||||
if (cp.m_show_text != b_value)
|
if (cp.m_show_text != b_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -500,7 +500,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
|
|
||||||
//One text per folio
|
//One text per folio
|
||||||
b_value = list.first().m_one_text_per_folio;
|
b_value = list.first().m_one_text_per_folio;
|
||||||
foreach(ConductorProperties cp, list)
|
for (ConductorProperties cp: list)
|
||||||
{
|
{
|
||||||
if (cp.m_one_text_per_folio != b_value)
|
if (cp.m_one_text_per_folio != b_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -511,7 +511,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
|
|
||||||
//Text rotation for vertical conducor
|
//Text rotation for vertical conducor
|
||||||
d_value = list.first().verti_rotate_text;
|
d_value = list.first().verti_rotate_text;
|
||||||
foreach(ConductorProperties cp, list)
|
for (ConductorProperties cp: list)
|
||||||
{
|
{
|
||||||
if (cp.verti_rotate_text != d_value)
|
if (cp.verti_rotate_text != d_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -522,7 +522,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
|
|||||||
|
|
||||||
//Text rotation for horizontal conducor
|
//Text rotation for horizontal conducor
|
||||||
d_value = list.first().horiz_rotate_text;
|
d_value = list.first().horiz_rotate_text;
|
||||||
foreach(ConductorProperties cp, list)
|
for (ConductorProperties cp: list)
|
||||||
{
|
{
|
||||||
if (cp.horiz_rotate_text != d_value)
|
if (cp.horiz_rotate_text != d_value)
|
||||||
equal = false;
|
equal = false;
|
||||||
@@ -592,7 +592,7 @@ void ConductorProperties::readStyle(const QString &style_string) {
|
|||||||
QStringList styles = style_string.split(";", QString::SkipEmptyParts);
|
QStringList styles = style_string.split(";", QString::SkipEmptyParts);
|
||||||
|
|
||||||
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
|
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
|
||||||
foreach (QString style_str, styles) {
|
for (QString style_str: styles) {
|
||||||
if (rx.exactMatch(style_str)) {
|
if (rx.exactMatch(style_str)) {
|
||||||
QString style_name = rx.cap(1);
|
QString style_name = rx.cap(1);
|
||||||
QString style_value = rx.cap(2);
|
QString style_value = rx.cap(2);
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ ConfigDialog::~ConfigDialog() {
|
|||||||
*/
|
*/
|
||||||
void ConfigDialog::buildPagesList() {
|
void ConfigDialog::buildPagesList() {
|
||||||
pages_list -> clear();
|
pages_list -> clear();
|
||||||
foreach(ConfigPage *page, pages) {
|
for (ConfigPage *page: pages) {
|
||||||
addPageToList(page);
|
addPageToList(page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ void ConfigDialog::addPageToList(ConfigPage *page) {
|
|||||||
Applique la configuration de toutes les pages
|
Applique la configuration de toutes les pages
|
||||||
*/
|
*/
|
||||||
void ConfigDialog::applyConf() {
|
void ConfigDialog::applyConf() {
|
||||||
foreach(ConfigPage *page, pages) {
|
for (ConfigPage *page: pages) {
|
||||||
page -> applyConf();
|
page -> applyConf();
|
||||||
}
|
}
|
||||||
accept();
|
accept();
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ void NewDiagramPage::applyConf() {
|
|||||||
|
|
||||||
// default xref properties
|
// default xref properties
|
||||||
QHash <QString, XRefProperties> hash_xrp = xrefpw -> properties();
|
QHash <QString, XRefProperties> hash_xrp = xrefpw -> properties();
|
||||||
foreach (QString key, hash_xrp.keys()) {
|
for (QString key: hash_xrp.keys()) {
|
||||||
XRefProperties xrp = hash_xrp[key];
|
XRefProperties xrp = hash_xrp[key];
|
||||||
QString str("diagrameditor/defaultxref");
|
QString str("diagrameditor/defaultxref");
|
||||||
xrp.toSettings(settings, str += key);
|
xrp.toSettings(settings, str += key);
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ Diagram::~Diagram() {
|
|||||||
|
|
||||||
// list removable items
|
// list removable items
|
||||||
QList<QGraphicsItem *> deletable_items;
|
QList<QGraphicsItem *> deletable_items;
|
||||||
foreach(QGraphicsItem *qgi, items()) {
|
for (QGraphicsItem *qgi: items()) {
|
||||||
if (qgi -> parentItem()) continue;
|
if (qgi -> parentItem()) continue;
|
||||||
if (qgraphicsitem_cast<Conductor *>(qgi)) continue;
|
if (qgraphicsitem_cast<Conductor *>(qgi)) continue;
|
||||||
deletable_items << qgi;
|
deletable_items << qgi;
|
||||||
@@ -251,7 +251,7 @@ void Diagram::keyPressEvent(QKeyEvent *e)
|
|||||||
if (!this->selectedContent().items(255).isEmpty()) {
|
if (!this->selectedContent().items(255).isEmpty()) {
|
||||||
switch(e -> key()) {
|
switch(e -> key()) {
|
||||||
case Qt::Key_Left:
|
case Qt::Key_Left:
|
||||||
foreach (Element *item, selectedContent().elements) {
|
for (Element *item: selectedContent().elements) {
|
||||||
left_position = item->mapRectFromScene(item->boundingRect()).x();
|
left_position = item->mapRectFromScene(item->boundingRect()).x();
|
||||||
if (left_position >= this->sceneRect().left() - item->boundingRect().width())
|
if (left_position >= this->sceneRect().left() - item->boundingRect().width())
|
||||||
return;
|
return;
|
||||||
@@ -260,7 +260,7 @@ void Diagram::keyPressEvent(QKeyEvent *e)
|
|||||||
break;
|
break;
|
||||||
case Qt::Key_Right: movement = QPointF(+xGrid, 0.0); break;
|
case Qt::Key_Right: movement = QPointF(+xGrid, 0.0); break;
|
||||||
case Qt::Key_Up:
|
case Qt::Key_Up:
|
||||||
foreach (Element *item, selectedContent().elements) {
|
for (Element *item:selectedContent().elements) {
|
||||||
top_position = item->mapRectFromScene(item->boundingRect()).y();
|
top_position = item->mapRectFromScene(item->boundingRect()).y();
|
||||||
if (top_position >= this->sceneRect().top() - item->boundingRect().height())
|
if (top_position >= this->sceneRect().top() - item->boundingRect().height())
|
||||||
return;
|
return;
|
||||||
@@ -382,14 +382,14 @@ bool Diagram::toPaintDevice(QPaintDevice &pix, int width, int height, Qt::Aspect
|
|||||||
|
|
||||||
// deselectionne tous les elements
|
// deselectionne tous les elements
|
||||||
QList<QGraphicsItem *> selected_elmts = selectedItems();
|
QList<QGraphicsItem *> selected_elmts = selectedItems();
|
||||||
foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(false);
|
for (QGraphicsItem *qgi: selected_elmts) qgi -> setSelected(false);
|
||||||
|
|
||||||
// effectue le rendu lui-meme
|
// effectue le rendu lui-meme
|
||||||
render(&p, QRect(QPoint(0, 0), image_size), source_area, aspectRatioMode);
|
render(&p, QRect(QPoint(0, 0), image_size), source_area, aspectRatioMode);
|
||||||
p.end();
|
p.end();
|
||||||
|
|
||||||
// restaure les elements selectionnes
|
// restaure les elements selectionnes
|
||||||
foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(true);
|
for (QGraphicsItem *qgi: selected_elmts) qgi -> setSelected(true);
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@@ -438,7 +438,7 @@ QList < QSet <Conductor *> > Diagram::potentials() {
|
|||||||
do {
|
do {
|
||||||
QSet <Conductor *> one_potential = conductors_list.first() -> relatedPotentialConductors();
|
QSet <Conductor *> one_potential = conductors_list.first() -> relatedPotentialConductors();
|
||||||
one_potential << conductors_list.takeFirst();
|
one_potential << conductors_list.takeFirst();
|
||||||
foreach (Conductor *c, one_potential) conductors_list.removeOne(c);
|
for (Conductor *c: one_potential) conductors_list.removeOne(c);
|
||||||
potential_List << one_potential;
|
potential_List << one_potential;
|
||||||
} while (!conductors_list.empty());
|
} while (!conductors_list.empty());
|
||||||
|
|
||||||
@@ -545,7 +545,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
QList<QGraphicsItem *> list_items = items();
|
QList<QGraphicsItem *> list_items = items();
|
||||||
;
|
;
|
||||||
// Determine les elements a "XMLiser"
|
// Determine les elements a "XMLiser"
|
||||||
foreach(QGraphicsItem *qgi, list_items) {
|
for (QGraphicsItem *qgi: list_items) {
|
||||||
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
|
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
|
||||||
if (whole_content) list_elements << elmt;
|
if (whole_content) list_elements << elmt;
|
||||||
else if (elmt -> isSelected()) list_elements << elmt;
|
else if (elmt -> isSelected()) list_elements << elmt;
|
||||||
@@ -574,7 +574,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
// enregistrement des elements
|
// enregistrement des elements
|
||||||
if (!list_elements.isEmpty()) {
|
if (!list_elements.isEmpty()) {
|
||||||
QDomElement elements = document.createElement("elements");
|
QDomElement elements = document.createElement("elements");
|
||||||
foreach(Element *elmt, list_elements) {
|
for (Element *elmt: list_elements) {
|
||||||
elements.appendChild(elmt -> toXml(document, table_adr_id));
|
elements.appendChild(elmt -> toXml(document, table_adr_id));
|
||||||
}
|
}
|
||||||
racine.appendChild(elements);
|
racine.appendChild(elements);
|
||||||
@@ -583,7 +583,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
// enregistrement des conducteurs
|
// enregistrement des conducteurs
|
||||||
if (!list_conductors.isEmpty()) {
|
if (!list_conductors.isEmpty()) {
|
||||||
QDomElement conductors = document.createElement("conductors");
|
QDomElement conductors = document.createElement("conductors");
|
||||||
foreach(Conductor *cond, list_conductors) {
|
for (Conductor *cond: list_conductors) {
|
||||||
conductors.appendChild(cond -> toXml(document, table_adr_id));
|
conductors.appendChild(cond -> toXml(document, table_adr_id));
|
||||||
}
|
}
|
||||||
racine.appendChild(conductors);
|
racine.appendChild(conductors);
|
||||||
@@ -592,7 +592,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
// enregistrement des champs de texte
|
// enregistrement des champs de texte
|
||||||
if (!list_texts.isEmpty()) {
|
if (!list_texts.isEmpty()) {
|
||||||
QDomElement inputs = document.createElement("inputs");
|
QDomElement inputs = document.createElement("inputs");
|
||||||
foreach(DiagramTextItem *dti, list_texts) {
|
for (DiagramTextItem *dti: list_texts) {
|
||||||
inputs.appendChild(dti -> toXml(document));
|
inputs.appendChild(dti -> toXml(document));
|
||||||
}
|
}
|
||||||
racine.appendChild(inputs);
|
racine.appendChild(inputs);
|
||||||
@@ -601,7 +601,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
// save of images
|
// save of images
|
||||||
if (!list_images.isEmpty()) {
|
if (!list_images.isEmpty()) {
|
||||||
QDomElement images = document.createElement("images");
|
QDomElement images = document.createElement("images");
|
||||||
foreach (DiagramImageItem *dii, list_images) {
|
for (DiagramImageItem *dii: list_images) {
|
||||||
images.appendChild(dii -> toXml(document));
|
images.appendChild(dii -> toXml(document));
|
||||||
}
|
}
|
||||||
racine.appendChild(images);
|
racine.appendChild(images);
|
||||||
@@ -610,7 +610,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
// save of basic shapes
|
// save of basic shapes
|
||||||
if (!list_shapes.isEmpty()) {
|
if (!list_shapes.isEmpty()) {
|
||||||
QDomElement shapes = document.createElement("shapes");
|
QDomElement shapes = document.createElement("shapes");
|
||||||
foreach (QetShapeItem *dii, list_shapes) {
|
for (QetShapeItem *dii: list_shapes) {
|
||||||
shapes.appendChild(dii -> toXml(document));
|
shapes.appendChild(dii -> toXml(document));
|
||||||
}
|
}
|
||||||
racine.appendChild(shapes);
|
racine.appendChild(shapes);
|
||||||
@@ -768,7 +768,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
//in the embedded collection of this project
|
//in the embedded collection of this project
|
||||||
if (other_project && other_project != m_project) {
|
if (other_project && other_project != m_project) {
|
||||||
ElementCollectionHandler ech;
|
ElementCollectionHandler ech;
|
||||||
foreach (QDomElement element_xml, QET::findInDomElement(root, "elements", "element")) {
|
for (QDomElement element_xml: QET::findInDomElement(root, "elements", "element")) {
|
||||||
if (!Element::valideXml(element_xml)) continue;
|
if (!Element::valideXml(element_xml)) continue;
|
||||||
|
|
||||||
QString type_id = element_xml.attribute("type");
|
QString type_id = element_xml.attribute("type");
|
||||||
@@ -783,7 +783,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
//Load all elements from the XML
|
//Load all elements from the XML
|
||||||
QList<Element *> added_elements;
|
QList<Element *> added_elements;
|
||||||
QHash<int, Terminal *> table_adr_id;
|
QHash<int, Terminal *> table_adr_id;
|
||||||
foreach (QDomElement element_xml, QET::findInDomElement(root, "elements", "element"))
|
for (QDomElement element_xml: QET::findInDomElement(root, "elements", "element"))
|
||||||
{
|
{
|
||||||
if (!Element::valideXml(element_xml)) continue;
|
if (!Element::valideXml(element_xml)) continue;
|
||||||
|
|
||||||
@@ -822,7 +822,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
|
|
||||||
// Load text
|
// Load text
|
||||||
QList<IndependentTextItem *> added_texts;
|
QList<IndependentTextItem *> added_texts;
|
||||||
foreach (QDomElement text_xml, QET::findInDomElement(root, "inputs", "input")) {
|
for (QDomElement text_xml: QET::findInDomElement(root, "inputs", "input")) {
|
||||||
IndependentTextItem *iti = new IndependentTextItem();
|
IndependentTextItem *iti = new IndependentTextItem();
|
||||||
iti -> fromXml(text_xml);
|
iti -> fromXml(text_xml);
|
||||||
addItem(iti);
|
addItem(iti);
|
||||||
@@ -831,7 +831,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
|
|
||||||
// Load image
|
// Load image
|
||||||
QList<DiagramImageItem *> added_images;
|
QList<DiagramImageItem *> added_images;
|
||||||
foreach (QDomElement image_xml, QET::findInDomElement(root, "images", "image")) {
|
for (QDomElement image_xml: QET::findInDomElement(root, "images", "image")) {
|
||||||
DiagramImageItem *dii = new DiagramImageItem ();
|
DiagramImageItem *dii = new DiagramImageItem ();
|
||||||
dii -> fromXml(image_xml);
|
dii -> fromXml(image_xml);
|
||||||
addItem(dii);
|
addItem(dii);
|
||||||
@@ -840,7 +840,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
|
|
||||||
// Load shape
|
// Load shape
|
||||||
QList<QetShapeItem *> added_shapes;
|
QList<QetShapeItem *> added_shapes;
|
||||||
foreach (QDomElement shape_xml, QET::findInDomElement(root, "shapes", "shape")) {
|
for (QDomElement shape_xml: QET::findInDomElement(root, "shapes", "shape")) {
|
||||||
QetShapeItem *dii = new QetShapeItem (QPointF(0,0));
|
QetShapeItem *dii = new QetShapeItem (QPointF(0,0));
|
||||||
dii -> fromXml(shape_xml);
|
dii -> fromXml(shape_xml);
|
||||||
addItem(dii);
|
addItem(dii);
|
||||||
@@ -849,7 +849,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
|
|
||||||
// Load conductor
|
// Load conductor
|
||||||
QList<Conductor *> added_conductors;
|
QList<Conductor *> added_conductors;
|
||||||
foreach (QDomElement f, QET::findInDomElement(root, "conductors", "conductor"))
|
for (QDomElement f: QET::findInDomElement(root, "conductors", "conductor"))
|
||||||
{
|
{
|
||||||
if (!Conductor::valideXml(f)) continue;
|
if (!Conductor::valideXml(f)) continue;
|
||||||
|
|
||||||
@@ -880,15 +880,15 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
if (position != QPointF()) {
|
if (position != QPointF()) {
|
||||||
|
|
||||||
QList<QGraphicsItem *> added_items;
|
QList<QGraphicsItem *> added_items;
|
||||||
foreach (Element *added_element, added_elements ) added_items << added_element;
|
for (Element *added_element: added_elements ) added_items << added_element;
|
||||||
foreach (Conductor *added_cond, added_conductors) added_items << added_cond;
|
for (Conductor *added_cond: added_conductors) added_items << added_cond;
|
||||||
foreach (QetShapeItem *added_shape, added_shapes ) added_items << added_shape;
|
for (QetShapeItem *added_shape: added_shapes ) added_items << added_shape;
|
||||||
foreach (DiagramTextItem *added_text, added_texts ) added_items << added_text;
|
for (DiagramTextItem *added_text: added_texts ) added_items << added_text;
|
||||||
foreach (DiagramImageItem *added_image, added_images ) added_items << added_image;
|
for (DiagramImageItem *added_image: added_images ) added_items << added_image;
|
||||||
|
|
||||||
//Get the top left corner of the rectangle that contain all added items
|
//Get the top left corner of the rectangle that contain all added items
|
||||||
QRectF items_rect;
|
QRectF items_rect;
|
||||||
foreach (QGraphicsItem *item, added_items) {
|
for (QGraphicsItem *item: added_items) {
|
||||||
items_rect = items_rect.united(item -> mapToScene(item -> boundingRect()).boundingRect());
|
items_rect = items_rect.united(item -> mapToScene(item -> boundingRect()).boundingRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -897,7 +897,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
position.y() - point_.y()));
|
position.y() - point_.y()));
|
||||||
|
|
||||||
//Translate all added items
|
//Translate all added items
|
||||||
foreach (QGraphicsItem *qgi, added_items)
|
for (QGraphicsItem *qgi: added_items)
|
||||||
qgi -> setPos( qgi -> pos() += pos_);
|
qgi -> setPos( qgi -> pos() += pos_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -923,7 +923,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
* @param type of sequential
|
* @param type of sequential
|
||||||
*/
|
*/
|
||||||
void Diagram::folioSequentialsFromXml(const QDomElement &root, QHash<QString, QStringList>* hash, QString folioSeq, QString seq, QString type, QString autonumFolioSeqType) {
|
void Diagram::folioSequentialsFromXml(const QDomElement &root, QHash<QString, QStringList>* hash, QString folioSeq, QString seq, QString type, QString autonumFolioSeqType) {
|
||||||
foreach (QDomElement folioSeqAutoNum, QET::findInDomElement(root, autonumFolioSeqType, folioSeq)) {
|
for (QDomElement folioSeqAutoNum: QET::findInDomElement(root, autonumFolioSeqType, folioSeq)) {
|
||||||
for(QDomElement folioseq = folioSeqAutoNum.firstChildElement(type); !folioseq.isNull(); folioseq = folioseq.nextSiblingElement(type)) {
|
for(QDomElement folioseq = folioSeqAutoNum.firstChildElement(type); !folioseq.isNull(); folioseq = folioseq.nextSiblingElement(type)) {
|
||||||
QString title = folioseq.attribute("title");
|
QString title = folioseq.attribute("title");
|
||||||
QStringList list;
|
QStringList list;
|
||||||
@@ -987,10 +987,10 @@ QDomElement Diagram::writeXml(QDomDocument &xml_doc) const {
|
|||||||
*/
|
*/
|
||||||
void Diagram::refreshContents() {
|
void Diagram::refreshContents() {
|
||||||
|
|
||||||
foreach (Element *elmt, elements())
|
for (Element *elmt: elements())
|
||||||
elmt->initLink(project());
|
elmt->initLink(project());
|
||||||
|
|
||||||
foreach (Conductor *conductor, conductors())
|
for (Conductor *conductor: conductors())
|
||||||
conductor->refreshText();
|
conductor->refreshText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1127,7 +1127,7 @@ void Diagram::selectAll() {
|
|||||||
if (items().isEmpty()) return;
|
if (items().isEmpty()) return;
|
||||||
|
|
||||||
blockSignals(true);
|
blockSignals(true);
|
||||||
foreach(QGraphicsItem *qgi, items()) qgi -> setSelected(true);
|
for (QGraphicsItem *qgi: items()) qgi -> setSelected(true);
|
||||||
blockSignals(false);
|
blockSignals(false);
|
||||||
emit(selectionChanged());
|
emit(selectionChanged());
|
||||||
}
|
}
|
||||||
@@ -1148,7 +1148,7 @@ void Diagram::invertSelection() {
|
|||||||
if (items().isEmpty()) return;
|
if (items().isEmpty()) return;
|
||||||
|
|
||||||
blockSignals(true);
|
blockSignals(true);
|
||||||
foreach (QGraphicsItem *item, items()) item -> setSelected(!item -> isSelected());
|
for (QGraphicsItem *item: items()) item -> setSelected(!item -> isSelected());
|
||||||
blockSignals(false);
|
blockSignals(false);
|
||||||
emit(selectionChanged());
|
emit(selectionChanged());
|
||||||
}
|
}
|
||||||
@@ -1159,11 +1159,11 @@ void Diagram::invertSelection() {
|
|||||||
* in their labels.
|
* in their labels.
|
||||||
*/
|
*/
|
||||||
void Diagram::updateLabels() {
|
void Diagram::updateLabels() {
|
||||||
foreach (Element *elmt, elements()) {
|
for (Element *elmt: elements()) {
|
||||||
if (elmt->elementInformations()["label"].toString().contains(("%F")))
|
if (elmt->elementInformations()["label"].toString().contains(("%F")))
|
||||||
elmt->updateLabel();
|
elmt->updateLabel();
|
||||||
}
|
}
|
||||||
foreach (Conductor *cnd, content().conductors()) {
|
for (Conductor *cnd: content().conductors()) {
|
||||||
cnd->refreshText();
|
cnd->refreshText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1341,7 +1341,7 @@ QString Diagram::title() const {
|
|||||||
*/
|
*/
|
||||||
QList<CustomElement *> Diagram::customElements() const {
|
QList<CustomElement *> Diagram::customElements() const {
|
||||||
QList<CustomElement *> elements_list;
|
QList<CustomElement *> elements_list;
|
||||||
foreach(QGraphicsItem *qgi, items()) {
|
for (QGraphicsItem *qgi: items()) {
|
||||||
if (CustomElement *elmt = qgraphicsitem_cast<CustomElement *>(qgi)) {
|
if (CustomElement *elmt = qgraphicsitem_cast<CustomElement *>(qgi)) {
|
||||||
elements_list << elmt;
|
elements_list << elmt;
|
||||||
}
|
}
|
||||||
@@ -1351,7 +1351,7 @@ QList<CustomElement *> Diagram::customElements() const {
|
|||||||
|
|
||||||
QList <Element *> Diagram::elements() const {
|
QList <Element *> Diagram::elements() const {
|
||||||
QList<Element *> element_list;
|
QList<Element *> element_list;
|
||||||
foreach (QGraphicsItem *qgi, items()) {
|
for (QGraphicsItem *qgi: items()) {
|
||||||
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi))
|
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi))
|
||||||
element_list <<elmt;
|
element_list <<elmt;
|
||||||
}
|
}
|
||||||
@@ -1364,7 +1364,7 @@ QList <Element *> Diagram::elements() const {
|
|||||||
*/
|
*/
|
||||||
QList <Conductor *> Diagram::conductors() const {
|
QList <Conductor *> Diagram::conductors() const {
|
||||||
QList<Conductor *> cnd_list;
|
QList<Conductor *> cnd_list;
|
||||||
foreach (QGraphicsItem *qgi, items()) {
|
for (QGraphicsItem *qgi: items()) {
|
||||||
if (Conductor *cnd = qgraphicsitem_cast<Conductor *>(qgi))
|
if (Conductor *cnd = qgraphicsitem_cast<Conductor *>(qgi))
|
||||||
cnd_list <<cnd;
|
cnd_list <<cnd;
|
||||||
}
|
}
|
||||||
@@ -1433,7 +1433,7 @@ void Diagram::endMoveElementTexts() {
|
|||||||
@return true si l'element location est utilise sur ce schema, false sinon
|
@return true si l'element location est utilise sur ce schema, false sinon
|
||||||
*/
|
*/
|
||||||
bool Diagram::usesElement(const ElementsLocation &location) {
|
bool Diagram::usesElement(const ElementsLocation &location) {
|
||||||
foreach(CustomElement *element, customElements()) {
|
for (CustomElement *element: customElements()) {
|
||||||
if (element -> location() == location) {
|
if (element -> location() == location) {
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@@ -1455,7 +1455,7 @@ bool Diagram::usesTitleBlockTemplate(const QString &name) {
|
|||||||
* Freeze every existent element label.
|
* Freeze every existent element label.
|
||||||
*/
|
*/
|
||||||
void Diagram::freezeElements(bool freeze) {
|
void Diagram::freezeElements(bool freeze) {
|
||||||
foreach (Element *elmt, elements()) {
|
for (Element *elmt: elements()) {
|
||||||
elmt->freezeLabel(freeze);
|
elmt->freezeLabel(freeze);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1465,7 +1465,7 @@ void Diagram::freezeElements(bool freeze) {
|
|||||||
* Unfreeze every existent element label.
|
* Unfreeze every existent element label.
|
||||||
*/
|
*/
|
||||||
void Diagram::unfreezeElements() {
|
void Diagram::unfreezeElements() {
|
||||||
foreach (Element *elmt, elements()) {
|
for (Element *elmt: elements()) {
|
||||||
elmt->freezeLabel(false);
|
elmt->freezeLabel(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1491,7 +1491,7 @@ bool Diagram::freezeNewElements() {
|
|||||||
* Freeze every existent conductor label.
|
* Freeze every existent conductor label.
|
||||||
*/
|
*/
|
||||||
void Diagram::freezeConductors(bool freeze) {
|
void Diagram::freezeConductors(bool freeze) {
|
||||||
foreach (Conductor *cnd, conductors()) {
|
for (Conductor *cnd: conductors()) {
|
||||||
cnd->setFreezeLabel(freeze);
|
cnd->setFreezeLabel(freeze);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1595,7 +1595,7 @@ QPointF Diagram::snapToGrid(const QPointF &p)
|
|||||||
@param dt true pour afficher les bornes, false sinon
|
@param dt true pour afficher les bornes, false sinon
|
||||||
*/
|
*/
|
||||||
void Diagram::setDrawTerminals(bool dt) {
|
void Diagram::setDrawTerminals(bool dt) {
|
||||||
foreach(QGraphicsItem *qgi, items()) {
|
for (QGraphicsItem *qgi: items()) {
|
||||||
if (Terminal *t = qgraphicsitem_cast<Terminal *>(qgi)) {
|
if (Terminal *t = qgraphicsitem_cast<Terminal *>(qgi)) {
|
||||||
t -> setVisible(dt);
|
t -> setVisible(dt);
|
||||||
}
|
}
|
||||||
@@ -1616,7 +1616,7 @@ void Diagram::setDrawColoredConductors(bool dcc) {
|
|||||||
*/
|
*/
|
||||||
QSet<Conductor *> Diagram::selectedConductors() const {
|
QSet<Conductor *> Diagram::selectedConductors() const {
|
||||||
QSet<Conductor *> conductors_set;
|
QSet<Conductor *> conductors_set;
|
||||||
foreach(QGraphicsItem *qgi, selectedItems()) {
|
for (QGraphicsItem *qgi: selectedItems()) {
|
||||||
if (Conductor *c = qgraphicsitem_cast<Conductor *>(qgi)) {
|
if (Conductor *c = qgraphicsitem_cast<Conductor *>(qgi)) {
|
||||||
conductors_set << c;
|
conductors_set << c;
|
||||||
}
|
}
|
||||||
@@ -1630,7 +1630,7 @@ QSet<Conductor *> Diagram::selectedConductors() const {
|
|||||||
*/
|
*/
|
||||||
QSet<DiagramTextItem *> Diagram::selectedTexts() const {
|
QSet<DiagramTextItem *> Diagram::selectedTexts() const {
|
||||||
QSet<DiagramTextItem *> selected_texts;
|
QSet<DiagramTextItem *> selected_texts;
|
||||||
foreach(QGraphicsItem *item, selectedItems()) {
|
for (QGraphicsItem *item: selectedItems()) {
|
||||||
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
|
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
|
||||||
selected_texts << cti;
|
selected_texts << cti;
|
||||||
} else if (ElementTextItem *eti = qgraphicsitem_cast<ElementTextItem *>(item)) {
|
} else if (ElementTextItem *eti = qgraphicsitem_cast<ElementTextItem *>(item)) {
|
||||||
@@ -1648,7 +1648,7 @@ QSet<DiagramTextItem *> Diagram::selectedTexts() const {
|
|||||||
*/
|
*/
|
||||||
QSet<ConductorTextItem *> Diagram::selectedConductorTexts() const {
|
QSet<ConductorTextItem *> Diagram::selectedConductorTexts() const {
|
||||||
QSet<ConductorTextItem *> selected_texts;
|
QSet<ConductorTextItem *> selected_texts;
|
||||||
foreach(QGraphicsItem *item, selectedItems()) {
|
for (QGraphicsItem *item: selectedItems()) {
|
||||||
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
|
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
|
||||||
selected_texts << cti;
|
selected_texts << cti;
|
||||||
}
|
}
|
||||||
@@ -1662,7 +1662,7 @@ QSet<ConductorTextItem *> Diagram::selectedConductorTexts() const {
|
|||||||
*/
|
*/
|
||||||
QSet<ElementTextItem*> Diagram::selectedElementTexts() const {
|
QSet<ElementTextItem*> Diagram::selectedElementTexts() const {
|
||||||
QSet<ElementTextItem *> selected_texts;
|
QSet<ElementTextItem *> selected_texts;
|
||||||
foreach(QGraphicsItem *item, selectedItems()) {
|
for (QGraphicsItem *item: selectedItems()) {
|
||||||
if (ElementTextItem *cti = qgraphicsitem_cast< ElementTextItem*>(item)) {
|
if (ElementTextItem *cti = qgraphicsitem_cast< ElementTextItem*>(item)) {
|
||||||
selected_texts << cti;
|
selected_texts << cti;
|
||||||
}
|
}
|
||||||
@@ -1750,7 +1750,7 @@ bool Diagram::isReadOnly() const
|
|||||||
*/
|
*/
|
||||||
DiagramContent Diagram::content() const {
|
DiagramContent Diagram::content() const {
|
||||||
DiagramContent dc;
|
DiagramContent dc;
|
||||||
foreach(QGraphicsItem *qgi, items()) {
|
for (QGraphicsItem *qgi: items()) {
|
||||||
if (Element *e = qgraphicsitem_cast<Element *>(qgi)) {
|
if (Element *e = qgraphicsitem_cast<Element *>(qgi)) {
|
||||||
dc.elements << e;
|
dc.elements << e;
|
||||||
} else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(qgi)) {
|
} else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(qgi)) {
|
||||||
@@ -1769,7 +1769,7 @@ DiagramContent Diagram::selectedContent() {
|
|||||||
DiagramContent dc;
|
DiagramContent dc;
|
||||||
|
|
||||||
// recupere les elements deplaces
|
// recupere les elements deplaces
|
||||||
foreach (QGraphicsItem *item, selectedItems()) {
|
for (QGraphicsItem *item: selectedItems()) {
|
||||||
if (Element *elmt = qgraphicsitem_cast<Element *>(item)) {
|
if (Element *elmt = qgraphicsitem_cast<Element *>(item)) {
|
||||||
dc.elements << elmt;
|
dc.elements << elmt;
|
||||||
} else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(item)) {
|
} else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(item)) {
|
||||||
@@ -1790,9 +1790,9 @@ DiagramContent Diagram::selectedContent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pour chaque element deplace, determine les conducteurs qui seront modifies
|
// pour chaque element deplace, determine les conducteurs qui seront modifies
|
||||||
foreach(Element *elmt, dc.elements) {
|
for (Element *elmt: dc.elements) {
|
||||||
foreach(Terminal *terminal, elmt -> terminals()) {
|
for (Terminal *terminal: elmt -> terminals()) {
|
||||||
foreach(Conductor *conductor, terminal -> conductors()) {
|
for (Conductor *conductor: terminal -> conductors()) {
|
||||||
Terminal *other_terminal;
|
Terminal *other_terminal;
|
||||||
if (conductor -> terminal1 == terminal) {
|
if (conductor -> terminal1 == terminal) {
|
||||||
other_terminal = conductor -> terminal2;
|
other_terminal = conductor -> terminal2;
|
||||||
@@ -1818,7 +1818,7 @@ DiagramContent Diagram::selectedContent() {
|
|||||||
et qu'au moins l'un d'entre eux peut etre pivote.
|
et qu'au moins l'un d'entre eux peut etre pivote.
|
||||||
*/
|
*/
|
||||||
bool Diagram::canRotateSelection() const {
|
bool Diagram::canRotateSelection() const {
|
||||||
foreach(QGraphicsItem * qgi, selectedItems()) {
|
for (QGraphicsItem * qgi: selectedItems()) {
|
||||||
if (qgraphicsitem_cast<IndependentTextItem *>(qgi) ||
|
if (qgraphicsitem_cast<IndependentTextItem *>(qgi) ||
|
||||||
qgraphicsitem_cast<ConductorTextItem *>(qgi) ||
|
qgraphicsitem_cast<ConductorTextItem *>(qgi) ||
|
||||||
qgraphicsitem_cast<DiagramImageItem *>(qgi) ||
|
qgraphicsitem_cast<DiagramImageItem *>(qgi) ||
|
||||||
|
|||||||
@@ -81,12 +81,12 @@ void DeleteElementsCommand::undo()
|
|||||||
{
|
{
|
||||||
diagram -> showMe();
|
diagram -> showMe();
|
||||||
|
|
||||||
foreach(QGraphicsItem *item, removed_content.items())
|
for (QGraphicsItem *item: removed_content.items())
|
||||||
diagram->addItem(item);
|
diagram->addItem(item);
|
||||||
|
|
||||||
//We relink element after every element was added to diagram
|
//We relink element after every element was added to diagram
|
||||||
foreach(Element *e, removed_content.elements)
|
for (Element *e: removed_content.elements)
|
||||||
foreach (Element *elmt, m_link_hash[e])
|
for (Element *elmt: m_link_hash[e])
|
||||||
e -> linkToElement(elmt);
|
e -> linkToElement(elmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ void DeleteElementsCommand::redo()
|
|||||||
{
|
{
|
||||||
diagram -> showMe();
|
diagram -> showMe();
|
||||||
|
|
||||||
foreach(Conductor *c, removed_content.conductors(DiagramContent::AnyConductor))
|
for (Conductor *c: removed_content.conductors(DiagramContent::AnyConductor))
|
||||||
{
|
{
|
||||||
//If option one text per folio is enable, and the text item of
|
//If option one text per folio is enable, and the text item of
|
||||||
//current conductor is visible (that mean the conductor have the single displayed text)
|
//current conductor is visible (that mean the conductor have the single displayed text)
|
||||||
@@ -113,14 +113,14 @@ void DeleteElementsCommand::redo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Element *e, removed_content.elements)
|
for (Element *e: removed_content.elements)
|
||||||
{
|
{
|
||||||
//Get linked element, for relink it at undo
|
//Get linked element, for relink it at undo
|
||||||
if (!e->linkedElements().isEmpty())
|
if (!e->linkedElements().isEmpty())
|
||||||
m_link_hash.insert(e, e->linkedElements());
|
m_link_hash.insert(e, e->linkedElements());
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(QGraphicsItem *item, removed_content.items())
|
for (QGraphicsItem *item: removed_content.items())
|
||||||
diagram->removeItem(item);
|
diagram->removeItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ void PasteDiagramCommand::undo()
|
|||||||
{
|
{
|
||||||
diagram -> showMe();
|
diagram -> showMe();
|
||||||
|
|
||||||
foreach(QGraphicsItem *item, content.items(filter))
|
for (QGraphicsItem *item: content.items(filter))
|
||||||
diagram->removeItem(item);
|
diagram->removeItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ void PasteDiagramCommand::redo()
|
|||||||
first_redo = false;
|
first_redo = false;
|
||||||
|
|
||||||
//this is the first paste, we do some actions for the new element
|
//this is the first paste, we do some actions for the new element
|
||||||
foreach(Element *e, content.elements) {
|
for (Element *e: content.elements) {
|
||||||
//make new uuid, because old uuid are the uuid of the copied element
|
//make new uuid, because old uuid are the uuid of the copied element
|
||||||
e -> newUuid();
|
e -> newUuid();
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ void PasteDiagramCommand::redo()
|
|||||||
eti -> setPlainText("_");
|
eti -> setPlainText("_");
|
||||||
|
|
||||||
//Reset the text of conductors
|
//Reset the text of conductors
|
||||||
foreach (Conductor *c, content.conductorsToMove) {
|
for (Conductor *c: content.conductorsToMove) {
|
||||||
ConductorProperties cp = c -> properties();
|
ConductorProperties cp = c -> properties();
|
||||||
cp.text = c->diagram() ? c -> diagram() -> defaultConductorProperties.text : "_";
|
cp.text = c->diagram() ? c -> diagram() -> defaultConductorProperties.text : "_";
|
||||||
c -> setProperties(cp);
|
c -> setProperties(cp);
|
||||||
@@ -214,14 +214,14 @@ void PasteDiagramCommand::redo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach (QGraphicsItem *item, content.items(filter)) {
|
for (QGraphicsItem *item: content.items(filter)) {
|
||||||
diagram->item_paste = true;
|
diagram->item_paste = true;
|
||||||
diagram->addItem(item);
|
diagram->addItem(item);
|
||||||
diagram->item_paste = false;
|
diagram->item_paste = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (QGraphicsItem *qgi, content.items())
|
for (QGraphicsItem *qgi: content.items())
|
||||||
qgi -> setSelected(true);
|
qgi -> setSelected(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +335,7 @@ void MoveElementsCommand::move(const QPointF &actual_movement) {
|
|||||||
typedef DiagramContent dc;
|
typedef DiagramContent dc;
|
||||||
|
|
||||||
//Move every movable item, except conductor
|
//Move every movable item, except conductor
|
||||||
foreach (QGraphicsItem *qgi, content_to_move.items(dc::Elements | dc::TextFields | dc::Images | dc::Shapes)) {
|
for (QGraphicsItem *qgi: content_to_move.items(dc::Elements | dc::TextFields | dc::Images | dc::Shapes)) {
|
||||||
//If curent item have parent, and parent item is in content_to_move
|
//If curent item have parent, and parent item is in content_to_move
|
||||||
//we don't apply movement to this item, because this item will be moved by is parent.
|
//we don't apply movement to this item, because this item will be moved by is parent.
|
||||||
if (qgi->parentItem()) {
|
if (qgi->parentItem()) {
|
||||||
@@ -349,12 +349,12 @@ void MoveElementsCommand::move(const QPointF &actual_movement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move some conductors
|
// Move some conductors
|
||||||
foreach(Conductor *conductor, content_to_move.conductorsToMove) {
|
for (Conductor *conductor: content_to_move.conductorsToMove) {
|
||||||
setupAnimation(conductor, "pos", conductor->pos(), conductor->pos() + actual_movement);
|
setupAnimation(conductor, "pos", conductor->pos(), conductor->pos() + actual_movement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recalcul the path of other conductor
|
// Recalcul the path of other conductor
|
||||||
foreach(Conductor *conductor, content_to_move.conductorsToUpdate) {
|
for (Conductor *conductor: content_to_move.conductorsToUpdate) {
|
||||||
setupAnimation(conductor, "animPath", 1, 1);
|
setupAnimation(conductor, "animPath", 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -403,7 +403,7 @@ MoveConductorsTextsCommand::~MoveConductorsTextsCommand() {
|
|||||||
/// annule le deplacement
|
/// annule le deplacement
|
||||||
void MoveConductorsTextsCommand::undo() {
|
void MoveConductorsTextsCommand::undo() {
|
||||||
diagram -> showMe();
|
diagram -> showMe();
|
||||||
foreach(ConductorTextItem *cti, texts_to_move_.keys()) {
|
for (ConductorTextItem *cti: texts_to_move_.keys()) {
|
||||||
QPointF movement = texts_to_move_[cti].first;
|
QPointF movement = texts_to_move_[cti].first;
|
||||||
bool was_already_moved = texts_to_move_[cti].second;
|
bool was_already_moved = texts_to_move_[cti].second;
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ void MoveConductorsTextsCommand::redo() {
|
|||||||
if (first_redo) {
|
if (first_redo) {
|
||||||
first_redo = false;
|
first_redo = false;
|
||||||
} else {
|
} else {
|
||||||
foreach(ConductorTextItem *cti, texts_to_move_.keys()) {
|
for (ConductorTextItem *cti: texts_to_move_.keys()) {
|
||||||
QPointF movement = texts_to_move_[cti].first;
|
QPointF movement = texts_to_move_[cti].first;
|
||||||
|
|
||||||
cti -> forceMovedByUser(true);
|
cti -> forceMovedByUser(true);
|
||||||
@@ -539,10 +539,10 @@ RotateElementsCommand::~RotateElementsCommand() {
|
|||||||
/// defait le pivotement
|
/// defait le pivotement
|
||||||
void RotateElementsCommand::undo() {
|
void RotateElementsCommand::undo() {
|
||||||
diagram -> showMe();
|
diagram -> showMe();
|
||||||
foreach(Element *e, elements_to_rotate) {
|
for (Element *e: elements_to_rotate) {
|
||||||
e -> rotateBy(-applied_rotation_angle_);
|
e -> rotateBy(-applied_rotation_angle_);
|
||||||
}
|
}
|
||||||
foreach(DiagramTextItem *dti, texts_to_rotate) {
|
for (DiagramTextItem *dti: texts_to_rotate) {
|
||||||
//ConductorTextItem have a default rotation angle, we apply a specific treatment
|
//ConductorTextItem have a default rotation angle, we apply a specific treatment
|
||||||
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(dti)) {
|
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(dti)) {
|
||||||
cti -> forceRotateByUser(previous_rotate_by_user_[cti]);
|
cti -> forceRotateByUser(previous_rotate_by_user_[cti]);
|
||||||
@@ -551,16 +551,16 @@ void RotateElementsCommand::undo() {
|
|||||||
}
|
}
|
||||||
else {dti -> rotateBy(-applied_rotation_angle_);}
|
else {dti -> rotateBy(-applied_rotation_angle_);}
|
||||||
}
|
}
|
||||||
foreach(DiagramImageItem *dii, images_to_rotate) dii -> rotateBy(-applied_rotation_angle_);
|
for (DiagramImageItem *dii: images_to_rotate) dii -> rotateBy(-applied_rotation_angle_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// refait le pivotement
|
/// refait le pivotement
|
||||||
void RotateElementsCommand::redo() {
|
void RotateElementsCommand::redo() {
|
||||||
diagram -> showMe();
|
diagram -> showMe();
|
||||||
foreach(Element *e, elements_to_rotate) {
|
for (Element *e: elements_to_rotate) {
|
||||||
e -> rotateBy(applied_rotation_angle_);
|
e -> rotateBy(applied_rotation_angle_);
|
||||||
}
|
}
|
||||||
foreach(DiagramTextItem *dti, texts_to_rotate) {
|
for (DiagramTextItem *dti: texts_to_rotate) {
|
||||||
//we grab the previous rotation by user of each ConductorTextItem
|
//we grab the previous rotation by user of each ConductorTextItem
|
||||||
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(dti)) {
|
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(dti)) {
|
||||||
previous_rotate_by_user_.insert(cti, cti -> wasRotateByUser());
|
previous_rotate_by_user_.insert(cti, cti -> wasRotateByUser());
|
||||||
@@ -568,7 +568,7 @@ void RotateElementsCommand::redo() {
|
|||||||
}
|
}
|
||||||
dti -> rotateBy(applied_rotation_angle_);
|
dti -> rotateBy(applied_rotation_angle_);
|
||||||
}
|
}
|
||||||
foreach(DiagramImageItem *dii, images_to_rotate) dii -> rotateBy(applied_rotation_angle_);
|
for (DiagramImageItem *dii: images_to_rotate) dii -> rotateBy(applied_rotation_angle_);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -597,7 +597,7 @@ RotateTextsCommand::RotateTextsCommand(const QList<DiagramTextItem *> &texts, do
|
|||||||
applied_rotation_angle_(applied_rotation),
|
applied_rotation_angle_(applied_rotation),
|
||||||
diagram(texts.first()->diagram())
|
diagram(texts.first()->diagram())
|
||||||
{
|
{
|
||||||
foreach(DiagramTextItem *text, texts) {
|
for (DiagramTextItem *text: texts) {
|
||||||
texts_to_rotate.insert(text, text -> rotationAngle());
|
texts_to_rotate.insert(text, text -> rotationAngle());
|
||||||
}
|
}
|
||||||
defineCommandName();
|
defineCommandName();
|
||||||
@@ -614,7 +614,7 @@ RotateTextsCommand::~RotateTextsCommand() {
|
|||||||
*/
|
*/
|
||||||
void RotateTextsCommand::undo() {
|
void RotateTextsCommand::undo() {
|
||||||
diagram -> showMe();
|
diagram -> showMe();
|
||||||
foreach(DiagramTextItem *text, texts_to_rotate.keys()) {
|
for (DiagramTextItem *text: texts_to_rotate.keys()) {
|
||||||
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text))
|
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text))
|
||||||
cti -> forceRotateByUser(previous_rotate_by_user_[cti]);
|
cti -> forceRotateByUser(previous_rotate_by_user_[cti]);
|
||||||
text -> setRotationAngle(texts_to_rotate[text]);
|
text -> setRotationAngle(texts_to_rotate[text]);
|
||||||
@@ -626,7 +626,7 @@ void RotateTextsCommand::undo() {
|
|||||||
*/
|
*/
|
||||||
void RotateTextsCommand::redo() {
|
void RotateTextsCommand::redo() {
|
||||||
diagram -> showMe();
|
diagram -> showMe();
|
||||||
foreach(DiagramTextItem *text, texts_to_rotate.keys()) {
|
for (DiagramTextItem *text: texts_to_rotate.keys()) {
|
||||||
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text)) {
|
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text)) {
|
||||||
//we grab the previous rotation by user of each ConductorTextItem
|
//we grab the previous rotation by user of each ConductorTextItem
|
||||||
previous_rotate_by_user_.insert(cti, cti -> wasRotateByUser());
|
previous_rotate_by_user_.insert(cti, cti -> wasRotateByUser());
|
||||||
@@ -741,7 +741,7 @@ ResetConductorCommand::~ResetConductorCommand() {
|
|||||||
*/
|
*/
|
||||||
void ResetConductorCommand::undo() {
|
void ResetConductorCommand::undo() {
|
||||||
diagram -> showMe();
|
diagram -> showMe();
|
||||||
foreach(Conductor *c, conductors_profiles.keys()) {
|
for (Conductor *c: conductors_profiles.keys()) {
|
||||||
c -> setProfiles(conductors_profiles[c]);
|
c -> setProfiles(conductors_profiles[c]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -751,7 +751,7 @@ void ResetConductorCommand::undo() {
|
|||||||
*/
|
*/
|
||||||
void ResetConductorCommand::redo() {
|
void ResetConductorCommand::redo() {
|
||||||
diagram -> showMe();
|
diagram -> showMe();
|
||||||
foreach(Conductor *c, conductors_profiles.keys()) {
|
for (Conductor *c: conductors_profiles.keys()) {
|
||||||
c -> textItem() -> forceMovedByUser (false);
|
c -> textItem() -> forceMovedByUser (false);
|
||||||
c -> textItem() -> forceRotateByUser (false);
|
c -> textItem() -> forceRotateByUser (false);
|
||||||
c -> setProfiles(ConductorProfilesGroup());
|
c -> setProfiles(ConductorProfilesGroup());
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ QList<Conductor *> DiagramContent::conductors(int filter) const {
|
|||||||
if (filter & ConductorsToUpdate) result += conductorsToUpdate;
|
if (filter & ConductorsToUpdate) result += conductorsToUpdate;
|
||||||
if (filter & OtherConductors) result += otherConductors;
|
if (filter & OtherConductors) result += otherConductors;
|
||||||
if (filter & SelectedOnly) {
|
if (filter & SelectedOnly) {
|
||||||
foreach(Conductor *conductor, result) {
|
for (Conductor *conductor: result) {
|
||||||
if (!conductor -> isSelected()) result.remove(conductor);
|
if (!conductor -> isSelected()) result.remove(conductor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,19 +89,19 @@ int DiagramContent::removeNonMovableItems()
|
|||||||
{
|
{
|
||||||
int count_ = 0;
|
int count_ = 0;
|
||||||
|
|
||||||
foreach(Element *elmt, elements) {
|
for (Element *elmt: elements) {
|
||||||
if (!elmt->isMovable()) {
|
if (!elmt->isMovable()) {
|
||||||
elements.remove(elmt);
|
elements.remove(elmt);
|
||||||
++count_;
|
++count_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach(DiagramImageItem *img, images) {
|
for (DiagramImageItem *img: images) {
|
||||||
if (!img->isMovable()) {
|
if (!img->isMovable()) {
|
||||||
images.remove(img);
|
images.remove(img);
|
||||||
++count_;
|
++count_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (QetShapeItem *shape, shapes) {
|
for (QetShapeItem *shape: shapes) {
|
||||||
if (!shape->isMovable()) {
|
if (!shape->isMovable()) {
|
||||||
shapes.remove(shape);
|
shapes.remove(shape);
|
||||||
++count_;
|
++count_;
|
||||||
@@ -116,7 +116,7 @@ int DiagramContent::removeNonMovableItems()
|
|||||||
*/
|
*/
|
||||||
QList<QGraphicsItem *> DiagramContent::items(int filter) const {
|
QList<QGraphicsItem *> DiagramContent::items(int filter) const {
|
||||||
QList<QGraphicsItem *> items_list;
|
QList<QGraphicsItem *> items_list;
|
||||||
foreach(QGraphicsItem *qgi, conductors(filter)) items_list << qgi;
|
for (QGraphicsItem *qgi: conductors(filter)) items_list << qgi;
|
||||||
|
|
||||||
if (filter & Elements) foreach(QGraphicsItem *qgi, elements) items_list << qgi;
|
if (filter & Elements) foreach(QGraphicsItem *qgi, elements) items_list << qgi;
|
||||||
if (filter & TextFields) foreach(QGraphicsItem *qgi, textFields) items_list << qgi;
|
if (filter & TextFields) foreach(QGraphicsItem *qgi, textFields) items_list << qgi;
|
||||||
@@ -124,7 +124,7 @@ QList<QGraphicsItem *> DiagramContent::items(int filter) const {
|
|||||||
if (filter & Shapes) foreach(QGraphicsItem *qgi, shapes) items_list << qgi;
|
if (filter & Shapes) foreach(QGraphicsItem *qgi, shapes) items_list << qgi;
|
||||||
|
|
||||||
if (filter & SelectedOnly) {
|
if (filter & SelectedOnly) {
|
||||||
foreach(QGraphicsItem *qgi, items_list) {
|
for (QGraphicsItem *qgi: items_list) {
|
||||||
if (!qgi -> isSelected()) items_list.removeOne(qgi);
|
if (!qgi -> isSelected()) items_list.removeOne(qgi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ bool DiagramContext::operator!=(const DiagramContext &dc) const {
|
|||||||
named \a tag_name (defaults to "property").
|
named \a tag_name (defaults to "property").
|
||||||
*/
|
*/
|
||||||
void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const {
|
void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const {
|
||||||
foreach (QString key, keys()) {
|
for (QString key : keys()) {
|
||||||
QDomElement property = e.ownerDocument().createElement(tag_name);
|
QDomElement property = e.ownerDocument().createElement(tag_name);
|
||||||
property.setAttribute("name", key);
|
property.setAttribute("name", key);
|
||||||
property.setAttribute("show",content_show[key]);
|
property.setAttribute("show",content_show[key]);
|
||||||
@@ -125,7 +125,7 @@ void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const {
|
|||||||
\a tag_name (defaults to "property").
|
\a tag_name (defaults to "property").
|
||||||
*/
|
*/
|
||||||
void DiagramContext::fromXml(const QDomElement &e, const QString &tag_name) {
|
void DiagramContext::fromXml(const QDomElement &e, const QString &tag_name) {
|
||||||
foreach (QDomElement property, QET::findInDomElement(e, tag_name)) {
|
for (QDomElement property : QET::findInDomElement(e, tag_name)) {
|
||||||
if (!property.hasAttribute("name")) continue;
|
if (!property.hasAttribute("name")) continue;
|
||||||
addValue(property.attribute("name"), QVariant(property.text()));
|
addValue(property.attribute("name"), QVariant(property.text()));
|
||||||
content_show.insert(property.attribute("name"), property.attribute("show", "1").toInt());
|
content_show.insert(property.attribute("name"), property.attribute("show", "1").toInt());
|
||||||
@@ -139,7 +139,7 @@ void DiagramContext::fromXml(const QDomElement &e, const QString &tag_name) {
|
|||||||
void DiagramContext::toSettings(QSettings &settings, const QString &array_name) const {
|
void DiagramContext::toSettings(QSettings &settings, const QString &array_name) const {
|
||||||
settings.beginWriteArray(array_name);
|
settings.beginWriteArray(array_name);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (QString key, content_.keys()) {
|
for (QString key : content_.keys()) {
|
||||||
settings.setArrayIndex(i);
|
settings.setArrayIndex(i);
|
||||||
settings.setValue("name", key);
|
settings.setValue("name", key);
|
||||||
settings.setValue("value", content_[key].toString());
|
settings.setValue("value", content_[key].toString());
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ DiagramContext DiagramContextWidget::context() const {
|
|||||||
void DiagramContextWidget::setContext(const DiagramContext &context) {
|
void DiagramContextWidget::setContext(const DiagramContext &context) {
|
||||||
clear();
|
clear();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (QString key, context.keys(DiagramContext::Alphabetical)) {
|
for (QString key: context.keys(DiagramContext::Alphabetical)) {
|
||||||
table_ -> setItem(i, 0, new QTableWidgetItem(key));
|
table_ -> setItem(i, 0, new QTableWidgetItem(key));
|
||||||
table_ -> setItem(i, 1, new QTableWidgetItem(context[key].toString()));
|
table_ -> setItem(i, 1, new QTableWidgetItem(context[key].toString()));
|
||||||
++ i;
|
++ i;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ DiagramEventAddElement::DiagramEventAddElement(ElementsLocation &location, Diagr
|
|||||||
DiagramEventAddElement::~DiagramEventAddElement()
|
DiagramEventAddElement::~DiagramEventAddElement()
|
||||||
{
|
{
|
||||||
if (m_element) delete m_element;
|
if (m_element) delete m_element;
|
||||||
foreach(QGraphicsView *view, m_diagram->views())
|
for (QGraphicsView *view: m_diagram->views())
|
||||||
view -> setContextMenuPolicy(Qt::DefaultContextMenu);
|
view -> setContextMenuPolicy(Qt::DefaultContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ bool DiagramEventAddElement::keyPressEvent(QKeyEvent *event)
|
|||||||
*/
|
*/
|
||||||
void DiagramEventAddElement::init()
|
void DiagramEventAddElement::init()
|
||||||
{
|
{
|
||||||
foreach(QGraphicsView *view, m_diagram->views())
|
for (QGraphicsView *view: m_diagram->views())
|
||||||
view->setContextMenuPolicy(Qt::NoContextMenu);
|
view->setContextMenuPolicy(Qt::NoContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ DiagramEventAddImage::~DiagramEventAddImage()
|
|||||||
delete m_image;
|
delete m_image;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (QGraphicsView *view, m_diagram->views())
|
for (QGraphicsView *view: m_diagram->views())
|
||||||
view->setContextMenuPolicy((Qt::DefaultContextMenu));
|
view->setContextMenuPolicy((Qt::DefaultContextMenu));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ bool DiagramEventAddImage::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
pos.ry() -= m_image->boundingRect().height()/2;
|
pos.ry() -= m_image->boundingRect().height()/2;
|
||||||
m_diagram -> undoStack().push (new AddItemCommand<DiagramImageItem *>(m_image, m_diagram, pos));
|
m_diagram -> undoStack().push (new AddItemCommand<DiagramImageItem *>(m_image, m_diagram, pos));
|
||||||
|
|
||||||
foreach (QGraphicsView *view, m_diagram->views())
|
for (QGraphicsView *view: m_diagram->views())
|
||||||
view->setContextMenuPolicy((Qt::DefaultContextMenu));
|
view->setContextMenuPolicy((Qt::DefaultContextMenu));
|
||||||
|
|
||||||
m_running = false;
|
m_running = false;
|
||||||
@@ -95,7 +95,7 @@ bool DiagramEventAddImage::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
|
|
||||||
if (!m_is_added)
|
if (!m_is_added)
|
||||||
{
|
{
|
||||||
foreach (QGraphicsView *view, m_diagram->views())
|
for (QGraphicsView *view: m_diagram->views())
|
||||||
view->setContextMenuPolicy((Qt::NoContextMenu));
|
view->setContextMenuPolicy((Qt::NoContextMenu));
|
||||||
|
|
||||||
m_diagram -> addItem(m_image);
|
m_diagram -> addItem(m_image);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ DiagramEventAddShape::~DiagramEventAddShape()
|
|||||||
delete m_help_horiz;
|
delete m_help_horiz;
|
||||||
delete m_help_verti;
|
delete m_help_verti;
|
||||||
|
|
||||||
foreach (QGraphicsView *v, m_diagram->views())
|
for (QGraphicsView *v: m_diagram->views())
|
||||||
v->setContextMenuPolicy(Qt::DefaultContextMenu);
|
v->setContextMenuPolicy(Qt::DefaultContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ bool DiagramEventAddShape::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event
|
|||||||
|
|
||||||
void DiagramEventAddShape::init()
|
void DiagramEventAddShape::init()
|
||||||
{
|
{
|
||||||
foreach (QGraphicsView *v, m_diagram->views())
|
for (QGraphicsView *v: m_diagram->views())
|
||||||
v->setContextMenuPolicy(Qt::NoContextMenu);
|
v->setContextMenuPolicy(Qt::NoContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -395,11 +395,11 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const Exp
|
|||||||
|
|
||||||
// deselectionne tous les elements
|
// deselectionne tous les elements
|
||||||
QList<QGraphicsItem *> selected_elmts = diagram -> selectedItems();
|
QList<QGraphicsItem *> selected_elmts = diagram -> selectedItems();
|
||||||
foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(false);
|
for (QGraphicsItem *qgi: selected_elmts) qgi -> setSelected(false);
|
||||||
|
|
||||||
// enleve le flag focusable de tous les elements concernes pour eviter toute reprise de focus par un champ de texte editable
|
// enleve le flag focusable de tous les elements concernes pour eviter toute reprise de focus par un champ de texte editable
|
||||||
QList<QGraphicsItem *> focusable_items;
|
QList<QGraphicsItem *> focusable_items;
|
||||||
foreach (QGraphicsItem *qgi, diagram -> items()) {
|
for (QGraphicsItem *qgi: diagram -> items()) {
|
||||||
if (qgi -> flags() & QGraphicsItem::ItemIsFocusable) {
|
if (qgi -> flags() & QGraphicsItem::ItemIsFocusable) {
|
||||||
focusable_items << qgi;
|
focusable_items << qgi;
|
||||||
qgi -> setFlag(QGraphicsItem::ItemIsFocusable, false);
|
qgi -> setFlag(QGraphicsItem::ItemIsFocusable, false);
|
||||||
@@ -407,7 +407,7 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const Exp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// evite toute autre forme d'interaction
|
// evite toute autre forme d'interaction
|
||||||
foreach (QGraphicsView *view, diagram -> views()) {
|
for (QGraphicsView *view: diagram -> views()) {
|
||||||
view -> setInteractive(false);
|
view -> setInteractive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,17 +476,17 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const Exp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remet en place les interactions
|
// remet en place les interactions
|
||||||
foreach (QGraphicsView *view, diagram -> views()) {
|
for (QGraphicsView *view: diagram -> views()) {
|
||||||
view -> setInteractive(true);
|
view -> setInteractive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// restaure les flags focusable
|
// restaure les flags focusable
|
||||||
foreach (QGraphicsItem *qgi, focusable_items) {
|
for (QGraphicsItem *qgi: focusable_items) {
|
||||||
qgi -> setFlag(QGraphicsItem::ItemIsFocusable, true);
|
qgi -> setFlag(QGraphicsItem::ItemIsFocusable, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// restaure les elements selectionnes
|
// restaure les elements selectionnes
|
||||||
foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(true);
|
for (QGraphicsItem *qgi: selected_elmts) qgi -> setSelected(true);
|
||||||
|
|
||||||
saveReloadDiagramParameters(diagram, options, false);
|
saveReloadDiagramParameters(diagram, options, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ QETProject *DiagramsChooser::project() const {
|
|||||||
*/
|
*/
|
||||||
QList<Diagram *> DiagramsChooser::selectedDiagrams() const {
|
QList<Diagram *> DiagramsChooser::selectedDiagrams() const {
|
||||||
QList<Diagram *> selected_diagrams;
|
QList<Diagram *> selected_diagrams;
|
||||||
foreach(Diagram *diagram, project_ -> diagrams()) {
|
for (Diagram *diagram: project_ -> diagrams()) {
|
||||||
QCheckBox *check_box = diagrams_[diagram];
|
QCheckBox *check_box = diagrams_[diagram];
|
||||||
if (check_box && check_box -> isChecked()) {
|
if (check_box && check_box -> isChecked()) {
|
||||||
selected_diagrams << diagram;
|
selected_diagrams << diagram;
|
||||||
@@ -76,7 +76,7 @@ QList<Diagram *> DiagramsChooser::selectedDiagrams() const {
|
|||||||
*/
|
*/
|
||||||
QList<Diagram *> DiagramsChooser::nonSelectedDiagrams() const {
|
QList<Diagram *> DiagramsChooser::nonSelectedDiagrams() const {
|
||||||
QList<Diagram *> selected_diagrams;
|
QList<Diagram *> selected_diagrams;
|
||||||
foreach(Diagram *diagram, diagrams_.keys()) {
|
for (Diagram *diagram: diagrams_.keys()) {
|
||||||
if (!(diagrams_[diagram] -> isChecked())) {
|
if (!(diagrams_[diagram] -> isChecked())) {
|
||||||
selected_diagrams << diagram;
|
selected_diagrams << diagram;
|
||||||
}
|
}
|
||||||
@@ -107,14 +107,14 @@ void DiagramsChooser::setSelectedDiagrams(const QList<Diagram *> &diagrams_list,
|
|||||||
|
|
||||||
// deselectionne tous les schemas si demande
|
// deselectionne tous les schemas si demande
|
||||||
if (reset) {
|
if (reset) {
|
||||||
foreach(QCheckBox *check_box, diagrams_.values()) {
|
for (QCheckBox *check_box: diagrams_.values()) {
|
||||||
check_box -> setChecked(false);
|
check_box -> setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int changes = 0;
|
int changes = 0;
|
||||||
QCheckBox *check_box;
|
QCheckBox *check_box;
|
||||||
foreach(Diagram *diagram, diagrams_list) {
|
for (Diagram *diagram: diagrams_list) {
|
||||||
if ((check_box = diagrams_[diagram])) {
|
if ((check_box = diagrams_[diagram])) {
|
||||||
if (check_box -> isChecked() != select) {
|
if (check_box -> isChecked() != select) {
|
||||||
check_box -> setChecked(select);
|
check_box -> setChecked(select);
|
||||||
@@ -136,7 +136,7 @@ void DiagramsChooser::setSelectedDiagrams(const QList<Diagram *> &diagrams_list,
|
|||||||
*/
|
*/
|
||||||
void DiagramsChooser::setSelectedAllDiagrams(bool select) {
|
void DiagramsChooser::setSelectedAllDiagrams(bool select) {
|
||||||
blockSignals(true);
|
blockSignals(true);
|
||||||
foreach(QCheckBox *check_box, diagrams_.values()) {
|
for (QCheckBox *check_box: diagrams_.values()) {
|
||||||
check_box -> setChecked(select);
|
check_box -> setChecked(select);
|
||||||
}
|
}
|
||||||
blockSignals(false);
|
blockSignals(false);
|
||||||
@@ -159,7 +159,7 @@ void DiagramsChooser::updateList() {
|
|||||||
buildLayout();
|
buildLayout();
|
||||||
|
|
||||||
// recree les checkbox necessaires
|
// recree les checkbox necessaires
|
||||||
foreach(Diagram *diagram, project_ -> diagrams()) {
|
for (Diagram *diagram: project_ -> diagrams()) {
|
||||||
// titre du schema
|
// titre du schema
|
||||||
QString diagram_title = diagram -> title();
|
QString diagram_title = diagram -> title();
|
||||||
if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre");
|
if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre");
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ void DiagramView::rotateSelection() {
|
|||||||
QList<Element *> elements_to_rotate;
|
QList<Element *> elements_to_rotate;
|
||||||
QList<DiagramTextItem *> texts_to_rotate;
|
QList<DiagramTextItem *> texts_to_rotate;
|
||||||
QList<DiagramImageItem *> images_to_rotate;
|
QList<DiagramImageItem *> images_to_rotate;
|
||||||
foreach (QGraphicsItem *item, scene -> selectedItems()) {
|
for (QGraphicsItem *item: scene -> selectedItems()) {
|
||||||
if (Element *e = qgraphicsitem_cast<Element *>(item)) {
|
if (Element *e = qgraphicsitem_cast<Element *>(item)) {
|
||||||
elements_to_rotate << e;
|
elements_to_rotate << e;
|
||||||
} else if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
|
} else if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
|
||||||
@@ -176,7 +176,7 @@ void DiagramView::rotateTexts() {
|
|||||||
|
|
||||||
// recupere les champs de texte a orienter
|
// recupere les champs de texte a orienter
|
||||||
QList<DiagramTextItem *> texts_to_rotate;
|
QList<DiagramTextItem *> texts_to_rotate;
|
||||||
foreach (QGraphicsItem *item, scene -> selectedItems()) {
|
for (QGraphicsItem *item: scene -> selectedItems()) {
|
||||||
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
|
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
|
||||||
texts_to_rotate << cti;
|
texts_to_rotate << cti;
|
||||||
} else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(item)) {
|
} else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(item)) {
|
||||||
@@ -714,7 +714,7 @@ void DiagramView::keyReleaseEvent(QKeyEvent *e) {
|
|||||||
void DiagramView::scrollOnMovement(QKeyEvent *e){
|
void DiagramView::scrollOnMovement(QKeyEvent *e){
|
||||||
QList<QGraphicsItem *> selected_elmts = scene->selectedContent().items(255);
|
QList<QGraphicsItem *> selected_elmts = scene->selectedContent().items(255);
|
||||||
QRectF viewed_scene = viewedSceneRect();
|
QRectF viewed_scene = viewedSceneRect();
|
||||||
foreach (QGraphicsItem *qgi, selected_elmts){
|
for (QGraphicsItem *qgi: selected_elmts){
|
||||||
if (qgraphicsitem_cast<Conductor *>(qgi)) continue;
|
if (qgraphicsitem_cast<Conductor *>(qgi)) continue;
|
||||||
if (qgraphicsitem_cast<QetShapeItem *>(qgi)) continue;
|
if (qgraphicsitem_cast<QetShapeItem *>(qgi)) continue;
|
||||||
qreal x = qgi->pos().x();
|
qreal x = qgi->pos().x();
|
||||||
@@ -802,7 +802,7 @@ bool DiagramView::hasSelectedItems() {
|
|||||||
peuvent etre copies dans le presse-papier, false sinon
|
peuvent etre copies dans le presse-papier, false sinon
|
||||||
*/
|
*/
|
||||||
bool DiagramView::hasCopiableItems() {
|
bool DiagramView::hasCopiableItems() {
|
||||||
foreach(QGraphicsItem *qgi, scene -> selectedItems()) {
|
for (QGraphicsItem *qgi: scene -> selectedItems()) {
|
||||||
if (
|
if (
|
||||||
qgraphicsitem_cast<Element *>(qgi) ||
|
qgraphicsitem_cast<Element *>(qgi) ||
|
||||||
qgraphicsitem_cast<IndependentTextItem *>(qgi) ||
|
qgraphicsitem_cast<IndependentTextItem *>(qgi) ||
|
||||||
@@ -819,7 +819,7 @@ bool DiagramView::hasCopiableItems() {
|
|||||||
@return true if there is any Text Item selected
|
@return true if there is any Text Item selected
|
||||||
*/
|
*/
|
||||||
bool DiagramView::hasTextItems() {
|
bool DiagramView::hasTextItems() {
|
||||||
foreach(QGraphicsItem *qgi, scene -> selectedItems()) {
|
for (QGraphicsItem *qgi: scene -> selectedItems()) {
|
||||||
if (
|
if (
|
||||||
qgraphicsitem_cast<IndependentTextItem *>(qgi) ||
|
qgraphicsitem_cast<IndependentTextItem *>(qgi) ||
|
||||||
qgraphicsitem_cast<ElementTextItem *>(qgi) ||
|
qgraphicsitem_cast<ElementTextItem *>(qgi) ||
|
||||||
@@ -837,7 +837,7 @@ bool DiagramView::hasTextItems() {
|
|||||||
peuvent etre supprimes, false sinon
|
peuvent etre supprimes, false sinon
|
||||||
*/
|
*/
|
||||||
bool DiagramView::hasDeletableItems() {
|
bool DiagramView::hasDeletableItems() {
|
||||||
foreach(QGraphicsItem *qgi, scene -> selectedItems()) {
|
for (QGraphicsItem *qgi: scene -> selectedItems()) {
|
||||||
if (
|
if (
|
||||||
qgraphicsitem_cast<Element *>(qgi) ||
|
qgraphicsitem_cast<Element *>(qgi) ||
|
||||||
qgraphicsitem_cast<Conductor *>(qgi) ||
|
qgraphicsitem_cast<Conductor *>(qgi) ||
|
||||||
@@ -1068,7 +1068,7 @@ void DiagramView::resetConductors() {
|
|||||||
|
|
||||||
// repere les conducteurs modifies (= profil non nul)
|
// repere les conducteurs modifies (= profil non nul)
|
||||||
QHash<Conductor *, ConductorProfilesGroup> conductors_and_profiles;
|
QHash<Conductor *, ConductorProfilesGroup> conductors_and_profiles;
|
||||||
foreach(Conductor *conductor, selected_conductors) {
|
for (Conductor *conductor: selected_conductors) {
|
||||||
ConductorProfilesGroup profile = conductor -> profiles();
|
ConductorProfilesGroup profile = conductor -> profiles();
|
||||||
if (
|
if (
|
||||||
!profile[Qt::TopLeftCorner].isNull() ||\
|
!profile[Qt::TopLeftCorner].isNull() ||\
|
||||||
|
|||||||
@@ -89,14 +89,14 @@ DeletePartsCommand::DeletePartsCommand(
|
|||||||
ElementEditionCommand(QObject::tr("suppression", "undo caption"), scene, 0, parent),
|
ElementEditionCommand(QObject::tr("suppression", "undo caption"), scene, 0, parent),
|
||||||
deleted_parts(parts)
|
deleted_parts(parts)
|
||||||
{
|
{
|
||||||
foreach(QGraphicsItem *qgi, deleted_parts) {
|
for (QGraphicsItem *qgi: deleted_parts) {
|
||||||
editor_scene_ -> qgiManager().manage(qgi);
|
editor_scene_ -> qgiManager().manage(qgi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destructeur : detruit egalement les parties supprimees
|
/// Destructeur : detruit egalement les parties supprimees
|
||||||
DeletePartsCommand::~DeletePartsCommand() {
|
DeletePartsCommand::~DeletePartsCommand() {
|
||||||
foreach(QGraphicsItem *qgi, deleted_parts) {
|
for (QGraphicsItem *qgi: deleted_parts) {
|
||||||
editor_scene_ -> qgiManager().release(qgi);
|
editor_scene_ -> qgiManager().release(qgi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ DeletePartsCommand::~DeletePartsCommand() {
|
|||||||
/// Restaure les parties supprimees
|
/// Restaure les parties supprimees
|
||||||
void DeletePartsCommand::undo() {
|
void DeletePartsCommand::undo() {
|
||||||
editor_scene_ -> blockSignals(true);
|
editor_scene_ -> blockSignals(true);
|
||||||
foreach(QGraphicsItem *qgi, deleted_parts) {
|
for (QGraphicsItem *qgi: deleted_parts) {
|
||||||
editor_scene_ -> addItem(qgi);
|
editor_scene_ -> addItem(qgi);
|
||||||
}
|
}
|
||||||
editor_scene_ -> blockSignals(false);
|
editor_scene_ -> blockSignals(false);
|
||||||
@@ -113,7 +113,7 @@ void DeletePartsCommand::undo() {
|
|||||||
/// Supprime les parties
|
/// Supprime les parties
|
||||||
void DeletePartsCommand::redo() {
|
void DeletePartsCommand::redo() {
|
||||||
editor_scene_ -> blockSignals(true);
|
editor_scene_ -> blockSignals(true);
|
||||||
foreach(QGraphicsItem *qgi, deleted_parts) {
|
for (QGraphicsItem *qgi: deleted_parts) {
|
||||||
editor_scene_ -> removeItem(qgi);
|
editor_scene_ -> removeItem(qgi);
|
||||||
}
|
}
|
||||||
editor_scene_ -> blockSignals(false);
|
editor_scene_ -> blockSignals(false);
|
||||||
@@ -149,7 +149,7 @@ PastePartsCommand::~PastePartsCommand() {
|
|||||||
void PastePartsCommand::undo() {
|
void PastePartsCommand::undo() {
|
||||||
// enleve les parties
|
// enleve les parties
|
||||||
editor_scene_ -> blockSignals(true);
|
editor_scene_ -> blockSignals(true);
|
||||||
foreach(QGraphicsItem *part, content_) {
|
for (QGraphicsItem *part: content_) {
|
||||||
editor_scene_ -> removeItem(part);
|
editor_scene_ -> removeItem(part);
|
||||||
}
|
}
|
||||||
editor_scene_ -> blockSignals(false);
|
editor_scene_ -> blockSignals(false);
|
||||||
@@ -166,7 +166,7 @@ void PastePartsCommand::redo() {
|
|||||||
else {
|
else {
|
||||||
// pose les parties
|
// pose les parties
|
||||||
editor_scene_ -> blockSignals(true);
|
editor_scene_ -> blockSignals(true);
|
||||||
foreach(QGraphicsItem *part, content_) {
|
for (QGraphicsItem *part: content_) {
|
||||||
editor_scene_ -> addItem(part);
|
editor_scene_ -> addItem(part);
|
||||||
}
|
}
|
||||||
editor_scene_ -> blockSignals(false);
|
editor_scene_ -> blockSignals(false);
|
||||||
@@ -240,7 +240,7 @@ MovePartsCommand::~MovePartsCommand() {
|
|||||||
|
|
||||||
/// Annule le deplacement
|
/// Annule le deplacement
|
||||||
void MovePartsCommand::undo() {
|
void MovePartsCommand::undo() {
|
||||||
foreach(QGraphicsItem *qgi, moved_parts) qgi -> moveBy(-movement.x(), -movement.y());
|
for (QGraphicsItem *qgi: moved_parts) qgi -> moveBy(-movement.x(), -movement.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Refait le deplacement
|
/// Refait le deplacement
|
||||||
@@ -250,7 +250,7 @@ void MovePartsCommand::redo() {
|
|||||||
first_redo = false;
|
first_redo = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
foreach(QGraphicsItem *qgi, moved_parts) qgi -> moveBy(movement.x(), movement.y());
|
for (QGraphicsItem *qgi: moved_parts) qgi -> moveBy(movement.x(), movement.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** AddPartCommand ***/
|
/*** AddPartCommand ***/
|
||||||
@@ -353,7 +353,7 @@ ChangeZValueCommand::ChangeZValueCommand(
|
|||||||
QList<QGraphicsItem *> items_list = editor_scene_ -> zItems(ElementScene::SortByZValue | ElementScene::SelectedOrNot);
|
QList<QGraphicsItem *> items_list = editor_scene_ -> zItems(ElementScene::SortByZValue | ElementScene::SelectedOrNot);
|
||||||
|
|
||||||
// prend un snapshot des zValues
|
// prend un snapshot des zValues
|
||||||
foreach(QGraphicsItem *qgi, items_list) undo_hash.insert(qgi, qgi -> zValue());
|
for (QGraphicsItem *qgi: items_list) undo_hash.insert(qgi, qgi -> zValue());
|
||||||
|
|
||||||
// choisit le nom en fonction du traitement
|
// choisit le nom en fonction du traitement
|
||||||
if (option == BringForward) {
|
if (option == BringForward) {
|
||||||
@@ -377,12 +377,12 @@ ChangeZValueCommand::~ChangeZValueCommand() {
|
|||||||
|
|
||||||
/// Annule les changements de zValue
|
/// Annule les changements de zValue
|
||||||
void ChangeZValueCommand::undo() {
|
void ChangeZValueCommand::undo() {
|
||||||
foreach(QGraphicsItem *qgi, undo_hash.keys()) qgi -> setZValue(undo_hash[qgi]);
|
for (QGraphicsItem *qgi: undo_hash.keys()) qgi -> setZValue(undo_hash[qgi]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Refait les changements de zValue
|
/// Refait les changements de zValue
|
||||||
void ChangeZValueCommand::redo() {
|
void ChangeZValueCommand::redo() {
|
||||||
foreach(QGraphicsItem *qgi, redo_hash.keys()) qgi -> setZValue(redo_hash[qgi]);
|
for (QGraphicsItem *qgi: redo_hash.keys()) qgi -> setZValue(redo_hash[qgi]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -392,15 +392,15 @@ void ChangeZValueCommand::redo() {
|
|||||||
void ChangeZValueCommand::applyBringForward(const QList<QGraphicsItem *> &items_list) {
|
void ChangeZValueCommand::applyBringForward(const QList<QGraphicsItem *> &items_list) {
|
||||||
QList<QGraphicsItem *> non_selected_items = items_list;
|
QList<QGraphicsItem *> non_selected_items = items_list;
|
||||||
QList<QGraphicsItem *> selected_items;
|
QList<QGraphicsItem *> selected_items;
|
||||||
foreach(QGraphicsItem *qgi, non_selected_items) {
|
for (QGraphicsItem *qgi: non_selected_items) {
|
||||||
if (qgi -> isSelected()) {
|
if (qgi -> isSelected()) {
|
||||||
selected_items << qgi;
|
selected_items << qgi;
|
||||||
non_selected_items.removeAt(non_selected_items.indexOf(qgi));
|
non_selected_items.removeAt(non_selected_items.indexOf(qgi));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int z = 1;
|
int z = 1;
|
||||||
foreach(QGraphicsItem *qgi, non_selected_items) redo_hash.insert(qgi, z ++);
|
for (QGraphicsItem *qgi: non_selected_items) redo_hash.insert(qgi, z ++);
|
||||||
foreach(QGraphicsItem *qgi, selected_items) redo_hash.insert(qgi, z ++);
|
for (QGraphicsItem *qgi: selected_items) redo_hash.insert(qgi, z ++);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -418,7 +418,7 @@ void ChangeZValueCommand::applyRaise(const QList<QGraphicsItem *> &items_list) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
int z = 1;
|
int z = 1;
|
||||||
foreach(QGraphicsItem *qgi, my_items_list) redo_hash.insert(qgi, z ++);
|
for (QGraphicsItem *qgi: my_items_list) redo_hash.insert(qgi, z ++);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -437,7 +437,7 @@ void ChangeZValueCommand::applyLower(const QList<QGraphicsItem *> &items_list) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int z = 1;
|
int z = 1;
|
||||||
foreach(QGraphicsItem *qgi, my_items_list) redo_hash.insert(qgi, z ++);
|
for (QGraphicsItem *qgi: my_items_list) redo_hash.insert(qgi, z ++);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -447,15 +447,15 @@ void ChangeZValueCommand::applyLower(const QList<QGraphicsItem *> &items_list) {
|
|||||||
void ChangeZValueCommand::applySendBackward(const QList<QGraphicsItem *> &items_list) {
|
void ChangeZValueCommand::applySendBackward(const QList<QGraphicsItem *> &items_list) {
|
||||||
QList<QGraphicsItem *> non_selected_items = items_list;
|
QList<QGraphicsItem *> non_selected_items = items_list;
|
||||||
QList<QGraphicsItem *> selected_items;
|
QList<QGraphicsItem *> selected_items;
|
||||||
foreach(QGraphicsItem *qgi, non_selected_items) {
|
for (QGraphicsItem *qgi: non_selected_items) {
|
||||||
if (qgi -> isSelected()) {
|
if (qgi -> isSelected()) {
|
||||||
selected_items << qgi;
|
selected_items << qgi;
|
||||||
non_selected_items.removeAt(non_selected_items.indexOf(qgi));
|
non_selected_items.removeAt(non_selected_items.indexOf(qgi));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int z = 1;
|
int z = 1;
|
||||||
foreach(QGraphicsItem *qgi, selected_items) redo_hash.insert(qgi, z ++);
|
for (QGraphicsItem *qgi: selected_items) redo_hash.insert(qgi, z ++);
|
||||||
foreach(QGraphicsItem *qgi, non_selected_items) redo_hash.insert(qgi, z ++);
|
for (QGraphicsItem *qgi: non_selected_items) redo_hash.insert(qgi, z ++);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -569,7 +569,7 @@ void ScalePartsCommand::scale(const QRectF &before, const QRectF &after) {
|
|||||||
if (before == after) return;
|
if (before == after) return;
|
||||||
if (!before.width() || !before.height()) return; // cowardly flee division by zero FIXME?
|
if (!before.width() || !before.height()) return; // cowardly flee division by zero FIXME?
|
||||||
|
|
||||||
foreach (CustomElementPart *part_item, scaled_primitives_) {
|
for (CustomElementPart *part_item: scaled_primitives_) {
|
||||||
part_item -> startUserTransformation(before);
|
part_item -> startUserTransformation(before);
|
||||||
part_item -> handleUserTransformation(before, after);
|
part_item -> handleUserTransformation(before, after);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ QRectF ElementPrimitiveDecorator::internalBoundingRect() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QRectF rect = decorated_items_.first() -> sceneGeometricRect();
|
QRectF rect = decorated_items_.first() -> sceneGeometricRect();
|
||||||
foreach (CustomElementPart *item, decorated_items_) {
|
for (CustomElementPart *item: decorated_items_) {
|
||||||
rect = rect.united(item -> sceneGeometricRect());
|
rect = rect.united(item -> sceneGeometricRect());
|
||||||
}
|
}
|
||||||
return(rect);
|
return(rect);
|
||||||
@@ -146,7 +146,7 @@ void ElementPrimitiveDecorator::setItems(const QList<CustomElementPart *> &items
|
|||||||
*/
|
*/
|
||||||
void ElementPrimitiveDecorator::setItems(const QList<QGraphicsItem *> &items) {
|
void ElementPrimitiveDecorator::setItems(const QList<QGraphicsItem *> &items) {
|
||||||
QList<CustomElementPart *> primitives;
|
QList<CustomElementPart *> primitives;
|
||||||
foreach (QGraphicsItem *item, items) {
|
for (QGraphicsItem *item: items) {
|
||||||
if (CustomElementPart *part_item = dynamic_cast<CustomElementPart *>(item)) {
|
if (CustomElementPart *part_item = dynamic_cast<CustomElementPart *>(item)) {
|
||||||
primitives << part_item;
|
primitives << part_item;
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ QList<CustomElementPart *> ElementPrimitiveDecorator::items() const {
|
|||||||
*/
|
*/
|
||||||
QList<QGraphicsItem *> ElementPrimitiveDecorator::graphicsItems() const {
|
QList<QGraphicsItem *> ElementPrimitiveDecorator::graphicsItems() const {
|
||||||
QList<QGraphicsItem *> list;
|
QList<QGraphicsItem *> list;
|
||||||
foreach (CustomElementPart *part_item, decorated_items_) {
|
for (CustomElementPart *part_item: decorated_items_) {
|
||||||
if (QGraphicsItem *item = dynamic_cast<QGraphicsItem *>(part_item)) {
|
if (QGraphicsItem *item = dynamic_cast<QGraphicsItem *>(part_item)) {
|
||||||
list << item;
|
list << item;
|
||||||
}
|
}
|
||||||
@@ -410,7 +410,7 @@ void ElementPrimitiveDecorator::keyPressEvent(QKeyEvent *e) {
|
|||||||
} else {
|
} else {
|
||||||
keys_movement_ += movement;
|
keys_movement_ += movement;
|
||||||
}
|
}
|
||||||
foreach(QGraphicsItem *qgi, graphicsItems()) {
|
for (QGraphicsItem *qgi: graphicsItems()) {
|
||||||
qgi -> setPos(qgi -> pos() + movement);
|
qgi -> setPos(qgi -> pos() + movement);
|
||||||
adjust();
|
adjust();
|
||||||
}
|
}
|
||||||
@@ -469,7 +469,7 @@ void ElementPrimitiveDecorator::adjustEffectiveBoundingRect() {
|
|||||||
void ElementPrimitiveDecorator::startMovement() {
|
void ElementPrimitiveDecorator::startMovement() {
|
||||||
adjust();
|
adjust();
|
||||||
|
|
||||||
foreach(CustomElementPart *item, decorated_items_) {
|
for (CustomElementPart *item: decorated_items_) {
|
||||||
item -> startUserTransformation(mapToScene(original_bounding_rect_).boundingRect());
|
item -> startUserTransformation(mapToScene(original_bounding_rect_).boundingRect());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -533,7 +533,7 @@ CustomElementPart *ElementPrimitiveDecorator::singleItem() const {
|
|||||||
void ElementPrimitiveDecorator::translateItems(const QPointF &movement) {
|
void ElementPrimitiveDecorator::translateItems(const QPointF &movement) {
|
||||||
if (!decorated_items_.count()) return;
|
if (!decorated_items_.count()) return;
|
||||||
|
|
||||||
foreach(QGraphicsItem *qgi, graphicsItems()) {
|
for (QGraphicsItem *qgi: graphicsItems()) {
|
||||||
// this is a naive, proof-of-concept implementation; we actually need to take
|
// this is a naive, proof-of-concept implementation; we actually need to take
|
||||||
// the grid into account and create a command object in mouseReleaseEvent()
|
// the grid into account and create a command object in mouseReleaseEvent()
|
||||||
qgi -> moveBy(movement.x(), movement.y());
|
qgi -> moveBy(movement.x(), movement.y());
|
||||||
@@ -553,7 +553,7 @@ void ElementPrimitiveDecorator::scaleItems(const QRectF &original_rect, const QR
|
|||||||
QRectF scene_original_rect = mapToScene(original_rect).boundingRect();
|
QRectF scene_original_rect = mapToScene(original_rect).boundingRect();
|
||||||
QRectF scene_new_rect = mapToScene(new_rect).boundingRect();
|
QRectF scene_new_rect = mapToScene(new_rect).boundingRect();
|
||||||
|
|
||||||
foreach(CustomElementPart *item, decorated_items_) {
|
for (CustomElementPart *item: decorated_items_) {
|
||||||
item -> handleUserTransformation(scene_original_rect, scene_new_rect);
|
item -> handleUserTransformation(scene_original_rect, scene_new_rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ const QDomDocument ElementScene::toXml(bool all_parts)
|
|||||||
QDomElement description = xml_document.createElement("description");
|
QDomElement description = xml_document.createElement("description");
|
||||||
|
|
||||||
//the graphic description of the element
|
//the graphic description of the element
|
||||||
foreach(QGraphicsItem *qgi, zItems())
|
for (QGraphicsItem *qgi: zItems())
|
||||||
{
|
{
|
||||||
//If the export concerns only the selection, the not selected part is ignored
|
//If the export concerns only the selection, the not selected part is ignored
|
||||||
if (!all_parts && !qgi -> isSelected()) continue;
|
if (!all_parts && !qgi -> isSelected()) continue;
|
||||||
@@ -416,7 +416,7 @@ void ElementScene::fromXml(
|
|||||||
*/
|
*/
|
||||||
QRectF ElementScene::elementSceneGeometricRect() const{
|
QRectF ElementScene::elementSceneGeometricRect() const{
|
||||||
QRectF esgr;
|
QRectF esgr;
|
||||||
foreach (QGraphicsItem *qgi, items()) {
|
for (QGraphicsItem *qgi: items()) {
|
||||||
if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
|
if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
|
||||||
if (qgi -> type() == QGraphicsRectItem::Type) continue;
|
if (qgi -> type() == QGraphicsRectItem::Type) continue;
|
||||||
if (qgi -> type() == PartTextField::Type) continue;
|
if (qgi -> type() == PartTextField::Type) continue;
|
||||||
@@ -432,7 +432,7 @@ QRectF ElementScene::elementSceneGeometricRect() const{
|
|||||||
aucune.
|
aucune.
|
||||||
*/
|
*/
|
||||||
bool ElementScene::containsTerminals() const {
|
bool ElementScene::containsTerminals() const {
|
||||||
foreach(QGraphicsItem *qgi,items()) {
|
for (QGraphicsItem *qgi:items()) {
|
||||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@@ -515,7 +515,7 @@ QETElementEditor* ElementScene::editor() const {
|
|||||||
void ElementScene::slot_select(const ElementContent &content) {
|
void ElementScene::slot_select(const ElementContent &content) {
|
||||||
blockSignals(true);
|
blockSignals(true);
|
||||||
clearSelection();
|
clearSelection();
|
||||||
foreach(QGraphicsItem *qgi, content) qgi -> setSelected(true);
|
for (QGraphicsItem *qgi: content) qgi -> setSelected(true);
|
||||||
blockSignals(false);
|
blockSignals(false);
|
||||||
emit(selectionChanged());
|
emit(selectionChanged());
|
||||||
}
|
}
|
||||||
@@ -539,7 +539,7 @@ void ElementScene::slot_deselectAll() {
|
|||||||
*/
|
*/
|
||||||
void ElementScene::slot_invertSelection() {
|
void ElementScene::slot_invertSelection() {
|
||||||
blockSignals(true);
|
blockSignals(true);
|
||||||
foreach(QGraphicsItem *qgi, items()) qgi -> setSelected(!qgi -> isSelected());
|
for (QGraphicsItem *qgi: items()) qgi -> setSelected(!qgi -> isSelected());
|
||||||
blockSignals(false);
|
blockSignals(false);
|
||||||
emit(selectionChanged());
|
emit(selectionChanged());
|
||||||
}
|
}
|
||||||
@@ -698,7 +698,7 @@ void ElementScene::slot_sendBackward() {
|
|||||||
*/
|
*/
|
||||||
QList<CustomElementPart *> ElementScene::primitives() const {
|
QList<CustomElementPart *> ElementScene::primitives() const {
|
||||||
QList<CustomElementPart *> primitives_list;
|
QList<CustomElementPart *> primitives_list;
|
||||||
foreach (QGraphicsItem *item, items()) {
|
for (QGraphicsItem *item: items()) {
|
||||||
if (CustomElementPart *primitive = dynamic_cast<CustomElementPart *>(item)) {
|
if (CustomElementPart *primitive = dynamic_cast<CustomElementPart *>(item)) {
|
||||||
primitives_list << primitive;
|
primitives_list << primitive;
|
||||||
}
|
}
|
||||||
@@ -768,7 +768,7 @@ QList<QGraphicsItem *> ElementScene::zItems(ItemOptions options) const {
|
|||||||
*/
|
*/
|
||||||
ElementContent ElementScene::selectedContent() const {
|
ElementContent ElementScene::selectedContent() const {
|
||||||
ElementContent content;
|
ElementContent content;
|
||||||
foreach(QGraphicsItem *qgi, zItems()) {
|
for (QGraphicsItem *qgi: zItems()) {
|
||||||
if (qgi -> isSelected()) content << qgi;
|
if (qgi -> isSelected()) content << qgi;
|
||||||
}
|
}
|
||||||
return(content);
|
return(content);
|
||||||
@@ -796,7 +796,7 @@ void ElementScene::reset()
|
|||||||
clearSelection();
|
clearSelection();
|
||||||
undoStack().clear();
|
undoStack().clear();
|
||||||
|
|
||||||
foreach (QGraphicsItem *qgi, items())
|
for (QGraphicsItem *qgi: items())
|
||||||
{
|
{
|
||||||
removeItem(qgi);
|
removeItem(qgi);
|
||||||
qgiManager().release(qgi);
|
qgiManager().release(qgi);
|
||||||
@@ -813,7 +813,7 @@ void ElementScene::reset()
|
|||||||
*/
|
*/
|
||||||
QRectF ElementScene::elementContentBoundingRect(const ElementContent &content) const {
|
QRectF ElementScene::elementContentBoundingRect(const ElementContent &content) const {
|
||||||
QRectF bounding_rect;
|
QRectF bounding_rect;
|
||||||
foreach(QGraphicsItem *qgi, content) {
|
for (QGraphicsItem *qgi: content) {
|
||||||
// skip non-primitives QGraphicsItems (paste area, selection decorator)
|
// skip non-primitives QGraphicsItems (paste area, selection decorator)
|
||||||
if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
|
if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
|
||||||
if (qgi -> type() == QGraphicsRectItem::Type) continue;
|
if (qgi -> type() == QGraphicsRectItem::Type) continue;
|
||||||
@@ -924,7 +924,7 @@ ElementContent ElementScene::loadContent(const QDomDocument &xml_document, QStri
|
|||||||
*/
|
*/
|
||||||
ElementContent ElementScene::addContent(const ElementContent &content, QString *error_message) {
|
ElementContent ElementScene::addContent(const ElementContent &content, QString *error_message) {
|
||||||
Q_UNUSED(error_message);
|
Q_UNUSED(error_message);
|
||||||
foreach(QGraphicsItem *part, content) {
|
for (QGraphicsItem *part: content) {
|
||||||
addPrimitive(part);
|
addPrimitive(part);
|
||||||
}
|
}
|
||||||
return(content);
|
return(content);
|
||||||
@@ -947,7 +947,7 @@ ElementContent ElementScene::addContentAtPos(const ElementContent &content, cons
|
|||||||
QPointF offset = pos - bounding_rect.topLeft();
|
QPointF offset = pos - bounding_rect.topLeft();
|
||||||
|
|
||||||
// ajoute les parties avec le decalage adequat
|
// ajoute les parties avec le decalage adequat
|
||||||
foreach(QGraphicsItem *part, content) {
|
for (QGraphicsItem *part: content) {
|
||||||
part -> setPos(part -> pos() + offset);
|
part -> setPos(part -> pos() + offset);
|
||||||
addPrimitive(part);
|
addPrimitive(part);
|
||||||
}
|
}
|
||||||
@@ -1018,7 +1018,7 @@ void ElementScene::centerElementToOrigine() {
|
|||||||
if (center_y < 0) move_y -= 10;
|
if (center_y < 0) move_y -= 10;
|
||||||
|
|
||||||
//move each primitive by @move
|
//move each primitive by @move
|
||||||
foreach (QGraphicsItem *qgi, items()) {
|
for (QGraphicsItem *qgi: items()) {
|
||||||
if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
|
if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
|
||||||
if (qgi -> type() == QGraphicsRectItem::Type) continue;
|
if (qgi -> type() == QGraphicsRectItem::Type) continue;
|
||||||
//deselect item for disable decorator
|
//deselect item for disable decorator
|
||||||
@@ -1075,7 +1075,7 @@ void ElementScene::stackAction(ElementEditionCommand *command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!command -> elementView()) {
|
if (!command -> elementView()) {
|
||||||
foreach (QGraphicsView *view, views()) {
|
for (QGraphicsView *view: views()) {
|
||||||
if (ElementView *element_view = dynamic_cast<ElementView *>(view)) {
|
if (ElementView *element_view = dynamic_cast<ElementView *>(view)) {
|
||||||
command -> setElementView(element_view);
|
command -> setElementView(element_view);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
|
|||||||
|
|
||||||
//Check each pair of style
|
//Check each pair of style
|
||||||
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
|
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
|
||||||
foreach (QString style, styles)
|
for (QString style: styles)
|
||||||
{
|
{
|
||||||
if (!rx.exactMatch(style)) continue;
|
if (!rx.exactMatch(style)) continue;
|
||||||
QString style_name = rx.cap(1);
|
QString style_name = rx.cap(1);
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ QList<QPointF> CustomElementPart::mapPoints(const QRectF &initial_selection_rect
|
|||||||
qreal new_top_left_x = new_selection_rect.x();
|
qreal new_top_left_x = new_selection_rect.x();
|
||||||
qreal new_top_left_y = new_selection_rect.y();
|
qreal new_top_left_y = new_selection_rect.y();
|
||||||
|
|
||||||
foreach (QPointF point, points) {
|
for (QPointF point: points) {
|
||||||
QPointF point_offset = point - initial_top_left;
|
QPointF point_offset = point - initial_top_left;
|
||||||
new_points << QPointF(
|
new_points << QPointF(
|
||||||
new_top_left_x + (point_offset.rx() * sx),
|
new_top_left_x + (point_offset.rx() * sx),
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ QRectF PartArc::boundingRect() const
|
|||||||
{
|
{
|
||||||
QRectF r = AbstractPartEllipse::boundingRect();
|
QRectF r = AbstractPartEllipse::boundingRect();
|
||||||
|
|
||||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||||
r |= rect;
|
r |= rect;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
@@ -154,7 +154,7 @@ QPainterPath PartArc::shape() const
|
|||||||
shape = pps.createStroke(shape);
|
shape = pps.createStroke(shape);
|
||||||
|
|
||||||
if (isSelected())
|
if (isSelected())
|
||||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||||
shape.addRect(rect);
|
shape.addRect(rect);
|
||||||
|
|
||||||
return shape;
|
return shape;
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ QRectF PartEllipse::boundingRect() const
|
|||||||
{
|
{
|
||||||
QRectF r = AbstractPartEllipse::boundingRect();
|
QRectF r = AbstractPartEllipse::boundingRect();
|
||||||
|
|
||||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||||
r |= rect;
|
r |= rect;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
@@ -149,7 +149,7 @@ QPainterPath PartEllipse::shape() const
|
|||||||
shape = pps.createStroke(shape);
|
shape = pps.createStroke(shape);
|
||||||
|
|
||||||
if (isSelected())
|
if (isSelected())
|
||||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||||
shape.addRect(rect);
|
shape.addRect(rect);
|
||||||
|
|
||||||
return shape;
|
return shape;
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ QPainterPath PartLine::shape() const
|
|||||||
shape = pps.createStroke(shape);
|
shape = pps.createStroke(shape);
|
||||||
|
|
||||||
if (isSelected())
|
if (isSelected())
|
||||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForLine(m_line)))
|
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForLine(m_line)))
|
||||||
shape.addRect(rect);
|
shape.addRect(rect);
|
||||||
|
|
||||||
return shape;
|
return shape;
|
||||||
@@ -373,10 +373,10 @@ void PartLine::debugPaint(QPainter *painter)
|
|||||||
|
|
||||||
painter -> setPen(Qt::red);
|
painter -> setPen(Qt::red);
|
||||||
|
|
||||||
foreach(QPointF pointy, fourEndPoints(m_line.p1(), m_line.p2(), first_length))
|
for (QPointF pointy: fourEndPoints(m_line.p1(), m_line.p2(), first_length))
|
||||||
painter -> drawEllipse(pointy, 0.1, 0.1);
|
painter -> drawEllipse(pointy, 0.1, 0.1);
|
||||||
|
|
||||||
foreach(QPointF pointy, fourEndPoints(m_line.p2(), m_line.p1(), second_length))
|
for (QPointF pointy: fourEndPoints(m_line.p2(), m_line.p1(), second_length))
|
||||||
painter -> drawEllipse(pointy, 0.1, 0.1);
|
painter -> drawEllipse(pointy, 0.1, 0.1);
|
||||||
|
|
||||||
painter -> restore();
|
painter -> restore();
|
||||||
@@ -402,7 +402,7 @@ QRectF PartLine::boundingRect() const
|
|||||||
bound = bound.normalized();
|
bound = bound.normalized();
|
||||||
bound.adjust(-adjust, -adjust, adjust, adjust);
|
bound.adjust(-adjust, -adjust, adjust, adjust);
|
||||||
|
|
||||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForLine(m_line)))
|
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForLine(m_line)))
|
||||||
bound |= rect;
|
bound |= rect;
|
||||||
|
|
||||||
return bound;
|
return bound;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ const QDomElement PartPolygon::toXml(QDomDocument &xml_document) const
|
|||||||
{
|
{
|
||||||
QDomElement xml_element = xml_document.createElement("polygon");
|
QDomElement xml_element = xml_document.createElement("polygon");
|
||||||
int i = 1;
|
int i = 1;
|
||||||
foreach(QPointF point, m_polygon) {
|
for (QPointF point: m_polygon) {
|
||||||
point = mapToScene(point);
|
point = mapToScene(point);
|
||||||
xml_element.setAttribute(QString("x%1").arg(i), QString("%1").arg(point.x()));
|
xml_element.setAttribute(QString("x%1").arg(i), QString("%1").arg(point.x()));
|
||||||
xml_element.setAttribute(QString("y%1").arg(i), QString("%1").arg(point.y()));
|
xml_element.setAttribute(QString("y%1").arg(i), QString("%1").arg(point.y()));
|
||||||
@@ -344,7 +344,7 @@ QPainterPath PartPolygon::shape() const
|
|||||||
shape = pps.createStroke(shape);
|
shape = pps.createStroke(shape);
|
||||||
|
|
||||||
if (isSelected())
|
if (isSelected())
|
||||||
foreach(QRectF rect, m_handler.handlerRect(m_polygon))
|
for (QRectF rect: m_handler.handlerRect(m_polygon))
|
||||||
shape.addRect(rect);
|
shape.addRect(rect);
|
||||||
|
|
||||||
return shape;
|
return shape;
|
||||||
@@ -379,7 +379,7 @@ QRectF PartPolygon::boundingRect() const
|
|||||||
|
|
||||||
r.adjust(-adjust, -adjust, adjust, adjust);
|
r.adjust(-adjust, -adjust, adjust, adjust);
|
||||||
|
|
||||||
foreach(QRectF rect, m_handler.handlerRect(m_polygon))
|
for (QRectF rect: m_handler.handlerRect(m_polygon))
|
||||||
r |=rect;
|
r |=rect;
|
||||||
|
|
||||||
return(r);
|
return(r);
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ QPainterPath PartRectangle::shape() const
|
|||||||
shape = pps.createStroke(shape);
|
shape = pps.createStroke(shape);
|
||||||
|
|
||||||
if (isSelected())
|
if (isSelected())
|
||||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||||
shape.addRect(rect);
|
shape.addRect(rect);
|
||||||
|
|
||||||
return shape;
|
return shape;
|
||||||
@@ -196,7 +196,7 @@ QRectF PartRectangle::boundingRect() const
|
|||||||
QRectF r = m_rect.normalized();
|
QRectF r = m_rect.normalized();
|
||||||
r.adjust(-adjust, -adjust, adjust, adjust);
|
r.adjust(-adjust, -adjust, adjust, adjust);
|
||||||
|
|
||||||
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
|
||||||
r |= rect;
|
r |= rect;
|
||||||
|
|
||||||
return(r);
|
return(r);
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ void PolygonEditor::updateForm() {
|
|||||||
if (!part) return;
|
if (!part) return;
|
||||||
activeConnections(false);
|
activeConnections(false);
|
||||||
while(points_list.takeTopLevelItem(0)) {}
|
while(points_list.takeTopLevelItem(0)) {}
|
||||||
foreach(QPointF point, part -> polygon()) {
|
for (QPointF point: part -> polygon()) {
|
||||||
point = part -> mapToScene(point);
|
point = part -> mapToScene(point);
|
||||||
QStringList qsl;
|
QStringList qsl;
|
||||||
qsl << QString("%1").arg(point.x()) << QString("%1").arg(point.y());
|
qsl << QString("%1").arg(point.x()) << QString("%1").arg(point.y());
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ void QETElementEditor::setupActions() {
|
|||||||
QAction *add_terminal = new QAction(QET::Icons::Terminal, tr("Ajouter une borne"), parts);
|
QAction *add_terminal = new QAction(QET::Icons::Terminal, tr("Ajouter une borne"), parts);
|
||||||
QAction *add_textfield = new QAction(QET::Icons::PartTextField, tr("Ajouter un champ de texte"), parts);
|
QAction *add_textfield = new QAction(QET::Icons::PartTextField, tr("Ajouter un champ de texte"), parts);
|
||||||
|
|
||||||
foreach (QAction *action, parts -> actions()) action -> setCheckable(true);
|
for (QAction *action: parts -> actions()) action -> setCheckable(true);
|
||||||
|
|
||||||
connect(add_line, SIGNAL(triggered()), this, SLOT(addLine() ));
|
connect(add_line, SIGNAL(triggered()), this, SLOT(addLine() ));
|
||||||
connect(add_rectangle, SIGNAL(triggered()), this, SLOT(addRect() ));
|
connect(add_rectangle, SIGNAL(triggered()), this, SLOT(addRect() ));
|
||||||
@@ -433,7 +433,7 @@ void QETElementEditor::slot_updateMenus() {
|
|||||||
bool clipboard_elmt = !read_only && ElementScene::clipboardMayContainElement();
|
bool clipboard_elmt = !read_only && ElementScene::clipboardMayContainElement();
|
||||||
|
|
||||||
// actions dependant seulement de l'etat "lecture seule" de l'editeur
|
// actions dependant seulement de l'etat "lecture seule" de l'editeur
|
||||||
foreach (QAction *action, parts -> actions()) {
|
for (QAction *action: parts -> actions()) {
|
||||||
action -> setEnabled(!read_only);
|
action -> setEnabled(!read_only);
|
||||||
}
|
}
|
||||||
selectall -> setEnabled(!read_only);
|
selectall -> setEnabled(!read_only);
|
||||||
@@ -447,7 +447,7 @@ void QETElementEditor::slot_updateMenus() {
|
|||||||
cut -> setEnabled(selected_items);
|
cut -> setEnabled(selected_items);
|
||||||
copy -> setEnabled(selected_items);
|
copy -> setEnabled(selected_items);
|
||||||
edit_delete -> setEnabled(selected_items);
|
edit_delete -> setEnabled(selected_items);
|
||||||
foreach (QAction *action, m_depth_ag -> actions())
|
for (QAction *action: m_depth_ag -> actions())
|
||||||
action->setEnabled(selected_items);
|
action->setEnabled(selected_items);
|
||||||
|
|
||||||
// actions dependant du contenu du presse-papiers
|
// actions dependant du contenu du presse-papiers
|
||||||
@@ -579,7 +579,7 @@ void QETElementEditor::slot_updateInformations() {
|
|||||||
if (selected_qgis.size() >= 2)
|
if (selected_qgis.size() >= 2)
|
||||||
{
|
{
|
||||||
style_editable = true;
|
style_editable = true;
|
||||||
foreach (QGraphicsItem *qgi, selected_qgis)
|
for (QGraphicsItem *qgi: selected_qgis)
|
||||||
{
|
{
|
||||||
if (CustomElementPart *cep = dynamic_cast<CustomElementPart *>(qgi))
|
if (CustomElementPart *cep = dynamic_cast<CustomElementPart *>(qgi))
|
||||||
cep_list << cep;
|
cep_list << cep;
|
||||||
@@ -689,7 +689,7 @@ bool QETElementEditor::checkElement()
|
|||||||
|
|
||||||
{
|
{
|
||||||
bool wrng = true;
|
bool wrng = true;
|
||||||
foreach (CustomElementPart *cep, ce_scene->primitives())
|
for (CustomElementPart *cep: ce_scene->primitives())
|
||||||
if (cep->property("tagg").toString() == "label") wrng = false;
|
if (cep->property("tagg").toString() == "label") wrng = false;
|
||||||
|
|
||||||
///Error #1: element is master, slave or simple but havent got input tagged 'label'
|
///Error #1: element is master, slave or simple but havent got input tagged 'label'
|
||||||
@@ -708,7 +708,7 @@ bool QETElementEditor::checkElement()
|
|||||||
{
|
{
|
||||||
int text =0, terminal =0;
|
int text =0, terminal =0;
|
||||||
|
|
||||||
foreach(QGraphicsItem *qgi, ce_scene->items())
|
for (QGraphicsItem *qgi: ce_scene->items())
|
||||||
{
|
{
|
||||||
if (qgraphicsitem_cast<PartTerminal *>(qgi)) terminal ++;
|
if (qgraphicsitem_cast<PartTerminal *>(qgi)) terminal ++;
|
||||||
else if (qgraphicsitem_cast<PartTextField *>(qgi)) text ++;
|
else if (qgraphicsitem_cast<PartTextField *>(qgi)) text ++;
|
||||||
@@ -744,7 +744,7 @@ bool QETElementEditor::checkElement()
|
|||||||
|
|
||||||
dialog_message += "<ol>";
|
dialog_message += "<ol>";
|
||||||
QList<QETWarning> total = warnings << errors;
|
QList<QETWarning> total = warnings << errors;
|
||||||
foreach(QETWarning warning, total) {
|
for (QETWarning warning: total) {
|
||||||
dialog_message += "<li>";
|
dialog_message += "<li>";
|
||||||
dialog_message += QString(
|
dialog_message += QString(
|
||||||
tr("<b>%1</b> : %2", "warning title: warning description")
|
tr("<b>%1</b> : %2", "warning title: warning description")
|
||||||
@@ -990,7 +990,7 @@ void QETElementEditor::addTerminal() {
|
|||||||
* Uncheck all action related to primitive
|
* Uncheck all action related to primitive
|
||||||
*/
|
*/
|
||||||
void QETElementEditor::UncheckAddPrimitive() {
|
void QETElementEditor::UncheckAddPrimitive() {
|
||||||
foreach(QAction *action, parts->actions()) action -> setChecked(false);
|
for (QAction *action: parts->actions()) action -> setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ void StyleEditor::updateForm()
|
|||||||
size_weight -> setCurrentIndex(first_part -> lineWeight());
|
size_weight -> setCurrentIndex(first_part -> lineWeight());
|
||||||
filling_color -> setCurrentIndex(first_part -> filling());
|
filling_color -> setCurrentIndex(first_part -> filling());
|
||||||
|
|
||||||
foreach (CustomElementGraphicPart *cegp, m_part_list)
|
for (CustomElementGraphicPart *cegp: m_part_list)
|
||||||
{
|
{
|
||||||
if (first_part -> antialiased() != cegp -> antialiased()) antialiasing -> setChecked(false);
|
if (first_part -> antialiased() != cegp -> antialiased()) antialiasing -> setChecked(false);
|
||||||
if (first_part -> color() != cegp -> color()) outline_color -> setCurrentIndex(-1);
|
if (first_part -> color() != cegp -> color()) outline_color -> setCurrentIndex(-1);
|
||||||
@@ -236,7 +236,7 @@ bool StyleEditor::setParts(QList<CustomElementPart *> part_list)
|
|||||||
|
|
||||||
if (!isStyleEditable(part_list)) return false;
|
if (!isStyleEditable(part_list)) return false;
|
||||||
|
|
||||||
foreach (CustomElementPart *cep, part_list)
|
for (CustomElementPart *cep: part_list)
|
||||||
{
|
{
|
||||||
if (CustomElementGraphicPart *cegp = dynamic_cast<CustomElementGraphicPart *>(cep))
|
if (CustomElementGraphicPart *cegp = dynamic_cast<CustomElementGraphicPart *>(cep))
|
||||||
m_part_list << cegp;
|
m_part_list << cegp;
|
||||||
@@ -244,7 +244,7 @@ bool StyleEditor::setParts(QList<CustomElementPart *> part_list)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (CustomElementGraphicPart *cegp, m_part_list)
|
for (CustomElementGraphicPart *cegp: m_part_list)
|
||||||
m_cep_list << cegp;
|
m_cep_list << cegp;
|
||||||
|
|
||||||
updateForm();
|
updateForm();
|
||||||
@@ -268,7 +268,7 @@ bool StyleEditor::isStyleEditable(QList<CustomElementPart *> cep_list)
|
|||||||
QStringList str;
|
QStringList str;
|
||||||
str << "arc" << "ellipse" << "line" << "polygon" << "rect";
|
str << "arc" << "ellipse" << "line" << "polygon" << "rect";
|
||||||
|
|
||||||
foreach (CustomElementPart *cep, cep_list)
|
for (CustomElementPart *cep: cep_list)
|
||||||
if (!str.contains(cep -> xmlName()))
|
if (!str.contains(cep -> xmlName()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ void StyleEditor::makeUndo(const QString &undo_text, const char *property_name,
|
|||||||
}
|
}
|
||||||
else if (!m_part_list.isEmpty())
|
else if (!m_part_list.isEmpty())
|
||||||
{
|
{
|
||||||
foreach (CustomElementGraphicPart *cegp, m_part_list)
|
for (CustomElementGraphicPart *cegp: m_part_list)
|
||||||
{
|
{
|
||||||
if (!undo)
|
if (!undo)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ void ElementDialog::setUpWidget()
|
|||||||
m_model = new ElementsCollectionModel(m_tree_view);
|
m_model = new ElementsCollectionModel(m_tree_view);
|
||||||
|
|
||||||
QList <QETProject *> prjs;
|
QList <QETProject *> prjs;
|
||||||
foreach(QETProject *prj, QETApp::registeredProjects())
|
for (QETProject *prj: QETApp::registeredProjects())
|
||||||
prjs.append(prj);
|
prjs.append(prj);
|
||||||
|
|
||||||
if (m_mode == OpenElement)
|
if (m_mode == OpenElement)
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ QList <Element *> ElementProvider::freeElement(const int filter) const{
|
|||||||
QList <Element *> free_elmt;
|
QList <Element *> free_elmt;
|
||||||
|
|
||||||
//serch in all diagram
|
//serch in all diagram
|
||||||
foreach (Diagram *d, diag_list) {
|
for (Diagram *d: diag_list) {
|
||||||
//get all element in diagram d
|
//get all element in diagram d
|
||||||
QList <Element *> elmt_list;
|
QList <Element *> elmt_list;
|
||||||
elmt_list = d->elements();
|
elmt_list = d->elements();
|
||||||
foreach (Element *elmt, elmt_list) {
|
for (Element *elmt: elmt_list) {
|
||||||
if (filter & elmt->linkType())
|
if (filter & elmt->linkType())
|
||||||
if (elmt->isFree()) free_elmt << elmt;
|
if (elmt->isFree()) free_elmt << elmt;
|
||||||
}
|
}
|
||||||
@@ -72,8 +72,8 @@ QList <Element *> ElementProvider::freeElement(const int filter) const{
|
|||||||
QList <Element *> ElementProvider::fromUuids(QList<QUuid> uuid_list) const {
|
QList <Element *> ElementProvider::fromUuids(QList<QUuid> uuid_list) const {
|
||||||
QList <Element *> found_element;
|
QList <Element *> found_element;
|
||||||
|
|
||||||
foreach (Diagram *d, diag_list) {
|
for (Diagram *d: diag_list) {
|
||||||
foreach(Element *elmt, d->elements()) {
|
for (Element *elmt: d->elements()) {
|
||||||
if (uuid_list.contains(elmt->uuid())) {
|
if (uuid_list.contains(elmt->uuid())) {
|
||||||
found_element << elmt;
|
found_element << elmt;
|
||||||
uuid_list.removeAll(elmt->uuid());
|
uuid_list.removeAll(elmt->uuid());
|
||||||
@@ -94,11 +94,11 @@ QList <Element *> ElementProvider::find(const int filter) const {
|
|||||||
QList <Element *> elmt_;
|
QList <Element *> elmt_;
|
||||||
|
|
||||||
//serch in all diagram
|
//serch in all diagram
|
||||||
foreach (Diagram *d, diag_list) {
|
for (Diagram *d: diag_list) {
|
||||||
//get all element in diagram d
|
//get all element in diagram d
|
||||||
QList <Element *> elmt_list;
|
QList <Element *> elmt_list;
|
||||||
elmt_list = d->elements();
|
elmt_list = d->elements();
|
||||||
foreach (Element *elmt, elmt_list) {
|
for (Element *elmt: elmt_list) {
|
||||||
if (filter & elmt->linkType())
|
if (filter & elmt->linkType())
|
||||||
elmt_ << elmt;
|
elmt_ << elmt;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,18 +99,18 @@ void ElementsMover::continueMovement(const QPointF &movement) {
|
|||||||
|
|
||||||
//Move every movable item, except conductor
|
//Move every movable item, except conductor
|
||||||
typedef DiagramContent dc;
|
typedef DiagramContent dc;
|
||||||
foreach (QGraphicsItem *qgi, moved_content_.items(dc::Elements | dc::TextFields | dc::Images | dc::Shapes)) {
|
for (QGraphicsItem *qgi: moved_content_.items(dc::Elements | dc::TextFields | dc::Images | dc::Shapes)) {
|
||||||
if (qgi == movement_driver_) continue;
|
if (qgi == movement_driver_) continue;
|
||||||
qgi -> setPos(qgi->pos() + movement);
|
qgi -> setPos(qgi->pos() + movement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move some conductors
|
// Move some conductors
|
||||||
foreach(Conductor *conductor, moved_content_.conductorsToMove) {
|
for (Conductor *conductor: moved_content_.conductorsToMove) {
|
||||||
conductor -> setPos(conductor -> pos() + movement);
|
conductor -> setPos(conductor -> pos() + movement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recalcul the path of other conductors
|
// Recalcul the path of other conductors
|
||||||
foreach(Conductor *conductor, moved_content_.conductorsToUpdate) {
|
for (Conductor *conductor: moved_content_.conductorsToUpdate) {
|
||||||
conductor -> updatePath();
|
conductor -> updatePath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,7 +168,7 @@ void ElementsMover::endMovement()
|
|||||||
{
|
{
|
||||||
use_properties = true;
|
use_properties = true;
|
||||||
others_properties = (*conductors_list.begin())->properties();
|
others_properties = (*conductors_list.begin())->properties();
|
||||||
foreach (Conductor *cond, conductors_list)
|
for (Conductor *cond: conductors_list)
|
||||||
if (cond->properties() != others_properties)
|
if (cond->properties() != others_properties)
|
||||||
use_properties = false;
|
use_properties = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ void ElementsPanel::reload(bool reload_collections) {
|
|||||||
if (first_reload_) custom_tbt_collection_item_ -> setExpanded(true);
|
if (first_reload_) custom_tbt_collection_item_ -> setExpanded(true);
|
||||||
|
|
||||||
// add projects
|
// add projects
|
||||||
foreach(QETProject *project, projects_to_display_.values()) {
|
for (QETProject *project: projects_to_display_.values()) {
|
||||||
addProject(project);
|
addProject(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ void ElementsPanel::filter(const QString &m, QET::Filtering filtering) {
|
|||||||
const int expanded_role = 42; // magic number? So you consider Douglas Adams wrote about magic?
|
const int expanded_role = 42; // magic number? So you consider Douglas Adams wrote about magic?
|
||||||
|
|
||||||
if (filtering == QET::BeginFilter) {
|
if (filtering == QET::BeginFilter) {
|
||||||
foreach (QTreeWidgetItem *item, items) {
|
for (QTreeWidgetItem *item: items) {
|
||||||
item -> setData(0, expanded_role, item -> isExpanded());
|
item -> setData(0, expanded_role, item -> isExpanded());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -334,7 +334,7 @@ void ElementsPanel::filter(const QString &m, QET::Filtering filtering) {
|
|||||||
QTreeWidgetItem *current_item = currentItem();
|
QTreeWidgetItem *current_item = currentItem();
|
||||||
|
|
||||||
// restore the tree as it was before the filtering
|
// restore the tree as it was before the filtering
|
||||||
foreach (QTreeWidgetItem *qtwi, items) {
|
for (QTreeWidgetItem *qtwi: items) {
|
||||||
qtwi -> setHidden(false);
|
qtwi -> setHidden(false);
|
||||||
qtwi -> setExpanded(qtwi -> data(0, expanded_role).toBool());
|
qtwi -> setExpanded(qtwi -> data(0, expanded_role).toBool());
|
||||||
}
|
}
|
||||||
@@ -377,7 +377,7 @@ void ElementsPanel::buildFilterList() {
|
|||||||
filter_list_ = filter_.split( '+' );
|
filter_list_ = filter_.split( '+' );
|
||||||
/*
|
/*
|
||||||
qDebug() << "*******************";
|
qDebug() << "*******************";
|
||||||
foreach( QString filter , filter_list_ ) {
|
for ( QString filter , filter_list_ ) {
|
||||||
filter = filter.trimmed();
|
filter = filter.trimmed();
|
||||||
qDebug() << filter;
|
qDebug() << filter;
|
||||||
}
|
}
|
||||||
@@ -392,10 +392,10 @@ void ElementsPanel::applyCurrentFilter(const QList<QTreeWidgetItem *> &items) {
|
|||||||
buildFilterList();
|
buildFilterList();
|
||||||
QList<QTreeWidgetItem *> matching_items;
|
QList<QTreeWidgetItem *> matching_items;
|
||||||
|
|
||||||
foreach (QTreeWidgetItem *item, items) {
|
for (QTreeWidgetItem *item: items) {
|
||||||
bool item_matches = true;
|
bool item_matches = true;
|
||||||
|
|
||||||
foreach( QString filter , filter_list_ ) {
|
for ( QString filter : filter_list_ ) {
|
||||||
filter = filter.trimmed();
|
filter = filter.trimmed();
|
||||||
if ( !filter.isEmpty() ) {
|
if ( !filter.isEmpty() ) {
|
||||||
item_matches &= matchesFilter(item, filter);
|
item_matches &= matchesFilter(item, filter);
|
||||||
@@ -414,19 +414,19 @@ void ElementsPanel::applyCurrentFilter(const QList<QTreeWidgetItem *> &items) {
|
|||||||
void ElementsPanel::ensureHierarchyIsVisible(const QList<QTreeWidgetItem *> &items) {
|
void ElementsPanel::ensureHierarchyIsVisible(const QList<QTreeWidgetItem *> &items) {
|
||||||
// remonte l'arborescence pour lister les categories contenant les elements filtres
|
// remonte l'arborescence pour lister les categories contenant les elements filtres
|
||||||
QSet<QTreeWidgetItem *> parent_items;
|
QSet<QTreeWidgetItem *> parent_items;
|
||||||
foreach(QTreeWidgetItem *item, items) {
|
for (QTreeWidgetItem *item: items) {
|
||||||
for (QTreeWidgetItem *parent_qtwi = item -> parent() ; parent_qtwi ; parent_qtwi = parent_qtwi -> parent()) {
|
for (QTreeWidgetItem *parent_qtwi = item -> parent() ; parent_qtwi ; parent_qtwi = parent_qtwi -> parent()) {
|
||||||
parent_items << parent_qtwi;
|
parent_items << parent_qtwi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// etend les parents
|
// etend les parents
|
||||||
foreach(QTreeWidgetItem *parent_qtwi, parent_items) {
|
for (QTreeWidgetItem *parent_qtwi: parent_items) {
|
||||||
if (!parent_qtwi -> isExpanded()) parent_qtwi -> setExpanded(true);
|
if (!parent_qtwi -> isExpanded()) parent_qtwi -> setExpanded(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// affiche les parents
|
// affiche les parents
|
||||||
foreach(QTreeWidgetItem *parent_qtwi, parent_items) {
|
for (QTreeWidgetItem *parent_qtwi: parent_items) {
|
||||||
if (parent_qtwi -> isHidden()) parent_qtwi -> setHidden(false);
|
if (parent_qtwi -> isHidden()) parent_qtwi -> setHidden(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ int ElementTextsMover::beginMovement(Diagram *diagram, QGraphicsItem *driver_ite
|
|||||||
movement_driver_ = driver_item;
|
movement_driver_ = driver_item;
|
||||||
m_texts_item_H.clear();
|
m_texts_item_H.clear();
|
||||||
|
|
||||||
foreach(QGraphicsItem *item, diagram -> selectedItems())
|
for (QGraphicsItem *item: diagram -> selectedItems())
|
||||||
{
|
{
|
||||||
if (item->type() == ElementTextItem::Type)
|
if (item->type() == ElementTextItem::Type)
|
||||||
{
|
{
|
||||||
@@ -79,7 +79,7 @@ void ElementTextsMover::continueMovement(const QPointF &movement)
|
|||||||
{
|
{
|
||||||
if (!movement_running_ || movement.isNull()) return;
|
if (!movement_running_ || movement.isNull()) return;
|
||||||
|
|
||||||
foreach(ElementTextItem *text_item, m_texts_item_H.keys())
|
for (ElementTextItem *text_item: m_texts_item_H.keys())
|
||||||
{
|
{
|
||||||
if (text_item == movement_driver_) continue;
|
if (text_item == movement_driver_) continue;
|
||||||
QPointF applied_movement = text_item -> mapMovementToParent(text_item-> mapMovementFromScene(movement));
|
QPointF applied_movement = text_item -> mapMovementToParent(text_item-> mapMovementFromScene(movement));
|
||||||
@@ -101,7 +101,7 @@ void ElementTextsMover::endMovement()
|
|||||||
|
|
||||||
QPropertyUndoCommand *undo = nullptr;
|
QPropertyUndoCommand *undo = nullptr;
|
||||||
|
|
||||||
foreach (ElementTextItem *eti, m_texts_item_H.keys())
|
for (ElementTextItem *eti: m_texts_item_H.keys())
|
||||||
{
|
{
|
||||||
if (undo)
|
if (undo)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ ExportDialog::~ExportDialog() {
|
|||||||
*/
|
*/
|
||||||
int ExportDialog::diagramsToExportCount() const {
|
int ExportDialog::diagramsToExportCount() const {
|
||||||
int checked_diagrams_count = 0;
|
int checked_diagrams_count = 0;
|
||||||
foreach(ExportDiagramLine *diagram_line, diagram_lines_.values()) {
|
for (ExportDiagramLine *diagram_line: diagram_lines_.values()) {
|
||||||
if (diagram_line -> must_export -> isChecked()) ++ checked_diagrams_count;
|
if (diagram_line -> must_export -> isChecked()) ++ checked_diagrams_count;
|
||||||
}
|
}
|
||||||
return(checked_diagrams_count);
|
return(checked_diagrams_count);
|
||||||
@@ -143,7 +143,7 @@ QWidget *ExportDialog::initDiagramsListPart() {
|
|||||||
diagrams_list_layout_ -> addWidget(new QLabel(tr("Dimensions")), line_count, 3, Qt::AlignHCenter | Qt::AlignVCenter);
|
diagrams_list_layout_ -> addWidget(new QLabel(tr("Dimensions")), line_count, 3, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
|
||||||
// remplit la liste
|
// remplit la liste
|
||||||
foreach (Diagram *diagram, project_ -> diagrams()) {
|
for (Diagram *diagram: project_ -> diagrams()) {
|
||||||
++ line_count;
|
++ line_count;
|
||||||
ExportDiagramLine *diagram_line = new ExportDiagramLine(diagram, diagramSize(diagram));
|
ExportDiagramLine *diagram_line = new ExportDiagramLine(diagram, diagramSize(diagram));
|
||||||
diagram_lines_.insert(line_count, diagram_line);
|
diagram_lines_.insert(line_count, diagram_line);
|
||||||
@@ -184,13 +184,13 @@ QWidget *ExportDialog::initDiagramsListPart() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ExportDialog::slot_selectAllClicked() {
|
void ExportDialog::slot_selectAllClicked() {
|
||||||
foreach (ExportDiagramLine *diagramLine, diagram_lines_) {
|
for (ExportDiagramLine *diagramLine: diagram_lines_) {
|
||||||
diagramLine -> must_export -> setChecked(true);
|
diagramLine -> must_export -> setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportDialog::slot_deSelectAllClicked() {
|
void ExportDialog::slot_deSelectAllClicked() {
|
||||||
foreach (ExportDiagramLine *diagramLine, diagram_lines_) {
|
for (ExportDiagramLine *diagramLine: diagram_lines_) {
|
||||||
diagramLine -> must_export -> setChecked(false);
|
diagramLine -> must_export -> setChecked(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -465,7 +465,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Determine les elements a "XMLiser"
|
// Determine les elements a "XMLiser"
|
||||||
foreach(QGraphicsItem *qgi, diagram -> items()) {
|
for (QGraphicsItem *qgi: diagram -> items()) {
|
||||||
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
|
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
|
||||||
list_elements << elmt;
|
list_elements << elmt;
|
||||||
} else if (Conductor *f = qgraphicsitem_cast<Conductor *>(qgi)) {
|
} else if (Conductor *f = qgraphicsitem_cast<Conductor *>(qgi)) {
|
||||||
@@ -480,10 +480,10 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (QetShapeItem *qsi, list_shapes) qsi->toDXF(file_path);
|
for (QetShapeItem *qsi: list_shapes) qsi->toDXF(file_path);
|
||||||
|
|
||||||
//Draw elements
|
//Draw elements
|
||||||
foreach(Element *elmt, list_elements) {
|
for (Element *elmt: list_elements) {
|
||||||
|
|
||||||
double rotation_angle = elmt -> orientation() * 90;
|
double rotation_angle = elmt -> orientation() * 90;
|
||||||
|
|
||||||
@@ -494,7 +494,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
qreal hotspot_y = Createdxf::sheetHeight - (elem_pos_y) * Createdxf::yScale;
|
qreal hotspot_y = Createdxf::sheetHeight - (elem_pos_y) * Createdxf::yScale;
|
||||||
|
|
||||||
QList<ElementTextItem *> elmt_text = elmt -> texts();
|
QList<ElementTextItem *> elmt_text = elmt -> texts();
|
||||||
foreach(ElementTextItem *dti, elmt_text) {
|
for (ElementTextItem *dti: elmt_text) {
|
||||||
qreal fontSize = dti -> font().pointSizeF();
|
qreal fontSize = dti -> font().pointSizeF();
|
||||||
if (fontSize < 0)
|
if (fontSize < 0)
|
||||||
fontSize = dti -> font().pixelSize();
|
fontSize = dti -> font().pixelSize();
|
||||||
@@ -508,7 +508,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
y = transformed_point.y();
|
y = transformed_point.y();
|
||||||
QStringList lines = dti -> toPlainText().split('\n');
|
QStringList lines = dti -> toPlainText().split('\n');
|
||||||
y += (fontSize/2) * (lines.count()-1);
|
y += (fontSize/2) * (lines.count()-1);
|
||||||
foreach (QString line, lines) {
|
for (QString line: lines) {
|
||||||
qreal angle = 360 - (dti -> rotationAngle() + rotation_angle);
|
qreal angle = 360 - (dti -> rotationAngle() + rotation_angle);
|
||||||
if (line.size() > 0 && line != "_" )
|
if (line.size() > 0 && line != "_" )
|
||||||
Createdxf::drawText(file_path, line, x, y, fontSize, angle, 0);
|
Createdxf::drawText(file_path, line, x, y, fontSize, angle, 0);
|
||||||
@@ -528,7 +528,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<QLineF *> elmt_line = elmt -> lines();
|
QList<QLineF *> elmt_line = elmt -> lines();
|
||||||
foreach(QLineF *line, elmt_line) {
|
for (QLineF *line: elmt_line) {
|
||||||
qreal x1 = (elem_pos_x + line -> p1().x()) * Createdxf::xScale;
|
qreal x1 = (elem_pos_x + line -> p1().x()) * Createdxf::xScale;
|
||||||
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + line -> p1().y()) * Createdxf::yScale;
|
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + line -> p1().y()) * Createdxf::yScale;
|
||||||
QPointF transformed_point = rotation_transformed(x1, y1, hotspot_x, hotspot_y, rotation_angle);
|
QPointF transformed_point = rotation_transformed(x1, y1, hotspot_x, hotspot_y, rotation_angle);
|
||||||
@@ -543,7 +543,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<QRectF *> elmt_rectangle = elmt -> rectangles();
|
QList<QRectF *> elmt_rectangle = elmt -> rectangles();
|
||||||
foreach(QRectF *rect, elmt_rectangle) {
|
for (QRectF *rect: elmt_rectangle) {
|
||||||
qreal x1 = (elem_pos_x + rect -> bottomLeft().x()) * Createdxf::xScale;
|
qreal x1 = (elem_pos_x + rect -> bottomLeft().x()) * Createdxf::xScale;
|
||||||
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + rect -> bottomLeft().y()) * Createdxf::yScale;
|
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + rect -> bottomLeft().y()) * Createdxf::yScale;
|
||||||
qreal w = rect -> width() * Createdxf::xScale;
|
qreal w = rect -> width() * Createdxf::xScale;
|
||||||
@@ -565,7 +565,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<QRectF *> elmt_circle = elmt -> circles();
|
QList<QRectF *> elmt_circle = elmt -> circles();
|
||||||
foreach(QRectF *circle_rect, elmt_circle) {
|
for (QRectF *circle_rect: elmt_circle) {
|
||||||
qreal x1 = (elem_pos_x + circle_rect ->center().x()) * Createdxf::xScale;
|
qreal x1 = (elem_pos_x + circle_rect ->center().x()) * Createdxf::xScale;
|
||||||
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + circle_rect -> center().y()) * Createdxf::yScale;
|
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + circle_rect -> center().y()) * Createdxf::yScale;
|
||||||
qreal r = circle_rect -> width() * Createdxf::xScale / 2;
|
qreal r = circle_rect -> width() * Createdxf::xScale / 2;
|
||||||
@@ -576,7 +576,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<QVector<QPointF> *> elmt_polygon = elmt -> polygons();
|
QList<QVector<QPointF> *> elmt_polygon = elmt -> polygons();
|
||||||
foreach(QVector<QPointF> *polygon, elmt_polygon) {
|
for (QVector<QPointF> *polygon: elmt_polygon) {
|
||||||
if (polygon -> size() == 0)
|
if (polygon -> size() == 0)
|
||||||
continue;
|
continue;
|
||||||
qreal x1 = (elem_pos_x + polygon -> at(0).x()) * Createdxf::xScale;
|
qreal x1 = (elem_pos_x + polygon -> at(0).x()) * Createdxf::xScale;
|
||||||
@@ -598,7 +598,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
|
|
||||||
// Draw arcs and ellipses
|
// Draw arcs and ellipses
|
||||||
QList<QVector<qreal> *> elmt_arc = elmt -> arcs();
|
QList<QVector<qreal> *> elmt_arc = elmt -> arcs();
|
||||||
foreach(QVector<qreal> *arc, elmt_arc) {
|
for (QVector<qreal> *arc: elmt_arc) {
|
||||||
if (arc -> size() == 0)
|
if (arc -> size() == 0)
|
||||||
continue;
|
continue;
|
||||||
qreal x = (elem_pos_x + arc -> at(0)) * Createdxf::xScale;
|
qreal x = (elem_pos_x + arc -> at(0)) * Createdxf::xScale;
|
||||||
@@ -612,8 +612,8 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Draw conductors
|
//Draw conductors
|
||||||
foreach(Conductor *cond, list_conductors) {
|
for (Conductor *cond: list_conductors) {
|
||||||
foreach(ConductorSegment *segment, cond -> segmentsList()) {
|
for (ConductorSegment *segment: cond -> segmentsList()) {
|
||||||
qreal x1 = (segment -> firstPoint().x()) * Createdxf::xScale;
|
qreal x1 = (segment -> firstPoint().x()) * Createdxf::xScale;
|
||||||
qreal y1 = Createdxf::sheetHeight - (segment -> firstPoint().y() * Createdxf::yScale);
|
qreal y1 = Createdxf::sheetHeight - (segment -> firstPoint().y() * Createdxf::yScale);
|
||||||
qreal x2 = (segment -> secondPoint().x()) * Createdxf::xScale;
|
qreal x2 = (segment -> secondPoint().x()) * Createdxf::xScale;
|
||||||
@@ -630,7 +630,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
qreal x = (textItem -> pos().x()) * Createdxf::xScale;
|
qreal x = (textItem -> pos().x()) * Createdxf::xScale;
|
||||||
qreal y = Createdxf::sheetHeight - (textItem -> pos().y() * Createdxf::yScale) - fontSize;
|
qreal y = Createdxf::sheetHeight - (textItem -> pos().y() * Createdxf::yScale) - fontSize;
|
||||||
QStringList lines = textItem->toPlainText().split('\n');
|
QStringList lines = textItem->toPlainText().split('\n');
|
||||||
foreach (QString line, lines) {
|
for (QString line: lines) {
|
||||||
qreal angle = 360 - (textItem -> rotationAngle());
|
qreal angle = 360 - (textItem -> rotationAngle());
|
||||||
if (line.size() > 0 && line != "_" )
|
if (line.size() > 0 && line != "_" )
|
||||||
Createdxf::drawText(file_path, line, x, y, fontSize, angle, 0 );
|
Createdxf::drawText(file_path, line, x, y, fontSize, angle, 0 );
|
||||||
@@ -651,7 +651,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Draw text items
|
//Draw text items
|
||||||
foreach(DiagramTextItem *dti, list_texts) {
|
for (DiagramTextItem *dti: list_texts) {
|
||||||
qreal fontSize = dti -> font().pointSizeF();
|
qreal fontSize = dti -> font().pointSizeF();
|
||||||
if (fontSize < 0)
|
if (fontSize < 0)
|
||||||
fontSize = dti -> font().pixelSize();
|
fontSize = dti -> font().pixelSize();
|
||||||
@@ -659,7 +659,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
qreal x = (dti -> pos().x()) * Createdxf::xScale;
|
qreal x = (dti -> pos().x()) * Createdxf::xScale;
|
||||||
qreal y = Createdxf::sheetHeight - (dti -> pos().y() * Createdxf::yScale) - fontSize*1.05;
|
qreal y = Createdxf::sheetHeight - (dti -> pos().y() * Createdxf::yScale) - fontSize*1.05;
|
||||||
QStringList lines = dti -> toPlainText().split('\n');
|
QStringList lines = dti -> toPlainText().split('\n');
|
||||||
foreach (QString line, lines) {
|
for (QString line: lines) {
|
||||||
qreal angle = 360 - (dti -> rotationAngle());
|
qreal angle = 360 - (dti -> rotationAngle());
|
||||||
if (line.size() > 0 && line != "_" )
|
if (line.size() > 0 && line != "_" )
|
||||||
Createdxf::drawText(file_path, line, x, y, fontSize, angle, 0);
|
Createdxf::drawText(file_path, line, x, y, fontSize, angle, 0);
|
||||||
@@ -742,7 +742,7 @@ QPointF ExportDialog::rotation_transformed(qreal px, qreal py , qreal origin_x,
|
|||||||
void ExportDialog::slot_export() {
|
void ExportDialog::slot_export() {
|
||||||
// recupere la liste des schemas a exporter
|
// recupere la liste des schemas a exporter
|
||||||
QList<ExportDiagramLine *> diagrams_to_export;
|
QList<ExportDiagramLine *> diagrams_to_export;
|
||||||
foreach(ExportDiagramLine *diagram_line, diagram_lines_.values()) {
|
for (ExportDiagramLine *diagram_line: diagram_lines_.values()) {
|
||||||
if (diagram_line -> must_export -> isChecked()) {
|
if (diagram_line -> must_export -> isChecked()) {
|
||||||
diagrams_to_export << diagram_line;
|
diagrams_to_export << diagram_line;
|
||||||
}
|
}
|
||||||
@@ -750,7 +750,7 @@ void ExportDialog::slot_export() {
|
|||||||
|
|
||||||
// verification #1 : chaque schema coche doit avoir un nom de fichier distinct
|
// verification #1 : chaque schema coche doit avoir un nom de fichier distinct
|
||||||
QSet<QString> filenames;
|
QSet<QString> filenames;
|
||||||
foreach(ExportDiagramLine *diagram_line, diagrams_to_export) {
|
for (ExportDiagramLine *diagram_line: diagrams_to_export) {
|
||||||
QString diagram_file = diagram_line -> file_name -> text();
|
QString diagram_file = diagram_line -> file_name -> text();
|
||||||
if (!diagram_file.isEmpty()) {
|
if (!diagram_file.isEmpty()) {
|
||||||
filenames << diagram_file;
|
filenames << diagram_file;
|
||||||
@@ -783,7 +783,7 @@ void ExportDialog::slot_export() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// exporte chaque schema a exporter
|
// exporte chaque schema a exporter
|
||||||
foreach(ExportDiagramLine *diagram_line, diagrams_to_export) {
|
for (ExportDiagramLine *diagram_line: diagrams_to_export) {
|
||||||
exportDiagram(diagram_line);
|
exportDiagram(diagram_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -868,7 +868,7 @@ void ExportDialog::exportDiagram(ExportDiagramLine *diagram_line) {
|
|||||||
*/
|
*/
|
||||||
void ExportDialog::slot_changeUseBorder() {
|
void ExportDialog::slot_changeUseBorder() {
|
||||||
// parcourt les schemas a exporter
|
// parcourt les schemas a exporter
|
||||||
foreach(int diagram_id, diagram_lines_.keys()) {
|
for (int diagram_id: diagram_lines_.keys()) {
|
||||||
ExportDiagramLine *diagram_line = diagram_lines_[diagram_id];
|
ExportDiagramLine *diagram_line = diagram_lines_[diagram_id];
|
||||||
|
|
||||||
// corrige les dimensions des schemas dont il faut preserver le ratio
|
// corrige les dimensions des schemas dont il faut preserver le ratio
|
||||||
@@ -900,7 +900,7 @@ void ExportDialog::slot_changeFilesExtension(bool force_extension) {
|
|||||||
QString format_extension = "." + format_acronym.toLower();
|
QString format_extension = "." + format_acronym.toLower();
|
||||||
|
|
||||||
// parcourt les schemas a exporter
|
// parcourt les schemas a exporter
|
||||||
foreach(ExportDiagramLine *diagram_line, diagram_lines_.values()) {
|
for (ExportDiagramLine *diagram_line: diagram_lines_.values()) {
|
||||||
QString diagram_filename = diagram_line -> file_name -> text();
|
QString diagram_filename = diagram_line -> file_name -> text();
|
||||||
|
|
||||||
// cas 1 : l'extension est presente et correcte : on ne fait rien
|
// cas 1 : l'extension est presente et correcte : on ne fait rien
|
||||||
@@ -959,7 +959,7 @@ void ExportDialog::slot_previewDiagram(int diagram_id) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// nettoie l'apercu
|
// nettoie l'apercu
|
||||||
foreach (QGraphicsItem *qgi, preview_scene -> items()) {
|
for (QGraphicsItem *qgi: preview_scene -> items()) {
|
||||||
preview_scene -> removeItem(qgi);
|
preview_scene -> removeItem(qgi);
|
||||||
delete qgi;
|
delete qgi;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ QTreeWidgetItem *GenericPanel::fillProjectItem(QTreeWidgetItem *project_qtwi, QE
|
|||||||
removeObsoleteItems(project -> diagrams(), project_qtwi, QET::Diagram, false);
|
removeObsoleteItems(project -> diagrams(), project_qtwi, QET::Diagram, false);
|
||||||
}
|
}
|
||||||
int index = 0;
|
int index = 0;
|
||||||
foreach (Diagram *diagram, project -> diagrams()) {
|
for (Diagram *diagram: project -> diagrams()) {
|
||||||
QTreeWidgetItem *diagram_qtwi = addDiagram(diagram, 0, options);
|
QTreeWidgetItem *diagram_qtwi = addDiagram(diagram, 0, options);
|
||||||
project_qtwi -> insertChild(index, diagram_qtwi);
|
project_qtwi -> insertChild(index, diagram_qtwi);
|
||||||
++ index;
|
++ index;
|
||||||
@@ -428,7 +428,7 @@ QTreeWidgetItem *GenericPanel::fillTemplatesCollectionItem(QTreeWidgetItem *tbt_
|
|||||||
}
|
}
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
foreach (QString template_name, tbt_collection -> templates()) {
|
for (QString template_name: tbt_collection -> templates()) {
|
||||||
QTreeWidgetItem *template_item = addTemplate(tbt_collection -> location(template_name), 0, options);
|
QTreeWidgetItem *template_item = addTemplate(tbt_collection -> location(template_name), 0, options);
|
||||||
tbt_collection_qtwi -> insertChild(index ++, template_item);
|
tbt_collection_qtwi -> insertChild(index ++, template_item);
|
||||||
}
|
}
|
||||||
@@ -770,7 +770,7 @@ QList<QTreeWidgetItem *> GenericPanel::childItems(QTreeWidgetItem *item, QET::It
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void GenericPanel::removeObsoleteItems(const QList<T> &expected_items, QTreeWidgetItem *item, QET::ItemType type, bool recursive) {
|
void GenericPanel::removeObsoleteItems(const QList<T> &expected_items, QTreeWidgetItem *item, QET::ItemType type, bool recursive) {
|
||||||
// remove items not found in expected_items
|
// remove items not found in expected_items
|
||||||
foreach (QTreeWidgetItem *child_item, childItems(item, type, recursive)) {
|
for (QTreeWidgetItem *child_item: childItems(item, type, recursive)) {
|
||||||
T child_value = valueForItem<T>(child_item);
|
T child_value = valueForItem<T>(child_item);
|
||||||
if (!expected_items.contains(child_value)) {
|
if (!expected_items.contains(child_value)) {
|
||||||
deleteItem(child_item);
|
deleteItem(child_item);
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ NamesList NamesListWidget::names() {
|
|||||||
Definit les noms que le widget doit afficher
|
Definit les noms que le widget doit afficher
|
||||||
*/
|
*/
|
||||||
void NamesListWidget::setNames(const NamesList &provided_names) {
|
void NamesListWidget::setNames(const NamesList &provided_names) {
|
||||||
foreach(QString lang, provided_names.langs()) {
|
for (QString lang: provided_names.langs()) {
|
||||||
QString value = provided_names[lang];
|
QString value = provided_names[lang];
|
||||||
QStringList values;
|
QStringList values;
|
||||||
values << lang << value;
|
values << lang << value;
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ QString nomenclature::getNomenclature()
|
|||||||
|
|
||||||
if(m_list_diagram.isEmpty()) return data;
|
if(m_list_diagram.isEmpty()) return data;
|
||||||
|
|
||||||
foreach (Diagram *d, m_list_diagram) {
|
for (Diagram *d: m_list_diagram) {
|
||||||
//Get only simple, master and unlinked slave element.
|
//Get only simple, master and unlinked slave element.
|
||||||
ElementProvider ep(d);
|
ElementProvider ep(d);
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
@@ -120,7 +120,7 @@ QString nomenclature::getNomenclature()
|
|||||||
|
|
||||||
list_elements << ep.freeElement(Element::Slave);
|
list_elements << ep.freeElement(Element::Slave);
|
||||||
|
|
||||||
foreach (Element *elmt, list_elements) {
|
for (Element *elmt: list_elements) {
|
||||||
data += getElementInfo(elmt);
|
data += getElementInfo(elmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -385,19 +385,19 @@ void ProjectAutoNumConfigPage::readValuesFromProject() {
|
|||||||
//Conductor Tab
|
//Conductor Tab
|
||||||
QList <QString> keys_conductor = m_project->conductorAutoNum().keys();
|
QList <QString> keys_conductor = m_project->conductorAutoNum().keys();
|
||||||
if (!keys_conductor.isEmpty()){
|
if (!keys_conductor.isEmpty()){
|
||||||
foreach (QString str, keys_conductor) { m_context_cb_conductor-> addItem(str); }
|
for (QString str: keys_conductor) { m_context_cb_conductor-> addItem(str); }
|
||||||
}
|
}
|
||||||
|
|
||||||
//Element Tab
|
//Element Tab
|
||||||
QList <QString> keys_element = m_project->elementAutoNum().keys();
|
QList <QString> keys_element = m_project->elementAutoNum().keys();
|
||||||
if (!keys_element.isEmpty()){
|
if (!keys_element.isEmpty()){
|
||||||
foreach (QString str, keys_element) { m_context_cb_element -> addItem(str);}
|
for (QString str: keys_element) { m_context_cb_element -> addItem(str);}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Folio Tab
|
//Folio Tab
|
||||||
QList <QString> keys_folio = m_project->folioAutoNum().keys();
|
QList <QString> keys_folio = m_project->folioAutoNum().keys();
|
||||||
if (!keys_folio.isEmpty()){
|
if (!keys_folio.isEmpty()){
|
||||||
foreach (QString str, keys_folio) { m_context_cb_folio -> addItem(str);}
|
for (QString str: keys_folio) { m_context_cb_folio -> addItem(str);}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Folio AutoNumbering Tab
|
//Folio AutoNumbering Tab
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ ProjectView::ProjectView(QETProject *project, QWidget *parent) :
|
|||||||
*/
|
*/
|
||||||
ProjectView::~ProjectView() {
|
ProjectView::~ProjectView() {
|
||||||
// qDebug() << "Suppression du ProjectView" << ((void *)this);
|
// qDebug() << "Suppression du ProjectView" << ((void *)this);
|
||||||
foreach(int id, diagram_ids_.keys()) {
|
for (int id: diagram_ids_.keys()) {
|
||||||
DiagramView *diagram_view = diagram_ids_.take(id);
|
DiagramView *diagram_view = diagram_ids_.take(id);
|
||||||
delete diagram_view;
|
delete diagram_view;
|
||||||
}
|
}
|
||||||
@@ -281,12 +281,12 @@ bool ProjectView::tryClosingElementEditors() {
|
|||||||
editant un element du projet.
|
editant un element du projet.
|
||||||
*/
|
*/
|
||||||
QList<QETElementEditor *> editors = QETApp::elementEditors(m_project);
|
QList<QETElementEditor *> editors = QETApp::elementEditors(m_project);
|
||||||
foreach(QETElementEditor *editor, editors) {
|
for (QETElementEditor *editor: editors) {
|
||||||
if (!editor -> close()) return(false);
|
if (!editor -> close()) return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QETTitleBlockTemplateEditor *> template_editors = QETApp::titleBlockTemplateEditors(m_project);
|
QList<QETTitleBlockTemplateEditor *> template_editors = QETApp::titleBlockTemplateEditors(m_project);
|
||||||
foreach(QETTitleBlockTemplateEditor *template_editor, template_editors) {
|
for (QETTitleBlockTemplateEditor *template_editor: template_editors) {
|
||||||
if (!template_editor -> close()) return(false);
|
if (!template_editor -> close()) return(false);
|
||||||
}
|
}
|
||||||
return(true);
|
return(true);
|
||||||
@@ -389,7 +389,7 @@ void ProjectView::addNewDiagramFolioList() {
|
|||||||
if (m_project -> isReadOnly()) return;
|
if (m_project -> isReadOnly()) return;
|
||||||
int i = 1; //< Each new diagram is added to the end of the project.
|
int i = 1; //< Each new diagram is added to the end of the project.
|
||||||
//< We use @i to move the folio list at second position in the project
|
//< We use @i to move the folio list at second position in the project
|
||||||
foreach (Diagram *d, m_project -> addNewDiagramFolioList()) {
|
for (Diagram *d: m_project -> addNewDiagramFolioList()) {
|
||||||
DiagramView *new_diagram_view = new DiagramView(d);
|
DiagramView *new_diagram_view = new DiagramView(d);
|
||||||
addDiagram(new_diagram_view);
|
addDiagram(new_diagram_view);
|
||||||
showDiagram(new_diagram_view);
|
showDiagram(new_diagram_view);
|
||||||
@@ -745,7 +745,7 @@ QETResult ProjectView::doSave(ProjectSaveOptions options) {
|
|||||||
the project file itself.
|
the project file itself.
|
||||||
*/
|
*/
|
||||||
void ProjectView::saveDiagrams(const QList<Diagram *> &diagrams) {
|
void ProjectView::saveDiagrams(const QList<Diagram *> &diagrams) {
|
||||||
foreach (Diagram *diagram, diagrams) {
|
for (Diagram *diagram: diagrams) {
|
||||||
// Diagram::write() emits the written() signal, which is connected
|
// Diagram::write() emits the written() signal, which is connected
|
||||||
// to QETProject::write() through QETProject::componentWritten().
|
// to QETProject::write() through QETProject::componentWritten().
|
||||||
// We do not want to write the project immediately, so we block
|
// We do not want to write the project immediately, so we block
|
||||||
@@ -892,7 +892,7 @@ void ProjectView::loadDiagrams() {
|
|||||||
|
|
||||||
setDisplayFallbackWidget(m_project -> diagrams().isEmpty());
|
setDisplayFallbackWidget(m_project -> diagrams().isEmpty());
|
||||||
|
|
||||||
foreach(Diagram *diagram, m_project -> diagrams()) {
|
for (Diagram *diagram: m_project -> diagrams()) {
|
||||||
DiagramView *sv = new DiagramView(diagram);
|
DiagramView *sv = new DiagramView(diagram);
|
||||||
addDiagram(sv);
|
addDiagram(sv);
|
||||||
}
|
}
|
||||||
@@ -972,7 +972,7 @@ void ProjectView::tabMoved(int from, int to) {
|
|||||||
le schema n'est pas trouve
|
le schema n'est pas trouve
|
||||||
*/
|
*/
|
||||||
DiagramView *ProjectView::findDiagram(Diagram *diagram) {
|
DiagramView *ProjectView::findDiagram(Diagram *diagram) {
|
||||||
foreach(DiagramView *diagram_view, diagrams()) {
|
for (DiagramView *diagram_view: diagrams()) {
|
||||||
if (diagram_view -> diagram() == diagram) {
|
if (diagram_view -> diagram() == diagram) {
|
||||||
return(diagram_view);
|
return(diagram_view);
|
||||||
}
|
}
|
||||||
@@ -987,7 +987,7 @@ void ProjectView::rebuildDiagramsMap() {
|
|||||||
// vide la map
|
// vide la map
|
||||||
diagram_ids_.clear();
|
diagram_ids_.clear();
|
||||||
|
|
||||||
foreach(DiagramView *diagram_view, m_diagram_view_list) {
|
for (DiagramView *diagram_view: m_diagram_view_list) {
|
||||||
int dv_idx = m_tab -> indexOf(diagram_view);
|
int dv_idx = m_tab -> indexOf(diagram_view);
|
||||||
if (dv_idx == -1) continue;
|
if (dv_idx == -1) continue;
|
||||||
diagram_ids_.insert(dv_idx, diagram_view);
|
diagram_ids_.insert(dv_idx, diagram_view);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ void XRefProperties::toSettings(QSettings &settings, const QString prefix) const
|
|||||||
settings.setValue(prefix + "master_label", master_label);
|
settings.setValue(prefix + "master_label", master_label);
|
||||||
QString slave_label = m_slave_label;
|
QString slave_label = m_slave_label;
|
||||||
settings.setValue(prefix + "slave_label", slave_label);
|
settings.setValue(prefix + "slave_label", slave_label);
|
||||||
foreach (QString key, m_prefix.keys()) {
|
for (QString key: m_prefix.keys()) {
|
||||||
settings.setValue(prefix + key + "prefix", m_prefix.value(key));
|
settings.setValue(prefix + key + "prefix", m_prefix.value(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ void XRefProperties::fromSettings(const QSettings &settings, const QString prefi
|
|||||||
m_offset = settings.value(prefix + "offset", "0").toInt();
|
m_offset = settings.value(prefix + "offset", "0").toInt();
|
||||||
m_master_label = settings.value(prefix + "master_label", "%f-%l%c").toString();
|
m_master_label = settings.value(prefix + "master_label", "%f-%l%c").toString();
|
||||||
m_slave_label = settings.value(prefix + "slave_label", "(%f-%l%c)").toString();
|
m_slave_label = settings.value(prefix + "slave_label", "(%f-%l%c)").toString();
|
||||||
foreach (QString key, m_prefix_keys) {
|
for (QString key: m_prefix_keys) {
|
||||||
m_prefix.insert(key, settings.value(prefix + key + "prefix").toString());
|
m_prefix.insert(key, settings.value(prefix + key + "prefix").toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ void XRefProperties::toXml(QDomElement &xml_element) const {
|
|||||||
xml_element.setAttribute("master_label", master_label);
|
xml_element.setAttribute("master_label", master_label);
|
||||||
QString slave_label = m_slave_label;
|
QString slave_label = m_slave_label;
|
||||||
xml_element.setAttribute("slave_label", slave_label);
|
xml_element.setAttribute("slave_label", slave_label);
|
||||||
foreach (QString key, m_prefix.keys()) {
|
for (QString key: m_prefix.keys()) {
|
||||||
xml_element.setAttribute(key + "prefix", m_prefix.value(key));
|
xml_element.setAttribute(key + "prefix", m_prefix.value(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ void XRefProperties::fromXml(const QDomElement &xml_element) {
|
|||||||
m_offset = xml_element.attribute("offset", "0").toInt();
|
m_offset = xml_element.attribute("offset", "0").toInt();
|
||||||
m_master_label = xml_element.attribute("master_label", "%f-%l%c");
|
m_master_label = xml_element.attribute("master_label", "%f-%l%c");
|
||||||
m_slave_label = xml_element.attribute("slave_label","(%f-%l%c)");
|
m_slave_label = xml_element.attribute("slave_label","(%f-%l%c)");
|
||||||
foreach (QString key, m_prefix_keys) {
|
for (QString key: m_prefix_keys) {
|
||||||
m_prefix.insert(key, xml_element.attribute(key + "prefix"));
|
m_prefix.insert(key, xml_element.attribute(key + "prefix"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ QHash<QString, XRefProperties> XRefProperties::defaultProperties()
|
|||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
foreach (QString key, keys)
|
for (QString key: keys)
|
||||||
{
|
{
|
||||||
XRefProperties properties;
|
XRefProperties properties;
|
||||||
QString str("diagrameditor/defaultxref");
|
QString str("diagrameditor/defaultxref");
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ QString QET::stringToFileName(const QString &name) {
|
|||||||
QString file_name(name.toLower());
|
QString file_name(name.toLower());
|
||||||
|
|
||||||
// remplace les caracteres interdits par des tirets
|
// remplace les caracteres interdits par des tirets
|
||||||
foreach(QChar c, QET::forbiddenCharacters()) {
|
for (QChar c: QET::forbiddenCharacters()) {
|
||||||
file_name.replace(c, '-');
|
file_name.replace(c, '-');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +454,7 @@ QStringList QET::splitWithSpaces(const QString &string) {
|
|||||||
QStringList escaped_strings = string.split(QRegExp("[^\\]?(?:\\\\)* "), QString::SkipEmptyParts);
|
QStringList escaped_strings = string.split(QRegExp("[^\\]?(?:\\\\)* "), QString::SkipEmptyParts);
|
||||||
|
|
||||||
QStringList returned_list;
|
QStringList returned_list;
|
||||||
foreach(QString escaped_string, escaped_strings) {
|
for (QString escaped_string: escaped_strings) {
|
||||||
returned_list << QET::unescapeSpaces(escaped_string);
|
returned_list << QET::unescapeSpaces(escaped_string);
|
||||||
}
|
}
|
||||||
return(returned_list);
|
return(returned_list);
|
||||||
@@ -670,7 +670,7 @@ QPointF QET::graphicsSceneEventPos(QEvent *event) {
|
|||||||
*/
|
*/
|
||||||
bool QET::eachStrIsEqual(const QStringList &qsl) {
|
bool QET::eachStrIsEqual(const QStringList &qsl) {
|
||||||
if (qsl.size() == 1) return true;
|
if (qsl.size() == 1) return true;
|
||||||
foreach (const QString t, qsl) {
|
for (const QString t: qsl) {
|
||||||
if (qsl.at(0) != t) return false;
|
if (qsl.at(0) != t) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ QList<TitleBlockTemplatesCollection *> QETApp::availableTitleBlockTemplatesColle
|
|||||||
collections_list << common_tbt_collection_;
|
collections_list << common_tbt_collection_;
|
||||||
collections_list << custom_tbt_collection_;
|
collections_list << custom_tbt_collection_;
|
||||||
|
|
||||||
foreach(QETProject *opened_project, registered_projects_) {
|
for (QETProject *opened_project: registered_projects_) {
|
||||||
collections_list << opened_project -> embeddedTitleBlockTemplatesCollection();
|
collections_list << opened_project -> embeddedTitleBlockTemplatesCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,7 +582,7 @@ QStringList QETApp::handledFileExtensions() {
|
|||||||
*/
|
*/
|
||||||
QStringList QETApp::handledFiles(const QList<QUrl> &urls) {
|
QStringList QETApp::handledFiles(const QList<QUrl> &urls) {
|
||||||
QList<QString> filepaths;
|
QList<QString> filepaths;
|
||||||
foreach (QUrl url, urls) {
|
for (QUrl url: urls) {
|
||||||
if (url.scheme() != "file") continue;
|
if (url.scheme() != "file") continue;
|
||||||
QString local_path = url.toLocalFile();
|
QString local_path = url.toLocalFile();
|
||||||
QFileInfo local_path_info(local_path);
|
QFileInfo local_path_info(local_path);
|
||||||
@@ -604,7 +604,7 @@ QETDiagramEditor *QETApp::diagramEditorForFile(const QString &filepath) {
|
|||||||
if (filepath.isEmpty()) return(0);
|
if (filepath.isEmpty()) return(0);
|
||||||
|
|
||||||
QETApp *qet_app(QETApp::instance());
|
QETApp *qet_app(QETApp::instance());
|
||||||
foreach (QETDiagramEditor *diagram_editor, qet_app -> diagramEditors()) {
|
for (QETDiagramEditor *diagram_editor: qet_app -> diagramEditors()) {
|
||||||
if (diagram_editor -> viewForFile(filepath)) {
|
if (diagram_editor -> viewForFile(filepath)) {
|
||||||
return(diagram_editor);
|
return(diagram_editor);
|
||||||
}
|
}
|
||||||
@@ -621,7 +621,7 @@ QETDiagramEditor *QETApp::diagramEditorForFile(const QString &filepath) {
|
|||||||
*/
|
*/
|
||||||
QETDiagramEditor *QETApp::diagramEditorAncestorOf (const QWidget *child)
|
QETDiagramEditor *QETApp::diagramEditorAncestorOf (const QWidget *child)
|
||||||
{
|
{
|
||||||
foreach (QETDiagramEditor *qde, QETApp::diagramEditors()) {
|
for (QETDiagramEditor *qde: QETApp::diagramEditors()) {
|
||||||
if (qde->isAncestorOf(child)) {
|
if (qde->isAncestorOf(child)) {
|
||||||
return qde;
|
return qde;
|
||||||
}
|
}
|
||||||
@@ -713,14 +713,14 @@ QString QETApp::languagesPath() {
|
|||||||
bool QETApp::closeEveryEditor() {
|
bool QETApp::closeEveryEditor() {
|
||||||
// s'assure que toutes les fenetres soient visibles avant de quitter
|
// s'assure que toutes les fenetres soient visibles avant de quitter
|
||||||
restoreEveryEditor();
|
restoreEveryEditor();
|
||||||
foreach(QETProject *project, registered_projects_) {
|
for (QETProject *project: registered_projects_) {
|
||||||
project -> close();
|
project -> close();
|
||||||
}
|
}
|
||||||
bool every_window_closed = true;
|
bool every_window_closed = true;
|
||||||
foreach(QETDiagramEditor *e, diagramEditors()) {
|
for (QETDiagramEditor *e: diagramEditors()) {
|
||||||
every_window_closed = every_window_closed && e -> close();
|
every_window_closed = every_window_closed && e -> close();
|
||||||
}
|
}
|
||||||
foreach(QETElementEditor *e, elementEditors()) {
|
for (QETElementEditor *e: elementEditors()) {
|
||||||
every_window_closed = every_window_closed && e -> close();
|
every_window_closed = every_window_closed && e -> close();
|
||||||
}
|
}
|
||||||
return(every_window_closed);
|
return(every_window_closed);
|
||||||
@@ -782,8 +782,8 @@ QList<QETTitleBlockTemplateEditor *> QETApp::titleBlockTemplateEditors(QETProjec
|
|||||||
QList<QETTitleBlockTemplateEditor *> editors;
|
QList<QETTitleBlockTemplateEditor *> editors;
|
||||||
if (!project) return(editors);
|
if (!project) return(editors);
|
||||||
|
|
||||||
// foreach known template editor
|
// for known template editor
|
||||||
foreach (QETTitleBlockTemplateEditor *tbt_editor, titleBlockTemplateEditors()) {
|
for (QETTitleBlockTemplateEditor *tbt_editor: titleBlockTemplateEditors()) {
|
||||||
if (tbt_editor -> location().parentProject() == project) {
|
if (tbt_editor -> location().parentProject() == project) {
|
||||||
editors << tbt_editor;
|
editors << tbt_editor;
|
||||||
}
|
}
|
||||||
@@ -839,7 +839,7 @@ QList<QETElementEditor *> QETApp::elementEditors(QETProject *project) {
|
|||||||
if (!project) return(editors);
|
if (!project) return(editors);
|
||||||
|
|
||||||
// pour chaque editeur d'element...
|
// pour chaque editeur d'element...
|
||||||
foreach(QETElementEditor *elmt_editor, elementEditors()) {
|
for (QETElementEditor *elmt_editor: elementEditors()) {
|
||||||
// on recupere l'emplacement de l'element qu'il edite
|
// on recupere l'emplacement de l'element qu'il edite
|
||||||
ElementsLocation elmt_editor_loc(elmt_editor -> location());
|
ElementsLocation elmt_editor_loc(elmt_editor -> location());
|
||||||
|
|
||||||
@@ -867,7 +867,7 @@ void QETApp::cleanup() {
|
|||||||
*/
|
*/
|
||||||
template <class T> QList<T *> QETApp::detectWindows() const {
|
template <class T> QList<T *> QETApp::detectWindows() const {
|
||||||
QList<T *> windows;
|
QList<T *> windows;
|
||||||
foreach(QWidget *widget, topLevelWidgets()) {
|
for (QWidget *widget: topLevelWidgets()) {
|
||||||
if (!widget -> isWindow()) continue;
|
if (!widget -> isWindow()) continue;
|
||||||
if (T *window = qobject_cast<T *>(widget)) {
|
if (T *window = qobject_cast<T *>(widget)) {
|
||||||
windows << window;
|
windows << window;
|
||||||
@@ -881,7 +881,7 @@ template <class T> QList<T *> QETApp::detectWindows() const {
|
|||||||
@param visible whether detected main windows should be visible
|
@param visible whether detected main windows should be visible
|
||||||
*/
|
*/
|
||||||
template <class T> void QETApp::setMainWindowsVisible(bool visible) {
|
template <class T> void QETApp::setMainWindowsVisible(bool visible) {
|
||||||
foreach(T *e, detectWindows<T>()) {
|
for (T *e: detectWindows<T>()) {
|
||||||
setMainWindowVisible(e, visible);
|
setMainWindowVisible(e, visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -912,7 +912,7 @@ void QETApp::setMainWindowVisible(QMainWindow *window, bool visible) {
|
|||||||
window_states.insert(window, window -> saveState());
|
window_states.insert(window, window -> saveState());
|
||||||
window -> hide();
|
window -> hide();
|
||||||
// cache aussi les toolbars et les docks
|
// cache aussi les toolbars et les docks
|
||||||
foreach (QWidget *qw, floatingToolbarsAndDocksForMainWindow(window)) {
|
for (QWidget *qw: floatingToolbarsAndDocksForMainWindow(window)) {
|
||||||
qw -> hide();
|
qw -> hide();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1044,7 +1044,7 @@ void QETApp::openProjectFiles(const QStringList &files_list) {
|
|||||||
// s'il y a des editeur de schemas ouvert, on cherche ceux qui sont visibles
|
// s'il y a des editeur de schemas ouvert, on cherche ceux qui sont visibles
|
||||||
if (diagrams_editors.count()) {
|
if (diagrams_editors.count()) {
|
||||||
QList<QETDiagramEditor *> visible_diagrams_editors;
|
QList<QETDiagramEditor *> visible_diagrams_editors;
|
||||||
foreach(QETDiagramEditor *de, diagrams_editors) {
|
for (QETDiagramEditor *de: diagrams_editors) {
|
||||||
if (de -> isVisible()) visible_diagrams_editors << de;
|
if (de -> isVisible()) visible_diagrams_editors << de;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1058,7 +1058,7 @@ void QETApp::openProjectFiles(const QStringList &files_list) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ouvre les fichiers dans l'editeur ainsi choisi
|
// ouvre les fichiers dans l'editeur ainsi choisi
|
||||||
foreach(QString file, files_list) {
|
for (QString file: files_list) {
|
||||||
de_open -> openAndAddProject(file);
|
de_open -> openAndAddProject(file);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1077,7 +1077,7 @@ void QETApp::openElementFiles(const QStringList &files_list) {
|
|||||||
|
|
||||||
// evite autant que possible les doublons dans la liste fournie
|
// evite autant que possible les doublons dans la liste fournie
|
||||||
QSet<QString> files_set;
|
QSet<QString> files_set;
|
||||||
foreach(QString file, files_list) {
|
for (QString file: files_list) {
|
||||||
QString canonical_filepath = QFileInfo(file).canonicalFilePath();
|
QString canonical_filepath = QFileInfo(file).canonicalFilePath();
|
||||||
if (!canonical_filepath.isEmpty()) files_set << canonical_filepath;
|
if (!canonical_filepath.isEmpty()) files_set << canonical_filepath;
|
||||||
}
|
}
|
||||||
@@ -1088,9 +1088,9 @@ void QETApp::openElementFiles(const QStringList &files_list) {
|
|||||||
QList<QETElementEditor *> element_editors = elementEditors();
|
QList<QETElementEditor *> element_editors = elementEditors();
|
||||||
|
|
||||||
// on traite les fichiers a la queue leu leu...
|
// on traite les fichiers a la queue leu leu...
|
||||||
foreach(QString element_file, files_set) {
|
for (QString element_file: files_set) {
|
||||||
bool already_opened_in_existing_element_editor = false;
|
bool already_opened_in_existing_element_editor = false;
|
||||||
foreach(QETElementEditor *element_editor, element_editors) {
|
for (QETElementEditor *element_editor: element_editors) {
|
||||||
if (element_editor -> isEditing(element_file)) {
|
if (element_editor -> isEditing(element_file)) {
|
||||||
// ce fichier est deja ouvert dans un editeur
|
// ce fichier est deja ouvert dans un editeur
|
||||||
already_opened_in_existing_element_editor = true;
|
already_opened_in_existing_element_editor = true;
|
||||||
@@ -1120,9 +1120,9 @@ void QETApp::openElementLocations(const QList<ElementsLocation> &locations_list)
|
|||||||
QList<QETElementEditor *> element_editors = elementEditors();
|
QList<QETElementEditor *> element_editors = elementEditors();
|
||||||
|
|
||||||
// on traite les emplacements a la queue leu leu...
|
// on traite les emplacements a la queue leu leu...
|
||||||
foreach(ElementsLocation element_location, locations_list) {
|
for (ElementsLocation element_location: locations_list) {
|
||||||
bool already_opened_in_existing_element_editor = false;
|
bool already_opened_in_existing_element_editor = false;
|
||||||
foreach(QETElementEditor *element_editor, element_editors) {
|
for (QETElementEditor *element_editor: element_editors) {
|
||||||
if (element_editor -> isEditing(element_location)) {
|
if (element_editor -> isEditing(element_location)) {
|
||||||
// cet emplacement est deja ouvert dans un editeur
|
// cet emplacement est deja ouvert dans un editeur
|
||||||
already_opened_in_existing_element_editor = true;
|
already_opened_in_existing_element_editor = true;
|
||||||
@@ -1175,7 +1175,7 @@ void QETApp::openTitleBlockTemplateFiles(const QStringList &files_list) {
|
|||||||
|
|
||||||
// avoid duplicates in the provided files list
|
// avoid duplicates in the provided files list
|
||||||
QSet<QString> files_set;
|
QSet<QString> files_set;
|
||||||
foreach (QString file, files_list) {
|
for (QString file: files_list) {
|
||||||
QString canonical_filepath = QFileInfo(file).canonicalFilePath();
|
QString canonical_filepath = QFileInfo(file).canonicalFilePath();
|
||||||
if (!canonical_filepath.isEmpty()) files_set << canonical_filepath;
|
if (!canonical_filepath.isEmpty()) files_set << canonical_filepath;
|
||||||
}
|
}
|
||||||
@@ -1185,9 +1185,9 @@ void QETApp::openTitleBlockTemplateFiles(const QStringList &files_list) {
|
|||||||
// opened title block template editors
|
// opened title block template editors
|
||||||
QList<QETTitleBlockTemplateEditor *> tbt_editors = titleBlockTemplateEditors();
|
QList<QETTitleBlockTemplateEditor *> tbt_editors = titleBlockTemplateEditors();
|
||||||
|
|
||||||
foreach(QString tbt_file, files_set) {
|
for (QString tbt_file: files_set) {
|
||||||
bool already_opened_in_existing_tbt_editor = false;
|
bool already_opened_in_existing_tbt_editor = false;
|
||||||
foreach(QETTitleBlockTemplateEditor *tbt_editor, tbt_editors) {
|
for (QETTitleBlockTemplateEditor *tbt_editor: tbt_editors) {
|
||||||
if (tbt_editor -> isEditing(tbt_file)) {
|
if (tbt_editor -> isEditing(tbt_file)) {
|
||||||
// this file is already opened
|
// this file is already opened
|
||||||
already_opened_in_existing_tbt_editor = true;
|
already_opened_in_existing_tbt_editor = true;
|
||||||
@@ -1267,7 +1267,7 @@ void QETApp::aboutQET() {
|
|||||||
*/
|
*/
|
||||||
QList<QWidget *> QETApp::floatingToolbarsAndDocksForMainWindow(QMainWindow *window) const {
|
QList<QWidget *> QETApp::floatingToolbarsAndDocksForMainWindow(QMainWindow *window) const {
|
||||||
QList<QWidget *> widgets;
|
QList<QWidget *> widgets;
|
||||||
foreach(QWidget *qw, topLevelWidgets()) {
|
for (QWidget *qw: topLevelWidgets()) {
|
||||||
if (!qw -> isWindow()) continue;
|
if (!qw -> isWindow()) continue;
|
||||||
if (qobject_cast<QToolBar *>(qw) || qobject_cast<QDockWidget *>(qw)) {
|
if (qobject_cast<QToolBar *>(qw) || qobject_cast<QDockWidget *>(qw)) {
|
||||||
if (qw -> parent() == window) widgets << qw;
|
if (qw -> parent() == window) widgets << qw;
|
||||||
@@ -1455,7 +1455,7 @@ void QETApp::initSystemTray() {
|
|||||||
*/
|
*/
|
||||||
template <class T> void QETApp::addWindowsListToMenu(QMenu *menu, const QList<T *> &windows) {
|
template <class T> void QETApp::addWindowsListToMenu(QMenu *menu, const QList<T *> &windows) {
|
||||||
menu -> addSeparator();
|
menu -> addSeparator();
|
||||||
foreach (QMainWindow *window, windows) {
|
for (QMainWindow *window: windows) {
|
||||||
QAction *current_menu = menu -> addAction(window -> windowTitle());
|
QAction *current_menu = menu -> addAction(window -> windowTitle());
|
||||||
current_menu -> setCheckable(true);
|
current_menu -> setCheckable(true);
|
||||||
current_menu -> setChecked(window -> isVisible());
|
current_menu -> setChecked(window -> isVisible());
|
||||||
@@ -1547,19 +1547,19 @@ void QETApp::fetchWindowStats(
|
|||||||
) {
|
) {
|
||||||
// compte le nombre de schemas visibles
|
// compte le nombre de schemas visibles
|
||||||
int visible_diagrams = 0;
|
int visible_diagrams = 0;
|
||||||
foreach(QMainWindow *w, diagrams) if (w -> isVisible()) ++ visible_diagrams;
|
for (QMainWindow *w: diagrams) if (w -> isVisible()) ++ visible_diagrams;
|
||||||
every_diagram_reduced = !visible_diagrams;
|
every_diagram_reduced = !visible_diagrams;
|
||||||
every_diagram_visible = visible_diagrams == diagrams.count();
|
every_diagram_visible = visible_diagrams == diagrams.count();
|
||||||
|
|
||||||
// compte le nombre de schemas visibles
|
// compte le nombre de schemas visibles
|
||||||
int visible_elements = 0;
|
int visible_elements = 0;
|
||||||
foreach(QMainWindow *w, elements) if (w -> isVisible()) ++ visible_elements;
|
for (QMainWindow *w: elements) if (w -> isVisible()) ++ visible_elements;
|
||||||
every_element_reduced = !visible_elements;
|
every_element_reduced = !visible_elements;
|
||||||
every_element_visible = visible_elements == elements.count();
|
every_element_visible = visible_elements == elements.count();
|
||||||
|
|
||||||
// count visible template editors
|
// count visible template editors
|
||||||
int visible_templates = 0;
|
int visible_templates = 0;
|
||||||
foreach(QMainWindow *window, tbtemplates) {
|
for (QMainWindow *window: tbtemplates) {
|
||||||
if (window -> isVisible()) ++ visible_templates;
|
if (window -> isVisible()) ++ visible_templates;
|
||||||
}
|
}
|
||||||
every_template_reduced = !visible_templates;
|
every_template_reduced = !visible_templates;
|
||||||
@@ -1683,7 +1683,7 @@ QETProject *QETApp::project(const uint &id) {
|
|||||||
@return l'id du projet en parametre si celui-ci est enregistre, -1 sinon
|
@return l'id du projet en parametre si celui-ci est enregistre, -1 sinon
|
||||||
*/
|
*/
|
||||||
int QETApp::projectId(const QETProject *project) {
|
int QETApp::projectId(const QETProject *project) {
|
||||||
foreach(int id, registered_projects_.keys()) {
|
for (int id: registered_projects_.keys()) {
|
||||||
if (registered_projects_[id] == project) {
|
if (registered_projects_[id] == project) {
|
||||||
return(id);
|
return(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ void QETArguments::parseArguments(const QList<QString> &arguments) {
|
|||||||
clear();
|
clear();
|
||||||
|
|
||||||
// separe les fichiers des options
|
// separe les fichiers des options
|
||||||
foreach(QString argument, arguments) {
|
for (QString argument: arguments) {
|
||||||
QFileInfo argument_info(argument);
|
QFileInfo argument_info(argument);
|
||||||
if (argument_info.exists()) {
|
if (argument_info.exists()) {
|
||||||
// on exprime les chemins des fichiers en absolu
|
// on exprime les chemins des fichiers en absolu
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
|||||||
if (files.count())
|
if (files.count())
|
||||||
{
|
{
|
||||||
//So we open this files
|
//So we open this files
|
||||||
foreach(QString file, files)
|
for (QString file: files)
|
||||||
if (openAndAddProject(file, false))
|
if (openAndAddProject(file, false))
|
||||||
++ opened_projects;
|
++ opened_projects;
|
||||||
}
|
}
|
||||||
@@ -282,8 +282,8 @@ void QETDiagramEditor::setUpActions()
|
|||||||
m_draw_grid->setCheckable(true);
|
m_draw_grid->setCheckable(true);
|
||||||
m_draw_grid->setChecked(true);
|
m_draw_grid->setChecked(true);
|
||||||
connect(m_draw_grid, &QAction::triggered, [this](bool checked) {
|
connect(m_draw_grid, &QAction::triggered, [this](bool checked) {
|
||||||
foreach (ProjectView *prjv, this->openedProjects())
|
for (ProjectView *prjv: this->openedProjects())
|
||||||
foreach (Diagram *d, prjv->project()->diagrams()) {
|
for (Diagram *d: prjv->project()->diagrams()) {
|
||||||
d->setDisplayGrid(checked);
|
d->setDisplayGrid(checked);
|
||||||
d->update();
|
d->update();
|
||||||
}
|
}
|
||||||
@@ -436,7 +436,7 @@ void QETDiagramEditor::setUpActions()
|
|||||||
add_ellipse ->setData("ellipse");
|
add_ellipse ->setData("ellipse");
|
||||||
add_polyline ->setData("polyline");
|
add_polyline ->setData("polyline");
|
||||||
|
|
||||||
foreach (QAction *action, m_add_item_actions_group.actions()) action->setCheckable(true);
|
for (QAction *action: m_add_item_actions_group.actions()) action->setCheckable(true);
|
||||||
connect(&m_add_item_actions_group, &QActionGroup::triggered, this, &QETDiagramEditor::addItemGroupTriggered);
|
connect(&m_add_item_actions_group, &QActionGroup::triggered, this, &QETDiagramEditor::addItemGroupTriggered);
|
||||||
|
|
||||||
//Keyboard shortcut
|
//Keyboard shortcut
|
||||||
@@ -657,7 +657,7 @@ void QETDiagramEditor::closeEvent(QCloseEvent *qce) {
|
|||||||
else showNormal();
|
else showNormal();
|
||||||
}
|
}
|
||||||
// sinon demande la permission de fermer chaque projet
|
// sinon demande la permission de fermer chaque projet
|
||||||
foreach(ProjectView *project, openedProjects()) {
|
for (ProjectView *project: openedProjects()) {
|
||||||
if (!closeProject(project)) {
|
if (!closeProject(project)) {
|
||||||
can_quit = false;
|
can_quit = false;
|
||||||
qce -> ignore();
|
qce -> ignore();
|
||||||
@@ -985,7 +985,7 @@ bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) {
|
|||||||
QList<ProjectView *> QETDiagramEditor::openedProjects() const {
|
QList<ProjectView *> QETDiagramEditor::openedProjects() const {
|
||||||
QList<ProjectView *> result;
|
QList<ProjectView *> result;
|
||||||
QList<QMdiSubWindow *> window_list(workspace.subWindowList());
|
QList<QMdiSubWindow *> window_list(workspace.subWindowList());
|
||||||
foreach(QMdiSubWindow *window, window_list) {
|
for (QMdiSubWindow *window: window_list) {
|
||||||
if (ProjectView *project_view = qobject_cast<ProjectView *>(window -> widget())) {
|
if (ProjectView *project_view = qobject_cast<ProjectView *>(window -> widget())) {
|
||||||
result << project_view;
|
result << project_view;
|
||||||
}
|
}
|
||||||
@@ -1054,7 +1054,7 @@ CustomElement *QETDiagramEditor::currentCustomElement() const {
|
|||||||
@return la vue sur le projet contenant ce schema ou 0 s'il n'y en a pas
|
@return la vue sur le projet contenant ce schema ou 0 s'il n'y en a pas
|
||||||
*/
|
*/
|
||||||
ProjectView *QETDiagramEditor::findProject(DiagramView *diagram_view) const {
|
ProjectView *QETDiagramEditor::findProject(DiagramView *diagram_view) const {
|
||||||
foreach(ProjectView *project_view, openedProjects()) {
|
for (ProjectView *project_view: openedProjects()) {
|
||||||
if (project_view -> diagrams().contains(diagram_view)) {
|
if (project_view -> diagrams().contains(diagram_view)) {
|
||||||
return(project_view);
|
return(project_view);
|
||||||
}
|
}
|
||||||
@@ -1068,8 +1068,8 @@ ProjectView *QETDiagramEditor::findProject(DiagramView *diagram_view) const {
|
|||||||
@return la vue sur le projet contenant ce schema ou 0 s'il n'y en a pas
|
@return la vue sur le projet contenant ce schema ou 0 s'il n'y en a pas
|
||||||
*/
|
*/
|
||||||
ProjectView *QETDiagramEditor::findProject(Diagram *diagram) const {
|
ProjectView *QETDiagramEditor::findProject(Diagram *diagram) const {
|
||||||
foreach(ProjectView *project_view, openedProjects()) {
|
for (ProjectView *project_view: openedProjects()) {
|
||||||
foreach(DiagramView *diagram_view, project_view -> diagrams()) {
|
for (DiagramView *diagram_view: project_view -> diagrams()) {
|
||||||
if (diagram_view -> diagram() == diagram) {
|
if (diagram_view -> diagram() == diagram) {
|
||||||
return(project_view);
|
return(project_view);
|
||||||
}
|
}
|
||||||
@@ -1083,7 +1083,7 @@ ProjectView *QETDiagramEditor::findProject(Diagram *diagram) const {
|
|||||||
@return la vue du projet passe en parametre
|
@return la vue du projet passe en parametre
|
||||||
*/
|
*/
|
||||||
ProjectView *QETDiagramEditor::findProject(QETProject *project) const {
|
ProjectView *QETDiagramEditor::findProject(QETProject *project) const {
|
||||||
foreach(ProjectView *opened_project, openedProjects()) {
|
for (ProjectView *opened_project: openedProjects()) {
|
||||||
if (opened_project -> project() == project) {
|
if (opened_project -> project() == project) {
|
||||||
return(opened_project);
|
return(opened_project);
|
||||||
}
|
}
|
||||||
@@ -1097,7 +1097,7 @@ ProjectView *QETDiagramEditor::findProject(QETProject *project) const {
|
|||||||
celui-ci n'a pas ete trouve
|
celui-ci n'a pas ete trouve
|
||||||
*/
|
*/
|
||||||
ProjectView *QETDiagramEditor::findProject(const QString &filepath) const {
|
ProjectView *QETDiagramEditor::findProject(const QString &filepath) const {
|
||||||
foreach(ProjectView *opened_project, openedProjects()) {
|
for (ProjectView *opened_project: openedProjects()) {
|
||||||
if (QETProject *project = opened_project -> project()) {
|
if (QETProject *project = opened_project -> project()) {
|
||||||
if (project -> filePath() == filepath) {
|
if (project -> filePath() == filepath) {
|
||||||
return(opened_project);
|
return(opened_project);
|
||||||
@@ -1113,7 +1113,7 @@ ProjectView *QETDiagramEditor::findProject(const QString &filepath) const {
|
|||||||
celui-ci n'a pas ete trouve.
|
celui-ci n'a pas ete trouve.
|
||||||
*/
|
*/
|
||||||
QMdiSubWindow *QETDiagramEditor::subWindowForWidget(QWidget *widget) const {
|
QMdiSubWindow *QETDiagramEditor::subWindowForWidget(QWidget *widget) const {
|
||||||
foreach(QMdiSubWindow *sub_window, workspace.subWindowList()) {
|
for (QMdiSubWindow *sub_window: workspace.subWindowList()) {
|
||||||
if (sub_window -> widget() == widget) {
|
if (sub_window -> widget() == widget) {
|
||||||
return(sub_window);
|
return(sub_window);
|
||||||
}
|
}
|
||||||
@@ -1284,7 +1284,7 @@ void QETDiagramEditor::rowColumnGroupTriggered(QAction *action)
|
|||||||
void QETDiagramEditor::slot_setSelectionMode()
|
void QETDiagramEditor::slot_setSelectionMode()
|
||||||
{
|
{
|
||||||
if (ProjectView *pv = currentProject())
|
if (ProjectView *pv = currentProject())
|
||||||
foreach(DiagramView *dv, pv -> diagrams())
|
for (DiagramView *dv: pv -> diagrams())
|
||||||
dv -> setSelectionMode();
|
dv -> setSelectionMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1295,7 +1295,7 @@ void QETDiagramEditor::slot_setSelectionMode()
|
|||||||
void QETDiagramEditor::slot_setVisualisationMode()
|
void QETDiagramEditor::slot_setVisualisationMode()
|
||||||
{
|
{
|
||||||
if (ProjectView *pv = currentProject())
|
if (ProjectView *pv = currentProject())
|
||||||
foreach(DiagramView *dv, pv -> diagrams())
|
for (DiagramView *dv: pv -> diagrams())
|
||||||
dv -> setVisualisationMode();
|
dv -> setVisualisationMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1506,7 +1506,7 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view)
|
|||||||
{
|
{
|
||||||
if (!project_view) return;
|
if (!project_view) return;
|
||||||
|
|
||||||
foreach(DiagramView *dv, project_view -> diagrams())
|
for (DiagramView *dv: project_view -> diagrams())
|
||||||
diagramWasAdded(dv);
|
diagramWasAdded(dv);
|
||||||
|
|
||||||
//Manage the close event of project
|
//Manage the close event of project
|
||||||
@@ -1543,7 +1543,7 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view)
|
|||||||
*/
|
*/
|
||||||
QList<QString> QETDiagramEditor::editedFiles() const {
|
QList<QString> QETDiagramEditor::editedFiles() const {
|
||||||
QList<QString> edited_files_list;
|
QList<QString> edited_files_list;
|
||||||
foreach (ProjectView *project_view, openedProjects()) {
|
for (ProjectView *project_view: openedProjects()) {
|
||||||
QString diagram_file(project_view -> project() -> filePath());
|
QString diagram_file(project_view -> project() -> filePath());
|
||||||
if (!diagram_file.isEmpty()) {
|
if (!diagram_file.isEmpty()) {
|
||||||
edited_files_list << QFileInfo(diagram_file).canonicalFilePath();
|
edited_files_list << QFileInfo(diagram_file).canonicalFilePath();
|
||||||
@@ -1566,7 +1566,7 @@ ProjectView *QETDiagramEditor::viewForFile(const QString &filepath) const {
|
|||||||
// QFileInfo returns an empty path for non-existent files
|
// QFileInfo returns an empty path for non-existent files
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
foreach (ProjectView *project_view, openedProjects()) {
|
for (ProjectView *project_view: openedProjects()) {
|
||||||
QString project_can_file_path = QFileInfo(project_view -> project() -> filePath()).canonicalFilePath();
|
QString project_can_file_path = QFileInfo(project_view -> project() -> filePath()).canonicalFilePath();
|
||||||
if (project_can_file_path == searched_can_file_path) {
|
if (project_can_file_path == searched_can_file_path) {
|
||||||
return(project_view);
|
return(project_view);
|
||||||
@@ -1616,7 +1616,7 @@ DiagramView *QETDiagramEditor::acessCurrentDiagramView () {
|
|||||||
*/
|
*/
|
||||||
void QETDiagramEditor::slot_updateWindowsMenu() {
|
void QETDiagramEditor::slot_updateWindowsMenu() {
|
||||||
// nettoyage du menu
|
// nettoyage du menu
|
||||||
foreach(QAction *a, windows_menu -> actions()) windows_menu -> removeAction(a);
|
for (QAction *a: windows_menu -> actions()) windows_menu -> removeAction(a);
|
||||||
|
|
||||||
// actions de fermeture
|
// actions de fermeture
|
||||||
windows_menu -> addAction(close_file);
|
windows_menu -> addAction(close_file);
|
||||||
@@ -1642,7 +1642,7 @@ void QETDiagramEditor::slot_updateWindowsMenu() {
|
|||||||
|
|
||||||
if (!windows.isEmpty()) windows_menu -> addSeparator();
|
if (!windows.isEmpty()) windows_menu -> addSeparator();
|
||||||
QActionGroup *windows_actions = new QActionGroup(this);
|
QActionGroup *windows_actions = new QActionGroup(this);
|
||||||
foreach(ProjectView *project_view, windows) {
|
for (ProjectView *project_view: windows) {
|
||||||
QString pv_title = project_view -> windowTitle();
|
QString pv_title = project_view -> windowTitle();
|
||||||
QAction *action = windows_menu -> addAction(pv_title);
|
QAction *action = windows_menu -> addAction(pv_title);
|
||||||
windows_actions -> addAction(action);
|
windows_actions -> addAction(action);
|
||||||
@@ -2035,7 +2035,7 @@ void QETDiagramEditor::removeDiagramFromProject() {
|
|||||||
|
|
||||||
// if the removed diagram was a folio sheet, then delete all the remaining folio sheets also.
|
// if the removed diagram was a folio sheet, then delete all the remaining folio sheets also.
|
||||||
if (isFolioList) {
|
if (isFolioList) {
|
||||||
foreach (DiagramView *diag, current_project -> diagrams()) {
|
for (DiagramView *diag: current_project -> diagrams()) {
|
||||||
if (dynamic_cast<DiagramFolioList *>(diag -> diagram())) {
|
if (dynamic_cast<DiagramFolioList *>(diag -> diagram())) {
|
||||||
current_project -> removeDiagram(diag);
|
current_project -> removeDiagram(diag);
|
||||||
}
|
}
|
||||||
@@ -2044,7 +2044,7 @@ void QETDiagramEditor::removeDiagramFromProject() {
|
|||||||
// else if after diagram removal, the total diagram quantity becomes a factor of 58, then
|
// else if after diagram removal, the total diagram quantity becomes a factor of 58, then
|
||||||
// remove one (last) folio sheet.
|
// remove one (last) folio sheet.
|
||||||
} else if (current_project -> diagrams().size() % 58 == 0) {
|
} else if (current_project -> diagrams().size() % 58 == 0) {
|
||||||
foreach (DiagramView *diag, current_project -> diagrams()) {
|
for (DiagramView *diag: current_project -> diagrams()) {
|
||||||
DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diag -> diagram());
|
DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diag -> diagram());
|
||||||
if (ptr && ptr -> getId() == current_project -> project() -> getFolioSheetsQuantity() - 1) {
|
if (ptr && ptr -> getId() == current_project -> project() -> getFolioSheetsQuantity() - 1) {
|
||||||
current_project -> removeDiagram(diag);
|
current_project -> removeDiagram(diag);
|
||||||
|
|||||||
@@ -280,13 +280,13 @@ QHash<ConductorSegmentProfile *, qreal> Conductor::shareOffsetBetweenSegments(
|
|||||||
) const {
|
) const {
|
||||||
// construit le QHash qui sera retourne
|
// construit le QHash qui sera retourne
|
||||||
QHash<ConductorSegmentProfile *, qreal> segments_hash;
|
QHash<ConductorSegmentProfile *, qreal> segments_hash;
|
||||||
foreach(ConductorSegmentProfile *csp, segments_list) {
|
for (ConductorSegmentProfile *csp: segments_list) {
|
||||||
segments_hash.insert(csp, csp -> length);
|
segments_hash.insert(csp, csp -> length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// memorise le signe de la longueur de chaque segement
|
// memorise le signe de la longueur de chaque segement
|
||||||
QHash<ConductorSegmentProfile *, int> segments_signs;
|
QHash<ConductorSegmentProfile *, int> segments_signs;
|
||||||
foreach(ConductorSegmentProfile *csp, segments_hash.keys()) {
|
for (ConductorSegmentProfile *csp: segments_hash.keys()) {
|
||||||
segments_signs.insert(csp, getSign(csp -> length));
|
segments_signs.insert(csp, getSign(csp -> length));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,12 +297,12 @@ QHash<ConductorSegmentProfile *, qreal> Conductor::shareOffsetBetweenSegments(
|
|||||||
while (remaining_offset > precision || remaining_offset < -precision) {
|
while (remaining_offset > precision || remaining_offset < -precision) {
|
||||||
// recupere le nombre de segments differents ayant une longueur non nulle
|
// recupere le nombre de segments differents ayant une longueur non nulle
|
||||||
uint segments_count = 0;
|
uint segments_count = 0;
|
||||||
foreach(ConductorSegmentProfile *csp, segments_hash.keys()) if (segments_hash[csp]) ++ segments_count;
|
for (ConductorSegmentProfile *csp: segments_hash.keys()) if (segments_hash[csp]) ++ segments_count;
|
||||||
//qDebug() << " remaining_offset =" << remaining_offset;
|
//qDebug() << " remaining_offset =" << remaining_offset;
|
||||||
qreal local_offset = remaining_offset / segments_count;
|
qreal local_offset = remaining_offset / segments_count;
|
||||||
//qDebug() << " repartition d'un offset local de" << local_offset << "px sur" << segments_count << "segments";
|
//qDebug() << " repartition d'un offset local de" << local_offset << "px sur" << segments_count << "segments";
|
||||||
remaining_offset = 0.0;
|
remaining_offset = 0.0;
|
||||||
foreach(ConductorSegmentProfile *csp, segments_hash.keys()) {
|
for (ConductorSegmentProfile *csp: segments_hash.keys()) {
|
||||||
// ignore les segments de longueur nulle
|
// ignore les segments de longueur nulle
|
||||||
if (!segments_hash[csp]) continue;
|
if (!segments_hash[csp]) continue;
|
||||||
// applique l'offset au segment
|
// applique l'offset au segment
|
||||||
@@ -526,7 +526,7 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi
|
|||||||
qp -> setPen(final_conductor_pen);
|
qp -> setPen(final_conductor_pen);
|
||||||
qp -> setBrush(junction_brush);
|
qp -> setBrush(junction_brush);
|
||||||
qp -> setRenderHint(QPainter::Antialiasing, true);
|
qp -> setRenderHint(QPainter::Antialiasing, true);
|
||||||
foreach(QPointF point, junctions_list) {
|
for (QPointF point: junctions_list) {
|
||||||
qp -> drawEllipse(QRectF(point.x() - 1.5, point.y() - 1.5, 3.0, 3.0));
|
qp -> drawEllipse(QRectF(point.x() - 1.5, point.y() - 1.5, 3.0, 3.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -764,7 +764,7 @@ QPainterPath Conductor::shape() const
|
|||||||
https://qelectrotech.org/forum/viewtopic.php?pid=5067#p5067
|
https://qelectrotech.org/forum/viewtopic.php?pid=5067#p5067
|
||||||
**/
|
**/
|
||||||
// if (isSelected()) {
|
// if (isSelected()) {
|
||||||
// foreach (QRectF rect, m_handler.handlerRect(handlerPoints())) {
|
// for (QRectF rect, m_handler.handlerRect(handlerPoints())) {
|
||||||
// shape_.addRect(rect);
|
// shape_.addRect(rect);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
@@ -792,7 +792,7 @@ uint Conductor::segmentsCount(QET::ConductorSegmentType type) const {
|
|||||||
QList<ConductorSegment *> segments_list = segmentsList();
|
QList<ConductorSegment *> segments_list = segmentsList();
|
||||||
if (type == QET::Both) return(segments_list.count());
|
if (type == QET::Both) return(segments_list.count());
|
||||||
uint nb_seg = 0;
|
uint nb_seg = 0;
|
||||||
foreach(ConductorSegment *conductor_segment, segments_list) {
|
for (ConductorSegment *conductor_segment: segments_list) {
|
||||||
if (conductor_segment -> type() == type) ++ nb_seg;
|
if (conductor_segment -> type() == type) ++ nb_seg;
|
||||||
}
|
}
|
||||||
return(nb_seg);
|
return(nb_seg);
|
||||||
@@ -895,7 +895,7 @@ QDomElement Conductor::toXml(QDomDocument &dom_document, QHash<Terminal *, int>
|
|||||||
{
|
{
|
||||||
// parcours et export des segments
|
// parcours et export des segments
|
||||||
QDomElement current_segment;
|
QDomElement current_segment;
|
||||||
foreach(ConductorSegment *segment, segmentsList())
|
for (ConductorSegment *segment: segmentsList())
|
||||||
{
|
{
|
||||||
current_segment = dom_document.createElement("segment");
|
current_segment = dom_document.createElement("segment");
|
||||||
current_segment.setAttribute("orientation", segment -> isHorizontal() ? "horizontal" : "vertical");
|
current_segment.setAttribute("orientation", segment -> isHorizontal() ? "horizontal" : "vertical");
|
||||||
@@ -954,8 +954,8 @@ bool Conductor::pathFromXml(const QDomElement &e) {
|
|||||||
|
|
||||||
// les longueurs recueillies doivent etre coherentes avec les positions des bornes
|
// les longueurs recueillies doivent etre coherentes avec les positions des bornes
|
||||||
qreal width = 0.0, height = 0.0;
|
qreal width = 0.0, height = 0.0;
|
||||||
foreach (qreal t, segments_x) width += t;
|
for (qreal t: segments_x) width += t;
|
||||||
foreach (qreal t, segments_y) height += t;
|
for (qreal t: segments_y) height += t;
|
||||||
QPointF t1 = terminal1 -> dockConductor();
|
QPointF t1 = terminal1 -> dockConductor();
|
||||||
QPointF t2 = terminal2 -> dockConductor();
|
QPointF t2 = terminal2 -> dockConductor();
|
||||||
qreal expected_width = t2.x() - t1.x();
|
qreal expected_width = t2.x() - t1.x();
|
||||||
@@ -1009,7 +1009,7 @@ QVector<QPointF> Conductor::handlerPoints() const
|
|||||||
|
|
||||||
QVector <QPointF> middle_points;
|
QVector <QPointF> middle_points;
|
||||||
|
|
||||||
foreach(ConductorSegment *segment, sl)
|
for (ConductorSegment *segment: sl)
|
||||||
middle_points.append(segment->middle());
|
middle_points.append(segment->middle());
|
||||||
|
|
||||||
return middle_points;
|
return middle_points;
|
||||||
@@ -1145,7 +1145,7 @@ void Conductor::calculateTextItemPosition() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//At this point this conductor is the longuest conductor we hide all text of conductor_list
|
//At this point this conductor is the longuest conductor we hide all text of conductor_list
|
||||||
foreach (Conductor *c, relatedPotentialConductors(false)) {
|
for (Conductor *c: relatedPotentialConductors(false)) {
|
||||||
c -> textItem() -> setVisible(false);
|
c -> textItem() -> setVisible(false);
|
||||||
}
|
}
|
||||||
//Make sure text item is visible
|
//Make sure text item is visible
|
||||||
@@ -1295,7 +1295,7 @@ void Conductor::setPropertyToPotential(const ConductorProperties &property, bool
|
|||||||
setProperties(property);
|
setProperties(property);
|
||||||
QSet <Conductor *> potential_list = relatedPotentialConductors();
|
QSet <Conductor *> potential_list = relatedPotentialConductors();
|
||||||
|
|
||||||
foreach(Conductor *other_conductor, potential_list)
|
for (Conductor *other_conductor: potential_list)
|
||||||
{
|
{
|
||||||
if (only_text)
|
if (only_text)
|
||||||
{
|
{
|
||||||
@@ -1400,7 +1400,7 @@ void Conductor::displayedTextChanged()
|
|||||||
{
|
{
|
||||||
undo->setText(tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
|
undo->setText(tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
|
||||||
|
|
||||||
foreach (Conductor *potential_conductor, relatedPotentialConductors())
|
for (Conductor *potential_conductor: relatedPotentialConductors())
|
||||||
{
|
{
|
||||||
old_value.setValue(potential_conductor->properties());
|
old_value.setValue(potential_conductor->properties());
|
||||||
ConductorProperties new_properties = potential_conductor->properties();
|
ConductorProperties new_properties = potential_conductor->properties();
|
||||||
@@ -1436,7 +1436,7 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(const bool all_diagram,
|
|||||||
this_terminal << terminal1 << terminal2;
|
this_terminal << terminal1 << terminal2;
|
||||||
|
|
||||||
// Return all conductor of terminal 1 and 2
|
// Return all conductor of terminal 1 and 2
|
||||||
foreach (Terminal *terminal, this_terminal) {
|
for (Terminal *terminal: this_terminal) {
|
||||||
if (!t_list -> contains(terminal)) {
|
if (!t_list -> contains(terminal)) {
|
||||||
t_list -> append(terminal);
|
t_list -> append(terminal);
|
||||||
QList <Conductor *> other_conductors_list_t = terminal -> conductors();
|
QList <Conductor *> other_conductors_list_t = terminal -> conductors();
|
||||||
@@ -1450,7 +1450,7 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(const bool all_diagram,
|
|||||||
|
|
||||||
other_conductors_list_t.removeAll(this);
|
other_conductors_list_t.removeAll(this);
|
||||||
// Research the conductors connected to conductors already found
|
// Research the conductors connected to conductors already found
|
||||||
foreach (Conductor *c, other_conductors_list_t) {
|
for (Conductor *c: other_conductors_list_t) {
|
||||||
other_conductors += c -> relatedPotentialConductors(all_diagram, t_list);
|
other_conductors += c -> relatedPotentialConductors(all_diagram, t_list);
|
||||||
}
|
}
|
||||||
other_conductors += other_conductors_list_t.toSet();
|
other_conductors += other_conductors_list_t.toSet();
|
||||||
@@ -1554,7 +1554,7 @@ QList<QPointF> Conductor::junctions() const {
|
|||||||
// determine si le point est une bifurcation ou non
|
// determine si le point est une bifurcation ou non
|
||||||
bool is_bend = false;
|
bool is_bend = false;
|
||||||
Qt::Corner current_bend_type = Qt::TopLeftCorner;
|
Qt::Corner current_bend_type = Qt::TopLeftCorner;
|
||||||
foreach(ConductorBend cb, bends_list) {
|
for (ConductorBend cb: bends_list) {
|
||||||
if (cb.first == point) {
|
if (cb.first == point) {
|
||||||
is_bend = true;
|
is_bend = true;
|
||||||
current_bend_type = cb.second;
|
current_bend_type = cb.second;
|
||||||
@@ -1566,7 +1566,7 @@ QList<QPointF> Conductor::junctions() const {
|
|||||||
|
|
||||||
bool is_junction = false;
|
bool is_junction = false;
|
||||||
QPointF scene_point = mapToScene(point);
|
QPointF scene_point = mapToScene(point);
|
||||||
foreach(Conductor *c, other_conductors) {
|
for (Conductor *c: other_conductors) {
|
||||||
// exprime le point dans les coordonnees de l'autre conducteur
|
// exprime le point dans les coordonnees de l'autre conducteur
|
||||||
QPointF conductor_point = c -> mapFromScene(scene_point);
|
QPointF conductor_point = c -> mapFromScene(scene_point);
|
||||||
// recupere les segments de l'autre conducteur
|
// recupere les segments de l'autre conducteur
|
||||||
@@ -1580,7 +1580,7 @@ QList<QPointF> Conductor::junctions() const {
|
|||||||
is_junction = true;
|
is_junction = true;
|
||||||
// ce point commun ne doit pas etre une bifurcation identique a celle-ci
|
// ce point commun ne doit pas etre une bifurcation identique a celle-ci
|
||||||
QList<ConductorBend> other_conductor_bends = c -> bends();
|
QList<ConductorBend> other_conductor_bends = c -> bends();
|
||||||
foreach(ConductorBend cb, other_conductor_bends) {
|
for (ConductorBend cb: other_conductor_bends) {
|
||||||
if (cb.first == conductor_point && cb.second == current_bend_type) {
|
if (cb.first == conductor_point && cb.second == current_bend_type) {
|
||||||
is_junction = false;
|
is_junction = false;
|
||||||
}
|
}
|
||||||
@@ -1714,7 +1714,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
|
|||||||
QList<QPolygonF> polygons = polygon.simplified().toSubpathPolygons();
|
QList<QPolygonF> polygons = polygon.simplified().toSubpathPolygons();
|
||||||
QList<QLineF> lines;
|
QList<QLineF> lines;
|
||||||
QList<QPointF> points;
|
QList<QPointF> points;
|
||||||
foreach(QPolygonF polygon, polygons) {
|
for (QPolygonF polygon: polygons) {
|
||||||
if (polygon.count() <= 1) continue;
|
if (polygon.count() <= 1) continue;
|
||||||
|
|
||||||
// on recense les lignes et les points
|
// on recense les lignes et les points
|
||||||
@@ -1727,7 +1727,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
|
|||||||
// on fait des projetes orthogonaux du point sur les differents segments du
|
// on fait des projetes orthogonaux du point sur les differents segments du
|
||||||
// polygone, en les triant par longueur croissante
|
// polygone, en les triant par longueur croissante
|
||||||
QMap<qreal, QPointF> intersections;
|
QMap<qreal, QPointF> intersections;
|
||||||
foreach (QLineF line, lines) {
|
for (QLineF line: lines) {
|
||||||
QPointF intersection_point;
|
QPointF intersection_point;
|
||||||
if (QET::orthogonalProjection(point, line, &intersection_point)) {
|
if (QET::orthogonalProjection(point, line, &intersection_point)) {
|
||||||
intersections.insert(QLineF(intersection_point, point).length(), intersection_point);
|
intersections.insert(QLineF(intersection_point, point).length(), intersection_point);
|
||||||
@@ -1764,7 +1764,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
|
|||||||
Conductor * longuestConductorInPotential(Conductor *conductor, bool all_diagram) {
|
Conductor * longuestConductorInPotential(Conductor *conductor, bool all_diagram) {
|
||||||
Conductor *longuest_conductor = conductor;
|
Conductor *longuest_conductor = conductor;
|
||||||
//Search the longuest conductor
|
//Search the longuest conductor
|
||||||
foreach (Conductor *c, conductor -> relatedPotentialConductors(all_diagram))
|
for (Conductor *c: conductor -> relatedPotentialConductors(all_diagram))
|
||||||
if (c -> length() > longuest_conductor -> length())
|
if (c -> length() > longuest_conductor -> length())
|
||||||
longuest_conductor = c;
|
longuest_conductor = c;
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ void CrossRefItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
m_hovered_contact->setSelected(true);
|
m_hovered_contact->setSelected(true);
|
||||||
|
|
||||||
//Zoom to the linked slave element
|
//Zoom to the linked slave element
|
||||||
foreach(QGraphicsView *view, m_hovered_contact->diagram()->views())
|
for (QGraphicsView *view: m_hovered_contact->diagram()->views())
|
||||||
{
|
{
|
||||||
QRectF fit = m_hovered_contact->sceneBoundingRect();
|
QRectF fit = m_hovered_contact->sceneBoundingRect();
|
||||||
fit.adjust(-200, -200, 200, 200);
|
fit.adjust(-200, -200, 200, 200);
|
||||||
@@ -230,7 +230,7 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
|
|
||||||
if (m_hovered_contact)
|
if (m_hovered_contact)
|
||||||
{
|
{
|
||||||
foreach(QRectF rect, m_hovered_contacts_map.values(m_hovered_contact))
|
for (QRectF rect: m_hovered_contacts_map.values(m_hovered_contact))
|
||||||
{
|
{
|
||||||
//Mouse hover the same rect than previous hover event
|
//Mouse hover the same rect than previous hover event
|
||||||
if (rect.contains(pos))
|
if (rect.contains(pos))
|
||||||
@@ -243,9 +243,9 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
//At this point, mouse don't hover previous rect
|
//At this point, mouse don't hover previous rect
|
||||||
m_hovered_contact = nullptr;
|
m_hovered_contact = nullptr;
|
||||||
|
|
||||||
foreach (Element *elmt, m_hovered_contacts_map.keys())
|
for (Element *elmt: m_hovered_contacts_map.keys())
|
||||||
{
|
{
|
||||||
foreach(QRectF rect, m_hovered_contacts_map.values(elmt))
|
for (QRectF rect: m_hovered_contacts_map.values(elmt))
|
||||||
{
|
{
|
||||||
//Mouse hover a contact
|
//Mouse hover a contact
|
||||||
if (rect.contains(pos))
|
if (rect.contains(pos))
|
||||||
@@ -261,9 +261,9 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (Element *elmt, m_hovered_contacts_map.keys())
|
for (Element *elmt: m_hovered_contacts_map.keys())
|
||||||
{
|
{
|
||||||
foreach(QRectF rect, m_hovered_contacts_map.values(elmt))
|
for (QRectF rect: m_hovered_contacts_map.values(elmt))
|
||||||
{
|
{
|
||||||
//Mouse hover a contact
|
//Mouse hover a contact
|
||||||
if (rect.contains(pos))
|
if (rect.contains(pos))
|
||||||
@@ -344,9 +344,9 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
|
|||||||
|
|
||||||
QStringList no_str, nc_str;
|
QStringList no_str, nc_str;
|
||||||
|
|
||||||
foreach (Element *elmt, NOElements())
|
for (Element *elmt: NOElements())
|
||||||
no_str.append(elementPositionText(elmt, true));
|
no_str.append(elementPositionText(elmt, true));
|
||||||
foreach(Element *elmt, NCElements())
|
for (Element *elmt: NCElements())
|
||||||
nc_str.append(elementPositionText(elmt, true));
|
nc_str.append(elementPositionText(elmt, true));
|
||||||
|
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
|
|||||||
|
|
||||||
//Bounding rect of the NO text
|
//Bounding rect of the NO text
|
||||||
QRectF no_bounding;
|
QRectF no_bounding;
|
||||||
foreach(QString str, no_str)
|
for (QString str: no_str)
|
||||||
{
|
{
|
||||||
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
|
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
|
||||||
no_bounding = no_bounding.united(bounding);
|
no_bounding = no_bounding.united(bounding);
|
||||||
@@ -371,7 +371,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
|
|||||||
|
|
||||||
//Bounding rect of the NC text
|
//Bounding rect of the NC text
|
||||||
QRectF nc_bounding;
|
QRectF nc_bounding;
|
||||||
foreach(QString str, nc_str)
|
for (QString str: nc_str)
|
||||||
{
|
{
|
||||||
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
|
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
|
||||||
nc_bounding = nc_bounding.united(bounding);
|
nc_bounding = nc_bounding.united(bounding);
|
||||||
@@ -434,7 +434,7 @@ void CrossRefItem::drawAsContacts(QPainter &painter)
|
|||||||
QRectF bounding_rect;
|
QRectF bounding_rect;
|
||||||
|
|
||||||
//Draw each linked contact
|
//Draw each linked contact
|
||||||
foreach (Element *elmt, m_element->linkedElements())
|
for (Element *elmt: m_element->linkedElements())
|
||||||
{
|
{
|
||||||
DiagramContext info = elmt->kindInformations();
|
DiagramContext info = elmt->kindInformations();
|
||||||
|
|
||||||
@@ -627,7 +627,7 @@ void CrossRefItem::fillCrossRef(QPainter &painter)
|
|||||||
|
|
||||||
//Fill NO
|
//Fill NO
|
||||||
QPointF no_top_left(0, header);
|
QPointF no_top_left(0, header);
|
||||||
foreach(Element *elmt, NOElements())
|
for (Element *elmt: NOElements())
|
||||||
{
|
{
|
||||||
QPen pen = painter.pen();
|
QPen pen = painter.pen();
|
||||||
m_hovered_contact == elmt ? pen.setColor(Qt::blue) :pen.setColor(Qt::black);
|
m_hovered_contact == elmt ? pen.setColor(Qt::blue) :pen.setColor(Qt::black);
|
||||||
@@ -651,7 +651,7 @@ void CrossRefItem::fillCrossRef(QPainter &painter)
|
|||||||
|
|
||||||
//Fill NC
|
//Fill NC
|
||||||
QPointF nc_top_left(middle_cross, header);
|
QPointF nc_top_left(middle_cross, header);
|
||||||
foreach(Element *elmt, NCElements())
|
for (Element *elmt: NCElements())
|
||||||
{
|
{
|
||||||
QPen pen = painter.pen();
|
QPen pen = painter.pen();
|
||||||
m_hovered_contact == elmt ? pen.setColor(Qt::blue) :pen.setColor(Qt::black);
|
m_hovered_contact == elmt ? pen.setColor(Qt::blue) :pen.setColor(Qt::black);
|
||||||
@@ -731,7 +731,7 @@ QList<Element *> CrossRefItem::NOElements() const
|
|||||||
{
|
{
|
||||||
QList<Element *> no_list;
|
QList<Element *> no_list;
|
||||||
|
|
||||||
foreach (Element *elmt, m_element->linkedElements())
|
for (Element *elmt: m_element->linkedElements())
|
||||||
{
|
{
|
||||||
//We continue if element is a power contact and xref propertie
|
//We continue if element is a power contact and xref propertie
|
||||||
//is set to don't show power contact
|
//is set to don't show power contact
|
||||||
@@ -761,7 +761,7 @@ QList<Element *> CrossRefItem::NCElements() const
|
|||||||
{
|
{
|
||||||
QList<Element *> nc_list;
|
QList<Element *> nc_list;
|
||||||
|
|
||||||
foreach (Element *elmt, m_element->linkedElements())
|
for (Element *elmt: m_element->linkedElements())
|
||||||
{
|
{
|
||||||
//We continue if element is a power contact and xref propertie
|
//We continue if element is a power contact and xref propertie
|
||||||
//is set to don't show power contact
|
//is set to don't show power contact
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ QList<Terminal *> CustomElement::terminals() const {
|
|||||||
/// @return la liste des conducteurs rattaches a cet element
|
/// @return la liste des conducteurs rattaches a cet element
|
||||||
QList<Conductor *> CustomElement::conductors() const {
|
QList<Conductor *> CustomElement::conductors() const {
|
||||||
QList<Conductor *> conductors;
|
QList<Conductor *> conductors;
|
||||||
foreach(Terminal *t, list_terminals) conductors << t -> conductors();
|
for (Terminal *t: list_terminals) conductors << t -> conductors();
|
||||||
return(conductors);
|
return(conductors);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -850,7 +850,7 @@ void CustomElement::setPainterStyle(QDomElement &e, QPainter &qp) {
|
|||||||
|
|
||||||
// agit sur le QPen et la QBrush en fonction des valeurs rencontrees
|
// agit sur le QPen et la QBrush en fonction des valeurs rencontrees
|
||||||
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
|
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
|
||||||
foreach (QString style, styles) {
|
for (QString style: styles) {
|
||||||
if (rx.exactMatch(style)) {
|
if (rx.exactMatch(style)) {
|
||||||
QString style_name = rx.cap(1);
|
QString style_name = rx.cap(1);
|
||||||
QString style_value = rx.cap(2);
|
QString style_value = rx.cap(2);
|
||||||
@@ -988,7 +988,7 @@ ElementTextItem* CustomElement::setTaggedText(const QString &tagg, const QString
|
|||||||
* @param tagg
|
* @param tagg
|
||||||
*/
|
*/
|
||||||
ElementTextItem* CustomElement::taggedText(const QString &tagg) const {
|
ElementTextItem* CustomElement::taggedText(const QString &tagg) const {
|
||||||
foreach (ElementTextItem *eti, list_texts_) {
|
for (ElementTextItem *eti: list_texts_) {
|
||||||
if (eti -> tagg() == tagg) return eti;
|
if (eti -> tagg() == tagg) return eti;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ void Element::setHighlighted(bool hl) {
|
|||||||
*/
|
*/
|
||||||
void Element::displayHelpLine(bool b)
|
void Element::displayHelpLine(bool b)
|
||||||
{
|
{
|
||||||
foreach (Terminal *t, terminals())
|
for (Terminal *t: terminals())
|
||||||
t->drawHelpLine(b);
|
t->drawHelpLine(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,14 +225,14 @@ void Element::rotateBy(const qreal &angle) {
|
|||||||
applyRotation(applied_angle + rotation());
|
applyRotation(applied_angle + rotation());
|
||||||
|
|
||||||
//update the path of conductor
|
//update the path of conductor
|
||||||
foreach(QGraphicsItem *qgi, childItems()) {
|
for (QGraphicsItem *qgi: childItems()) {
|
||||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
||||||
p -> updateConductor();
|
p -> updateConductor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// repositionne les textes de l'element qui ne comportent pas l'option "FollowParentRotations"
|
// repositionne les textes de l'element qui ne comportent pas l'option "FollowParentRotations"
|
||||||
foreach(ElementTextItem *eti, texts()) {
|
for (ElementTextItem *eti: texts()) {
|
||||||
if (!eti -> followParentRotations()) {
|
if (!eti -> followParentRotations()) {
|
||||||
// on souhaite pivoter le champ de texte par rapport a son centre
|
// on souhaite pivoter le champ de texte par rapport a son centre
|
||||||
QPointF eti_center = eti -> boundingRect().center();
|
QPointF eti_center = eti -> boundingRect().center();
|
||||||
@@ -400,16 +400,16 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
ce recensement servira lors de la mise en place des fils
|
ce recensement servira lors de la mise en place des fils
|
||||||
*/
|
*/
|
||||||
QList<QDomElement> liste_terminals;
|
QList<QDomElement> liste_terminals;
|
||||||
foreach(QDomElement qde, QET::findInDomElement(e, "terminals", "terminal")) {
|
for (QDomElement qde: QET::findInDomElement(e, "terminals", "terminal")) {
|
||||||
if (Terminal::valideXml(qde)) liste_terminals << qde;
|
if (Terminal::valideXml(qde)) liste_terminals << qde;
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<int, Terminal *> priv_id_adr;
|
QHash<int, Terminal *> priv_id_adr;
|
||||||
int terminals_non_trouvees = 0;
|
int terminals_non_trouvees = 0;
|
||||||
foreach(QGraphicsItem *qgi, childItems()) {
|
for (QGraphicsItem *qgi: childItems()) {
|
||||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
||||||
bool terminal_trouvee = false;
|
bool terminal_trouvee = false;
|
||||||
foreach(QDomElement qde, liste_terminals) {
|
for (QDomElement qde: liste_terminals) {
|
||||||
if (p -> fromXml(qde)) {
|
if (p -> fromXml(qde)) {
|
||||||
priv_id_adr.insert(qde.attribute("id").toInt(), p);
|
priv_id_adr.insert(qde.attribute("id").toInt(), p);
|
||||||
terminal_trouvee = true;
|
terminal_trouvee = true;
|
||||||
@@ -426,25 +426,25 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
return(false);
|
return(false);
|
||||||
} else {
|
} else {
|
||||||
// verifie que les associations id / adr n'entrent pas en conflit avec table_id_adr
|
// verifie que les associations id / adr n'entrent pas en conflit avec table_id_adr
|
||||||
foreach(int id_trouve, priv_id_adr.keys()) {
|
for (int id_trouve: priv_id_adr.keys()) {
|
||||||
if (table_id_adr.contains(id_trouve)) {
|
if (table_id_adr.contains(id_trouve)) {
|
||||||
// cet element possede un id qui est deja reference (= conflit)
|
// cet element possede un id qui est deja reference (= conflit)
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// copie des associations id / adr
|
// copie des associations id / adr
|
||||||
foreach(int id_trouve, priv_id_adr.keys()) {
|
for (int id_trouve: priv_id_adr.keys()) {
|
||||||
table_id_adr.insert(id_trouve, priv_id_adr.value(id_trouve));
|
table_id_adr.insert(id_trouve, priv_id_adr.value(id_trouve));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//import text filed value
|
//import text filed value
|
||||||
QList<QDomElement> inputs = QET::findInDomElement(e, "inputs", "input");
|
QList<QDomElement> inputs = QET::findInDomElement(e, "inputs", "input");
|
||||||
foreach(QGraphicsItem *qgi, childItems())
|
for (QGraphicsItem *qgi: childItems())
|
||||||
{
|
{
|
||||||
if (ElementTextItem *eti = qgraphicsitem_cast<ElementTextItem *>(qgi))
|
if (ElementTextItem *eti = qgraphicsitem_cast<ElementTextItem *>(qgi))
|
||||||
{
|
{
|
||||||
foreach(QDomElement input, inputs)
|
for (QDomElement input: inputs)
|
||||||
{
|
{
|
||||||
eti -> fromXml(input);
|
eti -> fromXml(input);
|
||||||
etiToElementLabels(eti);
|
etiToElementLabels(eti);
|
||||||
@@ -454,7 +454,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
|||||||
|
|
||||||
//load uuid of connected elements
|
//load uuid of connected elements
|
||||||
QList <QDomElement> uuid_list = QET::findInDomElement(e, "links_uuids", "link_uuid");
|
QList <QDomElement> uuid_list = QET::findInDomElement(e, "links_uuids", "link_uuid");
|
||||||
foreach (QDomElement qdo, uuid_list) tmp_uuids_link << qdo.attribute("uuid");
|
for (QDomElement qdo: uuid_list) tmp_uuids_link << qdo.attribute("uuid");
|
||||||
|
|
||||||
//uuid of this element
|
//uuid of this element
|
||||||
uuid_= QUuid(e.attribute("uuid", QUuid::createUuid().toString()));
|
uuid_= QUuid(e.attribute("uuid", QUuid::createUuid().toString()));
|
||||||
@@ -540,7 +540,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
|
|||||||
if (!table_adr_id.isEmpty()) {
|
if (!table_adr_id.isEmpty()) {
|
||||||
// trouve le plus grand id
|
// trouve le plus grand id
|
||||||
int max_id_t = -1;
|
int max_id_t = -1;
|
||||||
foreach (int id_t, table_adr_id.values()) {
|
for (int id_t: table_adr_id.values()) {
|
||||||
if (id_t > max_id_t) max_id_t = id_t;
|
if (id_t > max_id_t) max_id_t = id_t;
|
||||||
}
|
}
|
||||||
id_terminal = max_id_t + 1;
|
id_terminal = max_id_t + 1;
|
||||||
@@ -549,7 +549,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
|
|||||||
// enregistrement des bornes de l'appareil
|
// enregistrement des bornes de l'appareil
|
||||||
QDomElement xml_terminals = document.createElement("terminals");
|
QDomElement xml_terminals = document.createElement("terminals");
|
||||||
// pour chaque enfant de l'element
|
// pour chaque enfant de l'element
|
||||||
foreach(Terminal *t, terminals()) {
|
for (Terminal *t: terminals()) {
|
||||||
// alors on enregistre la borne
|
// alors on enregistre la borne
|
||||||
QDomElement terminal = t -> toXml(document);
|
QDomElement terminal = t -> toXml(document);
|
||||||
terminal.setAttribute("id", id_terminal);
|
terminal.setAttribute("id", id_terminal);
|
||||||
@@ -560,7 +560,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
|
|||||||
|
|
||||||
// enregistrement des champ de texte de l'appareil
|
// enregistrement des champ de texte de l'appareil
|
||||||
QDomElement inputs = document.createElement("inputs");
|
QDomElement inputs = document.createElement("inputs");
|
||||||
foreach(ElementTextItem *eti, texts()) {
|
for (ElementTextItem *eti: texts()) {
|
||||||
inputs.appendChild(eti -> toXml(document));
|
inputs.appendChild(eti -> toXml(document));
|
||||||
}
|
}
|
||||||
element.appendChild(inputs);
|
element.appendChild(inputs);
|
||||||
@@ -569,7 +569,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
|
|||||||
//save the uuid of each other elements
|
//save the uuid of each other elements
|
||||||
if (! isFree()) {
|
if (! isFree()) {
|
||||||
QDomElement links_uuids = document.createElement("links_uuids");
|
QDomElement links_uuids = document.createElement("links_uuids");
|
||||||
foreach (Element *elmt, connected_elements) {
|
for (Element *elmt: connected_elements) {
|
||||||
QDomElement link_uuid = document.createElement("link_uuid");
|
QDomElement link_uuid = document.createElement("link_uuid");
|
||||||
link_uuid.setAttribute("uuid", elmt->uuid().toString());
|
link_uuid.setAttribute("uuid", elmt->uuid().toString());
|
||||||
links_uuids.appendChild(link_uuid);
|
links_uuids.appendChild(link_uuid);
|
||||||
@@ -599,7 +599,7 @@ QList <QPair <Terminal *, Terminal *> > Element::AlignedFreeTerminals() const
|
|||||||
{
|
{
|
||||||
QList <QPair <Terminal *, Terminal *> > list;
|
QList <QPair <Terminal *, Terminal *> > list;
|
||||||
|
|
||||||
foreach (Terminal *terminal, terminals())
|
for (Terminal *terminal: terminals())
|
||||||
{
|
{
|
||||||
if (terminal->conductors().isEmpty())
|
if (terminal->conductors().isEmpty())
|
||||||
{
|
{
|
||||||
@@ -627,7 +627,7 @@ void Element::initLink(QETProject *prj)
|
|||||||
if (tmp_uuids_link.isEmpty()) return;
|
if (tmp_uuids_link.isEmpty()) return;
|
||||||
|
|
||||||
ElementProvider ep(prj);
|
ElementProvider ep(prj);
|
||||||
foreach (Element *elmt, ep.fromUuids(tmp_uuids_link)) {
|
for (Element *elmt: ep.fromUuids(tmp_uuids_link)) {
|
||||||
elmt->linkToElement(this);
|
elmt->linkToElement(this);
|
||||||
}
|
}
|
||||||
tmp_uuids_link.clear();
|
tmp_uuids_link.clear();
|
||||||
@@ -676,7 +676,7 @@ bool comparPos(const Element *elmt1, const Element *elmt2) {
|
|||||||
void Element::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
void Element::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
QetGraphicsItem::mouseMoveEvent(event);
|
QetGraphicsItem::mouseMoveEvent(event);
|
||||||
foreach (Terminal *t, terminals())
|
for (Terminal *t: terminals())
|
||||||
{
|
{
|
||||||
t -> drawHelpLine(true);
|
t -> drawHelpLine(true);
|
||||||
}
|
}
|
||||||
@@ -689,7 +689,7 @@ void Element::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
QetGraphicsItem::mouseReleaseEvent(event);
|
QetGraphicsItem::mouseReleaseEvent(event);
|
||||||
foreach (Terminal *t, terminals())
|
for (Terminal *t: terminals())
|
||||||
{
|
{
|
||||||
t -> drawHelpLine(false);
|
t -> drawHelpLine(false);
|
||||||
}
|
}
|
||||||
@@ -704,7 +704,7 @@ void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
|
void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
|
||||||
Q_UNUSED(e);
|
Q_UNUSED(e);
|
||||||
|
|
||||||
foreach (Element *elmt, linkedElements())
|
for (Element *elmt: linkedElements())
|
||||||
elmt -> setHighlighted(true);
|
elmt -> setHighlighted(true);
|
||||||
|
|
||||||
m_mouse_over = true;
|
m_mouse_over = true;
|
||||||
@@ -721,7 +721,7 @@ void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
|
|||||||
void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
|
void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
|
||||||
Q_UNUSED(e);
|
Q_UNUSED(e);
|
||||||
|
|
||||||
foreach (Element *elmt, linkedElements())
|
for (Element *elmt: linkedElements())
|
||||||
elmt -> setHighlighted(false);
|
elmt -> setHighlighted(false);
|
||||||
|
|
||||||
m_mouse_over = false;
|
m_mouse_over = false;
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ void ElementTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
linked -> setSelected(true);
|
linked -> setSelected(true);
|
||||||
|
|
||||||
//Zoom to the linked element
|
//Zoom to the linked element
|
||||||
foreach(QGraphicsView *view, linked -> diagram() -> views()) {
|
for (QGraphicsView *view: linked -> diagram() -> views()) {
|
||||||
QRectF fit = linked -> sceneBoundingRect();
|
QRectF fit = linked -> sceneBoundingRect();
|
||||||
fit.adjust(-200, -200, 200, 200);
|
fit.adjust(-200, -200, 200, 200);
|
||||||
view -> fitInView(fit, Qt::KeepAspectRatioByExpanding);
|
view -> fitInView(fit, Qt::KeepAspectRatioByExpanding);
|
||||||
@@ -328,7 +328,7 @@ void ElementTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
|
|
||||||
//Also color the child text if parent is a slave and linked
|
//Also color the child text if parent is a slave and linked
|
||||||
if (parent_element_-> linkType() == Element::Slave && !parent_element_ -> isFree())
|
if (parent_element_-> linkType() == Element::Slave && !parent_element_ -> isFree())
|
||||||
foreach (QGraphicsItem *qgi, childItems())
|
for (QGraphicsItem *qgi: childItems())
|
||||||
if (QGraphicsTextItem *qgti = qgraphicsitem_cast<QGraphicsTextItem *> (qgi))
|
if (QGraphicsTextItem *qgti = qgraphicsitem_cast<QGraphicsTextItem *> (qgi))
|
||||||
qgti -> setDefaultTextColor(Qt::blue);
|
qgti -> setDefaultTextColor(Qt::blue);
|
||||||
}
|
}
|
||||||
@@ -364,7 +364,7 @@ void ElementTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
|
|
||||||
//Also color the child text if parent is a slave and linked
|
//Also color the child text if parent is a slave and linked
|
||||||
if (parent_element_-> linkType() == Element::Slave && !parent_element_ -> isFree())
|
if (parent_element_-> linkType() == Element::Slave && !parent_element_ -> isFree())
|
||||||
foreach (QGraphicsItem *qgi, childItems())
|
for (QGraphicsItem *qgi: childItems())
|
||||||
if (QGraphicsTextItem *qgti = qgraphicsitem_cast<QGraphicsTextItem *> (qgi))
|
if (QGraphicsTextItem *qgti = qgraphicsitem_cast<QGraphicsTextItem *> (qgi))
|
||||||
qgti -> setDefaultTextColor(Qt::black);
|
qgti -> setDefaultTextColor(Qt::black);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ bool GhostElement::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr,
|
|||||||
terminalsFromXml(e, table_id_adr);
|
terminalsFromXml(e, table_id_adr);
|
||||||
|
|
||||||
// instancie les champs de texte decrits dans l'element XML
|
// instancie les champs de texte decrits dans l'element XML
|
||||||
foreach(QDomElement qde, QET::findInDomElement(e, "inputs", "input")) {
|
for (QDomElement qde: QET::findInDomElement(e, "inputs", "input")) {
|
||||||
qde.setAttribute("size", 9); // arbitraire
|
qde.setAttribute("size", 9); // arbitraire
|
||||||
if (ElementTextItem *new_input = CustomElement::parseInput(qde)) {
|
if (ElementTextItem *new_input = CustomElement::parseInput(qde)) {
|
||||||
new_input -> fromXml(qde);
|
new_input -> fromXml(qde);
|
||||||
@@ -116,7 +116,7 @@ QRectF GhostElement::minimalBoundingRect() const {
|
|||||||
*/
|
*/
|
||||||
bool GhostElement::terminalsFromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr) {
|
bool GhostElement::terminalsFromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr) {
|
||||||
// instancie les bornes decrites dans l'element XML
|
// instancie les bornes decrites dans l'element XML
|
||||||
foreach(QDomElement qde, QET::findInDomElement(e, "terminals", "terminal")) {
|
for (QDomElement qde: QET::findInDomElement(e, "terminals", "terminal")) {
|
||||||
if (!Terminal::valideXml(qde)) continue;
|
if (!Terminal::valideXml(qde)) continue;
|
||||||
|
|
||||||
// modifie certains attributs pour que l'analyse par la classe CustomElement reussisse
|
// modifie certains attributs pour que l'analyse par la classe CustomElement reussisse
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ void MasterElement::unlinkAllElements()
|
|||||||
// if this element is free no need to do something
|
// if this element is free no need to do something
|
||||||
if (!isFree())
|
if (!isFree())
|
||||||
{
|
{
|
||||||
foreach(Element *elmt, connected_elements)
|
for (Element *elmt: connected_elements)
|
||||||
unlinkElement(elmt);
|
unlinkElement(elmt);
|
||||||
emit linkedElementChanged();
|
emit linkedElementChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ void QetGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *e)
|
|||||||
{
|
{
|
||||||
//Disable views context menu
|
//Disable views context menu
|
||||||
if (scene())
|
if (scene())
|
||||||
foreach (QGraphicsView *view, scene()->views())
|
for (QGraphicsView *view: scene()->views())
|
||||||
view->setContextMenuPolicy(Qt::NoContextMenu);
|
view->setContextMenuPolicy(Qt::NoContextMenu);
|
||||||
|
|
||||||
first_move_ = true;
|
first_move_ = true;
|
||||||
@@ -164,6 +164,6 @@ void QetGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
|||||||
//Enable views context menu
|
//Enable views context menu
|
||||||
if (e -> button() == Qt::LeftButton)
|
if (e -> button() == Qt::LeftButton)
|
||||||
if (scene())
|
if (scene())
|
||||||
foreach (QGraphicsView *view, scene()->views())
|
for (QGraphicsView *view: scene()->views())
|
||||||
view -> setContextMenuPolicy(Qt::DefaultContextMenu);
|
view -> setContextMenuPolicy(Qt::DefaultContextMenu);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ QPainterPath QetShapeItem::shape() const
|
|||||||
else
|
else
|
||||||
vector = m_polygon;
|
vector = m_polygon;
|
||||||
|
|
||||||
foreach(QRectF r, m_handler.handlerRect(vector))
|
for (QRectF r: m_handler.handlerRect(vector))
|
||||||
path.addRect(r);
|
path.addRect(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,7 +562,7 @@ bool QetShapeItem::fromXml(const QDomElement &e)
|
|||||||
m_P2.setY(e.attribute("y2", 0).toDouble());
|
m_P2.setY(e.attribute("y2", 0).toDouble());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
foreach(QDomElement de, QET::findInDomElement(e, "points", "point"))
|
for (QDomElement de: QET::findInDomElement(e, "points", "point"))
|
||||||
m_polygon << QPointF(de.attribute("x", 0).toDouble(), de.attribute("y", 0).toDouble());
|
m_polygon << QPointF(de.attribute("x", 0).toDouble(), de.attribute("y", 0).toDouble());
|
||||||
|
|
||||||
return (true);
|
return (true);
|
||||||
@@ -596,7 +596,7 @@ QDomElement QetShapeItem::toXml(QDomDocument &document) const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
QDomElement points = document.createElement("points");
|
QDomElement points = document.createElement("points");
|
||||||
foreach(QPointF p, m_polygon)
|
for (QPointF p: m_polygon)
|
||||||
{
|
{
|
||||||
QDomElement point = document.createElement("point");
|
QDomElement point = document.createElement("point");
|
||||||
QPointF pf = mapToScene(p);
|
QPointF pf = mapToScene(p);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ void ReportElement::unlinkAllElements()
|
|||||||
|
|
||||||
QList <Element *> tmp_elmt = connected_elements;
|
QList <Element *> tmp_elmt = connected_elements;
|
||||||
|
|
||||||
foreach(Element *elmt, connected_elements)
|
for (Element *elmt: connected_elements)
|
||||||
{
|
{
|
||||||
disconnect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
|
disconnect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
|
||||||
disconnect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel()));
|
disconnect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel()));
|
||||||
@@ -139,7 +139,7 @@ void ReportElement::unlinkAllElements()
|
|||||||
}
|
}
|
||||||
updateLabel();
|
updateLabel();
|
||||||
|
|
||||||
foreach(Element *elmt, tmp_elmt)
|
for (Element *elmt: tmp_elmt)
|
||||||
{
|
{
|
||||||
elmt -> setHighlighted(false);
|
elmt -> setHighlighted(false);
|
||||||
elmt -> unlinkAllElements();
|
elmt -> unlinkAllElements();
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ void SlaveElement::unlinkAllElements()
|
|||||||
// if this element is free no need to do something
|
// if this element is free no need to do something
|
||||||
if (!isFree())
|
if (!isFree())
|
||||||
{
|
{
|
||||||
foreach(Element *elmt, connected_elements)
|
for (Element *elmt: connected_elements)
|
||||||
unlinkElement(elmt);
|
unlinkElement(elmt);
|
||||||
emit linkedElementChanged();
|
emit linkedElementChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ Terminal::Terminal(QPointF pf, Qet::Orientation o, QString num, QString name, bo
|
|||||||
associes.
|
associes.
|
||||||
*/
|
*/
|
||||||
Terminal::~Terminal() {
|
Terminal::~Terminal() {
|
||||||
foreach(Conductor *c, conductors_) delete c;
|
for (Conductor *c: conductors_) delete c;
|
||||||
delete br_;
|
delete br_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ bool Terminal::addConductor(Conductor *conductor)
|
|||||||
Terminal *other_terminal = (conductor -> terminal1 == this) ? conductor->terminal2 : conductor->terminal1;
|
Terminal *other_terminal = (conductor -> terminal1 == this) ? conductor->terminal2 : conductor->terminal1;
|
||||||
|
|
||||||
//Check if this terminal isn't already linked with other_terminal
|
//Check if this terminal isn't already linked with other_terminal
|
||||||
foreach (Conductor* cond, conductors_)
|
for (Conductor* cond: conductors_)
|
||||||
if (cond -> terminal1 == other_terminal || cond -> terminal2 == other_terminal)
|
if (cond -> terminal1 == other_terminal || cond -> terminal2 == other_terminal)
|
||||||
return false; //They already a conductor linked to this and other_terminal
|
return false; //They already a conductor linked to this and other_terminal
|
||||||
|
|
||||||
@@ -418,14 +418,14 @@ Terminal* Terminal::alignedWithTerminal() const
|
|||||||
QList <QGraphicsItem *> qgi_list = diagram() -> items(path);
|
QList <QGraphicsItem *> qgi_list = diagram() -> items(path);
|
||||||
|
|
||||||
//Remove all terminals of the parent element
|
//Remove all terminals of the parent element
|
||||||
foreach (Terminal *t, parent_element_ -> terminals())
|
for (Terminal *t: parent_element_ -> terminals())
|
||||||
qgi_list.removeAll(t);
|
qgi_list.removeAll(t);
|
||||||
|
|
||||||
if (qgi_list.isEmpty()) return nullptr;
|
if (qgi_list.isEmpty()) return nullptr;
|
||||||
|
|
||||||
//Get terminals only if orientation is opposed with this terminal
|
//Get terminals only if orientation is opposed with this terminal
|
||||||
QList <Terminal *> available_terminals;
|
QList <Terminal *> available_terminals;
|
||||||
foreach (QGraphicsItem *qgi, qgi_list)
|
for (QGraphicsItem *qgi: qgi_list)
|
||||||
{
|
{
|
||||||
if (Terminal *tt = qgraphicsitem_cast <Terminal *> (qgi))
|
if (Terminal *tt = qgraphicsitem_cast <Terminal *> (qgi))
|
||||||
{
|
{
|
||||||
@@ -448,7 +448,7 @@ Terminal* Terminal::alignedWithTerminal() const
|
|||||||
Terminal *nearest_terminal = available_terminals.takeFirst();
|
Terminal *nearest_terminal = available_terminals.takeFirst();
|
||||||
|
|
||||||
//Search the nearest terminal to this one
|
//Search the nearest terminal to this one
|
||||||
foreach (Terminal *terminal, available_terminals)
|
for (Terminal *terminal: available_terminals)
|
||||||
{
|
{
|
||||||
line.setP2(terminal -> dockConductor());
|
line.setP2(terminal -> dockConductor());
|
||||||
if (line.length() < current_lenght)
|
if (line.length() < current_lenght)
|
||||||
@@ -595,7 +595,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
|
|||||||
{
|
{
|
||||||
use_properties = true;
|
use_properties = true;
|
||||||
others_properties = (*conductors_list.begin())->properties();
|
others_properties = (*conductors_list.begin())->properties();
|
||||||
foreach (Conductor *conductor, conductors_list) {
|
for (Conductor *conductor: conductors_list) {
|
||||||
if (conductor->properties() != others_properties)
|
if (conductor->properties() != others_properties)
|
||||||
use_properties = false;
|
use_properties = false;
|
||||||
}
|
}
|
||||||
@@ -632,7 +632,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
|
|||||||
* Update the path of conductor docked to this terminal
|
* Update the path of conductor docked to this terminal
|
||||||
*/
|
*/
|
||||||
void Terminal::updateConductor() {
|
void Terminal::updateConductor() {
|
||||||
foreach (Conductor *conductor, conductors_)
|
for (Conductor *conductor: conductors_)
|
||||||
conductor->updatePath();
|
conductor->updatePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -644,7 +644,7 @@ bool Terminal::isLinkedTo(Terminal *other_terminal) {
|
|||||||
if (other_terminal == this) return(false);
|
if (other_terminal == this) return(false);
|
||||||
|
|
||||||
bool already_linked = false;
|
bool already_linked = false;
|
||||||
foreach (Conductor *c, conductors_) {
|
for (Conductor *c: conductors_) {
|
||||||
if (c -> terminal1 == other_terminal || c -> terminal2 == other_terminal) {
|
if (c -> terminal1 == other_terminal || c -> terminal2 == other_terminal) {
|
||||||
already_linked = true;
|
already_linked = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ void QETMainWindow::initCommonActions() {
|
|||||||
qet_app->configureQET();
|
qet_app->configureQET();
|
||||||
//TODO we use reloadOldElementPanel only to keep up to date the string of the folio in the old element panel.
|
//TODO we use reloadOldElementPanel only to keep up to date the string of the folio in the old element panel.
|
||||||
//then, if user change the option "Use labels of folio instead of their ID" the string of folio in the old element panel is up to date
|
//then, if user change the option "Use labels of folio instead of their ID" the string of folio in the old element panel is up to date
|
||||||
foreach (QETDiagramEditor *qde, qet_app->diagramEditors())
|
for (QETDiagramEditor *qde: qet_app->diagramEditors())
|
||||||
qde->reloadOldElementPanel();
|
qde->reloadOldElementPanel();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ void QETPrintPreviewDialog::updateZoomList() {
|
|||||||
int current_zoom_index = -1;
|
int current_zoom_index = -1;
|
||||||
zoom_box_ -> blockSignals(true);
|
zoom_box_ -> blockSignals(true);
|
||||||
zoom_box_ -> clear();
|
zoom_box_ -> clear();
|
||||||
foreach (qreal z, zooms_real) {
|
for (qreal z: zooms_real) {
|
||||||
zoom_box_ -> addItem(QString(tr("%1 %")).arg(z * 100.0, 0, 'f', 2), z);
|
zoom_box_ -> addItem(QString(tr("%1 %")).arg(z * 100.0, 0, 'f', 2), z);
|
||||||
if (z == current_zoom) current_zoom_index = zoom_box_ -> count() - 1;
|
if (z == current_zoom) current_zoom_index = zoom_box_ -> count() - 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -737,7 +737,7 @@ QDomDocument QETProject::toXml() {
|
|||||||
// titleblock templates, if any
|
// titleblock templates, if any
|
||||||
if (titleblocks_.templates().count()) {
|
if (titleblocks_.templates().count()) {
|
||||||
QDomElement titleblocktemplates_elmt = xml_doc.createElement("titleblocktemplates");
|
QDomElement titleblocktemplates_elmt = xml_doc.createElement("titleblocktemplates");
|
||||||
foreach (QString template_name, titleblocks_.templates()) {
|
for (QString template_name: titleblocks_.templates()) {
|
||||||
QDomElement e = titleblocks_.getTemplateXmlDescription(template_name);
|
QDomElement e = titleblocks_.getTemplateXmlDescription(template_name);
|
||||||
titleblocktemplates_elmt.appendChild(xml_doc.importNode(e, true));
|
titleblocktemplates_elmt.appendChild(xml_doc.importNode(e, true));
|
||||||
}
|
}
|
||||||
@@ -758,7 +758,7 @@ QDomDocument QETProject::toXml() {
|
|||||||
|
|
||||||
// qDebug() << "Export XML de" << diagrams_.count() << "schemas";
|
// qDebug() << "Export XML de" << diagrams_.count() << "schemas";
|
||||||
int order_num = 1;
|
int order_num = 1;
|
||||||
foreach(Diagram *diagram, diagrams_) {
|
for (Diagram *diagram: diagrams_) {
|
||||||
|
|
||||||
// Write the diagram to XML only if it is not of type DiagramFolioList.
|
// Write the diagram to XML only if it is not of type DiagramFolioList.
|
||||||
DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diagram);
|
DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diagram);
|
||||||
@@ -848,7 +848,7 @@ bool QETProject::isEmpty() const {
|
|||||||
|
|
||||||
// compte le nombre de schemas non vides
|
// compte le nombre de schemas non vides
|
||||||
int pertinent_diagrams = 0;
|
int pertinent_diagrams = 0;
|
||||||
foreach(Diagram *diagram, diagrams_) {
|
for (Diagram *diagram: diagrams_) {
|
||||||
if (!diagram -> isEmpty()) ++ pertinent_diagrams;
|
if (!diagram -> isEmpty()) ++ pertinent_diagrams;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -988,7 +988,7 @@ QString QETProject::integrateTitleBlockTemplate(const TitleBlockTemplateLocation
|
|||||||
*/
|
*/
|
||||||
bool QETProject::usesElement(const ElementsLocation &location) const
|
bool QETProject::usesElement(const ElementsLocation &location) const
|
||||||
{
|
{
|
||||||
foreach(Diagram *diagram, diagrams()) {
|
for (Diagram *diagram: diagrams()) {
|
||||||
if (diagram -> usesElement(location)) {
|
if (diagram -> usesElement(location)) {
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@@ -1007,7 +1007,7 @@ QList<ElementsLocation> QETProject::unusedElements() const
|
|||||||
{
|
{
|
||||||
QList <ElementsLocation> unused_list;
|
QList <ElementsLocation> unused_list;
|
||||||
|
|
||||||
foreach(ElementsLocation location, m_elements_collection->elementsLocation())
|
for (ElementsLocation location: m_elements_collection->elementsLocation())
|
||||||
if (location.isElement() && !usesElement(location))
|
if (location.isElement() && !usesElement(location))
|
||||||
unused_list << location;
|
unused_list << location;
|
||||||
|
|
||||||
@@ -1023,7 +1023,7 @@ bool QETProject::usesTitleBlockTemplate(const TitleBlockTemplateLocation &locati
|
|||||||
// a diagram can only use a title block template embedded wihtin its parent project
|
// a diagram can only use a title block template embedded wihtin its parent project
|
||||||
if (location.parentProject() != this) return(false);
|
if (location.parentProject() != this) return(false);
|
||||||
|
|
||||||
foreach (Diagram *diagram, diagrams()) {
|
for (Diagram *diagram: diagrams()) {
|
||||||
if (diagram -> usesTitleBlockTemplate(location.name())) {
|
if (diagram -> usesTitleBlockTemplate(location.name())) {
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@@ -1279,12 +1279,12 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Add the diagrams according to there "order" attribute
|
//Add the diagrams according to there "order" attribute
|
||||||
foreach(Diagram *diagram, loaded_diagrams.values())
|
for (Diagram *diagram: loaded_diagrams.values())
|
||||||
addDiagram(diagram);
|
addDiagram(diagram);
|
||||||
|
|
||||||
//Initialise links between elements in this project
|
//Initialise links between elements in this project
|
||||||
//and refresh the text of conductor
|
//and refresh the text of conductor
|
||||||
foreach (Diagram *d, diagrams())
|
for (Diagram *d: diagrams())
|
||||||
d->refreshContents();
|
d->refreshContents();
|
||||||
|
|
||||||
delete dlgWaiting;
|
delete dlgWaiting;
|
||||||
@@ -1323,7 +1323,7 @@ void QETProject::readElementsCollectionXml(QDomDocument &xml_project)
|
|||||||
*/
|
*/
|
||||||
void QETProject::readProjectPropertiesXml(QDomDocument &xml_project)
|
void QETProject::readProjectPropertiesXml(QDomDocument &xml_project)
|
||||||
{
|
{
|
||||||
foreach (QDomElement e, QET::findInDomElement(xml_project.documentElement(), "properties"))
|
for (QDomElement e: QET::findInDomElement(xml_project.documentElement(), "properties"))
|
||||||
project_properties_.fromXml(e);
|
project_properties_.fromXml(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1381,7 +1381,7 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
|||||||
if (!report_elmt.isNull()) setDefaultReportProperties(report_elmt.attribute("label"));
|
if (!report_elmt.isNull()) setDefaultReportProperties(report_elmt.attribute("label"));
|
||||||
if (!xref_elmt.isNull())
|
if (!xref_elmt.isNull())
|
||||||
{
|
{
|
||||||
foreach(QDomElement elmt, QET::findInDomElement(xref_elmt, "xref"))
|
for (QDomElement elmt: QET::findInDomElement(xref_elmt, "xref"))
|
||||||
{
|
{
|
||||||
XRefProperties xrp;
|
XRefProperties xrp;
|
||||||
xrp.fromXml(elmt);
|
xrp.fromXml(elmt);
|
||||||
@@ -1392,7 +1392,7 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
|||||||
{
|
{
|
||||||
m_current_conductor_autonum = conds_autonums.attribute("current_autonum");
|
m_current_conductor_autonum = conds_autonums.attribute("current_autonum");
|
||||||
m_freeze_new_conductors = conds_autonums.attribute("freeze_new_conductors") == "true";
|
m_freeze_new_conductors = conds_autonums.attribute("freeze_new_conductors") == "true";
|
||||||
foreach (QDomElement elmt, QET::findInDomElement(conds_autonums, "conductor_autonum"))
|
for (QDomElement elmt: QET::findInDomElement(conds_autonums, "conductor_autonum"))
|
||||||
{
|
{
|
||||||
NumerotationContext nc;
|
NumerotationContext nc;
|
||||||
nc.fromXml(elmt);
|
nc.fromXml(elmt);
|
||||||
@@ -1401,7 +1401,7 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
|||||||
}
|
}
|
||||||
if (!folio_autonums.isNull())
|
if (!folio_autonums.isNull())
|
||||||
{
|
{
|
||||||
foreach (QDomElement elmt, QET::findInDomElement(folio_autonums, "folio_autonum"))
|
for (QDomElement elmt: QET::findInDomElement(folio_autonums, "folio_autonum"))
|
||||||
{
|
{
|
||||||
NumerotationContext nc;
|
NumerotationContext nc;
|
||||||
nc.fromXml(elmt);
|
nc.fromXml(elmt);
|
||||||
@@ -1412,7 +1412,7 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
|||||||
{
|
{
|
||||||
m_current_element_autonum = element_autonums.attribute("current_autonum");
|
m_current_element_autonum = element_autonums.attribute("current_autonum");
|
||||||
m_freeze_new_elements = element_autonums.attribute("freeze_new_elements") == "true";
|
m_freeze_new_elements = element_autonums.attribute("freeze_new_elements") == "true";
|
||||||
foreach (QDomElement elmt, QET::findInDomElement(element_autonums, "element_autonum"))
|
for (QDomElement elmt: QET::findInDomElement(element_autonums, "element_autonum"))
|
||||||
{
|
{
|
||||||
NumerotationContext nc;
|
NumerotationContext nc;
|
||||||
nc.fromXml(elmt);
|
nc.fromXml(elmt);
|
||||||
@@ -1463,7 +1463,7 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
|
|||||||
|
|
||||||
// export default XRef properties
|
// export default XRef properties
|
||||||
QDomElement xrefs_elmt = xml_document.createElement("xrefs");
|
QDomElement xrefs_elmt = xml_document.createElement("xrefs");
|
||||||
foreach (QString key, defaultXRefProperties().keys()) {
|
for (QString key: defaultXRefProperties().keys()) {
|
||||||
QDomElement xref_elmt = xml_document.createElement("xref");
|
QDomElement xref_elmt = xml_document.createElement("xref");
|
||||||
xref_elmt.setAttribute("type", key);
|
xref_elmt.setAttribute("type", key);
|
||||||
defaultXRefProperties()[key].toXml(xref_elmt);
|
defaultXRefProperties()[key].toXml(xref_elmt);
|
||||||
@@ -1475,7 +1475,7 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
|
|||||||
QDomElement conductor_autonums = xml_document.createElement("conductors_autonums");
|
QDomElement conductor_autonums = xml_document.createElement("conductors_autonums");
|
||||||
conductor_autonums.setAttribute("current_autonum", m_current_conductor_autonum);
|
conductor_autonums.setAttribute("current_autonum", m_current_conductor_autonum);
|
||||||
conductor_autonums.setAttribute("freeze_new_conductors", m_freeze_new_conductors ? "true" : "false");
|
conductor_autonums.setAttribute("freeze_new_conductors", m_freeze_new_conductors ? "true" : "false");
|
||||||
foreach (QString key, conductorAutoNum().keys()) {
|
for (QString key: conductorAutoNum().keys()) {
|
||||||
QDomElement conductor_autonum = conductorAutoNum(key).toXml(xml_document, "conductor_autonum");
|
QDomElement conductor_autonum = conductorAutoNum(key).toXml(xml_document, "conductor_autonum");
|
||||||
if (key != "" && conductorAutoNumFormula(key) != "") {
|
if (key != "" && conductorAutoNumFormula(key) != "") {
|
||||||
conductor_autonum.setAttribute("title", key);
|
conductor_autonum.setAttribute("title", key);
|
||||||
@@ -1487,7 +1487,7 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
|
|||||||
|
|
||||||
//Export Folio Autonums
|
//Export Folio Autonums
|
||||||
QDomElement folio_autonums = xml_document.createElement("folio_autonums");
|
QDomElement folio_autonums = xml_document.createElement("folio_autonums");
|
||||||
foreach (QString key, folioAutoNum().keys()) {
|
for (QString key: folioAutoNum().keys()) {
|
||||||
QDomElement folio_autonum = folioAutoNum(key).toXml(xml_document, "folio_autonum");
|
QDomElement folio_autonum = folioAutoNum(key).toXml(xml_document, "folio_autonum");
|
||||||
folio_autonum.setAttribute("title", key);
|
folio_autonum.setAttribute("title", key);
|
||||||
folio_autonums.appendChild(folio_autonum);
|
folio_autonums.appendChild(folio_autonum);
|
||||||
@@ -1498,7 +1498,7 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
|
|||||||
QDomElement element_autonums = xml_document.createElement("element_autonums");
|
QDomElement element_autonums = xml_document.createElement("element_autonums");
|
||||||
element_autonums.setAttribute("current_autonum", m_current_element_autonum);
|
element_autonums.setAttribute("current_autonum", m_current_element_autonum);
|
||||||
element_autonums.setAttribute("freeze_new_elements", m_freeze_new_elements ? "true" : "false");
|
element_autonums.setAttribute("freeze_new_elements", m_freeze_new_elements ? "true" : "false");
|
||||||
foreach (QString key, elementAutoNum().keys()) {
|
for (QString key: elementAutoNum().keys()) {
|
||||||
QDomElement element_autonum = elementAutoNum(key).toXml(xml_document, "element_autonum");
|
QDomElement element_autonum = elementAutoNum(key).toXml(xml_document, "element_autonum");
|
||||||
if (key != "" && elementAutoNumFormula(key) != "") {
|
if (key != "" && elementAutoNumFormula(key) != "") {
|
||||||
element_autonum.setAttribute("title", key);
|
element_autonum.setAttribute("title", key);
|
||||||
@@ -1652,7 +1652,7 @@ void QETProject::updateDiagramsFolioData() {
|
|||||||
void QETProject::updateDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection *collection, const QString &template_name) {
|
void QETProject::updateDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection *collection, const QString &template_name) {
|
||||||
Q_UNUSED(collection)
|
Q_UNUSED(collection)
|
||||||
|
|
||||||
foreach (Diagram *diagram, diagrams_) {
|
for (Diagram *diagram: diagrams_) {
|
||||||
diagram -> titleBlockTemplateChanged(template_name);
|
diagram -> titleBlockTemplateChanged(template_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1666,7 +1666,7 @@ void QETProject::removeDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection
|
|||||||
Q_UNUSED(collection)
|
Q_UNUSED(collection)
|
||||||
|
|
||||||
// warn diagrams that the given template is about to be removed
|
// warn diagrams that the given template is about to be removed
|
||||||
foreach (Diagram *diagram, diagrams_) {
|
for (Diagram *diagram: diagrams_) {
|
||||||
diagram -> titleBlockTemplateRemoved(template_name);
|
diagram -> titleBlockTemplateRemoved(template_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ QGIManager::QGIManager(QGraphicsScene *sc) :
|
|||||||
*/
|
*/
|
||||||
QGIManager::~QGIManager(){
|
QGIManager::~QGIManager(){
|
||||||
if (!destroy_qgi_on_delete) return;
|
if (!destroy_qgi_on_delete) return;
|
||||||
foreach(QGraphicsItem *qgi, qgi_manager.keys()) {
|
for (QGraphicsItem *qgi: qgi_manager.keys()) {
|
||||||
if (!scene -> items().contains(qgi)) delete qgi;
|
if (!scene -> items().contains(qgi)) delete qgi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ void QGIManager::release(QGraphicsItem *qgi) {
|
|||||||
@param qgis QGraphicsItems a gerer
|
@param qgis QGraphicsItems a gerer
|
||||||
*/
|
*/
|
||||||
void QGIManager::manage(const QList<QGraphicsItem *> &qgis) {
|
void QGIManager::manage(const QList<QGraphicsItem *> &qgis) {
|
||||||
foreach(QGraphicsItem *qgi, qgis) manage(qgi);
|
for (QGraphicsItem *qgi: qgis) manage(qgi);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,7 +82,7 @@ void QGIManager::manage(const QList<QGraphicsItem *> &qgis) {
|
|||||||
@param qgis QGraphicsItems a ne plus gerer
|
@param qgis QGraphicsItems a ne plus gerer
|
||||||
*/
|
*/
|
||||||
void QGIManager::release(const QList<QGraphicsItem *> &qgis) {
|
void QGIManager::release(const QList<QGraphicsItem *> &qgis) {
|
||||||
foreach(QGraphicsItem *qgi, qgis) release(qgi);
|
for (QGraphicsItem *qgi: qgis) release(qgi);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ void QTextOrientationWidget::setFont(const QFont &font) {
|
|||||||
text_font_ = font;
|
text_font_ = font;
|
||||||
|
|
||||||
// invalide le cache contenant les longueurs des textes a disposition
|
// invalide le cache contenant les longueurs des textes a disposition
|
||||||
foreach(QString text, text_size_hash_.keys()) {
|
for (QString text: text_size_hash_.keys()) {
|
||||||
text_size_hash_[text] = -1;
|
text_size_hash_[text] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ void QTextOrientationWidget::setUsableTexts(const QStringList &texts_list) {
|
|||||||
if (texts_list.isEmpty()) return;
|
if (texts_list.isEmpty()) return;
|
||||||
|
|
||||||
// on oublie les anciennes chaines
|
// on oublie les anciennes chaines
|
||||||
foreach(QString text, text_size_hash_.keys()) {
|
for (QString text: text_size_hash_.keys()) {
|
||||||
// il faut oublier les anciennes chaines
|
// il faut oublier les anciennes chaines
|
||||||
if (!texts_list.contains(text)) {
|
if (!texts_list.contains(text)) {
|
||||||
text_size_hash_.remove(text);
|
text_size_hash_.remove(text);
|
||||||
@@ -127,7 +127,7 @@ void QTextOrientationWidget::setUsableTexts(const QStringList &texts_list) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// on ajoute les nouvelles, sans les calculer (on met -1 en guise de longueur)
|
// on ajoute les nouvelles, sans les calculer (on met -1 en guise de longueur)
|
||||||
foreach(QString text, texts_list) {
|
for (QString text: texts_list) {
|
||||||
if (!text_size_hash_.contains(text)) {
|
if (!text_size_hash_.contains(text)) {
|
||||||
text_size_hash_[text] = -1;
|
text_size_hash_[text] = -1;
|
||||||
}
|
}
|
||||||
@@ -306,7 +306,7 @@ QString QTextOrientationWidget::getMostUsableStringForRadius(const qreal &radius
|
|||||||
*/
|
*/
|
||||||
void QTextOrientationWidget::generateTextSizeHash() {
|
void QTextOrientationWidget::generateTextSizeHash() {
|
||||||
QFontMetrics font_metrics(text_font_);
|
QFontMetrics font_metrics(text_font_);
|
||||||
foreach(QString text, text_size_hash_.keys()) {
|
for (QString text: text_size_hash_.keys()) {
|
||||||
if (text_size_hash_[text] == -1) {
|
if (text_size_hash_[text] == -1) {
|
||||||
text_size_hash_[text] = font_metrics.boundingRect(text).width();
|
text_size_hash_[text] = font_metrics.boundingRect(text).width();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ void RecentFiles::buildMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remplit le menu
|
// remplit le menu
|
||||||
foreach (QString filepath, list_) {
|
for (QString filepath: list_) {
|
||||||
// creee une nouvelle action pour le fichier
|
// creee une nouvelle action pour le fichier
|
||||||
QAction *action = new QAction(filepath, this);
|
QAction *action = new QAction(filepath, this);
|
||||||
if (!files_icon_.isNull()) {
|
if (!files_icon_.isNull()) {
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ RichTextEditorToolBar::RichTextEditorToolBar(RichTextEditor *editor,
|
|||||||
// Font size combo box
|
// Font size combo box
|
||||||
m_font_size_input->setEditable(false);
|
m_font_size_input->setEditable(false);
|
||||||
const QList<int> font_sizes = QFontDatabase::standardSizes();
|
const QList<int> font_sizes = QFontDatabase::standardSizes();
|
||||||
foreach (int font_size, font_sizes)
|
for (int font_size: font_sizes)
|
||||||
m_font_size_input->addItem(QString::number(font_size));
|
m_font_size_input->addItem(QString::number(font_size));
|
||||||
|
|
||||||
connect(m_font_size_input, SIGNAL(activated(QString)),
|
connect(m_font_size_input, SIGNAL(activated(QString)),
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ void HelperCell::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
|
|||||||
if (actions_.isEmpty()) return;
|
if (actions_.isEmpty()) return;
|
||||||
|
|
||||||
QMenu context_menu;
|
QMenu context_menu;
|
||||||
foreach (QAction *action, actions_) {
|
for (QAction *action: actions_) {
|
||||||
context_menu.addAction(action);
|
context_menu.addAction(action);
|
||||||
}
|
}
|
||||||
emit(contextMenuTriggered(this));
|
emit(contextMenuTriggered(this));
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ TitleBlockTemplateCellsSet::~TitleBlockTemplateCellsSet() {
|
|||||||
*/
|
*/
|
||||||
QPainterPath TitleBlockTemplateCellsSet::painterPath() const {
|
QPainterPath TitleBlockTemplateCellsSet::painterPath() const {
|
||||||
QPainterPath cells_path;
|
QPainterPath cells_path;
|
||||||
foreach (TitleBlockTemplateVisualCell *cell, *this) {
|
for (TitleBlockTemplateVisualCell *cell: *this) {
|
||||||
cells_path.addRect(cell -> geometry());
|
cells_path.addRect(cell -> geometry());
|
||||||
}
|
}
|
||||||
return(cells_path);
|
return(cells_path);
|
||||||
@@ -74,7 +74,7 @@ bool TitleBlockTemplateCellsSet::isRectangle() const {
|
|||||||
@return true if all cells within this set are selected
|
@return true if all cells within this set are selected
|
||||||
*/
|
*/
|
||||||
bool TitleBlockTemplateCellsSet::allCellsAreSelected() const {
|
bool TitleBlockTemplateCellsSet::allCellsAreSelected() const {
|
||||||
foreach (TitleBlockTemplateVisualCell *cell, *this) {
|
for (TitleBlockTemplateVisualCell *cell: *this) {
|
||||||
if (!cell -> isSelected()) {
|
if (!cell -> isSelected()) {
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ bool TitleBlockTemplateCellsSet::hasExternalSpan() const {
|
|||||||
QSet<TitleBlockCell *> all_cells = cells(true);
|
QSet<TitleBlockCell *> all_cells = cells(true);
|
||||||
|
|
||||||
// look for cells spanned by cells that do not belong to this set
|
// look for cells spanned by cells that do not belong to this set
|
||||||
foreach (TitleBlockCell *cell, all_cells) {
|
for (TitleBlockCell *cell: all_cells) {
|
||||||
if (cell -> spanner_cell && !all_cells.contains(cell -> spanner_cell)) {
|
if (cell -> spanner_cell && !all_cells.contains(cell -> spanner_cell)) {
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::topLeftCell() const {
|
|||||||
|
|
||||||
// look for cells at the top
|
// look for cells at the top
|
||||||
QMultiMap<int, TitleBlockTemplateVisualCell *> top_cells;
|
QMultiMap<int, TitleBlockTemplateVisualCell *> top_cells;
|
||||||
foreach (TitleBlockTemplateVisualCell *cell_view, *this) {
|
for (TitleBlockTemplateVisualCell *cell_view: *this) {
|
||||||
if (TitleBlockCell *cell = cell_view -> cell()) {
|
if (TitleBlockCell *cell = cell_view -> cell()) {
|
||||||
top_cells.insertMulti(cell -> num_row, cell_view);
|
top_cells.insertMulti(cell -> num_row, cell_view);
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::topLeftCell() const {
|
|||||||
// look for the cell at the left
|
// look for the cell at the left
|
||||||
int lowest_num_col = 100000;
|
int lowest_num_col = 100000;
|
||||||
TitleBlockTemplateVisualCell *candidate = 0;
|
TitleBlockTemplateVisualCell *candidate = 0;
|
||||||
foreach (TitleBlockTemplateVisualCell *cell_view, candidates) {
|
for (TitleBlockTemplateVisualCell *cell_view: candidates) {
|
||||||
if (TitleBlockCell *cell = cell_view -> cell()) {
|
if (TitleBlockCell *cell = cell_view -> cell()) {
|
||||||
if (cell -> num_col < lowest_num_col) {
|
if (cell -> num_col < lowest_num_col) {
|
||||||
lowest_num_col = cell -> num_col;
|
lowest_num_col = cell -> num_col;
|
||||||
@@ -139,7 +139,7 @@ TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::bottomRightCell() cons
|
|||||||
|
|
||||||
// look for cells at the bottom
|
// look for cells at the bottom
|
||||||
QMultiMap<qreal, TitleBlockTemplateVisualCell *> bottom_cells;
|
QMultiMap<qreal, TitleBlockTemplateVisualCell *> bottom_cells;
|
||||||
foreach (TitleBlockTemplateVisualCell *cell_view, *this) {
|
for (TitleBlockTemplateVisualCell *cell_view: *this) {
|
||||||
bottom_cells.insertMulti(cell_view -> geometry().bottom(), cell_view);
|
bottom_cells.insertMulti(cell_view -> geometry().bottom(), cell_view);
|
||||||
}
|
}
|
||||||
QList<TitleBlockTemplateVisualCell *> candidates = bottom_cells.values(bottom_cells.keys().last());
|
QList<TitleBlockTemplateVisualCell *> candidates = bottom_cells.values(bottom_cells.keys().last());
|
||||||
@@ -148,7 +148,7 @@ TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::bottomRightCell() cons
|
|||||||
// look for the cell at the right
|
// look for the cell at the right
|
||||||
qreal highest_right = -100000;
|
qreal highest_right = -100000;
|
||||||
TitleBlockTemplateVisualCell *candidate = 0;
|
TitleBlockTemplateVisualCell *candidate = 0;
|
||||||
foreach (TitleBlockTemplateVisualCell *cell_view, candidates) {
|
for (TitleBlockTemplateVisualCell *cell_view: candidates) {
|
||||||
qreal right = cell_view -> geometry().right();
|
qreal right = cell_view -> geometry().right();
|
||||||
if (right > highest_right) {
|
if (right > highest_right) {
|
||||||
highest_right = right;
|
highest_right = right;
|
||||||
@@ -197,10 +197,10 @@ TitleBlockTemplateCellsSet TitleBlockTemplateCellsSet::mergeArea(const QRectF &r
|
|||||||
*/
|
*/
|
||||||
QSet<TitleBlockCell *> TitleBlockTemplateCellsSet::cells(bool include_spanned) const {
|
QSet<TitleBlockCell *> TitleBlockTemplateCellsSet::cells(bool include_spanned) const {
|
||||||
QSet<TitleBlockCell *> set;
|
QSet<TitleBlockCell *> set;
|
||||||
foreach (TitleBlockTemplateVisualCell *cell_view, *this) {
|
for (TitleBlockTemplateVisualCell *cell_view: *this) {
|
||||||
if (TitleBlockCell *cell = cell_view -> cell()) {
|
if (TitleBlockCell *cell = cell_view -> cell()) {
|
||||||
if (include_spanned) {
|
if (include_spanned) {
|
||||||
foreach (TitleBlockCell *cell, cell_view -> cells()) {
|
for (TitleBlockCell *cell: cell_view -> cells()) {
|
||||||
set << cell;
|
set << cell;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ void TitleBlockTemplateCellWidget::updateLogosComboBox(const TitleBlockTemplate
|
|||||||
logo_input_ -> setCurrentIndex(0);
|
logo_input_ -> setCurrentIndex(0);
|
||||||
|
|
||||||
if (!parent_template) return;
|
if (!parent_template) return;
|
||||||
foreach (QString logo, parent_template -> logos()) {
|
for (QString logo: parent_template -> logos()) {
|
||||||
logo_input_ -> addItem(logo, QVariant(logo));
|
logo_input_ -> addItem(logo, QVariant(logo));
|
||||||
}
|
}
|
||||||
int current_value_index = logo_input_ -> findData(current_value);
|
int current_value_index = logo_input_ -> findData(current_value);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ bool ModifyTitleBlockCellCommand::mergeWith(const QUndoCommand *command) {
|
|||||||
*/
|
*/
|
||||||
void ModifyTitleBlockCellCommand::undo() {
|
void ModifyTitleBlockCellCommand::undo() {
|
||||||
if (!modified_cell_) return;
|
if (!modified_cell_) return;
|
||||||
foreach (QString attribute, old_values_.keys()) {
|
for (QString attribute: old_values_.keys()) {
|
||||||
modified_cell_ -> setAttribute(attribute, old_values_[attribute]);
|
modified_cell_ -> setAttribute(attribute, old_values_[attribute]);
|
||||||
}
|
}
|
||||||
if (view_) view_ -> refresh();
|
if (view_) view_ -> refresh();
|
||||||
@@ -83,7 +83,7 @@ void ModifyTitleBlockCellCommand::undo() {
|
|||||||
*/
|
*/
|
||||||
void ModifyTitleBlockCellCommand::redo() {
|
void ModifyTitleBlockCellCommand::redo() {
|
||||||
if (!modified_cell_) return;
|
if (!modified_cell_) return;
|
||||||
foreach (QString attribute, new_values_.keys()) {
|
for (QString attribute: new_values_.keys()) {
|
||||||
modified_cell_ -> setAttribute(attribute, new_values_[attribute]);
|
modified_cell_ -> setAttribute(attribute, new_values_[attribute]);
|
||||||
}
|
}
|
||||||
if (view_) view_ -> refresh();
|
if (view_) view_ -> refresh();
|
||||||
@@ -601,7 +601,7 @@ MergeCellsCommand::MergeCellsCommand(const TitleBlockTemplateCellsSet &merged_ce
|
|||||||
if (!spanning_cell_) return;
|
if (!spanning_cell_) return;
|
||||||
|
|
||||||
// store the spanner_cell attribute of each cell implied in the merge
|
// store the spanner_cell attribute of each cell implied in the merge
|
||||||
foreach(TitleBlockCell *cell, merged_cells.cells()) {
|
for (TitleBlockCell *cell: merged_cells.cells()) {
|
||||||
spanner_cells_before_merge_.insert(cell, cell -> spanner_cell);
|
spanner_cells_before_merge_.insert(cell, cell -> spanner_cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,7 +670,7 @@ void MergeCellsCommand::undo() {
|
|||||||
if (!isValid()) return;
|
if (!isValid()) return;
|
||||||
|
|
||||||
// restore the original spanning_cell attribute of all impacted cells
|
// restore the original spanning_cell attribute of all impacted cells
|
||||||
foreach (TitleBlockCell *cell, spanner_cells_before_merge_.keys()) {
|
for (TitleBlockCell *cell: spanner_cells_before_merge_.keys()) {
|
||||||
cell -> spanner_cell = spanner_cells_before_merge_[cell];
|
cell -> spanner_cell = spanner_cells_before_merge_[cell];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -691,7 +691,7 @@ void MergeCellsCommand::redo() {
|
|||||||
if (!isValid()) return;
|
if (!isValid()) return;
|
||||||
|
|
||||||
// set the spanning_cell attributes of spanned cells to the spanning cell
|
// set the spanning_cell attributes of spanned cells to the spanning cell
|
||||||
foreach (TitleBlockCell *cell, spanner_cells_before_merge_.keys()) {
|
for (TitleBlockCell *cell: spanner_cells_before_merge_.keys()) {
|
||||||
if (cell == spanning_cell_) continue;
|
if (cell == spanning_cell_) continue;
|
||||||
cell -> spanner_cell = spanning_cell_;
|
cell -> spanner_cell = spanning_cell_;
|
||||||
}
|
}
|
||||||
@@ -723,7 +723,7 @@ TitleBlockCell *MergeCellsCommand::getBottomRightCell(const TitleBlockTemplateCe
|
|||||||
// we then look for the bottom right logical cell
|
// we then look for the bottom right logical cell
|
||||||
int max_num_row = -1, max_num_col = -1;
|
int max_num_row = -1, max_num_col = -1;
|
||||||
TitleBlockCell *candidate = 0;
|
TitleBlockCell *candidate = 0;
|
||||||
foreach(TitleBlockCell *cell, logical_cells) {
|
for (TitleBlockCell *cell: logical_cells) {
|
||||||
if (cell -> num_row > max_num_row) max_num_row = cell -> num_row;
|
if (cell -> num_row > max_num_row) max_num_row = cell -> num_row;
|
||||||
if (cell -> num_col > max_num_col) max_num_col = cell -> num_col;
|
if (cell -> num_col > max_num_col) max_num_col = cell -> num_col;
|
||||||
if (cell -> num_row == max_num_row && cell -> num_col == max_num_col) {
|
if (cell -> num_row == max_num_row && cell -> num_col == max_num_col) {
|
||||||
@@ -810,7 +810,7 @@ void SplitCellsCommand::undo() {
|
|||||||
if (!isValid()) return;
|
if (!isValid()) return;
|
||||||
|
|
||||||
// the spanned cells are spanned again
|
// the spanned cells are spanned again
|
||||||
foreach(TitleBlockCell *cell, spanned_cells_) {
|
for (TitleBlockCell *cell: spanned_cells_) {
|
||||||
cell -> spanner_cell = spanning_cell_;
|
cell -> spanner_cell = spanning_cell_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -831,7 +831,7 @@ void SplitCellsCommand::redo() {
|
|||||||
if (!isValid()) return;
|
if (!isValid()) return;
|
||||||
|
|
||||||
// the spanned cells are not spanned anymore
|
// the spanned cells are not spanned anymore
|
||||||
foreach(TitleBlockCell *cell, spanned_cells_) {
|
for (TitleBlockCell *cell: spanned_cells_) {
|
||||||
cell -> spanner_cell = 0;
|
cell -> spanner_cell = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -898,7 +898,7 @@ CutTemplateCellsCommand::~CutTemplateCellsCommand() {
|
|||||||
Undo a cut operation
|
Undo a cut operation
|
||||||
*/
|
*/
|
||||||
void CutTemplateCellsCommand::undo() {
|
void CutTemplateCellsCommand::undo() {
|
||||||
foreach (TitleBlockCell *cell, cut_cells_.keys()) {
|
for (TitleBlockCell *cell: cut_cells_.keys()) {
|
||||||
cell -> cell_type = cut_cells_.value(cell);
|
cell -> cell_type = cut_cells_.value(cell);
|
||||||
}
|
}
|
||||||
refreshView();
|
refreshView();
|
||||||
@@ -908,14 +908,14 @@ void CutTemplateCellsCommand::undo() {
|
|||||||
Redo a cut operation
|
Redo a cut operation
|
||||||
*/
|
*/
|
||||||
void CutTemplateCellsCommand::redo() {
|
void CutTemplateCellsCommand::redo() {
|
||||||
foreach (TitleBlockCell *cell, cut_cells_.keys()) {
|
for (TitleBlockCell *cell: cut_cells_.keys()) {
|
||||||
cell -> cell_type = TitleBlockCell::EmptyCell;
|
cell -> cell_type = TitleBlockCell::EmptyCell;
|
||||||
}
|
}
|
||||||
refreshView();
|
refreshView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutTemplateCellsCommand::setCutCells(const QList<TitleBlockCell *> &cells) {
|
void CutTemplateCellsCommand::setCutCells(const QList<TitleBlockCell *> &cells) {
|
||||||
foreach (TitleBlockCell *cell, cells) {
|
for (TitleBlockCell *cell: cells) {
|
||||||
cut_cells_.insert(cell, cell -> cell_type);
|
cut_cells_.insert(cell, cell -> cell_type);
|
||||||
}
|
}
|
||||||
updateText();
|
updateText();
|
||||||
@@ -957,7 +957,7 @@ void PasteTemplateCellsCommand::updateText() {
|
|||||||
*/
|
*/
|
||||||
void PasteTemplateCellsCommand::undo() {
|
void PasteTemplateCellsCommand::undo() {
|
||||||
bool span_management = erased_cells_.count() > 1;
|
bool span_management = erased_cells_.count() > 1;
|
||||||
foreach (TitleBlockCell *cell, erased_cells_.keys()) {
|
for (TitleBlockCell *cell: erased_cells_.keys()) {
|
||||||
cell -> loadContentFromCell(erased_cells_.value(cell));
|
cell -> loadContentFromCell(erased_cells_.value(cell));
|
||||||
}
|
}
|
||||||
if (span_management) {
|
if (span_management) {
|
||||||
@@ -987,7 +987,7 @@ void PasteTemplateCellsCommand::redo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// copy data from each pasted cell into each erased cell
|
// copy data from each pasted cell into each erased cell
|
||||||
foreach (TitleBlockCell *cell, erased_cells_.keys()) {
|
for (TitleBlockCell *cell: erased_cells_.keys()) {
|
||||||
if (span_management) {
|
if (span_management) {
|
||||||
// the erased cell may be spanned by another cell
|
// the erased cell may be spanned by another cell
|
||||||
if (TitleBlockCell *spanning_cell = cell -> spanner_cell) {
|
if (TitleBlockCell *spanning_cell = cell -> spanner_cell) {
|
||||||
@@ -1012,7 +1012,7 @@ void PasteTemplateCellsCommand::redo() {
|
|||||||
|
|
||||||
if (cell -> row_span || cell -> col_span) {
|
if (cell -> row_span || cell -> col_span) {
|
||||||
// browse newly spanned cells...
|
// browse newly spanned cells...
|
||||||
foreach (TitleBlockCell *spanned_cell, tbtemplate_ -> spannedCells(cell, true)) {
|
for (TitleBlockCell *spanned_cell: tbtemplate_ -> spannedCells(cell, true)) {
|
||||||
// ... to ensure they are not already spanned by other cells
|
// ... to ensure they are not already spanned by other cells
|
||||||
if (spanned_cell -> spanner_cell && spanned_cell -> spanner_cell != cell) {
|
if (spanned_cell -> spanner_cell && spanned_cell -> spanner_cell != cell) {
|
||||||
// if so, simply cancel the whole spanning
|
// if so, simply cancel the whole spanning
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ void TitleBlockTemplateLocationChooser::updateCollections() {
|
|||||||
collections_index_.clear();
|
collections_index_.clear();
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
foreach(TitleBlockTemplatesCollection *collection, QETApp::availableTitleBlockTemplatesCollections()) {
|
for (TitleBlockTemplatesCollection *collection: QETApp::availableTitleBlockTemplatesCollections()) {
|
||||||
collections_ -> addItem(collection -> title());
|
collections_ -> addItem(collection -> title());
|
||||||
collections_index_.insert(index, collection);
|
collections_index_.insert(index, collection);
|
||||||
++ index;
|
++ index;
|
||||||
@@ -136,7 +136,7 @@ void TitleBlockTemplateLocationChooser::updateTemplates() {
|
|||||||
|
|
||||||
QStringList available_templates = current_collection -> templates();
|
QStringList available_templates = current_collection -> templates();
|
||||||
if (available_templates.count()) {
|
if (available_templates.count()) {
|
||||||
foreach (QString template_name, available_templates) {
|
for (QString template_name: available_templates) {
|
||||||
templates_ -> addItem(template_name, QVariant(true));
|
templates_ -> addItem(template_name, QVariant(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ void TitleBlockTemplateLogoManager::fillView() {
|
|||||||
if (!managed_template_) return;
|
if (!managed_template_) return;
|
||||||
logos_view_ -> clear();
|
logos_view_ -> clear();
|
||||||
|
|
||||||
foreach (QString logo_name, managed_template_ -> logos()) {
|
for (QString logo_name: managed_template_ -> logos()) {
|
||||||
QIcon current_icon;
|
QIcon current_icon;
|
||||||
QPixmap current_logo = managed_template_ -> bitmapLogo(logo_name);
|
QPixmap current_logo = managed_template_ -> bitmapLogo(logo_name);
|
||||||
if (!current_logo.isNull()) {
|
if (!current_logo.isNull()) {
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ QETProject *TitleBlockTemplatesCollection::parentProject() {
|
|||||||
*/
|
*/
|
||||||
QList<TitleBlockTemplateLocation> TitleBlockTemplatesCollection::templatesLocations() {
|
QList<TitleBlockTemplateLocation> TitleBlockTemplatesCollection::templatesLocations() {
|
||||||
QList<TitleBlockTemplateLocation> locations;
|
QList<TitleBlockTemplateLocation> locations;
|
||||||
foreach (QString template_name, templates()) {
|
for (QString template_name: templates()) {
|
||||||
locations << location(template_name);
|
locations << location(template_name);
|
||||||
}
|
}
|
||||||
return(locations);
|
return(locations);
|
||||||
@@ -320,7 +320,7 @@ bool TitleBlockTemplatesProjectCollection::isReadOnly(const QString &template_na
|
|||||||
@param xml_element XML element to be parsed to load title block templates
|
@param xml_element XML element to be parsed to load title block templates
|
||||||
*/
|
*/
|
||||||
void TitleBlockTemplatesProjectCollection::fromXml(const QDomElement &xml_element) {
|
void TitleBlockTemplatesProjectCollection::fromXml(const QDomElement &xml_element) {
|
||||||
foreach (QDomElement e, QET::findInDomElement(xml_element, "titleblocktemplates", "titleblocktemplate")) {
|
for (QDomElement e: QET::findInDomElement(xml_element, "titleblocktemplates", "titleblocktemplate")) {
|
||||||
// each titleblock template must have a name
|
// each titleblock template must have a name
|
||||||
if (!e.hasAttribute("name")) continue;
|
if (!e.hasAttribute("name")) continue;
|
||||||
QString titleblock_template_name = e.attribute("name");
|
QString titleblock_template_name = e.attribute("name");
|
||||||
@@ -340,7 +340,7 @@ void TitleBlockTemplatesProjectCollection::fromXml(const QDomElement &xml_elemen
|
|||||||
void TitleBlockTemplatesProjectCollection::deleteUnusedTitleBlocKTemplates() {
|
void TitleBlockTemplatesProjectCollection::deleteUnusedTitleBlocKTemplates() {
|
||||||
if (!project_) return;
|
if (!project_) return;
|
||||||
|
|
||||||
foreach (QString template_name, templates()) {
|
for (QString template_name: templates()) {
|
||||||
if (!project_ -> usesTitleBlockTemplate(location(template_name))) {
|
if (!project_ -> usesTitleBlockTemplate(location(template_name))) {
|
||||||
removeTemplate(template_name);
|
removeTemplate(template_name);
|
||||||
}
|
}
|
||||||
@@ -390,7 +390,7 @@ QString TitleBlockTemplatesFilesCollection::path(const QString &template_name) c
|
|||||||
QStringList TitleBlockTemplatesFilesCollection::templates() {
|
QStringList TitleBlockTemplatesFilesCollection::templates() {
|
||||||
QStringList templates_names;
|
QStringList templates_names;
|
||||||
QRegExp replace_regexp(QString("%1$").arg(TITLEBLOCKS_FILE_EXTENSION));
|
QRegExp replace_regexp(QString("%1$").arg(TITLEBLOCKS_FILE_EXTENSION));
|
||||||
foreach(QString name, dir_.entryList()) {
|
for (QString name: dir_.entryList()) {
|
||||||
templates_names << name.replace(replace_regexp, "");
|
templates_names << name.replace(replace_regexp, "");
|
||||||
}
|
}
|
||||||
return(templates_names);
|
return(templates_names);
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ QList<TitleBlockCell *> TitleBlockTemplateView::copy() {
|
|||||||
QDomDocument xml_export;
|
QDomDocument xml_export;
|
||||||
QDomElement tbtpartial = xml_export.createElement("titleblocktemplate-partial");
|
QDomElement tbtpartial = xml_export.createElement("titleblocktemplate-partial");
|
||||||
xml_export.appendChild(tbtpartial);
|
xml_export.appendChild(tbtpartial);
|
||||||
foreach (TitleBlockCell *cell, copied_cells) {
|
for (TitleBlockCell *cell: copied_cells) {
|
||||||
tbtemplate_ -> exportCellToXml(cell, tbtpartial);
|
tbtemplate_ -> exportCellToXml(cell, tbtpartial);
|
||||||
tbtpartial.setAttribute("row", cell -> num_row);
|
tbtpartial.setAttribute("row", cell -> num_row);
|
||||||
tbtpartial.setAttribute("col", cell -> num_col);
|
tbtpartial.setAttribute("col", cell -> num_col);
|
||||||
@@ -248,7 +248,7 @@ void TitleBlockTemplateView::paste() {
|
|||||||
normalizeCells(pasted_cells, erased_cell -> num_row, erased_cell -> num_col);
|
normalizeCells(pasted_cells, erased_cell -> num_row, erased_cell -> num_col);
|
||||||
|
|
||||||
PasteTemplateCellsCommand *paste_command = new PasteTemplateCellsCommand(tbtemplate_);
|
PasteTemplateCellsCommand *paste_command = new PasteTemplateCellsCommand(tbtemplate_);
|
||||||
foreach (TitleBlockCell cell, pasted_cells) {
|
for (TitleBlockCell cell: pasted_cells) {
|
||||||
TitleBlockCell *erased_cell = tbtemplate_ -> cell(cell.num_row, cell.num_col);
|
TitleBlockCell *erased_cell = tbtemplate_ -> cell(cell.num_row, cell.num_col);
|
||||||
if (!erased_cell) continue;
|
if (!erased_cell) continue;
|
||||||
paste_command -> addCell(erased_cell, *erased_cell, cell);
|
paste_command -> addCell(erased_cell, *erased_cell, cell);
|
||||||
@@ -1056,7 +1056,7 @@ void TitleBlockTemplateView::removeItem(QGraphicsLayoutItem *item) {
|
|||||||
*/
|
*/
|
||||||
TitleBlockTemplateCellsSet TitleBlockTemplateView::makeCellsSetFromGraphicsItems(const QList<QGraphicsItem *> &items) const {
|
TitleBlockTemplateCellsSet TitleBlockTemplateView::makeCellsSetFromGraphicsItems(const QList<QGraphicsItem *> &items) const {
|
||||||
TitleBlockTemplateCellsSet set(this);
|
TitleBlockTemplateCellsSet set(this);
|
||||||
foreach (QGraphicsItem *item, items) {
|
for (QGraphicsItem *item: items) {
|
||||||
if (TitleBlockTemplateVisualCell *cell_view = dynamic_cast<TitleBlockTemplateVisualCell *>(item)) {
|
if (TitleBlockTemplateVisualCell *cell_view = dynamic_cast<TitleBlockTemplateVisualCell *>(item)) {
|
||||||
if (cell_view -> cell() && cell_view -> cell() -> num_row != -1) {
|
if (cell_view -> cell() && cell_view -> cell() -> num_row != -1) {
|
||||||
set << cell_view;
|
set << cell_view;
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ void TitleBlockProperties::fromXml(const QDomElement &e) {
|
|||||||
|
|
||||||
// reads the additional fields used to fill the title block
|
// reads the additional fields used to fill the title block
|
||||||
context.clear();
|
context.clear();
|
||||||
foreach (QDomElement e, QET::findInDomElement(e, "properties")) {
|
for (QDomElement e: QET::findInDomElement(e, "properties")) {
|
||||||
context.fromXml(e);
|
context.fromXml(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ TitleBlockTemplate *TitleBlockTemplate::clone() const {
|
|||||||
copy -> information_ = information_;
|
copy -> information_ = information_;
|
||||||
|
|
||||||
// this does not really duplicates pixmaps, only the objects that hold a key to the implicitly shared pixmaps
|
// this does not really duplicates pixmaps, only the objects that hold a key to the implicitly shared pixmaps
|
||||||
foreach (QString logo_key, bitmap_logos_.keys()) {
|
for (QString logo_key: bitmap_logos_.keys()) {
|
||||||
copy -> bitmap_logos_[logo_key] = QPixmap(bitmap_logos_[logo_key]);
|
copy -> bitmap_logos_[logo_key] = QPixmap(bitmap_logos_[logo_key]);
|
||||||
#ifdef TITLEBLOCK_TEMPLATE_DEBUG
|
#ifdef TITLEBLOCK_TEMPLATE_DEBUG
|
||||||
qDebug() << Q_FUNC_INFO << "copying " << bitmap_logos_[logo_key] -> cacheKey() << "to" << copy -> bitmap_logos_[logo_key] -> cacheKey();
|
qDebug() << Q_FUNC_INFO << "copying " << bitmap_logos_[logo_key] -> cacheKey() << "to" << copy -> bitmap_logos_[logo_key] -> cacheKey();
|
||||||
@@ -180,7 +180,7 @@ TitleBlockTemplate *TitleBlockTemplate::clone() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we have to create new QSvgRenderer objects from the data (no copy constructor)
|
// we have to create new QSvgRenderer objects from the data (no copy constructor)
|
||||||
foreach (QString logo_key, vector_logos_.keys()) {
|
for (QString logo_key: vector_logos_.keys()) {
|
||||||
copy -> vector_logos_[logo_key] = new QSvgRenderer(data_logos_[logo_key]);
|
copy -> vector_logos_[logo_key] = new QSvgRenderer(data_logos_[logo_key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ void TitleBlockTemplate::parseRows(const QString &rows_string) {
|
|||||||
bool conv_ok;
|
bool conv_ok;
|
||||||
|
|
||||||
QStringList rows_descriptions = rows_string.split(QChar(';'), QString::SkipEmptyParts);
|
QStringList rows_descriptions = rows_string.split(QChar(';'), QString::SkipEmptyParts);
|
||||||
foreach (QString rows_description, rows_descriptions) {
|
for (QString rows_description: rows_descriptions) {
|
||||||
if (row_size_format.exactMatch(rows_description)) {
|
if (row_size_format.exactMatch(rows_description)) {
|
||||||
int row_size = row_size_format.capturedTexts().at(1).toInt(&conv_ok);
|
int row_size = row_size_format.capturedTexts().at(1).toInt(&conv_ok);
|
||||||
if (conv_ok) rows_heights_ << row_size;
|
if (conv_ok) rows_heights_ << row_size;
|
||||||
@@ -359,7 +359,7 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) {
|
|||||||
bool conv_ok;
|
bool conv_ok;
|
||||||
|
|
||||||
QStringList cols_descriptions = cols_string.split(QChar(';'), QString::SkipEmptyParts);
|
QStringList cols_descriptions = cols_string.split(QChar(';'), QString::SkipEmptyParts);
|
||||||
foreach (QString cols_description, cols_descriptions) {
|
for (QString cols_description: cols_descriptions) {
|
||||||
if (abs_col_size_format.exactMatch(cols_description)) {
|
if (abs_col_size_format.exactMatch(cols_description)) {
|
||||||
int col_size = abs_col_size_format.capturedTexts().at(1).toInt(&conv_ok);
|
int col_size = abs_col_size_format.capturedTexts().at(1).toInt(&conv_ok);
|
||||||
if (conv_ok) columns_width_ << TitleBlockDimension(col_size, QET::Absolute);
|
if (conv_ok) columns_width_ << TitleBlockDimension(col_size, QET::Absolute);
|
||||||
@@ -370,7 +370,7 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef TITLEBLOCK_TEMPLATE_DEBUG
|
#ifdef TITLEBLOCK_TEMPLATE_DEBUG
|
||||||
foreach (TitleBlockColDimension icd, columns_width_) {
|
for (TitleBlockColDimension icd, columns_width_) {
|
||||||
qDebug() << Q_FUNC_INFO << QString("%1 [%2]").arg(icd.value).arg(QET::titleBlockColumnLengthToString(icd.type));
|
qDebug() << Q_FUNC_INFO << QString("%1 [%2]").arg(icd.value).arg(QET::titleBlockColumnLengthToString(icd.type));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -423,7 +423,7 @@ void TitleBlockTemplate::saveInformation(QDomElement &xml_element) const {
|
|||||||
*/
|
*/
|
||||||
void TitleBlockTemplate::saveLogos(QDomElement &xml_element) const {
|
void TitleBlockTemplate::saveLogos(QDomElement &xml_element) const {
|
||||||
QDomElement logos_element = xml_element.ownerDocument().createElement("logos");
|
QDomElement logos_element = xml_element.ownerDocument().createElement("logos");
|
||||||
foreach(QString logo_name, type_logos_.keys()) {
|
for (QString logo_name: type_logos_.keys()) {
|
||||||
QDomElement logo_element = xml_element.ownerDocument().createElement("logo");
|
QDomElement logo_element = xml_element.ownerDocument().createElement("logo");
|
||||||
saveLogo(logo_name, logo_element);
|
saveLogo(logo_name, logo_element);
|
||||||
logos_element.appendChild(logo_element);
|
logos_element.appendChild(logo_element);
|
||||||
@@ -462,8 +462,8 @@ void TitleBlockTemplate::saveGrid(QDomElement &xml_element) const {
|
|||||||
QDomElement grid_element = xml_element.ownerDocument().createElement("grid");
|
QDomElement grid_element = xml_element.ownerDocument().createElement("grid");
|
||||||
|
|
||||||
QString rows_attr, cols_attr;
|
QString rows_attr, cols_attr;
|
||||||
foreach(int row_height, rows_heights_) rows_attr += QString("%1;").arg(row_height);
|
for (int row_height: rows_heights_) rows_attr += QString("%1;").arg(row_height);
|
||||||
foreach(TitleBlockDimension col_width, columns_width_) cols_attr += col_width.toShortString();
|
for (TitleBlockDimension col_width: columns_width_) cols_attr += col_width.toShortString();
|
||||||
grid_element.setAttribute("rows", rows_attr);
|
grid_element.setAttribute("rows", rows_attr);
|
||||||
grid_element.setAttribute("cols", cols_attr);
|
grid_element.setAttribute("cols", cols_attr);
|
||||||
|
|
||||||
@@ -719,7 +719,7 @@ QList<int> TitleBlockTemplate::columnsWidth(int total_width) const {
|
|||||||
int share = difference > 0 ? 1 : -1;
|
int share = difference > 0 ? 1 : -1;
|
||||||
if (qAbs(difference) <= max_acceptable_difference) {
|
if (qAbs(difference) <= max_acceptable_difference) {
|
||||||
while (difference) {
|
while (difference) {
|
||||||
foreach (int index, relative_columns) {
|
for (int index: relative_columns) {
|
||||||
final_widths[index] += share;
|
final_widths[index] += share;
|
||||||
difference -= share;
|
difference -= share;
|
||||||
if (!difference) break;
|
if (!difference) break;
|
||||||
@@ -807,7 +807,7 @@ int TitleBlockTemplate::maximumWidth() {
|
|||||||
*/
|
*/
|
||||||
int TitleBlockTemplate::width(int total_width) {
|
int TitleBlockTemplate::width(int total_width) {
|
||||||
int width = 0;
|
int width = 0;
|
||||||
foreach (int col_width, columnsWidth(total_width)) {
|
for (int col_width: columnsWidth(total_width)) {
|
||||||
width += col_width;
|
width += col_width;
|
||||||
}
|
}
|
||||||
return(width);
|
return(width);
|
||||||
@@ -818,7 +818,7 @@ int TitleBlockTemplate::width(int total_width) {
|
|||||||
*/
|
*/
|
||||||
int TitleBlockTemplate::height() const {
|
int TitleBlockTemplate::height() const {
|
||||||
int height = 0;
|
int height = 0;
|
||||||
foreach(int row_height, rows_heights_) {
|
for (int row_height: rows_heights_) {
|
||||||
height += row_height;
|
height += row_height;
|
||||||
}
|
}
|
||||||
return(height);
|
return(height);
|
||||||
@@ -1011,7 +1011,7 @@ QHash<TitleBlockCell *, QPair<int, int> > TitleBlockTemplate::getAllSpans() cons
|
|||||||
Restore a set of span parameters.
|
Restore a set of span parameters.
|
||||||
*/
|
*/
|
||||||
void TitleBlockTemplate::setAllSpans(const QHash<TitleBlockCell *, QPair<int, int> > &spans) {
|
void TitleBlockTemplate::setAllSpans(const QHash<TitleBlockCell *, QPair<int, int> > &spans) {
|
||||||
foreach (TitleBlockCell *cell, spans.keys()) {
|
for (TitleBlockCell *cell: spans.keys()) {
|
||||||
cell -> row_span = spans[cell].first;
|
cell -> row_span = spans[cell].first;
|
||||||
cell -> col_span = spans[cell].second;
|
cell -> col_span = spans[cell].second;
|
||||||
}
|
}
|
||||||
@@ -1362,7 +1362,7 @@ QString TitleBlockTemplate::finalTextForCell(const TitleBlockCell &cell, const D
|
|||||||
*/
|
*/
|
||||||
QString TitleBlockTemplate::interpreteVariables(const QString &string, const DiagramContext &diagram_context) const {
|
QString TitleBlockTemplate::interpreteVariables(const QString &string, const DiagramContext &diagram_context) const {
|
||||||
QString interpreted_string = string;
|
QString interpreted_string = string;
|
||||||
foreach (QString key, diagram_context.keys(DiagramContext::DecreasingLength)) {
|
for (QString key: diagram_context.keys(DiagramContext::DecreasingLength)) {
|
||||||
interpreted_string.replace("%{" + key + "}", diagram_context[key].toString());
|
interpreted_string.replace("%{" + key + "}", diagram_context[key].toString());
|
||||||
interpreted_string.replace("%" + key, diagram_context[key].toString());
|
interpreted_string.replace("%" + key, diagram_context[key].toString());
|
||||||
}
|
}
|
||||||
@@ -1505,7 +1505,7 @@ void TitleBlockTemplate::forgetSpanning() {
|
|||||||
*/
|
*/
|
||||||
void TitleBlockTemplate::forgetSpanning(TitleBlockCell *spanning_cell, bool modify_cell) {
|
void TitleBlockTemplate::forgetSpanning(TitleBlockCell *spanning_cell, bool modify_cell) {
|
||||||
if (!spanning_cell) return;
|
if (!spanning_cell) return;
|
||||||
foreach (TitleBlockCell *spanned_cell, spannedCells(spanning_cell)) {
|
for (TitleBlockCell *spanned_cell: spannedCells(spanning_cell)) {
|
||||||
spanned_cell -> spanner_cell = 0;
|
spanned_cell -> spanner_cell = 0;
|
||||||
}
|
}
|
||||||
if (modify_cell) {
|
if (modify_cell) {
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ void ConductorPropertiesDialog::PropertiesDialog(Conductor *conductor, QWidget *
|
|||||||
{
|
{
|
||||||
undo->setText(tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
|
undo->setText(tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
|
||||||
|
|
||||||
foreach (Conductor *potential_conductor, conductor->relatedPotentialConductors())
|
for (Conductor *potential_conductor: conductor->relatedPotentialConductors())
|
||||||
{
|
{
|
||||||
old_value.setValue(potential_conductor->properties());
|
old_value.setValue(potential_conductor->properties());
|
||||||
new QPropertyUndoCommand (potential_conductor, "properties", old_value, new_value, undo);
|
new QPropertyUndoCommand (potential_conductor, "properties", old_value, new_value, undo);
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ void DiagramPropertiesEditorDockWidget::selectionChanged()
|
|||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (PropertiesEditorWidget *pew, editors())
|
for (PropertiesEditorWidget *pew: editors())
|
||||||
pew->setLiveEdit(true);
|
pew->setLiveEdit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ bool ElementInfoWidget::event(QEvent *event)
|
|||||||
*/
|
*/
|
||||||
void ElementInfoWidget::enableLiveEdit()
|
void ElementInfoWidget::enableLiveEdit()
|
||||||
{
|
{
|
||||||
foreach (ElementInfoPartWidget *eipw, m_eipw_list)
|
for (ElementInfoPartWidget *eipw: m_eipw_list)
|
||||||
{
|
{
|
||||||
connect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
|
connect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
|
||||||
connect(eipw, &ElementInfoPartWidget::showClicked, this, &ElementInfoWidget::apply);
|
connect(eipw, &ElementInfoPartWidget::showClicked, this, &ElementInfoWidget::apply);
|
||||||
@@ -170,7 +170,7 @@ void ElementInfoWidget::enableLiveEdit()
|
|||||||
*/
|
*/
|
||||||
void ElementInfoWidget::disableLiveEdit()
|
void ElementInfoWidget::disableLiveEdit()
|
||||||
{
|
{
|
||||||
foreach (ElementInfoPartWidget *eipw, m_eipw_list)
|
for (ElementInfoPartWidget *eipw: m_eipw_list)
|
||||||
{
|
{
|
||||||
disconnect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
|
disconnect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
|
||||||
disconnect(eipw, &ElementInfoPartWidget::showClicked, this, &ElementInfoWidget::apply);
|
disconnect(eipw, &ElementInfoPartWidget::showClicked, this, &ElementInfoWidget::apply);
|
||||||
@@ -183,7 +183,7 @@ void ElementInfoWidget::disableLiveEdit()
|
|||||||
*/
|
*/
|
||||||
void ElementInfoWidget::buildInterface()
|
void ElementInfoWidget::buildInterface()
|
||||||
{
|
{
|
||||||
foreach (QString str, QETApp::elementInfoKeys())
|
for (QString str: QETApp::elementInfoKeys())
|
||||||
{
|
{
|
||||||
ElementInfoPartWidget *eipw = new ElementInfoPartWidget(str, QETApp::elementTranslatedInfoKey(str), this);
|
ElementInfoPartWidget *eipw = new ElementInfoPartWidget(str, QETApp::elementTranslatedInfoKey(str), this);
|
||||||
ui->scroll_vlayout->addWidget(eipw);
|
ui->scroll_vlayout->addWidget(eipw);
|
||||||
@@ -199,7 +199,7 @@ void ElementInfoWidget::buildInterface()
|
|||||||
*/
|
*/
|
||||||
ElementInfoPartWidget *ElementInfoWidget::infoPartWidgetForKey(const QString &key) const
|
ElementInfoPartWidget *ElementInfoWidget::infoPartWidgetForKey(const QString &key) const
|
||||||
{
|
{
|
||||||
foreach (ElementInfoPartWidget *eipw, m_eipw_list)
|
for (ElementInfoPartWidget *eipw: m_eipw_list)
|
||||||
{
|
{
|
||||||
if (eipw->key() == key)
|
if (eipw->key() == key)
|
||||||
return eipw;
|
return eipw;
|
||||||
@@ -219,7 +219,7 @@ void ElementInfoWidget::updateUi()
|
|||||||
if (m_live_edit) disableLiveEdit();
|
if (m_live_edit) disableLiveEdit();
|
||||||
|
|
||||||
DiagramContext element_info = m_element->elementInformations();
|
DiagramContext element_info = m_element->elementInformations();
|
||||||
foreach (ElementInfoPartWidget *eipw, m_eipw_list)
|
for (ElementInfoPartWidget *eipw: m_eipw_list)
|
||||||
{
|
{
|
||||||
|
|
||||||
eipw -> setText (element_info[eipw->key()].toString());
|
eipw -> setText (element_info[eipw->key()].toString());
|
||||||
@@ -246,7 +246,7 @@ DiagramContext ElementInfoWidget::currentInfo() const
|
|||||||
{
|
{
|
||||||
DiagramContext info_;
|
DiagramContext info_;
|
||||||
|
|
||||||
foreach (ElementInfoPartWidget *eipw, m_eipw_list)
|
for (ElementInfoPartWidget *eipw: m_eipw_list)
|
||||||
if (!eipw->text().isEmpty()) //add value only if they're something to store
|
if (!eipw->text().isEmpty()) //add value only if they're something to store
|
||||||
info_.addValue(eipw->key(), eipw->text(), eipw->mustShow());
|
info_.addValue(eipw->key(), eipw->text(), eipw->mustShow());
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ void ElementPropertiesWidget::setElement(Element *element)
|
|||||||
//If previous element is same type as new element we just call setElement for each editor
|
//If previous element is same type as new element we just call setElement for each editor
|
||||||
if(previous_element->linkType() == m_element->linkType())
|
if(previous_element->linkType() == m_element->linkType())
|
||||||
{
|
{
|
||||||
foreach (AbstractElementPropertiesEditorWidget *aepew, m_list_editor)
|
for (AbstractElementPropertiesEditorWidget *aepew: m_list_editor)
|
||||||
{
|
{
|
||||||
aepew->setElement(m_element);
|
aepew->setElement(m_element);
|
||||||
addGeneralWidget();
|
addGeneralWidget();
|
||||||
@@ -81,21 +81,21 @@ void ElementPropertiesWidget::apply()
|
|||||||
{
|
{
|
||||||
QList <QUndoCommand *> undo_list;
|
QList <QUndoCommand *> undo_list;
|
||||||
|
|
||||||
foreach (PropertiesEditorWidget *pew, m_list_editor)
|
for (PropertiesEditorWidget *pew: m_list_editor)
|
||||||
if (QUndoCommand *undo = pew->associatedUndo())
|
if (QUndoCommand *undo = pew->associatedUndo())
|
||||||
undo_list << undo;
|
undo_list << undo;
|
||||||
|
|
||||||
if (undo_list.isEmpty()) return;
|
if (undo_list.isEmpty()) return;
|
||||||
|
|
||||||
QString str;
|
QString str;
|
||||||
foreach(QUndoCommand *uc, undo_list) str += uc->text() += " ";
|
for (QUndoCommand *uc: undo_list) str += uc->text() += " ";
|
||||||
|
|
||||||
QUndoStack &stack = m_element -> diagram() -> undoStack();
|
QUndoStack &stack = m_element -> diagram() -> undoStack();
|
||||||
stack.beginMacro(str);
|
stack.beginMacro(str);
|
||||||
foreach(QUndoCommand *uc, undo_list) stack.push(uc);
|
for (QUndoCommand *uc: undo_list) stack.push(uc);
|
||||||
stack.endMacro();
|
stack.endMacro();
|
||||||
|
|
||||||
foreach(PropertiesEditorWidget *pew, m_list_editor)
|
for (PropertiesEditorWidget *pew: m_list_editor)
|
||||||
pew->updateUi();
|
pew->updateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ void ElementPropertiesWidget::apply()
|
|||||||
* Reset the edited properties
|
* Reset the edited properties
|
||||||
*/
|
*/
|
||||||
void ElementPropertiesWidget::reset() {
|
void ElementPropertiesWidget::reset() {
|
||||||
foreach (PropertiesEditorWidget *pew, m_list_editor) pew->reset();
|
for (PropertiesEditorWidget *pew: m_list_editor) pew->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ElementPropertiesWidget::setLiveEdit(bool live_edit)
|
bool ElementPropertiesWidget::setLiveEdit(bool live_edit)
|
||||||
@@ -112,7 +112,7 @@ bool ElementPropertiesWidget::setLiveEdit(bool live_edit)
|
|||||||
if (m_live_edit == live_edit) return true;
|
if (m_live_edit == live_edit) return true;
|
||||||
m_live_edit = live_edit;
|
m_live_edit = live_edit;
|
||||||
|
|
||||||
foreach (AbstractElementPropertiesEditorWidget *aepew, m_list_editor)
|
for (AbstractElementPropertiesEditorWidget *aepew: m_list_editor)
|
||||||
aepew->setLiveEdit(m_live_edit);
|
aepew->setLiveEdit(m_live_edit);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -205,7 +205,7 @@ void ElementPropertiesWidget::updateUi()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Add each editors in tab widget
|
//Add each editors in tab widget
|
||||||
foreach (AbstractElementPropertiesEditorWidget *aepew, m_list_editor)
|
for (AbstractElementPropertiesEditorWidget *aepew: m_list_editor)
|
||||||
{
|
{
|
||||||
aepew->setLiveEdit(m_live_edit);
|
aepew->setLiveEdit(m_live_edit);
|
||||||
m_tab->addTab(aepew, aepew->title());
|
m_tab->addTab(aepew, aepew->title());
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ void LinkSingleElementWidget::buildTree()
|
|||||||
|
|
||||||
if (m_element->linkType() == Element::Slave)
|
if (m_element->linkType() == Element::Slave)
|
||||||
{
|
{
|
||||||
foreach(Element *elmt, availableElements())
|
for (Element *elmt: availableElements())
|
||||||
{
|
{
|
||||||
QStringList search_list;
|
QStringList search_list;
|
||||||
QStringList str_list;
|
QStringList str_list;
|
||||||
@@ -255,7 +255,7 @@ void LinkSingleElementWidget::buildTree()
|
|||||||
|
|
||||||
else if (m_element->linkType() & Element::AllReport)
|
else if (m_element->linkType() & Element::AllReport)
|
||||||
{
|
{
|
||||||
foreach(Element *elmt, availableElements())
|
for (Element *elmt: availableElements())
|
||||||
{
|
{
|
||||||
QStringList search_list;
|
QStringList search_list;
|
||||||
QStringList str_list;
|
QStringList str_list;
|
||||||
@@ -362,7 +362,7 @@ void LinkSingleElementWidget::setUpCompleter()
|
|||||||
delete ui->m_search_field->completer();
|
delete ui->m_search_field->completer();
|
||||||
|
|
||||||
QStringList search;
|
QStringList search;
|
||||||
foreach(QStringList strl , m_qtwi_strl_hash.values())
|
for (QStringList strl: m_qtwi_strl_hash.values())
|
||||||
search.append(strl);
|
search.append(strl);
|
||||||
|
|
||||||
QCompleter *c = new QCompleter(search, ui->m_search_field);
|
QCompleter *c = new QCompleter(search, ui->m_search_field);
|
||||||
@@ -385,7 +385,7 @@ void LinkSingleElementWidget::clearTreeWidget()
|
|||||||
delete qtwi;
|
delete qtwi;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(QTreeWidgetItem *qtwi, m_qtwi_elmt_hash.keys())
|
for (QTreeWidgetItem *qtwi: m_qtwi_elmt_hash.keys())
|
||||||
delete qtwi;
|
delete qtwi;
|
||||||
|
|
||||||
m_qtwi_elmt_hash.clear();
|
m_qtwi_elmt_hash.clear();
|
||||||
@@ -589,14 +589,14 @@ void LinkSingleElementWidget::on_m_show_this_pb_clicked()
|
|||||||
void LinkSingleElementWidget::on_m_search_field_textEdited(const QString &arg1)
|
void LinkSingleElementWidget::on_m_search_field_textEdited(const QString &arg1)
|
||||||
{
|
{
|
||||||
//Show all items if arg1 is empty, if not hide all items
|
//Show all items if arg1 is empty, if not hide all items
|
||||||
foreach(QTreeWidgetItem *qtwi, m_qtwi_elmt_hash.keys())
|
for (QTreeWidgetItem *qtwi: m_qtwi_elmt_hash.keys())
|
||||||
qtwi->setHidden(!arg1.isEmpty());
|
qtwi->setHidden(!arg1.isEmpty());
|
||||||
|
|
||||||
QList <QTreeWidgetItem *> qtwi_list;
|
QList <QTreeWidgetItem *> qtwi_list;
|
||||||
|
|
||||||
foreach(QTreeWidgetItem *qtwi, m_qtwi_strl_hash.keys())
|
for (QTreeWidgetItem *qtwi: m_qtwi_strl_hash.keys())
|
||||||
{
|
{
|
||||||
foreach(QString str, m_qtwi_strl_hash.value(qtwi))
|
for (QString str: m_qtwi_strl_hash.value(qtwi))
|
||||||
{
|
{
|
||||||
if(str.contains(arg1, Qt::CaseInsensitive))
|
if(str.contains(arg1, Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
@@ -607,6 +607,6 @@ void LinkSingleElementWidget::on_m_search_field_textEdited(const QString &arg1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Show items which match with arg1
|
//Show items which match with arg1
|
||||||
foreach(QTreeWidgetItem *qtwi, qtwi_list)
|
for (QTreeWidgetItem *qtwi: qtwi_list)
|
||||||
qtwi->setHidden(false);
|
qtwi->setHidden(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ void MasterPropertiesWidget::apply() {
|
|||||||
*/
|
*/
|
||||||
void MasterPropertiesWidget::reset()
|
void MasterPropertiesWidget::reset()
|
||||||
{
|
{
|
||||||
foreach (QTreeWidgetItem *qtwi, m_qtwi_hash.keys())
|
for (QTreeWidgetItem *qtwi: m_qtwi_hash.keys())
|
||||||
delete qtwi;
|
delete qtwi;
|
||||||
|
|
||||||
m_qtwi_hash.clear();
|
m_qtwi_hash.clear();
|
||||||
@@ -177,7 +177,7 @@ QUndoCommand* MasterPropertiesWidget::associatedUndo() const
|
|||||||
{
|
{
|
||||||
bool equal = true;
|
bool equal = true;
|
||||||
|
|
||||||
foreach(Element *elmt, to_link)
|
for (Element *elmt: to_link)
|
||||||
if (!linked_.contains(elmt))
|
if (!linked_.contains(elmt))
|
||||||
equal = false;
|
equal = false;
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ void MasterPropertiesWidget::updateUi()
|
|||||||
|
|
||||||
//Build the list of free available element
|
//Build the list of free available element
|
||||||
QList <QTreeWidgetItem *> items_list;
|
QList <QTreeWidgetItem *> items_list;
|
||||||
foreach(Element *elmt, elmt_prov.freeElement(Element::Slave))
|
for (Element *elmt: elmt_prov.freeElement(Element::Slave))
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_free_tree_widget);
|
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_free_tree_widget);
|
||||||
qtwi->setIcon(0, elmt->pixmap());
|
qtwi->setIcon(0, elmt->pixmap());
|
||||||
@@ -243,7 +243,7 @@ void MasterPropertiesWidget::updateUi()
|
|||||||
items_list.clear();
|
items_list.clear();
|
||||||
|
|
||||||
//Build the list of already linked element
|
//Build the list of already linked element
|
||||||
foreach(Element *elmt, m_element->linkedElements())
|
for (Element *elmt: m_element->linkedElements())
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_link_tree_widget);
|
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_link_tree_widget);
|
||||||
qtwi->setIcon(0, elmt->pixmap());
|
qtwi->setIcon(0, elmt->pixmap());
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector
|
|||||||
|
|
||||||
if ((elmt_->linkType() & Element::Terminale) && !elmt_->terminals().isEmpty())
|
if ((elmt_->linkType() & Element::Terminale) && !elmt_->terminals().isEmpty())
|
||||||
{
|
{
|
||||||
foreach(Terminal *t, elmt_->terminals())
|
for (Terminal *t: elmt_->terminals())
|
||||||
{
|
{
|
||||||
if (t->conductors().isEmpty()) continue;
|
if (t->conductors().isEmpty()) continue;
|
||||||
conductor_in_potential = t->conductors().first();
|
conductor_in_potential = t->conductors().first();
|
||||||
@@ -106,7 +106,7 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector
|
|||||||
|
|
||||||
c_list = conductor_in_potential->relatedPotentialConductors().toList();
|
c_list = conductor_in_potential->relatedPotentialConductors().toList();
|
||||||
c_list.append(conductor_in_potential);
|
c_list.append(conductor_in_potential);
|
||||||
foreach(Conductor *c, c_list)
|
for (Conductor *c: c_list)
|
||||||
properties_list.append(c->properties());
|
properties_list.append(c->properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,14 +139,14 @@ class LinkReportPotentialSelector : public AbstractPotentialSelector
|
|||||||
m_seq_num_1 = report->conductors().first()->sequenceNum();
|
m_seq_num_1 = report->conductors().first()->sequenceNum();
|
||||||
m_conductors_list_1.append(report->conductors().first()->relatedPotentialConductors().toList());
|
m_conductors_list_1.append(report->conductors().first()->relatedPotentialConductors().toList());
|
||||||
m_conductors_list_1.append(report->conductors().first());
|
m_conductors_list_1.append(report->conductors().first());
|
||||||
foreach(Conductor *c, m_conductors_list_1)
|
for (Conductor *c: m_conductors_list_1)
|
||||||
m_properties_list_1 << c->properties();
|
m_properties_list_1 << c->properties();
|
||||||
|
|
||||||
m_conductor_number_2 = other_report->conductors().first()->relatedPotentialConductors().size() + 1;
|
m_conductor_number_2 = other_report->conductors().first()->relatedPotentialConductors().size() + 1;
|
||||||
m_seq_num_2 = other_report->conductors().first()->sequenceNum();
|
m_seq_num_2 = other_report->conductors().first()->sequenceNum();
|
||||||
m_conductors_list_2.append(other_report->conductors().first()->relatedPotentialConductors().toList());
|
m_conductors_list_2.append(other_report->conductors().first()->relatedPotentialConductors().toList());
|
||||||
m_conductors_list_2.append(other_report->conductors().first());
|
m_conductors_list_2.append(other_report->conductors().first());
|
||||||
foreach(Conductor *c, m_conductors_list_2)
|
for (Conductor *c: m_conductors_list_2)
|
||||||
m_properties_list_2 << c->properties();
|
m_properties_list_2 << c->properties();
|
||||||
|
|
||||||
//We relink the report
|
//We relink the report
|
||||||
@@ -283,7 +283,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted()
|
|||||||
new_seq.setValue(m_sequential_num);
|
new_seq.setValue(m_sequential_num);
|
||||||
|
|
||||||
//Set the new properties for each conductors of the new potential
|
//Set the new properties for each conductors of the new potential
|
||||||
foreach(Conductor *cond, m_conductors_to_change)
|
for (Conductor *cond: m_conductors_to_change)
|
||||||
{
|
{
|
||||||
ConductorProperties new_properties = cond->properties();
|
ConductorProperties new_properties = cond->properties();
|
||||||
new_properties.applyForEqualAttributes(m_properties_list);
|
new_properties.applyForEqualAttributes(m_properties_list);
|
||||||
@@ -296,7 +296,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted()
|
|||||||
|
|
||||||
//Check if formula of the new potential have incompatible variable with folio report
|
//Check if formula of the new potential have incompatible variable with folio report
|
||||||
QRegularExpression rx ("%sequf_|%seqtf_|%seqhf_|%id|%F|%M|%LM");
|
QRegularExpression rx ("%sequf_|%seqtf_|%seqhf_|%id|%F|%M|%LM");
|
||||||
foreach(ConductorProperties cp, m_properties_list)
|
for (ConductorProperties cp: m_properties_list)
|
||||||
{
|
{
|
||||||
if (cp.m_formula.contains(rx))
|
if (cp.m_formula.contains(rx))
|
||||||
{
|
{
|
||||||
@@ -316,7 +316,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted()
|
|||||||
QString new_formula = fag.formula();
|
QString new_formula = fag.formula();
|
||||||
QSet <Conductor *> c_list = m_report->conductors().first()->relatedPotentialConductors();
|
QSet <Conductor *> c_list = m_report->conductors().first()->relatedPotentialConductors();
|
||||||
c_list.insert(m_report->conductors().first());
|
c_list.insert(m_report->conductors().first());
|
||||||
foreach(Conductor *cond, c_list)
|
for (Conductor *cond: c_list)
|
||||||
{
|
{
|
||||||
old_value.setValue(cond->properties());
|
old_value.setValue(cond->properties());
|
||||||
ConductorProperties new_properties = cond->properties();
|
ConductorProperties new_properties = cond->properties();
|
||||||
@@ -351,7 +351,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted()
|
|||||||
new QPropertyUndoCommand(m_conductor, "properties", old_value, new_value, undo);
|
new QPropertyUndoCommand(m_conductor, "properties", old_value, new_value, undo);
|
||||||
|
|
||||||
//Set the new properties for each conductors of the new potential
|
//Set the new properties for each conductors of the new potential
|
||||||
foreach(Conductor *cond, m_conductor->relatedPotentialConductors())
|
for (Conductor *cond: m_conductor->relatedPotentialConductors())
|
||||||
{
|
{
|
||||||
new_properties = cond->properties();
|
new_properties = cond->properties();
|
||||||
new_properties.applyForEqualAttributes(m_properties_list);
|
new_properties.applyForEqualAttributes(m_properties_list);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(QList<TitleBlockTemplates
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
initDialog(current_date,project);
|
initDialog(current_date,project);
|
||||||
foreach (TitleBlockTemplatesCollection *c, tbt_collection)
|
for (TitleBlockTemplatesCollection *c: tbt_collection)
|
||||||
addCollection(c);
|
addCollection(c);
|
||||||
updateTemplateList();
|
updateTemplateList();
|
||||||
setProperties(titleblock);
|
setProperties(titleblock);
|
||||||
@@ -230,7 +230,7 @@ TitleBlockTemplateLocation TitleBlockPropertiesWidget::currentTitleBlockLocation
|
|||||||
{
|
{
|
||||||
QET::QetCollection qc = m_map_index_to_collection_type.at(ui->m_tbt_cb->currentIndex());
|
QET::QetCollection qc = m_map_index_to_collection_type.at(ui->m_tbt_cb->currentIndex());
|
||||||
TitleBlockTemplatesCollection *collection = nullptr;
|
TitleBlockTemplatesCollection *collection = nullptr;
|
||||||
foreach (TitleBlockTemplatesCollection *c, m_tbt_collection_list)
|
for (TitleBlockTemplatesCollection *c: m_tbt_collection_list)
|
||||||
if (c -> collection() == qc)
|
if (c -> collection() == qc)
|
||||||
collection = c;
|
collection = c;
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ void TitleBlockPropertiesWidget::initDialog(const bool ¤t_date, QETProjec
|
|||||||
|
|
||||||
if (project!= NULL){
|
if (project!= NULL){
|
||||||
keys_2 = project -> folioAutoNum().keys();
|
keys_2 = project -> folioAutoNum().keys();
|
||||||
foreach (QString str, keys_2) { ui -> auto_page_cb -> addItem(str); }
|
for (QString str: keys_2) { ui -> auto_page_cb -> addItem(str); }
|
||||||
if (ui->auto_page_cb->currentText()==NULL)
|
if (ui->auto_page_cb->currentText()==NULL)
|
||||||
ui->auto_page_cb->addItem(tr("Créer un Folio Numérotation Auto"));
|
ui->auto_page_cb->addItem(tr("Créer un Folio Numérotation Auto"));
|
||||||
}
|
}
|
||||||
@@ -365,7 +365,7 @@ void TitleBlockPropertiesWidget::updateTemplateList()
|
|||||||
ui -> m_tbt_cb -> addItem(QET::Icons::QETLogo, tr("Modèle par défaut"));
|
ui -> m_tbt_cb -> addItem(QET::Icons::QETLogo, tr("Modèle par défaut"));
|
||||||
|
|
||||||
//Add every title block stored in m_tbt_collection_list
|
//Add every title block stored in m_tbt_collection_list
|
||||||
foreach (TitleBlockTemplatesCollection *tbt_c, m_tbt_collection_list)
|
for (TitleBlockTemplatesCollection *tbt_c: m_tbt_collection_list)
|
||||||
{
|
{
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
QET::QetCollection qc = tbt_c -> collection();
|
QET::QetCollection qc = tbt_c -> collection();
|
||||||
@@ -376,7 +376,7 @@ void TitleBlockPropertiesWidget::updateTemplateList()
|
|||||||
else if (qc == QET::QetCollection::Embedded)
|
else if (qc == QET::QetCollection::Embedded)
|
||||||
icon = QET::Icons::TitleBlock;
|
icon = QET::Icons::TitleBlock;
|
||||||
|
|
||||||
foreach(QString tbt_name, tbt_c -> templates())
|
for (QString tbt_name: tbt_c -> templates())
|
||||||
{
|
{
|
||||||
m_map_index_to_collection_type.append(qc);
|
m_map_index_to_collection_type.append(qc);
|
||||||
ui -> m_tbt_cb -> addItem(icon, tbt_name, tbt_name);
|
ui -> m_tbt_cb -> addItem(icon, tbt_name, tbt_name);
|
||||||
@@ -394,7 +394,7 @@ void TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate(int index)
|
|||||||
|
|
||||||
QET::QetCollection qc = m_map_index_to_collection_type.at(index);
|
QET::QetCollection qc = m_map_index_to_collection_type.at(index);
|
||||||
TitleBlockTemplatesCollection *collection = nullptr;
|
TitleBlockTemplatesCollection *collection = nullptr;
|
||||||
foreach (TitleBlockTemplatesCollection *c, m_tbt_collection_list)
|
for (TitleBlockTemplatesCollection *c: m_tbt_collection_list)
|
||||||
if (c -> collection() == qc)
|
if (c -> collection() == qc)
|
||||||
collection = c;
|
collection = c;
|
||||||
|
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ void LinkElementCommand::setLink(Element *element_)
|
|||||||
*/
|
*/
|
||||||
void LinkElementCommand::unlink(QList<Element *> element_list)
|
void LinkElementCommand::unlink(QList<Element *> element_list)
|
||||||
{
|
{
|
||||||
foreach(Element *elmt, element_list)
|
for (Element *elmt: element_list)
|
||||||
m_linked_after.removeAll(elmt);
|
m_linked_after.removeAll(elmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ void LinkElementCommand::redo()
|
|||||||
c_list << m_element->conductors().first();
|
c_list << m_element->conductors().first();
|
||||||
//fill list of text
|
//fill list of text
|
||||||
QStringList strl;
|
QStringList strl;
|
||||||
foreach (const Conductor *c, c_list) strl<<(c->properties().text);
|
for (const Conductor *c: c_list) strl<<(c->properties().text);
|
||||||
|
|
||||||
//check text list, isn't same in potential, ask user what to do
|
//check text list, isn't same in potential, ask user what to do
|
||||||
if (!QET::eachStrIsEqual(strl))
|
if (!QET::eachStrIsEqual(strl))
|
||||||
@@ -245,7 +245,7 @@ void LinkElementCommand::setUpNewLink(const QList<Element *> &element_list, bool
|
|||||||
//if m_element isn't master (may be a report or slave) we can connect only one element
|
//if m_element isn't master (may be a report or slave) we can connect only one element
|
||||||
if (m_element->linkType() == Element::Master || element_list.size() == 1)
|
if (m_element->linkType() == Element::Master || element_list.size() == 1)
|
||||||
{
|
{
|
||||||
foreach(Element *elmt, element_list)
|
for (Element *elmt: element_list)
|
||||||
if (isLinkable(m_element, elmt, already_link))
|
if (isLinkable(m_element, elmt, already_link))
|
||||||
m_linked_after << elmt;
|
m_linked_after << elmt;
|
||||||
}
|
}
|
||||||
@@ -253,7 +253,7 @@ void LinkElementCommand::setUpNewLink(const QList<Element *> &element_list, bool
|
|||||||
{
|
{
|
||||||
qDebug() << "LinkElementCommand::setUpNewLink : try to link several elements to a report element or slave element,"
|
qDebug() << "LinkElementCommand::setUpNewLink : try to link several elements to a report element or slave element,"
|
||||||
" only the first element of the list will be taken to be linked";
|
" only the first element of the list will be taken to be linked";
|
||||||
foreach(Element *elmt, element_list)
|
for (Element *elmt: element_list)
|
||||||
if (isLinkable(m_element, elmt, already_link))
|
if (isLinkable(m_element, elmt, already_link))
|
||||||
{
|
{
|
||||||
m_linked_after << elmt;
|
m_linked_after << elmt;
|
||||||
@@ -278,17 +278,17 @@ void LinkElementCommand::makeLink(const QList<Element *> &element_list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//We link all element from element_list
|
//We link all element from element_list
|
||||||
foreach(Element *elmt, element_list)
|
for (Element *elmt: element_list)
|
||||||
m_element->linkToElement(elmt);
|
m_element->linkToElement(elmt);
|
||||||
|
|
||||||
//At this point may be there are unwanted linked elements to m_element. We must to unlink it.
|
//At this point may be there are unwanted linked elements to m_element. We must to unlink it.
|
||||||
//Elements from @element_list are wanted so we compare @element_list to current linked element of @m_element
|
//Elements from @element_list are wanted so we compare @element_list to current linked element of @m_element
|
||||||
QList<Element *> to_unlink = m_element->linkedElements();
|
QList<Element *> to_unlink = m_element->linkedElements();
|
||||||
foreach(Element *elmt, element_list)
|
for (Element *elmt: element_list)
|
||||||
to_unlink.removeAll(elmt);
|
to_unlink.removeAll(elmt);
|
||||||
|
|
||||||
//All elements stored in to_unlink is unwanted we unlink it from m_element
|
//All elements stored in to_unlink is unwanted we unlink it from m_element
|
||||||
if (!to_unlink.isEmpty())
|
if (!to_unlink.isEmpty())
|
||||||
foreach(Element *elmt, to_unlink)
|
for (Element *elmt: to_unlink)
|
||||||
m_element->unlinkElement(elmt);
|
m_element->unlinkElement(elmt);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user