#include "arrowrectangle.h"

#include <DApplication>

ArrowRectangle::ArrowRectangle(ArrowDirection direction, QWidget *parent)
    : DArrowRectangle(direction, DArrowRectangle::FloatWindow, parent)
{
    connect(qApp, &DApplication::focusChanged, this, [=](QWidget* old, QWidget* now){
        Q_UNUSED(old);
        if (now != this && !this->isAncestorOf(now))
        {
            hide();
        }
    });
}

void ArrowRectangle::hideEvent(QHideEvent *e)
{
    Q_UNUSED(e);
    emit hideWindow();
}

ArrowRectangle::~ArrowRectangle()
{}
