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

Screen grabber: Fix flying-flyout bug when resizing window while open

This commit is contained in:
Stefan Merettig 2015-04-04 23:22:03 +02:00 committed by tux3
parent f982938919
commit f14c399297
4 changed files with 17 additions and 5 deletions

View File

@ -432,7 +432,7 @@ SOURCES += \
src/core/corefile.cpp \
src/core/corestructs.cpp \
src/profilelocker.cpp \
src/avatarbroadcaster.cpp
src/avatarbroadcaster.cpp \
src/widget/tool/screenshotgrabber.cpp \
src/widget/tool/screengrabberchooserrectitem.cpp \
src/widget/tool/screengrabberoverlayitem.cpp \

View File

@ -79,7 +79,6 @@ public slots:
void onVolMuteToggle();
void onAvatarChange(uint32_t FriendId, const QPixmap& pic);
void onAvatarRemoved(uint32_t FriendId);
void onAttachContext(const QPoint &pos);
private slots:
void onSendTriggered();

View File

@ -192,12 +192,17 @@ GenericChatForm::GenericChatForm(QWidget *parent)
fileFlyout->installEventFilter(this);
}
void GenericChatForm::adjustFileMenuPosition()
{
QPoint pos = fileButton->pos();
QSize size = fileFlyout->size();
fileFlyout->move(pos.x() - size.width(), pos.y());
}
void GenericChatForm::showFileMenu()
{
if (!fileFlyout->isShown() && !fileFlyout->isBeingShown()) {
QPoint pos = fileButton->pos();
QSize size = fileFlyout->size();
fileFlyout->move(pos.x() - size.width(), pos.y());
adjustFileMenuPosition();
}
fileFlyout->animateShow();
@ -416,6 +421,12 @@ void GenericChatForm::hideEvent(QHideEvent* event)
QWidget::hideEvent(event);
}
void GenericChatForm::resizeEvent(QResizeEvent* event)
{
adjustFileMenuPosition();
QWidget::resizeEvent(event);
}
bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
{
if (object != this->fileButton && object != this->fileFlyout)

View File

@ -85,6 +85,8 @@ protected:
QString resolveToxID(const ToxID &id);
void insertChatMessage(ChatMessage::Ptr msg);
void hideEvent(QHideEvent* event);
void resizeEvent(QResizeEvent* event);
void adjustFileMenuPosition();
ToxID previousId;
QDateTime prevMsgDateTime;