Changeset 52402 in vbox
- Timestamp:
- Aug 18, 2014 6:38:06 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 95564
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISlidingToolBar.cpp
r52389 r52402 29 29 #endif /* Q_WS_MAC */ 30 30 31 UISlidingToolBar::UISlidingToolBar(QWidget *pParentWidget, QWidget *pIndentWidget, QWidget *pChildWidget )31 UISlidingToolBar::UISlidingToolBar(QWidget *pParentWidget, QWidget *pIndentWidget, QWidget *pChildWidget, Position position) 32 32 : QWidget(pParentWidget, Qt::Tool | Qt::FramelessWindowHint) 33 , m_position(position) 33 34 , m_parentRect(pParentWidget->geometry()) 34 35 , m_indentRect(pIndentWidget->geometry()) … … 128 129 void UISlidingToolBar::prepareGeometry() 129 130 { 130 /* Prepare geometry based on parent and mdi-sub-window size-hints: */ 131 /* Prepare geometry based on parent and mdi-sub-window size-hints, 132 * But move mdi-sub-window to initial position: */ 131 133 const QSize sh = m_pEmbeddedWidget->sizeHint(); 132 setGeometry(m_parentRect.x(), m_parentRect.y() + m_parentRect.height() - m_indentRect.height() - sh.height(), 133 qMax(m_parentRect.width(), sh.width()), sh.height()); 134 /* But move mdi-sub-window to initial position: */ 135 m_pEmbeddedWidget->setGeometry(0, sh.height(), qMax(width(), sh.width()), sh.height()); 134 switch (m_position) 135 { 136 case Position_Top: 137 { 138 setGeometry(m_parentRect.x(), m_parentRect.y() + m_indentRect.height(), 139 qMax(m_parentRect.width(), sh.width()), sh.height()); 140 m_pEmbeddedWidget->setGeometry(0, -sh.height(), qMax(width(), sh.width()), sh.height()); 141 break; 142 } 143 case Position_Bottom: 144 { 145 setGeometry(m_parentRect.x(), m_parentRect.y() + m_parentRect.height() - m_indentRect.height() - sh.height(), 146 qMax(m_parentRect.width(), sh.width()), sh.height()); 147 m_pEmbeddedWidget->setGeometry(0, sh.height(), qMax(width(), sh.width()), sh.height()); 148 break; 149 } 150 } 136 151 137 152 #ifdef Q_WS_X11 … … 171 186 /* Adjust geometry based on parent and mdi-sub-window size-hints: */ 172 187 const QSize sh = m_pEmbeddedWidget->sizeHint(); 173 setGeometry(m_parentRect.x(), m_parentRect.y() + m_parentRect.height() - m_indentRect.height() - sh.height(), 174 qMax(m_parentRect.width(), sh.width()), sh.height()); 188 switch (m_position) 189 { 190 case Position_Top: 191 { 192 setGeometry(m_parentRect.x(), m_parentRect.y() + m_indentRect.height(), 193 qMax(m_parentRect.width(), sh.width()), sh.height()); 194 break; 195 } 196 case Position_Bottom: 197 { 198 setGeometry(m_parentRect.x(), m_parentRect.y() + m_parentRect.height() - m_indentRect.height() - sh.height(), 199 qMax(m_parentRect.width(), sh.width()), sh.height()); 200 break; 201 } 202 } 175 203 /* And move mdi-sub-window to corresponding position: */ 176 204 m_pEmbeddedWidget->setGeometry(0, 0, qMax(width(), sh.width()), sh.height()); … … 195 223 /* Recalculate mdi-sub-window geometry animation boundaries based on size-hint: */ 196 224 const QSize sh = m_pEmbeddedWidget->sizeHint(); 197 m_startWidgetGeometry = QRect(0, sh.height(), qMax(width(), sh.width()), sh.height()); 198 m_finalWidgetGeometry = QRect(0, 0, qMax(width(), sh.width()), sh.height()); 225 switch (m_position) 226 { 227 case Position_Top: m_startWidgetGeometry = QRect(0, -sh.height(), qMax(width(), sh.width()), sh.height()); break; 228 case Position_Bottom: m_startWidgetGeometry = QRect(0, sh.height(), qMax(width(), sh.width()), sh.height()); break; 229 } 230 m_finalWidgetGeometry = QRect(0, 0, qMax(width(), sh.width()), sh.height()); 199 231 m_pAnimation->update(); 200 232 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISlidingToolBar.h
r52389 r52402 47 47 public: 48 48 49 /** Possible positions. */ 50 enum Position 51 { 52 Position_Top, 53 Position_Bottom 54 }; 55 49 56 /** Constructor, passes @a pParentWidget to the QWidget constructor. 50 57 * @param pParentWidget is used to get parent-widget geoemtry, 51 58 * @param pIndentWidget is used to get indent-widget geometry, 52 59 * @param pChildWidget brings child-widget to be injected into tool-bar. */ 53 UISlidingToolBar(QWidget *pParentWidget, QWidget *pIndentWidget, QWidget *pChildWidget );60 UISlidingToolBar(QWidget *pParentWidget, QWidget *pIndentWidget, QWidget *pChildWidget, Position position); 54 61 55 62 private slots: … … 98 105 /** @name Geometry 99 106 * @{ */ 107 /** Holds the tool-bar position. */ 108 const Position m_position; 100 109 /** Holds the cached parent-widget geometry. */ 101 110 QRect m_parentRect; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp
r52389 r52402 118 118 public: 119 119 120 /** Constructor, passes @a pParent to the QWidget constructor. 121 * @param rect is used to define initial cached parent geometry. 122 * @param statusBarRect is used to define initial cached status-bar geometry. */ 120 /** Constructor, passes @a pParent to the QWidget constructor. */ 123 121 UIStatusBarEditorWidget(QWidget *pParent = 0); 124 122 … … 445 443 connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange()), 446 444 this, SLOT(sltHandleConfigurationChange())); 445 447 446 /* Update status buttons: */ 448 447 updateStatusButtons(); … … 546 545 } 547 546 547 /* Paint shape/shadow: */ 548 painter.fillRect(QRect(5, 5, width() - 5 * 2, height() - 5), color0); // background 549 painter.fillRect(QRect(0, 0, 5, 5), grad1); // left corner 550 painter.fillRect(QRect(width() - 5, 0, 5, 5), grad2); // right corner 551 painter.fillRect(QRect(5, 0, width() - 5 * 2, 5), grad3); // bottom line 552 painter.fillRect(QRect(0, 5, 5, height() - 5), grad4); // left line 553 painter.fillRect(QRect(width() - 5, 5, 5, height() - 5), grad5); // right line 554 555 #if defined(Q_WS_WIN) || defined(Q_WS_X11) 548 556 /* Paint frames: */ 549 painter.fillRect(QRect(5, 5, width() - 5 * 2, height() - 5), color0);550 painter.fillRect(QRect(0, 0, 5, 5), grad1);551 painter.fillRect(QRect(width() - 5, 0, 5, 5), grad2);552 painter.fillRect(QRect(5, 0, width() - 5 * 2, 5), grad3);553 painter.fillRect(QRect(0, 5, 5, height() - 5), grad4);554 painter.fillRect(QRect(width() - 5, 5, 5, height() - 5), grad5);555 #if defined(Q_WS_WIN) || defined(Q_WS_X11)556 557 painter.save(); 557 558 painter.setPen(color3); … … 695 696 696 697 UIStatusBarEditorWindow::UIStatusBarEditorWindow(UIMachineWindow *pParent) 697 : UISlidingToolBar(pParent, pParent->statusBar(), new UIStatusBarEditorWidget )698 : UISlidingToolBar(pParent, pParent->statusBar(), new UIStatusBarEditorWidget, UISlidingToolBar::Position_Bottom) 698 699 { 699 700 }
Note:
See TracChangeset
for help on using the changeset viewer.