//
// Created by Krad on 2021/12/16.
//

#ifndef GUI_GUIERRORBASE_H
#define GUI_GUIERRORBASE_H

#include <QWidget>

/**
 *  GUI Error interface
 */
class GUIErrorBase {
public:
    GUIErrorBase()= default;

    /**
     * parse error object from error msg
     * @param errorMsg
     */
    virtual void parse(const QString& errorMsg){};

    /**
     * setErrorHandleParent
     * @param parent The parent widget of error handling
     */
    void setErrorHandleParent(QWidget* parent){
        if (parent)this->parent = parent;
    };

    /**
     * handle error, should be implement in sub class
     */
    virtual void handle(){};
protected:
    QWidget* parent = nullptr;
};


#endif //GUI_GUIERRORBASE_H
