History

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.

Ryan Huffman committed 12 years ago

Commit 2d481dd1 parent 5099a0e1 file · +4 −4Browse files

Showing the changes to interface/src/Menu.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Menu.cpp+4−4
@@ -1206,12 +1206,12 @@ void Menu::showChat() { · 1205 unmodified lines
12061206 mainWindow->addDockWidget(Qt::NoDockWidgetArea, _chatWindow = new ChatWindow());
12071207 }
12081208 if (!_chatWindow->toggleViewAction()->isChecked()) {
1209− int width = _chatWindow->width();
1210− int y = qMax((mainWindow->height() - _chatWindow->height()) / 2, 0);
1211− _chatWindow->move(mainWindow->width(), y);
1209+ const QRect& windowGeometry = mainWindow->geometry();
1210+ _chatWindow->move(windowGeometry.topRight().x() - _chatWindow->width(),
1211+ windowGeometry.topRight().y() + (windowGeometry.height() / 2) - (_chatWindow->height() / 2));
1212+
12121213 _chatWindow->resize(0, _chatWindow->height());
12131214 _chatWindow->toggleViewAction()->trigger();
1214−
12151215 }
12161216 }
12171217