From 2d481dda4e4d5ff345dcec0cda9cbc56515ce342 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 10 Apr 2014 11:46:28 -0700 Subject: [PATCH] Update chat menu to properly position itself when opening The previous implementation seemed to assume a full-screen main window - it will now open on the right side of the window, vertically centered, regardless of where the main window is. --- interface/src/Menu.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index ba3ea45229..7b67aadfba 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -1206,12 +1206,12 @@ void Menu::showChat() { mainWindow->addDockWidget(Qt::NoDockWidgetArea, _chatWindow = new ChatWindow()); } if (!_chatWindow->toggleViewAction()->isChecked()) { - int width = _chatWindow->width(); - int y = qMax((mainWindow->height() - _chatWindow->height()) / 2, 0); - _chatWindow->move(mainWindow->width(), y); + const QRect& windowGeometry = mainWindow->geometry(); + _chatWindow->move(windowGeometry.topRight().x() - _chatWindow->width(), + windowGeometry.topRight().y() + (windowGeometry.height() / 2) - (_chatWindow->height() / 2)); + _chatWindow->resize(0, _chatWindow->height()); _chatWindow->toggleViewAction()->trigger(); - } }