I believe at some point in the past @zxiiro suggested making a new QWidget subclass for the notification widget? That is a much cleaner and more generic solution that building the widget like this.