I'm not sure if this is better or not but here's what I ended up with:
{
...
_lineEdit->installEventFilter(this);
}
if(obj
== _lineEdit
&& (event
->type
() == QEvent::FocusIn || event
->type
() == QEvent::FocusOut)) update();
return False;
}
Widget::Widget(QWidget *parent) :
QWidget(parent), _brush(Qt::red)
{
...
_lineEdit->installEventFilter(this);
}
void Widget::eventFilter(QObject *obj, QEvent * event){
if(obj == _lineEdit && (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut))
update();
return False;
}
To copy to clipboard, switch view to plain text mode
I also ended up changing the widget around a bit, now its a scroll area with a custom viewport which has line edit inside of it, so I'm not sure if this works with my original setup, either way, these all appear to work for various problems
Bookmarks