Hello everybody!
I would like to get rid of those many Qt5/Qt6 - differentiations in sourcecode, so I tried something that seems to work for both, but to be sure:
Can someone please test this patch with undocommand/deletegraphicsitemcommand
diff --git a/sources/undocommand/deleteqgraphicsitemcommand.cpp b/sources/undocommand/deleteqgraphicsitemcommand.cpp
index 5aa85ca42..632c64a9a 100644
--- a/sources/undocommand/deleteqgraphicsitemcommand.cpp
+++ b/sources/undocommand/deleteqgraphicsitemcommand.cpp
@@ -179,7 +179,7 @@ void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements()
//If a conductor was already created between these two terminals
//in this undo command, from another removed element, we do nothing
bool exist_ = false;
- for (QPair<Terminal *, Terminal *> pair : m_connected_terminals)
+ for (std::pair<Terminal *, Terminal *> pair : m_connected_terminals)
{
if (pair.first == hub_terminal && pair.second == t) {
exist_ = true;
@@ -192,14 +192,8 @@ void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements()
if (exist_ == false)
{
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
- m_connected_terminals.append(qMakePair<Terminal *, Terminal *>(hub_terminal, t));
-#else
-#if TODO_LIST
-#pragma message("@TODO remove code for QT 6 or later")
-#endif
- qDebug()<<"Help code for QT 6 or later";
-#endif
+ m_connected_terminals.append(std::make_pair<Terminal *, Terminal *>((Terminal *)hub_terminal, (Terminal *)t));
+ qInfo() << "m_connected_terminals" << m_connected_terminals;
Conductor *new_cond = new Conductor(hub_terminal, t);
new_cond->setProperties(properties);
new AddGraphicsObjectCommand(new_cond, t->diagram(), QPointF(), this);
diff --git a/sources/undocommand/deleteqgraphicsitemcommand.h b/sources/undocommand/deleteqgraphicsitemcommand.h
index 2f03ed050..c4ad2946b 100644
--- a/sources/undocommand/deleteqgraphicsitemcommand.h
+++ b/sources/undocommand/deleteqgraphicsitemcommand.h
@@ -52,7 +52,7 @@ class DeleteQGraphicsItemCommand : public QUndoCommand
QHash <Element *, QList<Element *> > m_link_hash; /// keep linked element for each removed element linked to other element.
QHash <DynamicElementTextItem *, Element *> m_elmt_text_hash; /// Keep the parent element of each deleted dynamic element text item
QHash <DynamicElementTextItem *, ElementTextItemGroup *> m_grp_texts_hash; ///Keep the parent group of each deleted element text item
- QList <QPair<Terminal *, Terminal *>> m_connected_terminals;
+ QList <std::pair<Terminal *, Terminal *>> m_connected_terminals;
QHash <QetGraphicsTableItem *, QPointer<QGraphicsScene>> m_table_scene_hash;
bool m_remove_linked_table = false;
};
These functions handle the case that an element, that has more than one connections at one terminal, is deleted and then recovered again.
Don't want to demolish basic functions, so to be sure...
Thanks in advance!
Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !