Pilot error! The event filter:
textEdit->viewport()->installEventFilter(this);
...
{
if( obj == textEdit ) // Wrong!! since the event filter was installed on the viewport, we need the parent
{
if (event
->type
() == QEvent::MouseButtonDblClick) {
}
}
}
{
if( obj->parent()== textEdit ) // Correct!
{
if (event
->type
() == QEvent::MouseButtonDblClick) {
}
}
}
textEdit->viewport()->installEventFilter(this);
...
bool Dialog::eventFilter(QObject* obj, QEvent* event)
{
if( obj == textEdit ) // Wrong!! since the event filter was installed on the viewport, we need the parent
{
if (event->type() == QEvent::MouseButtonDblClick)
{
}
}
}
bool Dialog::eventFilter(QObject* obj, QEvent* event)
{
if( obj->parent()== textEdit ) // Correct!
{
if (event->type() == QEvent::MouseButtonDblClick)
{
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks