Changeset 47041 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 8, 2013 1:59:23 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp
r47028 r47041 21 21 #include <QEvent> 22 22 #include <QMainWindow> 23 #include <QMenuBar> 23 24 #include <QStatusBar> 24 25 … … 34 35 : m_iLayoutMargin(1) 35 36 , m_iLayoutSpacing(1) 37 , m_iParentMenuBarHeight(0) 36 38 , m_iParentStatusBarHeight(0) 37 39 { … … 115 117 /* Call to base-class: */ 116 118 QWidget::setParent(pParent); 119 /* Recalculate parent menu-bar height: */ 120 m_iParentMenuBarHeight = parentMenuBarHeight(pParent); 117 121 /* Recalculate parent status-bar height: */ 118 122 m_iParentStatusBarHeight = parentStatusBarHeight(pParent); … … 123 127 /* Call to base-class: */ 124 128 QWidget::setParent(pParent, flags); 129 /* Recalculate parent menu-bar height: */ 130 m_iParentMenuBarHeight = parentMenuBarHeight(pParent); 125 131 /* Recalculate parent status-bar height: */ 126 132 m_iParentStatusBarHeight = parentStatusBarHeight(pParent); … … 139 145 bool fIsWindow = isWindow(); 140 146 const int iX = fIsWindow ? parentWidget()->x() : 0; 141 const int iY = fIsWindow ? parentWidget()->y() : 0;147 const int iY = fIsWindow ? parentWidget()->y() : m_iParentMenuBarHeight; 142 148 const int iWidth = parentWidget()->width(); 143 149 const int iHeight = m_minimumSizeHint.height(); … … 282 288 283 289 /* static */ 290 int UIPopupStack::parentMenuBarHeight(QWidget *pParent) 291 { 292 /* Menu-bar can exist only on QMainWindow sub-class: */ 293 if (QMainWindow *pMainWindow = qobject_cast<QMainWindow*>(pParent)) 294 { 295 /* Search for existing menu-bar child: */ 296 if (QMenuBar *pMenuBar = pMainWindow->findChild<QMenuBar*>()) 297 return pMenuBar->height(); 298 } 299 /* Zero by default: */ 300 return 0; 301 } 302 303 /* static */ 284 304 int UIPopupStack::parentStatusBarHeight(QWidget *pParent) 285 305 { … … 287 307 if (QMainWindow *pMainWindow = qobject_cast<QMainWindow*>(pParent)) 288 308 { 289 /* Status-bar can exist only: 290 * 1. on non-machine-window 291 * 2. on machine-window in normal mode: */ 292 if (!qobject_cast<UIMachineWindow*>(pMainWindow) || 293 qobject_cast<UIMachineWindowNormal*>(pMainWindow)) 294 return pMainWindow->statusBar()->height(); 309 /* Search for existing status-bar child: */ 310 if (QStatusBar *pStatusBar = pMainWindow->findChild<QStatusBar*>()) 311 return pStatusBar->height(); 295 312 } 296 313 /* Zero by default: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.h
r47014 r47041 81 81 82 82 /* Static helpers: Prepare stuff: */ 83 static int parentMenuBarHeight(QWidget *pParent); 83 84 static int parentStatusBarHeight(QWidget *pParent); 84 85 … … 87 88 const int m_iLayoutSpacing; 88 89 QSize m_minimumSizeHint; 90 int m_iParentMenuBarHeight; 89 91 int m_iParentStatusBarHeight; 90 92 QMap<QString, UIPopupPane*> m_panes;
Note:
See TracChangeset
for help on using the changeset viewer.