1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Screen grabber: Moving from button -> flyout -> button doesn't collapse

This commit is contained in:
Stefan Merettig 2015-03-25 14:51:14 +01:00 committed by tux3
parent 7ab64d5628
commit 9539a38f15
4 changed files with 7 additions and 14 deletions

View File

@ -189,6 +189,7 @@ GenericChatForm::GenericChatForm(QWidget *parent)
fileFlyout->setFixedSize(24, 24);
fileFlyout->setParent(this);
fileButton->installEventFilter(this);
fileFlyout->installEventFilter(this);
}
void GenericChatForm::showFileMenu()
@ -411,7 +412,7 @@ void GenericChatForm::insertChatMessage(ChatMessage::Ptr msg)
bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
{
if (object != this->fileButton)
if (object != this->fileButton && object != this->fileFlyout)
return false;
switch(event->type())
@ -422,9 +423,10 @@ bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
case QEvent::Leave: {
QPoint pos = mapFromGlobal(QCursor::pos());
QRect rect (fileFlyout->pos(), fileFlyout->size());
QRect fileRect(fileFlyout->pos(), fileFlyout->size());
fileRect = fileRect.united(QRect(fileButton->pos(), fileButton->size()));
if (!rect.contains(pos))
if (!fileRect.contains(pos))
hideFileMenu();
} break;

View File

@ -88,12 +88,6 @@ void FlyoutOverlayWidget::animateHide()
animation->start();
}
void FlyoutOverlayWidget::leaveEvent(QEvent* event)
{
Q_UNUSED(event);
animateHide();
}
void FlyoutOverlayWidget::finishedAnimation()
{
bool hide = (animation->direction() == QAbstractAnimation::Backward);

View File

@ -44,9 +44,6 @@ signals:
void hidden();
protected:
void leaveEvent(QEvent* event);
private:
void finishedAnimation();