Fix Qt 6 definition of macro ‘Q_DECLARE_MOVABLE_CONTAINER’

adding #include <QHash>

+ code fail to compile if it uses deprecated APIs.
=> see .pro file
This commit is contained in:
Simon De Backer 2020-09-21 21:19:50 +02:00
parent c958d54d01
commit 2a69e540d6
25 changed files with 207 additions and 165 deletions

View File

@ -76,6 +76,7 @@ include(sources/QWidgetAnimation/QWidgetAnimation.pri)
DEFINES += QAPPLICATION_CLASS=QApplication
DEFINES += QT_MESSAGELOGCONTEXT
DEFINES += GIT_COMMIT_SHA="\\\"$(shell git -C \""$$_PRO_FILE_PWD_"\" rev-parse --verify HEAD)\\\""
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
TEMPLATE = app
DEPENDPATH += .

View File

@ -19,6 +19,7 @@
#define ELEMENTSCOLLECTIONMODEL2_H
#include <QStandardItemModel>
#include <QHash>
#include "elementslocation.h"
class XmlProjectElementCollectionItem;

View File

@ -1,25 +1,27 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NAMELISTWIDGET_H
#define NAMELISTWIDGET_H
#include "nameslist.h"
#include <QWidget>
#include <QHash>
#include "nameslist.h"
namespace Ui {
class NameListWidget;
@ -32,27 +34,27 @@ namespace Ui {
class NameListWidget : public QWidget
{
Q_OBJECT
public:
explicit NameListWidget(QWidget *parent = nullptr);
~NameListWidget();
void addLine();
void setNames (const NamesList &name_list);
NamesList names() const;
void setReadOnly(bool ro);
bool isEmpty() const;
void setClipboardValue (QHash <QString, QString> value);
private slots:
void on_m_clipboard_cb_activated(int index);
private:
void clean();
private:
Ui::NameListWidget *ui;
bool m_read_only = false;
bool m_read_only = false;
};
#endif // NAMELISTWIDGET_H

View File

@ -1,20 +1,26 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QFontDialog>
#include <QFont>
#include <QSizePolicy>
#include <utility>
#include "configpages.h"
#include "borderpropertieswidget.h"
#include "conductorpropertieswidget.h"
@ -27,10 +33,7 @@
#include "qetproject.h"
#include "reportproperties.h"
#include "qetapp.h"
#include <QFontDialog>
#include <QFont>
#include <QSizePolicy>
#include <utility>
#include "nameslist.h"
/**
@brief NewDiagramPage::NewDiagramPage
@ -249,13 +252,13 @@ void NewDiagramPage::loadSavedTbp()
ExportConfigPage::ExportConfigPage(QWidget *parent) : ConfigPage(parent) {
// epw contient les options d'export
epw = new ExportPropertiesWidget(ExportProperties::defaultExportProperties());
// layout vertical contenant le titre, une ligne horizontale et epw
QVBoxLayout *vlayout1 = new QVBoxLayout();
QLabel *title = new QLabel(this -> title());
vlayout1 -> addWidget(title);
QFrame *horiz_line = new QFrame();
horiz_line -> setFrameShape(QFrame::HLine);
vlayout1 -> addWidget(horiz_line);
@ -300,13 +303,13 @@ PrintConfigPage::PrintConfigPage(QWidget *parent) : ConfigPage(parent) {
// epw contient les options d'export
epw = new ExportPropertiesWidget(ExportProperties::defaultPrintProperties());
epw -> setPrintingMode(true);
// layout vertical contenant le titre, une ligne horizontale et epw
QVBoxLayout *vlayout1 = new QVBoxLayout();
QLabel *title = new QLabel(this -> title());
vlayout1 -> addWidget(title);
QFrame *horiz_line = new QFrame();
horiz_line -> setFrameShape(QFrame::HLine);
vlayout1 -> addWidget(horiz_line);
@ -329,10 +332,10 @@ PrintConfigPage::~PrintConfigPage()
void PrintConfigPage::applyConf()
{
QString prefix = "print/default";
QSettings settings;
epw -> exportProperties().toSettings(settings, prefix);
// annule l'enregistrement de certaines proprietes non pertinentes
settings.remove(prefix + "path");
settings.remove(prefix + "format");

View File

@ -20,6 +20,7 @@
#include <QWidget>
#include <QButtonGroup>
#include <QHash>
class QListWidgetItem;

View File

@ -20,6 +20,7 @@
#include <QSet>
#include <QPointF>
#include <QHash>
class QGraphicsItem;
class DiagramTextItem;
@ -37,16 +38,16 @@ class ElementTextsMover
ElementTextsMover();
private:
ElementTextsMover(const ElementTextsMover &);
public:
bool isReady() const;
int beginMovement(Diagram *diagram, QGraphicsItem *driver_item = nullptr);
void continueMovement(QGraphicsSceneMouseEvent *event);
void endMovement();
private:
QString undoText() const;
private:
bool m_movement_running = false;
Diagram *m_diagram = nullptr;

View File

@ -15,9 +15,11 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QMetaEnum>
#include <QHash>
#include "xrefproperties.h"
#include "qetapp.h"
#include <QMetaEnum>
/**
@brief XRefProperties::XRefProperties
@ -56,7 +58,7 @@ void XRefProperties::toSettings(QSettings &settings,
QString slave_label = m_slave_label;
settings.setValue(prefix + "slave_label", slave_label);
QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>();
settings.setValue(prefix + "xrefpos", var.valueToKey(m_xref_pos));
@ -110,7 +112,7 @@ QDomElement XRefProperties::toXml(QDomDocument &xml_document) const
xml_element.setAttribute("snapto", snap);
QString xrefpos;
QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>();
xml_element.setAttribute("xrefpos", var.valueToKey(m_xref_pos));

View File

@ -18,8 +18,10 @@
#ifndef XREFPROPERTIES_H
#define XREFPROPERTIES_H
#include "propertiesinterface.h"
#include <QStringList>
#include <QHash>
#include "propertiesinterface.h"
/**
@brief The XRefProperties class

View File

@ -1,23 +1,27 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ELEMENT_H
#define ELEMENT_H
#include <algorithm>
#include <QPicture>
#include <QHash>
#include "qet.h"
#include "qetgraphicsitem.h"
#include "diagramcontext.h"
@ -25,9 +29,6 @@
#include "elementslocation.h"
#include "nameslist.h"
#include <algorithm>
#include <QPicture>
class QETProject;
class Terminal;
class Conductor;
@ -40,7 +41,7 @@ class ElementTextItemGroup;
class Element : public QetGraphicsItem
{
friend class DiagramEventAddElement;
Q_OBJECT
public:
/**
@ -64,7 +65,7 @@ class Element : public QetGraphicsItem
~Element() override;
private:
Element(const Element &);
// attributes
public:
/**
@ -74,7 +75,7 @@ class Element : public QetGraphicsItem
*/
enum { Type = UserType + 1000 };
int type() const override { return Type; }
signals:
void linkedElementChanged(); //This signal is emited when the linked elements with this element change
void elementInfoChange(
@ -91,12 +92,12 @@ class Element : public QetGraphicsItem
DynamicElementTextItem *text,
ElementTextItemGroup *group);
public:
QList<Terminal *> terminals() const;
QList<Conductor *> conductors() const;
QList<QPair<Terminal *,Terminal *>> AlignedFreeTerminals() const;
//METHODS related to information
DiagramContext elementInformations()const
{return m_element_informations;}
@ -118,7 +119,7 @@ class Element : public QetGraphicsItem
bool isFreezeLabel() const {return m_freeze_label;}
void freezeNewAddedElement();
QString actualLabel();
QString name() const override;
ElementsLocation location() const;
virtual void setHighlighted(bool);
@ -140,7 +141,7 @@ class Element : public QetGraphicsItem
int> &) const;
QUuid uuid() const;
int orientation() const;
//METHODS related to texts
void addDynamicTextItem(DynamicElementTextItem *deti = nullptr);
void removeDynamicTextItem(DynamicElementTextItem *deti);
@ -156,7 +157,7 @@ class Element : public QetGraphicsItem
bool removeTextFromGroup(
DynamicElementTextItem *text,
ElementTextItemGroup *group);
//METHODS related to linked element
bool isFree() const;
virtual void linkToElement(Element *) {}
@ -171,7 +172,7 @@ class Element : public QetGraphicsItem
protected:
void drawAxes(QPainter *, const QStyleOptionGraphicsItem *);
void setSize(int, int);
private:
void drawSelection(
QPainter *,
@ -212,25 +213,25 @@ class Element : public QetGraphicsItem
// to be use in the function element::fromXml
QHash <DynamicElementTextItem *, QPointF>
m_converted_text_from_xml_description;
//ATTRIBUTES related to linked element
QList <Element *> connected_elements;
QList <QUuid> tmp_uuids_link;
QUuid m_uuid;
kind m_link_type = Element::Simple;
//ATTRIBUTES related to informations
DiagramContext m_element_informations, m_kind_informations;
autonum::sequentialNumbers m_autoNum_seq;
bool m_freeze_label = false;
QString m_F_str;
ElementsLocation m_location;
NamesList m_names;
QList <Terminal *> m_terminals;
const QPicture m_picture;
const QPicture m_low_zoom_picture;
private:
bool m_must_highlight = false;
QSize dimensions;

View File

@ -1,25 +1,26 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "qetinformation.h"
#include <QObject>
#include <QHash>
#include "qetinformation.h"
/**
@brief QETInformation::titleblockInfoKeys
@return all available key for use with a titleblock
@ -47,7 +48,7 @@ QStringList QETInformation::titleblockInfoKeys()
info_list << "savedtime";
info_list << "savedfilename";
info_list << "savedfilepath";
return info_list;
}

View File

@ -1,17 +1,17 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
@ -19,6 +19,7 @@
#define QETINFORMATION_H
#include <QStringList>
#include <QHash>
namespace QETInformation
{

View File

@ -15,6 +15,13 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QTimer>
#include <QStandardPaths>
#include <utility>
#include <QtConcurrent>
#include <QHash>
#include "qetproject.h"
#include "diagram.h"
#include "qetapp.h"
@ -30,11 +37,6 @@
#include "numerotationcontextcommands.h"
#include "assignvariables.h"
#include <QTimer>
#include <QStandardPaths>
#include <utility>
#include <QtConcurrent>
static int BACKUP_INTERVAL = 120000; //interval in ms of backup = 2min
/**

View File

@ -1,23 +1,26 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QET_PROJECT_H
#define QET_PROJECT_H
#include <KAutoSaveFile>
#include <QHash>
#include "nameslist.h"
#include "elementslocation.h"
#include "borderproperties.h"
@ -28,8 +31,6 @@
#include "projectdatabase.h"
#include "reportproperties.h"
#include <KAutoSaveFile>
class Diagram;
class ElementsLocation;
class QETResult;
@ -62,7 +63,7 @@ class QETProject : public QObject
};
Q_PROPERTY(bool autoConductor READ autoConductor WRITE setAutoConductor)
// constructors, destructor
public:
QETProject (QObject *parent = nullptr);
@ -72,7 +73,7 @@ class QETProject : public QObject
private:
QETProject(const QETProject &);
// methods
public:
projectDataBase *dataBase();
@ -166,13 +167,13 @@ class QETProject : public QObject
DiagramContext projectProperties();
void setProjectProperties(const DiagramContext &);
QUndoStack* undoStack() {return m_undo_stack;}
public slots:
Diagram *addNewDiagram(int pos = -1);
void removeDiagram(Diagram *);
void diagramOrderChanged(int, int);
void setModified(bool);
signals:
void projectFilePathChanged(QETProject *, const QString &);
void projectTitleChanged(QETProject *, const QString &);
@ -195,14 +196,14 @@ class QETProject : public QObject
void folioAutoNumChanged(QString);
void defaultTitleBlockPropertiesChanged();
void conductorAutoNumChanged();
private slots:
void updateDiagramsFolioData();
void updateDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection *, const QString &);
void removeDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection *, const QString &);
void usedTitleBlockTemplateChanged(const QString &);
void undoStackChanged (bool a) {if (!a) setModified(true);}
private:
void readProjectXml(QDomDocument &xml_project);
void readDiagramsXml(QDomDocument &xml_project);
@ -217,7 +218,7 @@ class QETProject : public QObject
void writeBackup();
void init();
ProjectState openFile(QFile *file);
// attributes
private:
/// File path this project is saved to

View File

@ -19,6 +19,8 @@
#define DYNAMICELEMENTTEXTMODEL_H
#include <QStandardItemModel>
#include <QHash>
#include <qstyleditemdelegate.h>
#include "dynamicelementtextitem.h"
@ -35,7 +37,7 @@ class Element;
class DynamicElementTextModel : public QStandardItemModel
{
Q_OBJECT
public:
enum ValueType {
textFrom =1,
@ -58,10 +60,10 @@ class DynamicElementTextModel : public QStandardItemModel
grpHoldBottom,
grpFrame
};
DynamicElementTextModel(Element *element, QObject *parent = nullptr);
~DynamicElementTextModel() override;
bool indexIsInGroup(const QModelIndex &index) const;
DynamicElementTextItem *textFromIndex(const QModelIndex &index) const;
DynamicElementTextItem *textFromItem(QStandardItem *item) const;
@ -72,13 +74,13 @@ class DynamicElementTextModel : public QStandardItemModel
QUndoCommand *undoForEditedGroup(
ElementTextItemGroup *group,
QUndoCommand *parent_undo = nullptr) const;
ElementTextItemGroup *groupFromIndex(const QModelIndex &index) const;
ElementTextItemGroup *groupFromItem(QStandardItem *item) const;
QModelIndex indexFromGroup(ElementTextItemGroup *group) const;
bool indexIsText(const QModelIndex &index) const;
bool indexIsGroup(const QModelIndex &index) const;
bool canDropMimeData(
const QMimeData *data,
Qt::DropAction action,
@ -93,10 +95,10 @@ class DynamicElementTextModel : public QStandardItemModel
const QModelIndex &parent) override;
QMimeData *mimeData(const QModelIndexList &indexes) const override;
QStringList mimeTypes() const override;
signals:
void dataChanged();
private:
QList<QStandardItem *> itemsForText(DynamicElementTextItem *deti);
void addText(DynamicElementTextItem *deti);
@ -119,7 +121,7 @@ class DynamicElementTextModel : public QStandardItemModel
DynamicElementTextModel::ValueType type);
void updateDataFromGroup(ElementTextItemGroup *group,
DynamicElementTextModel::ValueType type);
private:
QPointer<Element> m_element;
QHash <DynamicElementTextItem *, QStandardItem *> m_texts_list;
@ -134,10 +136,10 @@ class DynamicElementTextModel : public QStandardItemModel
class DynamicTextItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
DynamicTextItemDelegate(QObject *parent = Q_NULLPTR);
QWidget *createEditor(
QWidget *parent,
const QStyleOptionViewItem &option,
@ -146,10 +148,10 @@ class DynamicTextItemDelegate : public QStyledItemDelegate
QWidget *editor,
QAbstractItemModel *model,
const QModelIndex &index) const override;
protected:
bool eventFilter(QObject *object, QEvent *event) override;
private:
QStringList availableInfo(DynamicElementTextItem *deti) const;
};

View File

@ -18,6 +18,8 @@
#ifndef LINKSINGLEELEMENTWIDGET_H
#define LINKSINGLEELEMENTWIDGET_H
#include <QHash>
#include "element.h"
#include "abstractelementpropertieseditorwidget.h"
@ -73,30 +75,30 @@ class LinkSingleElementWidget : public AbstractElementPropertiesEditorWidget
void hideButtons();
void showButtons();
void headerCustomContextMenuRequested(const QPoint &pos);
void on_m_unlink_pb_clicked();
void on_m_tree_widget_itemDoubleClicked(QTreeWidgetItem *item, int column);
void on_m_tree_widget_customContextMenuRequested(const QPoint &pos);
void on_m_show_linked_pb_clicked();
void on_m_show_this_pb_clicked();
void on_m_search_field_textEdited(const QString &arg1);
private:
Ui::LinkSingleElementWidget *ui;
bool m_unlink = false;
Element::kind m_filter;
QHash <QTreeWidgetItem*, Element*> m_qtwi_elmt_hash;
QHash <QTreeWidgetItem*, QStringList> m_qtwi_strl_hash;
QTreeWidgetItem *m_qtwi_at_context_menu = nullptr,
*m_pending_qtwi = nullptr;
Element *m_showed_element = nullptr,
*m_element_to_link = nullptr;
QMenu *m_context_menu;
QAction *m_link_action,
*m_show_qtwi,

View File

@ -20,6 +20,7 @@
#include <QWidget>
#include <QHash>
#include "abstractelementpropertieseditorwidget.h"
class Element;

View File

@ -15,13 +15,16 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QSettings>
#include <QHash>
#include "multipastedialog.h"
#include "ui_multipastedialog.h"
#include "diagram.h"
#include "diagramcommands.h"
#include "element.h"
#include "conductorautonumerotation.h"
#include <QSettings>
MultiPasteDialog::MultiPasteDialog(Diagram *diagram, QWidget *parent) :
QDialog(parent),
@ -29,16 +32,16 @@ MultiPasteDialog::MultiPasteDialog(Diagram *diagram, QWidget *parent) :
m_diagram(diagram)
{
ui->setupUi(this);
connect(ui->m_x_sb, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &MultiPasteDialog::updatePreview);
connect(ui->m_y_sb, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &MultiPasteDialog::updatePreview);
connect(ui->m_copy_count, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &MultiPasteDialog::updatePreview);
QRectF br;
for (QGraphicsItem *item : m_diagram->selectedItems())
br = br.united(item->mapToScene(item->boundingRect()).boundingRect());
m_origin = br.topLeft();
m_document = m_diagram->toXml(false);
updatePreview();
}
@ -56,7 +59,7 @@ MultiPasteDialog::~MultiPasteDialog()
}
}
}
delete ui;
}
@ -73,20 +76,20 @@ void MultiPasteDialog::updatePreview()
}
m_pasted_content.clear();
m_pasted_content_list.clear();
QPointF offset(ui->m_x_sb->value(), ui->m_y_sb->value());
QPointF pos = m_origin+offset;
for(int i=0 ; i<ui->m_copy_count->value() ; i++)
{
{
DiagramContent dc;
m_diagram->fromXml(m_document, pos, false, &dc);
m_pasted_content += dc;
m_pasted_content_list << dc;
pos += offset;
}
if(m_pasted_content.count())
m_diagram->adjustSceneRect();
}
@ -96,7 +99,7 @@ void MultiPasteDialog::on_m_button_box_accepted()
if(m_pasted_content.count())
{
m_diagram->undoStack().beginMacro(tr("Multi-collage"));
QSettings settings;
bool erase_label = settings.value("diagramcommands/erase-label-on-copy", true).toBool();
//Ensure when 'auto_num' is checked, the settings 'save_label' is to true.
@ -105,18 +108,18 @@ void MultiPasteDialog::on_m_button_box_accepted()
//and so the auto_num below do nothing (there is not a formula to compare)
if(ui->m_auto_num_cb->isChecked())
settings.setValue("diagramcommands/erase-label-on-copy", false);
m_diagram->clearSelection();
m_diagram->undoStack().push(new PasteDiagramCommand(m_diagram, m_pasted_content));
for(DiagramContent dc : m_pasted_content_list)
{
QList<Element *> pasted_elements = dc.m_elements;
//Sort the list element by there pos (top -> bottom)
std::sort(pasted_elements.begin(), pasted_elements.end(), [](Element *a, Element *b){return (a->pos().y() < b->pos().y());});
//Auto-connection
if(ui->m_auto_connection_cb->isChecked())
{
@ -125,10 +128,10 @@ void MultiPasteDialog::on_m_button_box_accepted()
while (!elmt->AlignedFreeTerminals().isEmpty())
{
QPair <Terminal *, Terminal *> pair = elmt->AlignedFreeTerminals().takeFirst();
Conductor *conductor = new Conductor(pair.first, pair.second);
m_diagram->undoStack().push(new AddItemCommand<Conductor *>(conductor, m_diagram, QPointF()));
//Autonum the new conductor, the undo command associated for this, have for parent undo_object
ConductorAutoNumerotation can (conductor, m_diagram);
can.numerate();
@ -138,7 +141,7 @@ void MultiPasteDialog::on_m_button_box_accepted()
}
}
}
//Set up the label of element
//Instead of use the current autonum of project,
//we try to fetch the same formula of the pasted element, in the several autonum of the project
@ -152,7 +155,7 @@ void MultiPasteDialog::on_m_button_box_accepted()
{
QHash <QString, NumerotationContext> autonums = m_diagram->project()->elementAutoNum();
QHashIterator<QString, NumerotationContext> hash_iterator(autonums);
while(hash_iterator.hasNext())
{
hash_iterator.next();
@ -167,7 +170,7 @@ void MultiPasteDialog::on_m_button_box_accepted()
}
//Like elements, we compare formula of pasted conductor with the autonums available in the project.
if(ui->m_auto_num_cond_cb->isChecked())
{
{
//This list is to ensure we not numerate twice the same conductor
QList<Conductor *> numerated;
//Start with the element at top
@ -184,7 +187,7 @@ void MultiPasteDialog::on_m_button_box_accepted()
{
QHash <QString, NumerotationContext> autonums = m_diagram->project()->conductorAutoNum();
QHashIterator <QString, NumerotationContext> hash_iterator(autonums);
while (hash_iterator.hasNext())
{
hash_iterator.next();
@ -205,7 +208,7 @@ void MultiPasteDialog::on_m_button_box_accepted()
}
}
}
m_diagram->adjustSceneRect();
m_accept = true;
settings.setValue("diagramcommands/erase-label-on-copy", erase_label);

View File

@ -15,11 +15,14 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QRadioButton>
#include <QHash>
#include "potentialselectordialog.h"
#include "ui_potentialselectordialog.h"
#include "conductor.h"
#include "terminal.h"
#include <QRadioButton>
#include "QPropertyUndoCommand/qpropertyundocommand.h"
#include "diagram.h"
#include "element.h"
@ -191,14 +194,14 @@ ConductorProperties PotentialSelectorDialog::chosenProperties(QList<ConductorPro
} else if (list.size() == 1) {
return list.first();
}
QDialog dialog(widget);
QVBoxLayout layout(widget);
dialog.setLayout(&layout);
QLabel label(tr("Veuillez choisir un potentiel électrique de la liste \n"
"à utiliser pour le nouveau potentiel"));
layout.addWidget(&label);
QHash <QRadioButton *, ConductorProperties> H;
for (ConductorProperties cp : list)
{
@ -213,7 +216,7 @@ ConductorProperties PotentialSelectorDialog::chosenProperties(QList<ConductorPro
text.append(tr("\nCouleur du conducteur : %1").arg(cp.m_wire_color));
if(!cp.m_wire_section.isEmpty())
text.append(tr("\nSection du conducteur : %1").arg(cp.m_wire_section));
QRadioButton *b = new QRadioButton(text, &dialog);
layout.addWidget(b);
H.insert(b, cp);
@ -221,14 +224,14 @@ ConductorProperties PotentialSelectorDialog::chosenProperties(QList<ConductorPro
QDialogButtonBox *button_box = new QDialogButtonBox(QDialogButtonBox::Ok, &dialog);
layout.addWidget(button_box);
connect(button_box, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
dialog.exec();
for (QRadioButton *b : H.keys()) {
if(b->isChecked()) {
return H.value(b);
}
}
return ConductorProperties();
}
@ -290,7 +293,7 @@ void PotentialSelectorDialog::buildWidget()
QString text1(tr("%n conducteurs composent le potentiel suivant :",
"",
m_potential_selector->m_conductor_number_1));
ConductorProperties cp1;
if(!m_potential_selector->m_properties_list_1.isEmpty())
cp1 = m_potential_selector->m_properties_list_1.first();;
@ -308,14 +311,14 @@ void PotentialSelectorDialog::buildWidget()
if(!cp1.m_wire_section.isEmpty())
text1.append(tr("\nSection du conducteur : %1")
.arg(cp1.m_wire_section));
QString text2(tr("%n conducteurs composent le potentiel suivant :",
"",
m_potential_selector->m_conductor_number_2));
ConductorProperties cp2;
if(!m_potential_selector->m_properties_list_2.isEmpty())
cp2 = m_potential_selector->m_properties_list_2.first();
if(!cp2.text.isEmpty())
text2.append(tr("\nNuméro : %1").arg(cp2.text));
if(!cp2.m_function.isEmpty())
@ -329,7 +332,7 @@ void PotentialSelectorDialog::buildWidget()
if(!cp2.m_wire_section.isEmpty())
text2.append(tr("\nSection du conducteur : %1")
.arg(cp2.m_wire_section));
QRadioButton *rb1 = new QRadioButton(text1, this);
QRadioButton *rb2 = new QRadioButton(text2, this);
@ -429,7 +432,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted()
new_value,
undo);
}
//Check if formula of the new potential
// have incompatible variable with folio report
QRegularExpression rx ("%sequf_|%seqtf_|%seqhf_|%id|%F|%M|%LM");
@ -445,7 +448,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted()
<< "%F"
<< "%M"
<< "%LM";
QString text(tr("La formule du nouveau potentiel contient des variables incompatibles avec les reports de folio.\n"
"Veuillez saisir une formule compatible pour ce potentiel.\n"
"Les variables suivantes sont incompatibles :\n"
@ -455,7 +458,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted()
fag.setText(text);
fag.setFormula(cp.m_formula);
fag.exec();
QString new_formula = fag.formula();
QSet <Conductor *> c_list = m_report->conductors().first()->relatedPotentialConductors();
c_list.insert(m_report->conductors().first());
@ -471,7 +474,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted()
new_value,
undo);
}
break;
}
}

View File

@ -15,6 +15,9 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QHash>
#include "shapegraphicsitempropertieswidget.h"
#include "ui_shapegraphicsitempropertieswidget.h"
#include "qetshapeitem.h"

View File

@ -15,12 +15,14 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "xrefpropertieswidget.h"
#include <utility>
#include <QHash>
#include <QMetaEnum>
#include "xrefpropertieswidget.h"
#include "ui_xrefpropertieswidget.h"
#include "qdebug.h"
#include <QMetaEnum>
/**
@brief XRefPropertiesWidget::XRefPropertiesWidget

View File

@ -19,6 +19,8 @@
#define XREFPROPERTIESWIDGET_H
#include <QWidget>
#include <QHash>
#include "properties/xrefproperties.h"
namespace Ui {

View File

@ -1,17 +1,17 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
@ -21,6 +21,7 @@
#include <QUndoCommand>
#include <QPointer>
#include <QDomElement>
#include <QHash>
class Element;
class DynamicElementTextItem;
@ -37,10 +38,10 @@ class AddElementTextCommand : public QUndoCommand
DynamicElementTextItem *deti,
QUndoCommand *parent = nullptr);
~AddElementTextCommand() override;
void undo() override;
void redo() override;
private:
Element *m_element = nullptr;
DynamicElementTextItem *m_text = nullptr;
@ -64,10 +65,10 @@ class AddTextsGroupCommand : public QUndoCommand
QList<DynamicElementTextItem *> texts_list,
QUndoCommand *parent = nullptr);
~AddTextsGroupCommand() override;
void undo() override;
void redo() override;
private:
QPointer<Element> m_element;
QPointer<ElementTextItemGroup> m_group;
@ -88,10 +89,10 @@ class RemoveTextsGroupCommand : public QUndoCommand
ElementTextItemGroup *group,
QUndoCommand *parent = nullptr);
~RemoveTextsGroupCommand() override;
void undo() override;
void redo() override;
private:
QPointer<Element> m_element;
QPointer<ElementTextItemGroup> m_group;
@ -108,10 +109,10 @@ class AddTextToGroupCommand : public QUndoCommand
ElementTextItemGroup *group,
QUndoCommand *parent = nullptr);
~AddTextToGroupCommand() override;
void undo() override;
void redo() override;
private:
QPointer<DynamicElementTextItem> m_text;
QPointer<ElementTextItemGroup> m_group;
@ -128,10 +129,10 @@ class RemoveTextFromGroupCommand : public QUndoCommand
ElementTextItemGroup *group,
QUndoCommand *parent = nullptr);
~RemoveTextFromGroupCommand() override;
void undo() override;
void redo() override;
private:
QPointer<DynamicElementTextItem> m_text;
QPointer<ElementTextItemGroup> m_group;
@ -148,12 +149,12 @@ class AlignmentTextsGroupCommand : public QUndoCommand
Qt::Alignment new_alignment,
QUndoCommand *parent = nullptr);
~AlignmentTextsGroupCommand() override;
int id() const override{return 6;}
bool mergeWith(const QUndoCommand *other) override;
void undo() override;
void redo() override;
private:
QPointer<ElementTextItemGroup> m_group;
Qt::Alignment m_previous_alignment,

View File

@ -1,17 +1,17 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
@ -19,6 +19,8 @@
#define DELETEQGRAPHICSITEMCOMMAND_H
#include <QUndoCommand>
#include <QHash>
#include "diagramcontent.h"
class Diagram;
@ -32,17 +34,17 @@ class DeleteQGraphicsItemCommand : public QUndoCommand
public:
DeleteQGraphicsItemCommand(Diagram *diagram, const DiagramContent &content, QUndoCommand * parent = nullptr);
~DeleteQGraphicsItemCommand() override;
private:
DeleteQGraphicsItemCommand(const DeleteQGraphicsItemCommand &);
void setPotentialsOfRemovedElements();
Terminal *terminalInSamePotential(Terminal *terminal, Conductor *conductor_to_exclude);
public:
void undo() override;
void redo() override;
// attributes
private:
DiagramContent m_removed_contents;

View File

@ -1,17 +1,17 @@
/*
Copyright 2006-2020 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
@ -20,6 +20,7 @@
#include <QUndoCommand>
#include <QPointer>
#include <QHash>
class Diagram;
class ConductorTextItem;
@ -35,16 +36,16 @@ class RotateSelectionCommand : public QUndoCommand
RotateSelectionCommand(Diagram *diagram, qreal angle=90, QUndoCommand *parent=nullptr);
void undo() override;
void redo() override;
bool isValid();
private:
Diagram *m_diagram =nullptr;
QList<QPointer<ConductorTextItem>> m_cond_text;
QHash<ConductorTextItem *, bool> m_rotate_by_user;
QList<QPropertyUndoCommand*> m_undo;
};
#endif // ROTATESELECTIONCOMMAND_H

View File

@ -20,6 +20,7 @@
#include <QUndoCommand>
#include <QPointer>
#include <QHash>
class ConductorTextItem;
class Diagram;
@ -34,14 +35,14 @@ class RotateTextsCommand : public QUndoCommand
{
public:
RotateTextsCommand(Diagram *diagram, QUndoCommand *parent=nullptr);
void undo() override;
void redo() override;
private:
void openDialog();
void setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant& start, const QVariant& end);
private:
QPointer<Diagram> m_diagram;
QHash<ConductorTextItem *, bool> m_cond_texts;