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:
parent
7ab64d5628
commit
9539a38f15
|
@ -874,13 +874,13 @@ void ChatForm::doScreenshot()
|
|||
{
|
||||
disconnect(fileFlyout, &FlyoutOverlayWidget::hidden, this, &ChatForm::doScreenshot);
|
||||
|
||||
ScreenshotGrabber* screenshotGrabber = new ScreenshotGrabber (this);
|
||||
ScreenshotGrabber* screenshotGrabber = new ScreenshotGrabber(this);
|
||||
connect(screenshotGrabber, &ScreenshotGrabber::screenshotTaken, this, &ChatForm::onScreenshotTaken);
|
||||
screenshotGrabber->showGrabber();
|
||||
|
||||
}
|
||||
|
||||
void ChatForm::onScreenshotTaken (const QPixmap &pixmap) {
|
||||
void ChatForm::onScreenshotTaken(const QPixmap &pixmap) {
|
||||
QTemporaryFile file("qTox-Screenshot-XXXXXXXX.png");
|
||||
|
||||
if (!file.open())
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -44,9 +44,6 @@ signals:
|
|||
|
||||
void hidden();
|
||||
|
||||
protected:
|
||||
void leaveEvent(QEvent* event);
|
||||
|
||||
private:
|
||||
|
||||
void finishedAnimation();
|
||||
|
|
Loading…
Reference in New Issue
Block a user