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
1206 mainWindow->addDockWidget(Qt::NoDockWidgetArea, _chatWindow = new ChatWindow());1206 mainWindow->addDockWidget(Qt::NoDockWidgetArea, _chatWindow = new ChatWindow());
1207 }1207 }
1208 if (!_chatWindow->toggleViewAction()->isChecked()) {1208 if (!_chatWindow->toggleViewAction()->isChecked()) {
1209 int width = _chatWindow->width();1209 const QRect& windowGeometry = mainWindow->geometry();
1210 int y = qMax((mainWindow->height() - _chatWindow->height()) / 2, 0);1210 _chatWindow->move(windowGeometry.topRight().x() - _chatWindow->width(),
1211 _chatWindow->move(mainWindow->width(), y);1211 windowGeometry.topRight().y() + (windowGeometry.height() / 2) - (_chatWindow->height() / 2));
1212
1212 _chatWindow->resize(0, _chatWindow->height());1213 _chatWindow->resize(0, _chatWindow->height());
1213 _chatWindow->toggleViewAction()->trigger();1214 _chatWindow->toggleViewAction()->trigger();
1214
1215 }1215 }
1216}1216}
1217 1217