diff --git a/sources/ElementsCollection/elementcollectionhandler.cpp b/sources/ElementsCollection/elementcollectionhandler.cpp index 847f5375f..b438a144e 100644 --- a/sources/ElementsCollection/elementcollectionhandler.cpp +++ b/sources/ElementsCollection/elementcollectionhandler.cpp @@ -402,9 +402,11 @@ ElementsLocation ElementCollectionHandler::createDir(ElementsLocation &parent, c @param location : location to copy @return true if import with success */ -bool ElementCollectionHandler::importFromProject(QETProject *project, ElementsLocation &location) +bool ElementCollectionHandler::importFromProject(QETProject *project, + ElementsLocation &location) { - if (!(location.isElement() && location.exist() && location.isProject())) return false; + if (!(location.isElement() && location.exist() && location.isProject())) + return false; ElementsLocation destination(location.collectionPath(false), project); if (destination.exist()) return true; @@ -421,14 +423,18 @@ bool ElementCollectionHandler::importFromProject(QETProject *project, ElementsLo while (!destination.exist()) { names.append(source.fileName()); source = source.parent(); - destination = ElementsLocation(source.collectionPath(), project); + destination = ElementsLocation(source.collectionPath(), + project); } XmlElementCollection *collection = project->embeddedElementCollection(); while (!names.isEmpty()) { source.addToPath(names.takeLast()); - destination = collection->copy(source, destination, QString(), false); + destination = collection->copy(source, + destination, + QString(), + false); if (!destination.exist()) return false; @@ -445,7 +451,8 @@ bool ElementCollectionHandler::importFromProject(QETProject *project, ElementsLo @param name_list : NamesList to use @return return true if success */ -bool ElementCollectionHandler::setNames(ElementsLocation &location, const NamesList &name_list) +bool ElementCollectionHandler::setNames(ElementsLocation &location, + const NamesList &name_list) { if ( !(location.exist() && location.isWritable()) ) { return false; @@ -454,11 +461,13 @@ bool ElementCollectionHandler::setNames(ElementsLocation &location, const NamesL if (location.isFileSystem()) { if (location.isDirectory()) { QDomDocument document; - QDomElement root = document.createElement("qet-directory"); + QDomElement root = document.createElement( + "qet-directory"); document.appendChild(root); root.appendChild(name_list.toXml(document)); - QString filepath = location.fileSystemPath() + "/qet_directory"; + QString filepath = location.fileSystemPath() + + "/qet_directory"; if (!QET::writeXmlFile(document, filepath)) { qDebug() << "ElementCollectionHandler::setNames : write qet-directory file failed"; return false; @@ -469,14 +478,18 @@ bool ElementCollectionHandler::setNames(ElementsLocation &location, const NamesL if (location.isElement()) { QDomDocument document; - document.appendChild(document.importNode(location.xml(), true)); + document.appendChild(document.importNode(location.xml(), + true)); if (document.isNull()) { qDebug() << "ElementCollectionHandler::setNames : failed to load xml document from file"; return false; } QDomElement document_element = document.documentElement(); - document_element.replaceChild(name_list.toXml(document), document_element.firstChildElement("names")); + document_element.replaceChild( + name_list.toXml(document), + document_element + .firstChildElement("names")); return true; } } @@ -484,7 +497,8 @@ bool ElementCollectionHandler::setNames(ElementsLocation &location, const NamesL if (location.isProject()) { QDomElement element = location.xml(); QDomDocument document = element.ownerDocument(); - element.replaceChild(name_list.toXml(document), element.firstChildElement("names")); + element.replaceChild(name_list.toXml(document), + element.firstChildElement("names")); return true; } diff --git a/sources/ElementsCollection/elementcollectionitem.cpp b/sources/ElementsCollection/elementcollectionitem.cpp index 7d3770d5e..f6fc49b54 100644 --- a/sources/ElementsCollection/elementcollectionitem.cpp +++ b/sources/ElementsCollection/elementcollectionitem.cpp @@ -49,7 +49,9 @@ void ElementCollectionItem::clearData() @return : The last item that exist in this hierarchy, or nullptr can't find (an error was occurred, or path already exist) */ -ElementCollectionItem *ElementCollectionItem::lastItemForPath(const QString &path, QString &no_found_path) +ElementCollectionItem *ElementCollectionItem::lastItemForPath( + const QString &path, + QString &no_found_path) { QStringList str_list = path.split("/"); if (str_list.isEmpty()) return nullptr; @@ -76,7 +78,8 @@ ElementCollectionItem *ElementCollectionItem::lastItemForPath(const QString &pat @param name @return */ -ElementCollectionItem *ElementCollectionItem::childWithCollectionName(const QString& name) const +ElementCollectionItem *ElementCollectionItem::childWithCollectionName( + const QString& name) const { rowCount(); foreach (QStandardItem *qsi, directChilds()) { diff --git a/sources/ElementsCollection/elementscollectionmodel.cpp b/sources/ElementsCollection/elementscollectionmodel.cpp index 6febf628f..04b53c451 100644 --- a/sources/ElementsCollection/elementscollectionmodel.cpp +++ b/sources/ElementsCollection/elementscollectionmodel.cpp @@ -64,7 +64,8 @@ QVariant ElementsCollectionModel::data(const QModelIndex &index, int role) const @param indexes @return */ -QMimeData *ElementsCollectionModel::mimeData(const QModelIndexList &indexes) const +QMimeData *ElementsCollectionModel::mimeData( + const QModelIndexList &indexes) const { QModelIndex index = indexes.first(); if (index.isValid()) @@ -315,7 +316,9 @@ void ElementsCollectionModel::addCommonCollection(bool set_data) void ElementsCollectionModel::addCustomCollection(bool set_data) { FileElementCollectionItem *feci = new FileElementCollectionItem(); - if (feci->setRootPath(QETApp::customElementsDirN(), set_data, m_hide_element)) { + if (feci->setRootPath(QETApp::customElementsDirN(), + set_data, + m_hide_element)) { invisibleRootItem()->appendRow(feci); if (set_data) feci->setUpData(); @@ -502,7 +505,8 @@ QList ElementsCollectionModel::items() const @param project @return return all items for project. the list can be empty */ -QList ElementsCollectionModel::projectItems(QETProject *project) const +QList ElementsCollectionModel::projectItems( + QETProject *project) const { QList list; @@ -596,7 +600,9 @@ void ElementsCollectionModel::elementIntegratedToCollection(const QString& path) XmlProjectElementCollectionItem *xpeci = m_project_hash.value(project); QString collection_name; - ElementCollectionItem *eci = xpeci->lastItemForPath(path, collection_name); + ElementCollectionItem *eci = xpeci->lastItemForPath( + path, + collection_name); if (!eci) return; @@ -626,7 +632,8 @@ void ElementsCollectionModel::itemRemovedFromCollection(const QString& path) } if (project) { - QModelIndex index = indexFromLocation(ElementsLocation(path, project)); + QModelIndex index = indexFromLocation( + ElementsLocation(path, project)); if (index.isValid()) removeRow(index.row(), index.parent()); } diff --git a/sources/ElementsCollection/elementstreeview.cpp b/sources/ElementsCollection/elementstreeview.cpp index 32a0e983a..9f00f8fe2 100644 --- a/sources/ElementsCollection/elementstreeview.cpp +++ b/sources/ElementsCollection/elementstreeview.cpp @@ -80,16 +80,20 @@ void ElementsTreeView::startElementDrag(const ElementsLocation &location) if (location.isDirectory()) { - mime_data->setData("application/x-qet-category-uri", location_str.toLatin1()); + mime_data->setData("application/x-qet-category-uri", + location_str.toLatin1()); drag->setPixmap(QET::Icons::Folder.pixmap(22, 22)); } else if (location.isElement()) { - mime_data->setData("application/x-qet-element-uri", location_str.toLatin1()); + mime_data->setData("application/x-qet-element-uri", + location_str.toLatin1()); //Build the element for set the pixmap of the QDrag int elmt_creation_state; - Element *temp_elmt = ElementFactory::Instance()->createElement(location, nullptr, &elmt_creation_state); + Element *temp_elmt = ElementFactory::Instance()->createElement( + location, nullptr, + &elmt_creation_state); if (elmt_creation_state) { delete temp_elmt; @@ -100,10 +104,17 @@ void ElementsTreeView::startElementDrag(const ElementsLocation &location) QPoint elmt_hotspot(temp_elmt->hotspot()); //Adjust the size of the pixmap if he is too big - QPoint elmt_pixmap_size(elmt_pixmap.width(), elmt_pixmap.height()); - if (elmt_pixmap.width() > MAX_DND_PIXMAP_WIDTH || elmt_pixmap.height() > MAX_DND_PIXMAP_HEIGHT) + QPoint elmt_pixmap_size(elmt_pixmap.width(), + elmt_pixmap.height()); + if (elmt_pixmap.width() + > MAX_DND_PIXMAP_WIDTH + || elmt_pixmap.height() + > MAX_DND_PIXMAP_HEIGHT) { - elmt_pixmap = elmt_pixmap.scaled(MAX_DND_PIXMAP_WIDTH, MAX_DND_PIXMAP_HEIGHT, Qt::KeepAspectRatio); + elmt_pixmap = elmt_pixmap.scaled( + MAX_DND_PIXMAP_WIDTH, + MAX_DND_PIXMAP_HEIGHT, + Qt::KeepAspectRatio); elmt_hotspot = QPoint( elmt_hotspot.x() * elmt_pixmap.width() / elmt_pixmap_size.x(), elmt_hotspot.y() * elmt_pixmap.height() / elmt_pixmap_size.y() diff --git a/sources/ElementsCollection/xmlelementcollection.cpp b/sources/ElementsCollection/xmlelementcollection.cpp index e4fd7cf77..b95ff8086 100644 --- a/sources/ElementsCollection/xmlelementcollection.cpp +++ b/sources/ElementsCollection/xmlelementcollection.cpp @@ -46,9 +46,18 @@ XmlElementCollection::XmlElementCollection(QETProject *project) : NamesList names; - const QChar russian_data[24] = { 0x0418, 0x043C, 0x043F, 0x043E, 0x0440, 0x0442, 0x0438, 0x0440, 0x043E, 0x0432, 0x0430, 0x043D, 0x043D, 0x044B, 0x0435, 0x0020, 0x044D, 0x043B, 0x0435, 0x043C, 0x0435, 0x043D, 0x0442, 0x044B }; - const QChar greek_data[18] = { 0x0395, 0x03b9, 0x03c3, 0x03b7, 0x03b3, 0x03bc, 0x03ad, 0x03bd, 0x03b1, 0x0020, 0x03c3, 0x03c4, 0x03bf, 0x03b9, 0x03c7, 0x03b5, 0x03af, 0x03b1 }; - const QChar turkish_data[12] ={ 0x0130, 0x0074, 0x0068, 0x0061, 0x006C, 0x0020, 0x00F6, 0x011F, 0x0065, 0x006C, 0x0065, 0x0072 }; + const QChar russian_data[24] = { 0x0418, 0x043C, 0x043F, 0x043E, 0x0440, + 0x0442, 0x0438, 0x0440, 0x043E, 0x0432, + 0x0430, 0x043D, 0x043D, 0x044B, 0x0435, + 0x0020, 0x044D, 0x043B, 0x0435, 0x043C, + 0x0435, 0x043D, 0x0442, 0x044B }; + const QChar greek_data[18] = { 0x0395, 0x03b9, 0x03c3, 0x03b7, 0x03b3, + 0x03bc, 0x03ad, 0x03bd, 0x03b1, 0x0020, + 0x03c3, 0x03c4, 0x03bf, 0x03b9, 0x03c7, + 0x03b5, 0x03af, 0x03b1 }; + const QChar turkish_data[12] ={ 0x0130, 0x0074, 0x0068, 0x0061, 0x006C, + 0x0020, 0x00F6, 0x011F, 0x0065, 0x006C, + 0x0065, 0x0072 }; names.addName("fr", "Éléments importés"); names.addName("en", "Imported elements"); names.addName("de", "Importierte elemente"); @@ -80,12 +89,14 @@ XmlElementCollection::XmlElementCollection(QETProject *project) : -the collection in a dom_element (the dom element in cloned) @param project : the project of this collection */ -XmlElementCollection::XmlElementCollection(const QDomElement &dom_element, QETProject *project) : +XmlElementCollection::XmlElementCollection(const QDomElement &dom_element, + QETProject *project) : QObject(project), m_project(project) { if (dom_element.tagName() == "collection") - m_dom_document.appendChild(m_dom_document.importNode(dom_element, true)); + m_dom_document.appendChild(m_dom_document.importNode( + dom_element, true)); else qDebug() << "XmlElementCollection : tagName of dom_element is not collection"; } @@ -114,9 +125,11 @@ QDomElement XmlElementCollection::importCategory() const { @param parent_element @return All childs element in the parent_element tree */ -QDomNodeList XmlElementCollection::childs(const QDomElement &parent_element) const +QDomNodeList XmlElementCollection::childs( + const QDomElement &parent_element) const { - if (parent_element.ownerDocument() != m_dom_document) return QDomNodeList(); + if (parent_element.ownerDocument() != m_dom_document) + return QDomNodeList(); return parent_element.childNodes(); } @@ -132,9 +145,11 @@ QDomNodeList XmlElementCollection::childs(const QDomElement &parent_element) con @param child_name : name of child to search. @return The child QDomElement or a null QDomElement if not found */ -QDomElement XmlElementCollection::child(const QDomElement &parent_element, const QString &child_name) const +QDomElement XmlElementCollection::child(const QDomElement &parent_element, + const QString &child_name) const { - if (parent_element.ownerDocument() != m_dom_document) return QDomElement(); + if (parent_element.ownerDocument() != m_dom_document) + return QDomElement(); //Get all childs element of parent_element QDomNodeList child_list = parent_element.childNodes(); @@ -143,7 +158,8 @@ QDomElement XmlElementCollection::child(const QDomElement &parent_element, const for (int i=0 ; i XmlElementCollection::directories(const QDomElement &parent_element) const +QList XmlElementCollection::directories( + const QDomElement &parent_element) const { QList directory_list; QDomNodeList node_list = childs(parent_element); @@ -193,7 +210,8 @@ QList XmlElementCollection::directories(const QDomElement &parent_e for (int i=0 ; i < node_list.count() ; i++) { QDomNode node = node_list.at(i); - if (node.isElement() && node.toElement().tagName() == "category") + if (node.isElement() + && node.toElement().tagName() == "category") directory_list << node.toElement(); } @@ -205,7 +223,8 @@ QList XmlElementCollection::directories(const QDomElement &parent_e @param parent_element @return a list of names for every child directories of parent_element */ -QStringList XmlElementCollection::directoriesNames(const QDomElement &parent_element) const +QStringList XmlElementCollection::directoriesNames( + const QDomElement &parent_element) const { QList childs = directories(parent_element); QStringList names; @@ -225,7 +244,8 @@ QStringList XmlElementCollection::directoriesNames(const QDomElement &parent_ele @param parent_element @return A list of element stored in parent_element */ -QList XmlElementCollection::elements(const QDomElement &parent_element) const +QList XmlElementCollection::elements( + const QDomElement &parent_element) const { QList element_list; QDomNodeList node_list = childs(parent_element); @@ -234,7 +254,7 @@ QList XmlElementCollection::elements(const QDomElement &parent_elem for (int i=0 ; i < node_list.count() ; i++) { QDomNode node = node_list.at(i); - if (node.isElement() && node.toElement().tagName() == "element") + if (node.isElement() && node.toElement().tagName() == "element") element_list << node.toElement(); } @@ -246,7 +266,8 @@ QList XmlElementCollection::elements(const QDomElement &parent_elem @param parent_element @return A list of names fr every childs element of parent_element */ -QStringList XmlElementCollection::elementsNames(const QDomElement &parent_element) const +QStringList XmlElementCollection::elementsNames( + const QDomElement &parent_element) const { QList childs = elements(parent_element); QStringList names; @@ -336,8 +357,9 @@ QString XmlElementCollection::addElement(ElementsLocation &location) return QString(); if (location.isFileSystem()) { - //Get the root dir of the filesystem collection - QDir dir(location.fileSystemPath().remove(location.collectionPath(false))); + //Get the root dir of the filesystem collection + QDir dir(location.fileSystemPath().remove( + location.collectionPath(false))); if (!dir.exists()) return QString(); @@ -446,11 +468,15 @@ QString XmlElementCollection::addElement(ElementsLocation &location) The tag name of xml_definition must be "definition". @return True if the element is added with success. */ -bool XmlElementCollection::addElementDefinition(const QString &dir_path, const QString &elmt_name, const QDomElement &xml_definition) +bool XmlElementCollection::addElementDefinition( + const QString &dir_path, + const QString &elmt_name, + const QDomElement &xml_definition) { QDomElement dom_dir = directory(dir_path); if (dom_dir.isNull()) { - qDebug() << "XmlElementCollection::addElementDefinition : No directory at path : " << dir_path; + qDebug() << "XmlElementCollection::addElementDefinition : No directory at path : " + << dir_path; return false; } @@ -510,9 +536,16 @@ bool XmlElementCollection::removeElement(const QString& path) @return the ElementLocation that represent the copy, if copy failed return a null ElementLocation */ -ElementsLocation XmlElementCollection::copy(ElementsLocation &source, ElementsLocation &destination, const QString& rename, bool deep_copy) +ElementsLocation XmlElementCollection::copy( + ElementsLocation &source, + ElementsLocation &destination, + const QString& rename, + bool deep_copy) { - if (!(source.exist() && destination.isDirectory() && destination.isProject() && destination.projectCollection() == this)) + if (!(source.exist() + && destination.isDirectory() + && destination.isProject() + && destination.projectCollection() == this)) return ElementsLocation(); if (source.isElement()) @@ -537,14 +570,17 @@ bool XmlElementCollection::exist(const QString &path) const /** @brief XmlElementCollection::createDir - Create a child directorie at path @path with the name @name. + Create a child directorie at path path with the name name. Emit directorieAdded if success. @param path : path of parent diectorie @param name : name of the directori to create. @param name_list : translation of the directorie name. - @return true if creation success, if directorie already exist return true. + @return true if creation success, + if directorie already exist return true. */ -bool XmlElementCollection::createDir(const QString& path, const QString& name, const NamesList &name_list) +bool XmlElementCollection::createDir(const QString& path, + const QString& name, + const NamesList &name_list) { QString new_dir_path = path + "/" + name; @@ -597,7 +633,9 @@ bool XmlElementCollection::removeDir(const QString& path) if false, only return the direct childs location of dom_element. @return */ -QList XmlElementCollection::elementsLocation(QDomElement dom_element, bool childs) const +QList XmlElementCollection::elementsLocation( + QDomElement dom_element, + bool childs) const { QList location_list; @@ -640,12 +678,14 @@ QList XmlElementCollection::elementsLocation(QDomElement dom_e The tag name of dom_element must be "element" @return the element location, location can be null if fail. */ -ElementsLocation XmlElementCollection::domToLocation(QDomElement dom_element) const +ElementsLocation XmlElementCollection::domToLocation( + QDomElement dom_element) const { if (dom_element.ownerDocument() == m_dom_document) { QString path = dom_element.attribute("name"); - while (!dom_element.parentNode().isNull() && dom_element.parentNode().isElement()) { + while (!dom_element.parentNode().isNull() + && dom_element.parentNode().isElement()) { dom_element = dom_element.parentNode().toElement(); if (dom_element.tagName() == "category") @@ -678,8 +718,10 @@ void XmlElementCollection::cleanUnusedDirectory() for(int i=0 ; isetFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable); + qtwi->setFlags(Qt::ItemIsEditable + | Qt::ItemIsEnabled + | Qt::ItemIsSelectable); } ui->m_tree->addTopLevelItem(qtwi); ui->m_tree->sortItems(0, Qt::AscendingOrder); diff --git a/sources/PropertiesEditor/propertieseditordialog.h b/sources/PropertiesEditor/propertieseditordialog.h index b31a0a4c8..a324f5063 100644 --- a/sources/PropertiesEditor/propertieseditordialog.h +++ b/sources/PropertiesEditor/propertieseditordialog.h @@ -55,11 +55,18 @@ class PropertiesEditorDialog : public QDialog //Build the dialog QVBoxLayout *vlayout = new QVBoxLayout(this); vlayout->addWidget(editor); - QDialogButtonBox *button_box = new QDialogButtonBox (QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::Reset, this); + QDialogButtonBox *button_box = new QDialogButtonBox ( + QDialogButtonBox::Apply + | QDialogButtonBox::Cancel + | QDialogButtonBox::Reset, + this); vlayout->addWidget(button_box); - //Setup connection between button box and the editor - connect(button_box, &QDialogButtonBox::clicked, [editor, button_box, this](QAbstractButton *button) + //Setup connection between button box and the editor + connect(button_box, + &QDialogButtonBox::clicked, + [editor, button_box, this] + (QAbstractButton *button) { switch(button_box->buttonRole(button)) { diff --git a/sources/PropertiesEditor/propertieseditordockwidget.cpp b/sources/PropertiesEditor/propertieseditordockwidget.cpp index 4598f48be..74154feaf 100644 --- a/sources/PropertiesEditor/propertieseditordockwidget.cpp +++ b/sources/PropertiesEditor/propertieseditordockwidget.cpp @@ -88,7 +88,8 @@ void PropertiesEditorDockWidget::reset() @return true if was added (or already add) or false if can't be add (editor = nullptr) */ -bool PropertiesEditorDockWidget::addEditor(PropertiesEditorWidget *editor, int index) +bool PropertiesEditorDockWidget::addEditor(PropertiesEditorWidget *editor, + int index) { if (!editor) return false; if (m_editor_list.contains(editor)) return true; diff --git a/sources/QPropertyUndoCommand/qpropertyundocommand.cpp b/sources/QPropertyUndoCommand/qpropertyundocommand.cpp index f5c4cbb90..5a5ca3621 100644 --- a/sources/QPropertyUndoCommand/qpropertyundocommand.cpp +++ b/sources/QPropertyUndoCommand/qpropertyundocommand.cpp @@ -26,7 +26,11 @@ @param old_value @param new_value */ -QPropertyUndoCommand::QPropertyUndoCommand(QObject *object, const char *property_name, const QVariant &old_value, const QVariant &new_value, QUndoCommand *parent) : +QPropertyUndoCommand::QPropertyUndoCommand(QObject *object, + const char *property_name, + const QVariant &old_value, + const QVariant &new_value, + QUndoCommand *parent) : QUndoCommand(parent), m_object(object), m_property_name(property_name), @@ -43,7 +47,10 @@ QPropertyUndoCommand::QPropertyUndoCommand(QObject *object, const char *property @param old_value @param parent */ -QPropertyUndoCommand::QPropertyUndoCommand(QObject *object, const char *property_name, const QVariant &old_value, QUndoCommand *parent) : +QPropertyUndoCommand::QPropertyUndoCommand(QObject *object, + const char *property_name, + const QVariant &old_value, + QUndoCommand *parent) : QUndoCommand(parent), m_object(object), m_property_name(property_name), diff --git a/sources/QWidgetAnimation/qwidgetanimation.cpp b/sources/QWidgetAnimation/qwidgetanimation.cpp index f14aa9b41..7c8242c33 100644 --- a/sources/QWidgetAnimation/qwidgetanimation.cpp +++ b/sources/QWidgetAnimation/qwidgetanimation.cpp @@ -25,7 +25,10 @@ @param duration : the duration of animation @see void QVariantAnimation::setDuration(int msecs) */ -QWidgetAnimation::QWidgetAnimation(QWidget *widget, Qt::Orientation orientation, QWidgetAnimation::Behavior behavior, int duration) : +QWidgetAnimation::QWidgetAnimation(QWidget *widget, + Qt::Orientation orientation, + QWidgetAnimation::Behavior behavior, + int duration) : QPropertyAnimation(widget), m_orientation(orientation), m_widget(widget), @@ -34,7 +37,9 @@ QWidgetAnimation::QWidgetAnimation(QWidget *widget, Qt::Orientation orientation, m_behavior(behavior) { setTargetObject(widget); - setPropertyName( m_orientation == Qt::Vertical ? "maximumHeight" : "maximumWidth"); + setPropertyName( m_orientation == Qt::Vertical + ? "maximumHeight" + : "maximumWidth"); setDuration(duration); setEasingCurve(QEasingCurve::OutCubic); @@ -42,8 +47,11 @@ QWidgetAnimation::QWidgetAnimation(QWidget *widget, Qt::Orientation orientation, { m_state = QWidgetAnimation::Finish; - if ( (this->m_orientation == Qt::Vertical && m_widget->geometry().height() == 0) || - (this->m_orientation == Qt::Horizontal && m_widget->geometry().width() == 0) ) { + if ( (this->m_orientation == Qt::Vertical + && m_widget->geometry().height() == 0) || + (this->m_orientation == Qt::Horizontal + && m_widget->geometry().width() == 0)) + { m_widget->hide(); } else { m_widget->setMaximumSize(m_maximum); @@ -78,32 +86,39 @@ void QWidgetAnimation::show() int end_value = 10000; if (m_behavior == QWidgetAnimation::minimumSizeHint) { - end_value = m_orientation == Qt::Horizontal ? m_widget->minimumSizeHint().width() : - m_widget->minimumSizeHint().height(); + end_value = m_orientation == Qt::Horizontal + ? m_widget->minimumSizeHint().width() + : m_widget->minimumSizeHint().height(); } - else if (m_behavior == QWidgetAnimation::availableSpace && m_widget->parentWidget()) + else if (m_behavior == QWidgetAnimation::availableSpace + && m_widget->parentWidget()) { m_widget->parentWidget()->layout(); - int available_ = m_orientation == Qt::Horizontal ? m_widget->parentWidget()->width() : - m_widget->parentWidget()->height(); + int available_ = m_orientation == Qt::Horizontal + ? m_widget->parentWidget()->width() + : m_widget->parentWidget()->height(); for (auto w : m_widget_to_substract) { - available_ -= m_orientation == Qt::Horizontal ? w->minimumSizeHint().width() : - w->minimumSizeHint().height(); + available_ -= m_orientation == Qt::Horizontal + ? w->minimumSizeHint().width() + : w->minimumSizeHint().height(); } - int mini_ = m_orientation == Qt::Horizontal ? m_widget->minimumSizeHint().width() : - m_widget->minimumSizeHint().height(); + int mini_ = m_orientation == Qt::Horizontal + ? m_widget->minimumSizeHint().width() + : m_widget->minimumSizeHint().height(); end_value = available_ > mini_ ? available_ : mini_; } else { if (m_last_rect.isValid()) { - end_value = m_orientation == Qt::Horizontal ? m_last_rect.width() : - m_last_rect.height(); + end_value = m_orientation == Qt::Horizontal + ? m_last_rect.width() + : m_last_rect.height(); } else { - end_value = m_orientation == Qt::Horizontal ? m_maximum.width() : - m_maximum.height(); + end_value = m_orientation == Qt::Horizontal + ? m_maximum.width() + : m_maximum.height(); } } @@ -127,8 +142,9 @@ void QWidgetAnimation::hide() } stop(); - int start_value = m_orientation == Qt::Horizontal ? m_widget->width() : - m_widget->height(); + int start_value = m_orientation == Qt::Horizontal + ? m_widget->width() + : m_widget->height(); setStartValue(start_value); setEndValue(0); m_state = QWidgetAnimation::Hidding; diff --git a/sources/QWidgetAnimation/qwidgetanimation.h b/sources/QWidgetAnimation/qwidgetanimation.h index da74c390c..6fa3fb0d9 100644 --- a/sources/QWidgetAnimation/qwidgetanimation.h +++ b/sources/QWidgetAnimation/qwidgetanimation.h @@ -53,7 +53,12 @@ class QWidgetAnimation : public QPropertyAnimation lastSize, }; - QWidgetAnimation(QWidget *widget, Qt::Orientation orientation, QWidgetAnimation::Behavior behavior = QWidgetAnimation::minimumSizeHint, int duration = 250); + QWidgetAnimation( + QWidget *widget, + Qt::Orientation orientation, + QWidgetAnimation::Behavior + behavior = QWidgetAnimation::minimumSizeHint, + int duration = 250); void widgetToSubtract (QVector widgets); void show(); diff --git a/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.cpp b/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.cpp index 5a53f21bc..34da10180 100644 --- a/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.cpp +++ b/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.cpp @@ -188,7 +188,9 @@ QRectF QetGraphicsHandlerUtility::mirrorRectForPosAtIndex(const QRectF &old_rect @param index @return */ -QLineF QetGraphicsHandlerUtility::lineForPosAtIndex(const QLineF &old_line, const QPointF &pos, int index) { +QLineF QetGraphicsHandlerUtility::lineForPosAtIndex(const QLineF &old_line, + const QPointF &pos, + int index) { QLineF line = old_line; index == 0 ? line.setP1(pos) : line.setP2(pos); return line; @@ -201,7 +203,10 @@ QLineF QetGraphicsHandlerUtility::lineForPosAtIndex(const QLineF &old_line, cons @param pos : the pos where the new point must be added @return the new polygon */ -QPolygonF QetGraphicsHandlerUtility::polygonForInsertPoint(const QPolygonF &old_polygon, bool closed, const QPointF &pos) +QPolygonF QetGraphicsHandlerUtility::polygonForInsertPoint( + const QPolygonF &old_polygon, + bool closed, + const QPointF &pos) { qreal max_angle = 0; int index = 0; diff --git a/sources/SearchAndReplace/searchandreplaceworker.cpp b/sources/SearchAndReplace/searchandreplaceworker.cpp index 66ffe9224..23a0787b1 100644 --- a/sources/SearchAndReplace/searchandreplaceworker.cpp +++ b/sources/SearchAndReplace/searchandreplaceworker.cpp @@ -397,7 +397,9 @@ ConductorProperties SearchAndReplaceWorker::invalidConductorProperties() @param change : the change properties, to be merged with original @return a new conductor properties with the change applyed. */ -ConductorProperties SearchAndReplaceWorker::applyChange(const ConductorProperties &original, const ConductorProperties &change) +ConductorProperties SearchAndReplaceWorker::applyChange( + const ConductorProperties &original, + const ConductorProperties &change) { ConductorProperties new_properties = original; @@ -432,7 +434,8 @@ ConductorProperties SearchAndReplaceWorker::applyChange(const ConductorPropertie @param change : the changed string: @return the string to be use in the properties */ -QString SearchAndReplaceWorker::applyChange(const QString &original, const QString &change) +QString SearchAndReplaceWorker::applyChange(const QString &original, + const QString &change) { if (change.isEmpty()) {return original;} else if (change == eraseText()) {return QString();} @@ -496,7 +499,8 @@ DiagramContext SearchAndReplaceWorker::replaceAdvanced(Element *element) @return the conductor properties with the change applied, according to the state of m_advanced_struct */ -ConductorProperties SearchAndReplaceWorker::replaceAdvanced(Conductor *conductor) +ConductorProperties SearchAndReplaceWorker::replaceAdvanced( + Conductor *conductor) { ConductorProperties properties = conductor->properties(); diff --git a/sources/autoNum/assignvariables.cpp b/sources/autoNum/assignvariables.cpp index 3ba4be13f..88d0a67f1 100644 --- a/sources/autoNum/assignvariables.cpp +++ b/sources/autoNum/assignvariables.cpp @@ -360,7 +360,9 @@ namespace autonum @param type : type of sequential (unit, unitfolio, ten, tenfolio, hundred, hundredfolio) */ - void setSequentialToList(QStringList &list, NumerotationContext &context, const QString& type) + void setSequentialToList(QStringList &list, + NumerotationContext &context, + const QString& type) { for (int i = 0; i < context.size(); i++) { @@ -384,7 +386,10 @@ namespace autonum @param hash : hash to have values inserted @param autoNumName : name to use as key of hash */ - void setFolioSequentialToHash(QStringList &list, QHash &hash, const QString& autoNumName) + void setFolioSequentialToHash(QStringList &list, + QHash &hash, + const QString& autoNumName) { if (hash.isEmpty() || !hash.contains(autoNumName)) { diff --git a/sources/autoNum/numerotationcontextcommands.cpp b/sources/autoNum/numerotationcontextcommands.cpp index 67b64bad0..22faf6b4d 100644 --- a/sources/autoNum/numerotationcontextcommands.cpp +++ b/sources/autoNum/numerotationcontextcommands.cpp @@ -161,7 +161,8 @@ NumStrategy::~NumStrategy() {} @brief NumStrategy::nextString @return the next value of nc at position i */ -NumerotationContext NumStrategy::nextString (const NumerotationContext &nc, const int i) const { +NumerotationContext NumStrategy::nextString (const NumerotationContext &nc, + const int i) const { QStringList strl = nc.itemAt(i); NumerotationContext newnc; newnc.addValue(strl.at(0), strl.at(1), strl.at(2).toInt()); @@ -170,9 +171,10 @@ NumerotationContext NumStrategy::nextString (const NumerotationContext &nc, cons /** @brief NumStrategy::nextNumber - @return the next value of @nc at position @i + @return the next value of nc at position i */ -NumerotationContext NumStrategy::nextNumber (const NumerotationContext &nc, const int i) const { +NumerotationContext NumStrategy::nextNumber (const NumerotationContext &nc, + const int i) const { QStringList strl = nc.itemAt(i); NumerotationContext newnc; QString value = QString::number( (strl.at(1).toInt()) + (strl.at(2).toInt()) ); @@ -184,7 +186,8 @@ NumerotationContext NumStrategy::nextNumber (const NumerotationContext &nc, cons @brief NumStrategy::previousNumber @return the previous value of nc at position i */ -NumerotationContext NumStrategy::previousNumber(const NumerotationContext &nc, const int i) const { +NumerotationContext NumStrategy::previousNumber(const NumerotationContext &nc, + const int i) const { QStringList strl = nc.itemAt(i); NumerotationContext newnc; QString value = QString::number( (strl.at(1).toInt()) - (strl.at(2).toInt()) ); diff --git a/sources/autoNum/ui/autonumberingmanagementw.cpp b/sources/autoNum/ui/autonumberingmanagementw.cpp index 61e24d6a4..c3e21fa8b 100644 --- a/sources/autoNum/ui/autonumberingmanagementw.cpp +++ b/sources/autoNum/ui/autonumberingmanagementw.cpp @@ -195,16 +195,18 @@ void AutoNumberingManagementW::on_buttonBox_clicked(QAbstractButton *button) { emit applyPressed(); break; case QDialogButtonBox::HelpRole: - QMessageBox::information(this, tr("Auto Numbering Management", "title window"), - tr("In this Menu you can set whether you want the Auto Numberings to be updated or not." - " For Element Auto Numbering you have 4 options of Update Policy:\n" - "-Both: both New and Existent Element labels will be updated. This is the default option.\n" - "-Update Only New: only new created Elements will be updated. Existent Element labels will be frozen.\n" - "-Update Only Existent: only existent Elements will be updated. New Elements will be assigned " - "their formula but will not update once created.\n" - "-Disable: both New and Existent Element labels will not be updated. This is valid for new folios as well.\n" - "Note: These options DO NOT allow or block Auto Numberings, only their Update Policy." - )); + QMessageBox::information( + this, + tr("Auto Numbering Management", "title window"), + tr("In this Menu you can set whether you want the Auto Numberings to be updated or not." + " For Element Auto Numbering you have 4 options of Update Policy:\n" + "-Both: both New and Existent Element labels will be updated. This is the default option.\n" + "-Update Only New: only new created Elements will be updated. Existent Element labels will be frozen.\n" + "-Update Only Existent: only existent Elements will be updated. New Elements will be assigned " + "their formula but will not update once created.\n" + "-Disable: both New and Existent Element labels will not be updated. This is valid for new folios as well.\n" + "Note: These options DO NOT allow or block Auto Numberings, only their Update Policy." + )); break; } }