mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-31 17:33:07 +00:00
Splitting the debug window of the component to allow quick change of a component
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Created by anonymus-raccoon on 3/20/20.
|
||||
//
|
||||
|
||||
#ifndef COMSQUARE_CLOSABLEWINDOW_HPP
|
||||
#define COMSQUARE_CLOSABLEWINDOW_HPP
|
||||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
|
||||
namespace ComSquare::Debugger
|
||||
{
|
||||
template <typename T>
|
||||
class ClosableWindow : public QMainWindow {
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *) override
|
||||
{
|
||||
(this->_obj->*this->_onClose)();
|
||||
}
|
||||
|
||||
private:
|
||||
T *_obj;
|
||||
void (T::*_onClose)();
|
||||
|
||||
public:
|
||||
explicit ClosableWindow(T *obj, void (T::*onClose)())
|
||||
: _obj(obj), _onClose(onClose)
|
||||
{ }
|
||||
ClosableWindow(const ClosableWindow &) = delete;
|
||||
ClosableWindow &operator=(const ClosableWindow &) = delete;
|
||||
~ClosableWindow() override = default;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //COMSQUARE_CLOSABLEWINDOW_HPP
|
||||
Reference in New Issue
Block a user