VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMainWindow.cpp@ 70603

Last change on this file since 70603 was 70603, checked in by vboxsync, 7 years ago

FE/Qt: bugref:8694: Selector UI: Use similar to macOS approach while restoring window geometry on Windows platform; that way window frame will be take into account to avoid restoring window with off-screen frame.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 1.4 KB
Line 
1/* $Id: QIMainWindow.cpp 70603 2018-01-16 17:56:07Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - QIMainWindow class implementation.
4 */
5
6/*
7 * Copyright (C) 2016-2017 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifdef VBOX_WITH_PRECOMPILED_HEADERS
19# include <precomp.h>
20#else /* !VBOX_WITH_PRECOMPILED_HEADERS */
21
22/* GUI includes: */
23# include "QIMainWindow.h"
24# include "VBoxGlobal.h"
25# include "UIDesktopWidgetWatchdog.h"
26
27#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
28
29
30QIMainWindow::QIMainWindow(QWidget *pParent /* = 0 */, Qt::WindowFlags enmFlags /* = 0 */)
31 : QMainWindow(pParent, enmFlags)
32{
33}
34
35void QIMainWindow::restoreGeometry()
36{
37#if defined(VBOX_WS_MAC) || defined(VBOX_WS_WIN)
38 /* Use the old approach for OSX/Win: */
39 move(m_geometry.topLeft());
40 resize(m_geometry.size());
41#else /* !VBOX_WS_MAC && !VBOX_WS_WIN */
42 /* Use the new approach for X11: */
43 VBoxGlobal::setTopLevelGeometry(this, m_geometry);
44#endif /* !VBOX_WS_MAC && !VBOX_WS_WIN */
45
46 /* Maximize (if necessary): */
47 if (shouldBeMaximized())
48 showMaximized();
49}
50
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette