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

fix(genericchatform): Fixed position of screenshot button

Fix #2427.
This commit is contained in:
Diadlo 2016-06-29 16:05:53 +03:00
parent 464daebdd7
commit 86e44143ad
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727

View File

@ -226,7 +226,7 @@ GenericChatForm::~GenericChatForm()
void GenericChatForm::adjustFileMenuPosition() void GenericChatForm::adjustFileMenuPosition()
{ {
QPoint pos = fileButton->pos(); QPoint pos = fileButton->mapTo(bodySplitter, QPoint());
QSize size = fileFlyout->size(); QSize size = fileFlyout->size();
fileFlyout->move(pos.x() - size.width(), pos.y()); fileFlyout->move(pos.x() - size.width(), pos.y());
} }
@ -244,7 +244,6 @@ void GenericChatForm::hideFileMenu()
{ {
if(fileFlyout->isShown() || fileFlyout->isBeingShown()) if(fileFlyout->isShown() || fileFlyout->isBeingShown())
fileFlyout->animateHide(); fileFlyout->animateHide();
} }
bool GenericChatForm::isEmpty() bool GenericChatForm::isEmpty()
@ -506,8 +505,8 @@ void GenericChatForm::resizeEvent(QResizeEvent* event)
bool GenericChatForm::eventFilter(QObject* object, QEvent* event) bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
{ {
EmoticonsWidget * ev = qobject_cast<EmoticonsWidget *>(object); EmoticonsWidget* ev = qobject_cast<EmoticonsWidget*>(object);
if (( ev) && (event->type() == QEvent::KeyPress) ) if (ev && event->type() == QEvent::KeyPress)
{ {
QKeyEvent* key = static_cast<QKeyEvent*>(event); QKeyEvent* key = static_cast<QKeyEvent*>(event);
msgEdit->sendKeyEvent(key); msgEdit->sendKeyEvent(key);
@ -527,15 +526,21 @@ bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
showFileMenu(); showFileMenu();
break; break;
case QEvent::Leave: { case QEvent::Leave:
QPoint pos = mapFromGlobal(QCursor::pos()); {
QRect fileRect(fileFlyout->pos(), fileFlyout->size()); QPoint flyPos = fileFlyout->mapToGlobal(QPoint());
fileRect = fileRect.united(QRect(fileButton->pos(), fileButton->size())); QSize flySize = fileFlyout->size();
if (!fileRect.contains(pos)) QPoint filePos = fileButton->mapToGlobal(QPoint());
QSize fileSize = fileButton->size();
QRect region = QRect(flyPos, flySize).united(QRect(filePos, fileSize));
if (!region.contains(QCursor::pos()))
hideFileMenu(); hideFileMenu();
} break; break;
}
case QEvent::MouseButtonPress: case QEvent::MouseButtonPress:
hideFileMenu(); hideFileMenu();