Gui: [skip ci] fix several warnings reported by GH Actions

This commit is contained in:
wmayer
2022-11-06 15:53:18 +01:00
parent 6a68da4871
commit b3372a5205
5 changed files with 14 additions and 7 deletions

View File

@@ -26,6 +26,7 @@
# include <QAction>
# include <QMap>
# include <QPointer>
# include <QTimer>
#endif
#include "ActionFunction.h"
@@ -58,7 +59,7 @@ void ActionFunction::trigger(QAction* action, std::function<void()> func)
Q_D(ActionFunction);
d->triggerMap[action] = func;
connect(action, SIGNAL(triggered()), this, SLOT(triggered()));
connect(action, &QAction::triggered, this, &ActionFunction::triggered);
}
void ActionFunction::triggered()
@@ -177,4 +178,9 @@ void TimerFunction::timeout()
deleteLater();
}
void TimerFunction::singleShot(int ms)
{
QTimer::singleShot(ms, this, &Gui::TimerFunction::timeout);
}
#include "moc_ActionFunction.cpp"

View File

@@ -67,7 +67,7 @@ class GuiExport ActionFunction : public QObject
public:
/// Constructor
ActionFunction(QObject*);
explicit ActionFunction(QObject*);
~ActionFunction() override;
/*!
@@ -96,13 +96,14 @@ class GuiExport TimerFunction : public QObject
public:
/// Constructor
TimerFunction(QObject* = nullptr);
explicit TimerFunction(QObject* = nullptr);
~TimerFunction() override;
void setFunction(std::function<void()> func);
void setFunction(std::function<void(QObject*)> func, QObject* args);
void setFunction(std::function<void(QVariant)> func, QVariant args);
void setAutoDelete(bool);
void singleShot(int ms);
private Q_SLOTS:
void timeout();

View File

@@ -402,7 +402,7 @@ void TaskView::keyPressEvent(QKeyEvent* ke)
Gui::Document* doc = Gui::Application::Instance->getDocument(ActiveDialog->getDocumentName().c_str());
if (doc) {
func->setFunction(std::bind(&Document::resetEdit, doc));
QTimer::singleShot(0, func, SLOT(timeout()));
func->singleShot(0);
}
}
}

View File

@@ -234,7 +234,7 @@ void ViewProvider::eventCallback(void * ud, SoEventCallback * node)
auto func = new Gui::TimerFunction();
func->setAutoDelete(true);
func->setFunction(std::bind(&Document::resetEdit, doc));
QTimer::singleShot(0, func, SLOT(timeout()));
func->singleShot(0);
}
}
else if (press) {

View File

@@ -1012,7 +1012,7 @@ void ViewProviderMesh::clipMeshCallback(void * ud, SoEventCallback * n)
func->setAutoDelete(true);
MeshSplit* split = new MeshSplit(self, clPoly, proj);
func->setFunction(std::bind(&MeshSplit::cutMesh, split));
QTimer::singleShot(0, func, SLOT(timeout()));
func->singleShot(0);
}
}
}
@@ -1073,7 +1073,7 @@ void ViewProviderMesh::trimMeshCallback(void * ud, SoEventCallback * n)
func->setAutoDelete(true);
MeshSplit* split = new MeshSplit(self, clPoly, proj);
func->setFunction(std::bind(&MeshSplit::trimMesh, split));
QTimer::singleShot(0, func, SLOT(timeout()));
func->singleShot(0);
}
}
}