PolygonEdit should have inherited from Button, and connected the pressed signal.

This commit is contained in:
Relintai 2022-06-15 18:03:35 +02:00
parent 9975ea358f
commit ee9144b1b5
2 changed files with 11 additions and 3 deletions

View File

@ -55,6 +55,12 @@ PolygonEdit::PolygonEdit() {
PolygonEdit::~PolygonEdit() {
}
void PolygonEdit::_notification(int p_what) {
if (p_what == NOTIFICATION_POSTINITIALIZE) {
connect("pressed", this, "_on_PolygonEdit_pressed");
}
}
void PolygonEdit::_bind_methods() {
ADD_SIGNAL(MethodInfo("updated", PropertyInfo(Variant::OBJECT, "polygon", PROPERTY_HINT_RESOURCE_TYPE, "PolygonBase")));

View File

@ -3,13 +3,13 @@
#include "core/reference.h"
#include "scene/gui/control.h"
#include "scene/gui/button.h"
class PolygonBase;
class PolygonView;
class PolygonEdit : public Control {
GDCLASS(PolygonEdit, Control);
class PolygonEdit : public Button {
GDCLASS(PolygonEdit, Button);
public:
bool get_closed() const;
@ -25,6 +25,8 @@ public:
~PolygonEdit();
protected:
void _notification(int p_what);
static void _bind_methods();
bool closed;