15 #include <QResizeEvent> 20 this->installEventFilterOnParent();
22 this->setAttribute(Qt::WA_TranslucentBackground);
27 this->removeEventFilterFromParent();
32 return this->testAttribute(Qt::WA_TransparentForMouseEvents);
37 this->setAttribute(Qt::WA_TransparentForMouseEvents, transparent);
42 if (e->type() == QEvent::ParentAboutToChange)
44 this->removeEventFilterFromParent();
46 else if (e->type() == QEvent::ParentChange)
48 this->installEventFilterOnParent();
51 return QWidget::event(e);
56 if (watched == this->parent())
58 if (event->type() == QEvent::Resize)
60 this->resize(static_cast<QResizeEvent*>(event)->size());
62 else if (event->type() == QEvent::ChildAdded)
68 return QWidget::eventFilter(watched, event);
73 QPainter painter(
this);
74 painter.fillRect(this->rect(), QColor(0, 0, 0, 63));
77 void QmitkOverlayWidget::installEventFilterOnParent()
79 if (this->parent() ==
nullptr)
82 this->parent()->installEventFilter(
this);
86 void QmitkOverlayWidget::removeEventFilterFromParent()
88 if (this->parent() ==
nullptr)
91 this->parent()->removeEventFilter(
this);