class CPT : public ...
{
...
protected:
...
};
{
//various child widgets are added
te->installEventFilter(this);
//some other widgets
}
{
if (e
->type
() == QEvent::MouseButtonDblClick) {
// process double click
return true; // eat event
}
// standard event processing
return false;
}
class CPT : public ...
{
...
protected:
bool eventFilter(QObject* o, QEvent* e);
...
};
CPT::CPT(QWidget *parent):QWidget(parent)
{
//various child widgets are added
QTextEdit *te=new QTextEdit(this);
te->installEventFilter(this);
//some other widgets
}
bool CPT::eventFilter(QObject* o, QEvent* e)
{
if (e->type() == QEvent::MouseButtonDblClick)
{
QMouseEvent* m = (QMouseEvent*) e;
// process double click
return true; // eat event
}
// standard event processing
return false;
}
To copy to clipboard, switch view to plain text mode
Bookmarks