The delegated widgets become hidden
Hello,
I have some delegated items on a tree widget. When I assign installEventFilter() function to those delegated items, they become invisible :( Might it be a bug or is there a way to overcome this problem? :confused:
Thanks a lot for your help...
Re: The delegated widgets become hidden
Most likely your event filter is buggy. Did you call the base class implementation if you don't react on a specific event?
Re: The delegated widgets become hidden
A part of my implementation is as the following:
Code:
{
if (event
->type
() == QEvent::MouseButtonPress) {
QComboBox *comboBox
= dynamic_cast<QComboBox
*>
(obj
);
if(comboBox != NULL)
{
t = findComboBox(comboBox);
if(t->parent() == treeWidgetItemName) // route
{
dynamic_cast<QComboBox
*>
(treeWidgetMission
->itemWidget
(t,
1))->setStyleSheet
(QString::fromUtf8("background-color: rgb(160, 160, 160);\n"));
dynamic_cast<QLineEdit
*>
(treeWidgetMission
->itemWidget
(t,
0))->setStyleSheet
(QString::fromUtf8("background-color: rgb(160, 160, 160);\n"));
}
t->setSelected(true);
treeWidgetMission->setCurrentItem(t);
}
//else ...
}
}
Is there a bug?
Thanks a lot...
Note: Even if I comment out the code in eventFilter(), the same problem exists. If I comment out the code where I assign installEventFilter() method to the delegated widgets, there is no problem, but, of course, eventFilter() is not caught by those widgets then.
Re: The delegated widgets become hidden
Quote:
Originally Posted by
fulbay
Is there a bug?
Yes, you need to call the base class impelemtation. Something like:
Code:
return QObject::eventFilter(obj, event
);
It is also described in QObject::installEventFilter().
Re: The delegated widgets become hidden
Oh, yes! Thanks! This help is great to me :)