* BUG: Try again to fix Event/Leave event management.


git-svn-id: svn://localhost/gambas/trunk@4605 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-04-07 02:24:58 +00:00
parent 0687a251de
commit 78ad25c6f7
3 changed files with 25 additions and 26 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -1924,7 +1924,7 @@ void MyMainWindow::showPopup(QPoint &pos)
setWindowFlags(Qt::Window | flags);
}
CWIDGET_check_hovered();
//CWIDGET_check_hovered();
}
#if 0