Changeset 81357 in vbox
- Timestamp:
- Oct 18, 2019 2:13:59 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r81353 r81357 470 470 * @{ */ 471 471 /** Extra-data Manager Window constructor. */ 472 UIExtraDataManagerWindow( );472 UIExtraDataManagerWindow(QWidget *pCenterWidget); 473 473 /** Extra-data Manager Window destructor. */ 474 474 ~UIExtraDataManagerWindow(); … … 645 645 646 646 647 /** @name Arguments 648 * @{ */ 649 /** Holds the center widget reference. */ 650 QWidget *m_pCenterWidget; 651 /** @} */ 652 647 653 /** @name General 648 654 * @{ */ … … 706 712 *********************************************************************************************************************************/ 707 713 708 UIExtraDataManagerWindow::UIExtraDataManagerWindow() 709 : m_pMainLayout(0), m_pToolBar(0), m_pSplitter(0) 714 UIExtraDataManagerWindow::UIExtraDataManagerWindow(QWidget *pCenterWidget) 715 : m_pCenterWidget(pCenterWidget) 716 , m_pMainLayout(0), m_pToolBar(0), m_pSplitter(0) 710 717 , m_pPaneOfChooser(0), m_pFilterOfChooser(0), m_pViewOfChooser(0) 711 718 , m_pModelSourceOfChooser(0), m_pModelProxyOfChooser(0) … … 1683 1690 /* Load window geometry: */ 1684 1691 { 1685 const QRect geo = gEDataManager->extraDataManagerGeometry(this );1692 const QRect geo = gEDataManager->extraDataManagerGeometry(this, m_pCenterWidget); 1686 1693 LogRel2(("GUI: UIExtraDataManagerWindow: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n", 1687 1694 geo.x(), geo.y(), geo.width(), geo.height())); … … 4116 4123 4117 4124 /* Use geometry (loaded or default): */ 4118 QRect geometry = fOk ? QRect(iX, iY, iW, iH) : QRect(QPoint(0, 0), availableGeometry.size() * . 33/* % */);4125 QRect geometry = fOk ? QRect(iX, iY, iW, iH) : QRect(QPoint(0, 0), availableGeometry.size() * .50 /* % */); 4119 4126 4120 4127 /* Take hint-widget into account: */ … … 4424 4431 4425 4432 #ifdef VBOX_GUI_WITH_EXTRADATA_MANAGER_UI 4426 QRect UIExtraDataManager::extraDataManagerGeometry(QWidget *pWidget )4433 QRect UIExtraDataManager::extraDataManagerGeometry(QWidget *pWidget, QWidget *pParentWidget) 4427 4434 { 4428 4435 /* Get corresponding extra-data: */ … … 4445 4452 while (0); 4446 4453 4454 /* Get available-geometry [of screen with point (iX, iY) if possible]: */ 4455 const QRect availableGeometry = fOk ? gpDesktop->availableGeometry(QPoint(iX, iY)) : 4456 gpDesktop->availableGeometry(); 4457 4447 4458 /* Use geometry (loaded or default): */ 4448 QRect geometry = fOk ? QRect(iX, iY, iW, iH) : QRect( 0, 0, 800, 600);4459 QRect geometry = fOk ? QRect(iX, iY, iW, iH) : QRect(QPoint(0, 0), availableGeometry.size() * .50 /* % */); 4449 4460 4450 4461 /* Take hint-widget into account: */ … … 4452 4463 geometry.setSize(geometry.size().expandedTo(pWidget->minimumSizeHint())); 4453 4464 4454 /* Get available-geometry [of screen with point (iX, iY) if possible]: */ 4455 const QRect availableGeometry = fOk ? gpDesktop->availableGeometry(QPoint(iX, iY)) : 4456 gpDesktop->availableGeometry(); 4457 4465 /* As a fallback, move default-geometry to pParentWidget' geometry center: */ 4466 if (!fOk && pParentWidget) 4467 geometry.moveCenter(pParentWidget->geometry().center()); 4458 4468 /* As final fallback, move default-geometry to available-geometry' center: */ 4459 if (!fOk)4469 else if (!fOk) 4460 4470 geometry.moveCenter(availableGeometry.center()); 4461 4471 … … 4541 4551 #endif /* VBOX_GUI_WITH_EXTRADATA_MANAGER_UI */ 4542 4552 4543 QRect UIExtraDataManager::logWindowGeometry(QWidget *pWidget, const QRect &defaultGeometry)4553 QRect UIExtraDataManager::logWindowGeometry(QWidget *pWidget, QWidget *pParentWidget, const QRect &defaultGeometry) 4544 4554 { 4545 4555 /* Get corresponding extra-data: */ … … 4562 4572 while (0); 4563 4573 4574 /* Get available-geometry [of screen with point (iX, iY) if possible]: */ 4575 const QRect availableGeometry = fOk ? gpDesktop->availableGeometry(QPoint(iX, iY)) : 4576 gpDesktop->availableGeometry(); 4577 4564 4578 /* Use geometry (loaded or default): */ 4565 4579 QRect geometry = fOk ? QRect(iX, iY, iW, iH) : defaultGeometry; … … 4569 4583 geometry.setSize(geometry.size().expandedTo(pWidget->minimumSizeHint())); 4570 4584 4585 /* As a fallback, move default-geometry to pParentWidget' geometry center: */ 4586 if (!fOk && pParentWidget) 4587 geometry.moveCenter(pParentWidget->geometry().center()); 4588 /* As final fallback, move default-geometry to available-geometry' center: */ 4589 else if (!fOk) 4590 geometry.moveCenter(availableGeometry.center()); 4591 4571 4592 /* In Windows Qt fails to reposition out of screen window properly, so doing it ourselves: */ 4572 4593 #ifdef VBOX_WS_WIN 4573 /* Get available-geometry [of screen with point (iX, iY) if possible]: */4574 const QRect availableGeometry = fOk ? gpDesktop->availableGeometry(QPoint(iX, iY)) :4575 gpDesktop->availableGeometry();4576 4577 4594 /* Make sure resulting geometry is within current bounds: */ 4578 4595 if (!availableGeometry.contains(geometry)) … … 4844 4861 { 4845 4862 /* Create window: */ 4846 m_pWindow = new UIExtraDataManagerWindow ;4863 m_pWindow = new UIExtraDataManagerWindow(pCenterWidget); 4847 4864 /* Configure window connections: */ 4848 4865 connect(this, &UIExtraDataManager::sigExtraDataMapAcknowledging, -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r81309 r81357 714 714 /** @name VirtualBox: Extra-data Manager window 715 715 * @{ */ 716 /** Returns Extra-data Manager geometry using @a pWidget a s hint. */717 QRect extraDataManagerGeometry(QWidget *pWidget );716 /** Returns Extra-data Manager geometry using @a pWidget and @a pParentWidget as hint. */ 717 QRect extraDataManagerGeometry(QWidget *pWidget, QWidget *pParentWidget); 718 718 /** Returns whether Extra-data Manager should be maximized or not. */ 719 719 bool extraDataManagerShouldBeMaximized(); … … 730 730 /** @name Virtual Machine: Log Viewer dialog 731 731 * @{ */ 732 /** Returns log-window geometry using @a pWidget and @a defaultGeometry as hints. */733 QRect logWindowGeometry(QWidget *pWidget, const QRect &defaultGeometry);732 /** Returns log-window geometry using @a pWidget, @a pParentWidget and @a defaultGeometry as hints. */ 733 QRect logWindowGeometry(QWidget *pWidget, QWidget *pParentWidget, const QRect &defaultGeometry); 734 734 /** Returns whether log-window should be maximized or not. */ 735 735 bool logWindowShouldBeMaximized(); -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerDialog.cpp
r81284 r81357 128 128 } 129 129 QRect defaultGeo(0, 0, iDefaultWidth, iDefaultHeight); 130 if (centerWidget())131 defaultGeo.moveCenter(centerWidget()->geometry().center());132 else133 defaultGeo.moveCenter(availableGeo.center());134 130 135 131 /* Load geometry from extradata: */ 136 const QRect geo = gEDataManager->logWindowGeometry(this, defaultGeo);132 const QRect geo = gEDataManager->logWindowGeometry(this, centerWidget(), defaultGeo); 137 133 LogRel2(("GUI: UIVMLogViewerDialog: Restoring geometry to: Origin=%dx%d, Size=%dx%d\n", 138 134 geo.x(), geo.y(), geo.width(), geo.height()));
Note:
See TracChangeset
for help on using the changeset viewer.