mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
parent
464daebdd7
commit
86e44143ad
|
@ -226,7 +226,7 @@ GenericChatForm::~GenericChatForm()
|
|||
|
||||
void GenericChatForm::adjustFileMenuPosition()
|
||||
{
|
||||
QPoint pos = fileButton->pos();
|
||||
QPoint pos = fileButton->mapTo(bodySplitter, QPoint());
|
||||
QSize size = fileFlyout->size();
|
||||
fileFlyout->move(pos.x() - size.width(), pos.y());
|
||||
}
|
||||
|
@ -244,7 +244,6 @@ void GenericChatForm::hideFileMenu()
|
|||
{
|
||||
if(fileFlyout->isShown() || fileFlyout->isBeingShown())
|
||||
fileFlyout->animateHide();
|
||||
|
||||
}
|
||||
|
||||
bool GenericChatForm::isEmpty()
|
||||
|
@ -506,8 +505,8 @@ void GenericChatForm::resizeEvent(QResizeEvent* event)
|
|||
|
||||
bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
EmoticonsWidget * ev = qobject_cast<EmoticonsWidget *>(object);
|
||||
if (( ev) && (event->type() == QEvent::KeyPress) )
|
||||
EmoticonsWidget* ev = qobject_cast<EmoticonsWidget*>(object);
|
||||
if (ev && event->type() == QEvent::KeyPress)
|
||||
{
|
||||
QKeyEvent* key = static_cast<QKeyEvent*>(event);
|
||||
msgEdit->sendKeyEvent(key);
|
||||
|
@ -527,15 +526,21 @@ bool GenericChatForm::eventFilter(QObject* object, QEvent* event)
|
|||
showFileMenu();
|
||||
break;
|
||||
|
||||
case QEvent::Leave: {
|
||||
QPoint pos = mapFromGlobal(QCursor::pos());
|
||||
QRect fileRect(fileFlyout->pos(), fileFlyout->size());
|
||||
fileRect = fileRect.united(QRect(fileButton->pos(), fileButton->size()));
|
||||
case QEvent::Leave:
|
||||
{
|
||||
QPoint flyPos = fileFlyout->mapToGlobal(QPoint());
|
||||
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();
|
||||
|
||||
} break;
|
||||
break;
|
||||
}
|
||||
|
||||
case QEvent::MouseButtonPress:
|
||||
hideFileMenu();
|
||||
|
|
Loading…
Reference in New Issue
Block a user