101

Re: Qt 6.0 development and qelectrotech

On existing projects, folio cross-references will have to be re linked, as will master-slave connections for contactor coils, relays, isolators, etc.

Edit: No, in fact they are not reread when the project is saved and reopened....but links connexions was saved in the XML.

In think the problemis here;
https://github.com/qelectrotech/qelectr … t.cpp#L770


    //load uuid of connected elements
    QList <QDomElement> uuid_list = QET::findInDomElement(e,
                                                          QStringLiteral("links_uuids"),
                                                          QStringLiteral("link_uuid"));
    foreach (QDomElement qdo, uuid_list)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)    // ### Qt 6: remove
        tmp_uuids_link << qdo.attribute(QStringLiteral("uuid"));
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 6 or later")
#endif
        qDebug()<<"Help code for QT 6 or later";
#endif
    //uuid of this element

Edit comment line tmp_uuids_link << qdo.attribute(QStringLiteral("uuid")); and compile code with Qt 5.15.x I have the same problem I saw with Qt6..

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."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 !

102

Re: Qt 6.0 development and qelectrotech

I wonder what is Qt5- or Qt6-specific about this line?
If I understand correctly, the linked elements are passed there ... they are also needed when compiling with Qt6.

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 !

103

Re: Qt 6.0 development and qelectrotech

Now, what I wanted to write in my own name!!!

Sorry again!

----------------------------------

Ok ... as I don't compile with Qt6, yet ...

In Qt-docs there is a function for casting QString to QUuid.

When I eliminate the "#if QT_VERSION..." and use this code with Qt5:

    foreach (QDomElement qdo, uuid_list) {
        tmp_uuids_link << QUuid(qdo.attribute(QStringLiteral("uuid")));
    }
    qInfo() << "tmp_uuids_link: " << tmp_uuids_link;

there are no compilation-errors or warnings and when I open a project with XRefs it prints the UUIDs to log-file and in the diagram I see all XRefs as before.

I see no reason, that something like that should not work for Qt6...

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 !

104

Re: Qt 6.0 development and qelectrotech

Now, what I wanted to write in my own name!!!

Sorry again!

no worries. nomicons/wink


Thanks for your tip plc-user, great, merged!.

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."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 !

105

Re: Qt 6.0 development and qelectrotech

I'm starting to smile to see that the Qt5 to Qt6 port seems to be going well, at least for now.
thanks Simon, plc-user elevatorMind, and others for your work...
There's still some fine-tuning and printing to be done.

As far as I'm concerned, the work of packaging QET on Qt6 hasn't started yet...it might not be easy...

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."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 !

106

Re: Qt 6.0 development and qelectrotech

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 !

107

Re: Qt 6.0 development and qelectrotech

Hallo,
Ich habe Deinen Patch mal getestet: Debian 12,  Qt5.15.2, im Creator mit dem aktuellen Source Code.
Ich bin mir nicht sicher was Du Dir für Tests vorgestellt hast, automatische wie auch manuelle Verbindungen
funktionieren jedenfalls normal, auch mehrere Verbindungen an einem Anschlußpunkt.
QT6 funktioniert bei mir noch nicht, kann ich also leider nicht testen.

108

Re: Qt 6.0 development and qelectrotech

@ plc_user,
da ich gerade gesehen habe das Du vor kurzem den Code im Element Editor bezüglich Rotation
angepasst hast, ein kurzer Hinweis:  Wenn man ein schon plaziertes Terminal-Element mit der Leertaste
rotiertieren will, springt das Terminal auf den Ursprong (0,0) zurück.
Ist sicher nicht so gewollt.

Gruß Achim

109

Re: Qt 6.0 development and qelectrotech

Hallo Achim,

Danke für Deine Rückmeldung!

Es geht primär darum, daß das mal jemand anderes ausprobiert, ob alles noch so geht, wie vorher:
Aus einem Schaltplan ein Element löschen, das mehrere Verbindungen an einem Anschlußpunkt hat, wiederherstellen, etc.

Manchmal sieht man den Wald vor lauter Bäumen nicht und wird "Betriebsblind" und sieht die eigenen Fehler nicht,

Dann werde ich das mal als PR einreichen.

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 !

110 (edited by plc-user 2025-03-07 12:45:48)

Re: Qt 6.0 development and qelectrotech

Hallo Achim,

achim wrote:

Wenn man ein schon plaziertes Terminal-Element mit der Leertaste
rotiertieren will, springt das Terminal auf den Ursprong (0,0) zurück.
Ist sicher nicht so gewollt.

Richtig: Das ist nicht so gewollt und es betrifft nicht nur Terminals.
Das ist mir auch schon aufgefallen und bedarf noch etwas Hirnschmalz.
Habe das Verhalten für den Moment aber billigend in Kauf genommen, weil das Ergebnis (Rotieren, Spiegeln, Umdrehen) deutlich besser ist, als was wir vorher hatten.

Zwischendurch das Element speichern und neu laden, hilft aber!


Addendum:
I'm working on a solution ... looks better at first glance!

