wagmare
16th August 2010, 12:07
hi friends,
my task is to show a list widget when user press or click on a lineEdit() ...
i made a small class popWidget derived from QListWidget and using the event filter on lineEdit i am showing the popWidget using show()...
eventFilter( QObject *obj, QEvent *ev )
{
if (obj == _hwListView)
{
if (ev->type() == QEvent::FocusIn)
{
_hwListPop->show();
_hwListPop->setFocus(Qt::PopupFocusReason);
return true;
}else
return false;
}
then comes the problem with hide() when the user press somewhere in the mainwindow ..
i reimplemented focusOutEvent() on popWidget to hide() it when it lost its focus ..
PopWidget::focusOutEvent(QFocusEvent *event)
{
this->hide();
}
actually that lineEdit is a part of the object say subWindow of mainWindow so when i press any where in subWindow i can manage to hide the popWidget but not in the mainWindow ..
how can i send the particular event to the mainWindow ..?
please help me ...
my task is to show a list widget when user press or click on a lineEdit() ...
i made a small class popWidget derived from QListWidget and using the event filter on lineEdit i am showing the popWidget using show()...
eventFilter( QObject *obj, QEvent *ev )
{
if (obj == _hwListView)
{
if (ev->type() == QEvent::FocusIn)
{
_hwListPop->show();
_hwListPop->setFocus(Qt::PopupFocusReason);
return true;
}else
return false;
}
then comes the problem with hide() when the user press somewhere in the mainwindow ..
i reimplemented focusOutEvent() on popWidget to hide() it when it lost its focus ..
PopWidget::focusOutEvent(QFocusEvent *event)
{
this->hide();
}
actually that lineEdit is a part of the object say subWindow of mainWindow so when i press any where in subWindow i can manage to hide the popWidget but not in the mainWindow ..
how can i send the particular event to the mainWindow ..?
please help me ...