Отключение eventFilter для дочерних элементов при реализации функции перемещения окна

Я пытаюсь сделать функционал перемещения окна, но есть одна проблема: не знаю, как отключить эту функцию на дочерних элементах для ui->frame_hint (три кнопки QPushButton). Т.е. при попадании курсора на эти кнопки, окно "прыгает". Другими словами, мне нужно перемещать окно курсором мыши за объект ui->frame_hint, за исключением случаев, когда курсор попадает на дочерние для ui->frame_hint объекты.

bool MainWindow::eventFilter(QObject *watched, QEvent *event)
{
    if (watched == ui->frame_hint)
    {
        if (event->type() == QEvent::MouseButtonPress)
        {
            QMouseEvent* mouse_event = dynamic_cast<QMouseEvent*>(event);
            if (mouse_event->button() == Qt::LeftButton)
            {
                mouseClickCoordinate = mouse_event->pos();
                return false;
            }
        }
        else if (event->type() == QEvent::MouseMove)
        {
            QMouseEvent* mouse_event = dynamic_cast<QMouseEvent*>(event);
            if (mouse_event->buttons() & Qt::LeftButton)
            {
                this->move(mouse_event->globalPos() - mouseClickCoordinate);
                return false;
            }
        }
    }
    return false;
}

Ответы (2 шт):

Автор решения: Helg1980

Удалось это сделать с помощью дополнительной переменной

bool clickPressedFlag = false;

и с использованием

QEvent::MouseButtonRelease

Рабочий код:

bool MainWindow::eventFilter(QObject *watched, QEvent *event)
{
    if (event->type() == QEvent::MouseButtonRelease)
    {
        QMouseEvent* mouse_event = dynamic_cast<QMouseEvent*>(event);
        if (mouse_event->button() == Qt::LeftButton)
        {
            clickPressedFlag = false;
            return QMainWindow::eventFilter(watched, event);
        }
    }

    if (watched == ui->frame_top_btns)
    {
        if (event->type() == QEvent::MouseButtonPress)
        {
            QMouseEvent* mouse_event = dynamic_cast<QMouseEvent*>(event);
            if (mouse_event->button() == Qt::LeftButton)
            {
                mouseClickCoordinate = mouse_event->pos();
                clickPressedFlag = true;
                return QMainWindow::eventFilter(watched, event);
            }
        }
        else if ((event->type() == QEvent::MouseMove) && clickPressedFlag == true)
        {
            QMouseEvent* mouse_event = dynamic_cast<QMouseEvent*>(event);
            if (mouse_event->buttons() & Qt::LeftButton)
            {
                this->move(mouse_event->globalPos() - mouseClickCoordinate);
                return QMainWindow::eventFilter(watched, event);
            }
        }
    }
    return QMainWindow::eventFilter(watched, event);
}
→ Ссылка
Автор решения: Sergey Tatarincev

к чему велосипеды если есть

void QObject::removeEventFilter(QObject *obj)
→ Ссылка