How to update eventFilter function?
How to update eventFilter function?
I use update( ) function but it`s not worked .
bool CLASS_NAME::eventFilter(QObject *o, QEvent *e)
{
for ( int i = 0; i < 42; i++ ) {
if (o == tree_widget[i]->viewport() && e->type() == QEvent::Paint) {
QPainter p;
p.begin(tree_widget[i]->viewport() );
p.drawText( 35, 70, "something");
p.end();
}
}
return QWidget::eventFilter(o, e);
}
Re: How to update eventFilter function?
You cannot paint outside the paintEvent method. That is one of the key rules of Qt widgets. What is it that you are trying to achieve? It looks as if you should sub-class the QTreeWidget, reimplement paintEvent and then call the QTreeWidget's paintEvent function at the end.
Re: How to update eventFilter function?
I can paint using eventFilter. But it`s worked when program started.
I try to achive; when clicked button, draw differrent text.