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