diff --git a/gb.qt4/src/CWidget.cpp b/gb.qt4/src/CWidget.cpp index 17b5d2922..5362c2e9e 100644 --- a/gb.qt4/src/CWidget.cpp +++ b/gb.qt4/src/CWidget.cpp @@ -318,6 +318,24 @@ bool CWIDGET_container_for(void *_object, void *container_for) return true; } +static void CWIDGET_enter(void *_object) +{ + if (!THIS->flag.inside) + { + THIS->flag.inside = true; + GB.Raise(THIS, EVENT_Enter, 0); + } +} + +static void CWIDGET_leave(void *_object) +{ + if (THIS->flag.inside) + { + THIS->flag.inside = false; + GB.Raise(THIS, EVENT_Leave, 0); + } +} + void CWIDGET_new(QWidget *w, void *_object, bool no_show, bool no_filter, bool no_init) { //QAbstractScrollArea *sa; @@ -372,7 +390,8 @@ static void post_check_hovered(intptr_t) const QPoint globalPos(QCursor::pos()); QPoint pos = WIDGET->mapFromGlobal(globalPos); _hovered = CWidget::getRealExisting(WIDGET->childAt(pos)); - CWIDGET_check_hovered(); + if (_hovered) + CWIDGET_enter(_hovered); } _post_check_hovered = false; @@ -2330,29 +2349,12 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) goto *jump; - /*if (type != QEvent::Enter) - { - if (_control_leave) - { - save = _control_leave; - _control_leave = NULL; - - if (type != QEvent::Leave || save != control) - GB.Raise(save, EVENT_Leave, 0); - } - }*/ - __ENTER: { QWidget *popup = qApp->activePopupWidget(); if (real && (!popup || CWidget::getReal(popup))) - { - _hovered = control; - CWIDGET_check_hovered(); - //_official_hovered = control; - //GB.Raise(control, EVENT_Enter, 0); - } + CWIDGET_enter(control); goto __NEXT; } @@ -2362,11 +2364,7 @@ bool CWidget::eventFilter(QObject *widget, QEvent *event) QWidget *popup = qApp->activePopupWidget(); if (real && (!popup || CWidget::getReal(popup))) - { - if (_hovered == control) - _hovered = NULL; - CWIDGET_check_hovered(); - } + CWIDGET_leave(control); goto __NEXT; } diff --git a/gb.qt4/src/CWidget.h b/gb.qt4/src/CWidget.h index 01f1c3f86..5d6591027 100644 --- a/gb.qt4/src/CWidget.h +++ b/gb.qt4/src/CWidget.h @@ -68,7 +68,8 @@ typedef unsigned grab : 1; unsigned dragging: 1; unsigned noTabFocus : 1; - unsigned _reserved : 4; + unsigned inside : 1; + unsigned _reserved : 3; } flag; int level; char *name; diff --git a/gb.qt4/src/CWindow.cpp b/gb.qt4/src/CWindow.cpp index 7ab1804f1..92548f463 100644 --- a/gb.qt4/src/CWindow.cpp +++ b/gb.qt4/src/CWindow.cpp @@ -1924,7 +1924,7 @@ void MyMainWindow::showPopup(QPoint &pos) setWindowFlags(Qt::Window | flags); } - CWIDGET_check_hovered(); + //CWIDGET_check_hovered(); } #if 0