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->setFixedSize(24, 24);
fileFlyout->setParent(this); fileFlyout->setParent(this);
fileButton->installEventFilter(this); fileButton->installEventFilter(this);
fileFlyout->installEventFilter(this);
} }
void GenericChatForm::showFileMenu() void GenericChatForm::showFileMenu()
@ -411,7 +412,7 @@ void GenericChatForm::insertChatMessage(ChatMessage::Ptr msg)
bool GenericChatForm::eventFilter(QObject* object, QEvent* event) bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
{ {
if (object != this->fileButton) if (object != this->fileButton && object != this->fileFlyout)
return false; return false;
switch(event->type()) switch(event->type())
@ -422,9 +423,10 @@ bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
case QEvent::Leave: { case QEvent::Leave: {
QPoint pos = mapFromGlobal(QCursor::pos()); 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(); hideFileMenu();
} break; } break;

View File

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

View File

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