2nd addendum (edited):
Fix released with version ...git8427...

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 !

111

Re: Qt 6.0 development and qelectrotech

Hallo Achim,

this plc-user's patch for Qt6 was related to SVN commit 5703: https://listengine.tuxfamily.org/lists. … 00018.html
description in the video
https://youtu.be/kQkrVEUSjdA

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."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 !

112

Re: Qt 6.0 development and qelectrotech

Laurent, thanks for the tip.
I think it matches

113

Re: Qt 6.0 development and qelectrotech

@elevatormind:

I haven't paid much attention to the stalefiles so far, but now that “we” want to organize them completely ourselves as “ Autosave”, I tried out your source code directly and am quite impressed!  nomicons/smile

Only two comments on the source code:

  • All other directory names are written in lower case.

  • If “QETApp::dataDir()” were also used here as the base directory, we would still have only one place in the source code where these base directories (dataDir, configDir, pictureDir...) are managed. The line lengths would also be much shorter nomicons/wink

(...)
#include "qetapp.h"
(...)
setFileTemplate(QETApp::dataDir() + "/autosave/qet_autosave_XXXXXX");
(...)
auto asf_dir = QDir(QETApp::dataDir() + "/autosave");
(...)

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 !

114

Re: Qt 6.0 development and qelectrotech

Hello everybody!

Did someone notice this:
While trying elevatorsmind's "Autosave" I killed the execution of QET and it cannot be started again!

This only is the case with the Qt6-Build and has nothing to do with "Autosave"!
It seems that singleapplication prevents a new re-start, because something is left behind, when killed!

I already try to find a solution (and it seems, I have found!), but before I waste too much time: Did someone notice this effect, too?

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 !

115

Re: Qt 6.0 development and qelectrotech

You're fast plc-user, i've just uploaded and you've already tested it nomicons/smile

I can't object to directory name in lower-case for consistency, and managing the autosave-directory in qetapp.* makes sense too. I'll write those changes.

Note that  KWidgetAddons and KCoreAddons are not needed on my qt6-cmake branch now!
Another request for you plc-user (and everybody else really), do all qt6 work on qt6-cmake branch for now. I did a rebase on the qt6-cmake branch against the master branch yesterday, and there were three commits that caused merge conflicts. Those commits were similar to https://github.com/qelectrotech/qelectr … 7121e1f85b, and then some similar changes made to the qt6-cmake branch. Keeping the qt5/qt6 version checks intact on the master branch makes it a lot easier to keep the qt6-cmake branch updated with other changes to the master branch. But I would like Laurent's input on this, he has the last say on how we should be going forward with the qt6-cmake branch.

On another note, i've noticed an issue with SingleApplication and Qt > 6.5. If QET terminates prematurely, the shared memory file doesn't clean up and stops you from starting QET again as it thinks it's a second QET-application starting... I've noticed development of SingleApplication is active but slow, I might have to work on some temporary replacement there too nomicons/smile SingleApplication should be used if it's fixed though, it's a solid project and we don't want to reinvent the wheel.

116 (edited by elevatormind 2025-03-09 14:20:59)

Re: Qt 6.0 development and qelectrotech

I didn't see your last post plc-user before posting.
The problem with SingleApplication I can confirm, but I don't get the problem when compiling with Qt 6.5.3 (but with 6.8.2 runtime). I think I read somewhere on the SingleApplicaton project that Qt drastically changed the way QSharedMemory works in Qt 6.6+, and that's the (probable) cause of this problem. Which version of Qt are you compiling against?

There is also another problem with AutoSaveFile at the moment. If you have a file open, terminate QET, rename or move your project file, start QET again, QET will crash trying to recover the now missing project file.

Edit:
Removing stale shared memory files in /dev/shm makes QET start again.

117

Re: Qt 6.0 development and qelectrotech

I use the versions coming with Debian GNU/Linux unstable to compile for Qt6: 6.8.2

I see that your knowledge of Qt goes much further than mine! That's why I have no problem with you staying on the subject of “SingleApplication”: You've already read up on it in docs and sources...

As I learned to know you so far, I guess you'll find a solution for the crash, too!  nomicons/smile

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 !

118

Re: Qt 6.0 development and qelectrotech

I don't know about that nomicons/smile VS code + GitHub copilot addon makes wonders, it's almost scary how the AI can predict with auto-complete what I wanna do and explain code I don't understand, and it knows Qt to 100%... All the comments/doxygen-comments in AutoSaveFile probably were made to 90% by GitHub copilot also. It's extremely useful when used right, but don't expect it to write all code for you.

I'll try to fix the AutoSaveFile issue I know about this weekend. And please do continue to contribute and help on both master and qt6-cmake! The qt6-cmake branch definitely needs a lot of testing! Regarding the SingleApplication problem, it might be some combination of Qt 6.6+ with AutoSaveFile. Don't remember if I had the same problem with the KCoreAddons, but it's possible it only showed up after I created AutoSaveFile as a replacement.

The SingleApplication problem with QT 6.6+ seems to be acknowledged here though:
https://github.com/itay-grudev/SingleAp … issues/190