mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-16 14:50:00 +01:00
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:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QHash>
|
||||
|
||||
#include "abstractelementpropertieseditorwidget.h"
|
||||
|
||||
class Element;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#define XREFPROPERTIESWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QHash>
|
||||
|
||||
#include "properties/xrefproperties.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
Reference in New Issue
Block a user