Error handle
This commit is contained in:
25
src/errorhandle/GUIErrorHandle.cpp
Normal file
25
src/errorhandle/GUIErrorHandle.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by Krad on 2021/12/16.
|
||||
//
|
||||
|
||||
#include "GUIErrorHandle.h"
|
||||
#include "GUIErrorFactory.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include <QApplication>
|
||||
void GUIErrorHandle::init() {
|
||||
connect(EventCenter::Default(),&EventCenter::GUIErrorRaise,[=](QObject*, QObject* msg){
|
||||
QString str;
|
||||
if (msg) {
|
||||
str = *(QString *) msg;
|
||||
} else {
|
||||
str = "Something went error!";
|
||||
}
|
||||
auto error = GUIErrorFactory::getError(str);
|
||||
// if (qApp->activeModalWidget()){
|
||||
// error->setErrorHandleParent(qApp->activeModalWidget());
|
||||
// } else{
|
||||
// error->setErrorHandleParent(qApp->activeWindow());
|
||||
// }
|
||||
error->handle();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user