From 044ab1cc14322ef047275ebab10a5df2d94f844f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Fri, 10 Mar 2023 01:59:49 +0100 Subject: [PATCH] Check that we are a UserControl when calling its special event handlers, because the MyContainer class is also used by the Form container. [GB.QT4] * BUG: Check that we are a UserControl when calling its special event handlers, because the MyContainer class is also used by the Form container. [GB.QT5] * BUG: Check that we are a UserControl when calling its special event handlers, because the MyContainer class is also used by the Form container. --- gb.qt4/src/CContainer.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gb.qt4/src/CContainer.cpp b/gb.qt4/src/CContainer.cpp index 77960c68e..688772464 100644 --- a/gb.qt4/src/CContainer.cpp +++ b/gb.qt4/src/CContainer.cpp @@ -68,7 +68,7 @@ static void send_change_event(CWIDGET *_object) { - if (GB.Is(THIS, CLASS_UserControl)) + if (THIS_ARRANGEMENT->paint) CALL_FUNCTION(THIS_USERCONTROL, change_func); } @@ -885,9 +885,12 @@ void MyContainer::paintEvent(QPaintEvent *event) handler.handler = (GB_CALLBACK)cleanup_drawing; - GB.OnErrorBegin(&handler); - CALL_FUNCTION(THIS_USERCONTROL, paint_func); - GB.OnErrorEnd(&handler); + if (THIS_ARRANGEMENT->paint) + { + GB.OnErrorBegin(&handler); + CALL_FUNCTION(THIS_USERCONTROL, paint_func); + GB.OnErrorEnd(&handler); + } PAINT_end(); } @@ -907,7 +910,8 @@ void MyContainer::changeEvent(QEvent *e) if (e->type() == QEvent::FontChange) { - CALL_FUNCTION(THIS_USERCONTROL, font_func); + if (THIS_ARRANGEMENT->paint) + CALL_FUNCTION(THIS_USERCONTROL, font_func); } else if (e->type() == QEvent::EnabledChange) { @@ -918,7 +922,8 @@ void MyContainer::changeEvent(QEvent *e) void MyContainer::resizeEvent(QResizeEvent *e) { void *_object = CWidget::get(this); - CALL_FUNCTION(THIS_USERCONTROL, resize_func); + if (THIS_ARRANGEMENT->paint) + CALL_FUNCTION(THIS_USERCONTROL, resize_func); }