Commit 9817a900 authored by Laurent Montel's avatar Laurent Montel 😁

Remove qApp->installEventFilter as discussed with david

parent d5ebce9a
......@@ -163,10 +163,6 @@ void SplitterCollapser::Private::widgetEventFilter(QEvent *event)
{
switch (event->type()) {
case QEvent::Resize:
updatePosition();
updateOpacity();
break;
case QEvent::Move:
case QEvent::Show:
case QEvent::Hide:
......@@ -219,8 +215,6 @@ SplitterCollapser::SplitterCollapser(QWidget *childWidget, QSplitter *splitter)
d->childWidget = childWidget;
d->childWidget->installEventFilter(this);
qApp->installEventFilter(this);
d->splitter = splitter;
setParent(d->splitter);
......@@ -260,14 +254,22 @@ bool SplitterCollapser::eventFilter(QObject *object, QEvent *event)
{
if (object == d->childWidget) {
d->widgetEventFilter(event);
} else { /* app */
if (event->type() == QEvent::MouseMove) {
d->updateOpacity();
}
}
return false;
}
void SplitterCollapser::enterEvent(QEvent *event)
{
Q_UNUSED(event)
d->updateOpacity();
}
void SplitterCollapser::leaveEvent(QEvent *event)
{
Q_UNUSED(event)
d->updateOpacity();
}
QSize SplitterCollapser::sizeHint() const
{
const int extent = style()->pixelMetric(QStyle::PM_ScrollBarExtent);
......@@ -297,6 +299,8 @@ void SplitterCollapser::slotClicked()
}
}
d->splitter->setSizes(sizes);
d->opacityTimeLine->setDirection(QTimeLine::Backward);
d->startTimeLine();
}
void SplitterCollapser::collapse()
......
......@@ -69,6 +69,8 @@ protected:
bool eventFilter(QObject *, QEvent *);
void paintEvent(QPaintEvent *);
void enterEvent(QEvent *event);
void leaveEvent(QEvent *event);
private:
class Private;
Private *const d;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment