I'm not sure if this is better or not but here's what I ended up with:

Qt Code:
  1. Widget::Widget(QWidget *parent) :
  2. QWidget(parent), _brush(Qt::red)
  3. {
  4. ...
  5. _lineEdit->installEventFilter(this);
  6. }
  7.  
  8. void Widget::eventFilter(QObject *obj, QEvent * event){
  9. if(obj == _lineEdit && (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut))
  10. update();
  11. return False;
  12. }
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