Hi all,

I have a Dialog with few buttons. When I disable the dialog, and I click on
a child button, nothing happens. But as soon as I enable the Dialog again,
the mouse event for the button is handled.

*Does disabling a Dialog simply delays handling of any mouse events for its
child widgets until enabled again? *

I tried installing event filters for child widgets when dialog is disabled
and then removing the event filters when enabled again. But it provides the
same behavior. As soon as dialog is enabled i.e. event filters for child
widgets removed, the mouse event (when disabled) are handled.

Can someone please help whats wrong here?  Here is the code I wrote:

void MyDialog::changeEvent(QEvent *e)

{

    if(e->type() == QEvent::EnabledChange)

    {

        if(isEnabled())

        {

            qDebug("Filters removed!\n");

            ui->pbtnOption1->removeEventFilter(this);

            ui->pbtnOption2->removeEventFilter(this);

            ui->pbtnOption3->removeEventFilter(this);

        }

        else

        {

            qDebug("Filters installed\n");

            ui->pbtnOption1->installEventFilter(this);

            ui->pbtnOption2->installEventFilter(this);

            ui->pbtnOption3->installEventFilter(this);

        }

    }

}


 bool MyDialog::eventFilter(QObject *obj, QEvent *e)

{

    if(obj == ui->pbtnOption1 || obj == ui->pbtnOption2 || obj ==
ui->pbtnOption3)

    {

        if(e->type() == QEvent::MouseButtonPress)

        {

            qDebug("MousePress Event!\n");

            return true;

        }

        else

            return false;

    }

    return QDialog::eventFilter(obj, e);

}


-- Regards,
Lata
*
*
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to