Skip to content

Commit

Permalink
Fem: move from string based connect() to overloaded variant based on …
Browse files Browse the repository at this point in the history
…meta methods
  • Loading branch information
wwmayer authored and donovaly committed Jan 27, 2023
1 parent b39e1f2 commit 633a6e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Mod/Fem/Gui/PreCompiled.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
#include <QFileInfo>
#include <QApplication>
#include <QMessageBox>
#include <QMetaMethod>
#include <QAction>
#include <QString>
#include <QSlider>
Expand Down
7 changes: 5 additions & 2 deletions src/Mod/Fem/Gui/TaskPostBoxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

# include <QApplication>
# include <QMessageBox>
# include <QMetaMethod>
# include <QToolTip>
#endif

Expand Down Expand Up @@ -241,8 +242,9 @@ void TaskDlgPost::connectSlots()
{
// Connect emitAddedFunction() with slotAddedFunction()
QObject* sender = nullptr;
int indexSignal = 0;
for (const auto dlg : m_boxes) {
int indexSignal = dlg->metaObject()->indexOfSignal(QMetaObject::normalizedSignature("emitAddedFunction()"));
indexSignal = dlg->metaObject()->indexOfSignal(QMetaObject::normalizedSignature("emitAddedFunction()"));
if (indexSignal >= 0) {
sender = dlg;
break;
Expand All @@ -253,7 +255,8 @@ void TaskDlgPost::connectSlots()
for (const auto dlg : m_boxes) {
int indexSlot = dlg->metaObject()->indexOfSlot(QMetaObject::normalizedSignature("slotAddedFunction()"));
if (indexSlot >= 0) {
connect(sender, SIGNAL(emitAddedFunction()), dlg, SLOT(slotAddedFunction()));
connect(sender, sender->metaObject()->method(indexSignal),
dlg, dlg->metaObject()->method(indexSlot));
}
}
}
Expand Down

0 comments on commit 633a6e8

Please sign in to comment.