Changeset 89101 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 17, 2021 2:58:15 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/details
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp
r89100 r89101 204 204 } 205 205 206 void UIDetailsElement::updateLayout() 207 { 208 /* Prepare variables: */ 209 QSize size = geometry().size().toSize(); 210 int iMargin = data(ElementData_Margin).toInt(); 211 212 /* Layout button: */ 213 int iButtonWidth = m_buttonSize.width(); 214 int iButtonHeight = m_buttonSize.height(); 215 int iButtonX = size.width() - 2 * iMargin - iButtonWidth; 216 int iButtonY = iButtonHeight == m_iMinimumHeaderHeight ? iMargin : 217 iMargin + (m_iMinimumHeaderHeight - iButtonHeight) / 2; 218 m_pButton->setPos(iButtonX, iButtonY); 219 220 /* If closed: */ 221 if (isClosed()) 222 { 223 /* Hide text-pane if still visible: */ 224 if (m_pTextPane->isVisible()) 225 m_pTextPane->hide(); 226 } 227 /* If opened: */ 228 else 229 { 230 /* Layout text-pane: */ 231 int iTextPaneX = 2 * iMargin; 232 int iTextPaneY = iMargin + m_iMinimumHeaderHeight + 2 * iMargin; 233 m_pTextPane->setPos(iTextPaneX, iTextPaneY); 234 m_pTextPane->resize(size.width() - 4 * iMargin, 235 size.height() - 4 * iMargin - m_iMinimumHeaderHeight); 236 /* Show text-pane if still invisible and animation finished: */ 237 if (!m_pTextPane->isVisible() && !isAnimationRunning()) 238 m_pTextPane->show(); 239 } 240 } 241 206 242 int UIDetailsElement::minimumWidthHint() const 207 243 { … … 385 421 { 386 422 AssertMsgFailed(("Details element do NOT support children!")); 387 }388 389 void UIDetailsElement::updateLayout()390 {391 /* Prepare variables: */392 QSize size = geometry().size().toSize();393 int iMargin = data(ElementData_Margin).toInt();394 395 /* Layout button: */396 int iButtonWidth = m_buttonSize.width();397 int iButtonHeight = m_buttonSize.height();398 int iButtonX = size.width() - 2 * iMargin - iButtonWidth;399 int iButtonY = iButtonHeight == m_iMinimumHeaderHeight ? iMargin :400 iMargin + (m_iMinimumHeaderHeight - iButtonHeight) / 2;401 m_pButton->setPos(iButtonX, iButtonY);402 403 /* If closed: */404 if (isClosed())405 {406 /* Hide text-pane if still visible: */407 if (m_pTextPane->isVisible())408 m_pTextPane->hide();409 }410 /* If opened: */411 else412 {413 /* Layout text-pane: */414 int iTextPaneX = 2 * iMargin;415 int iTextPaneY = iMargin + m_iMinimumHeaderHeight + 2 * iMargin;416 m_pTextPane->setPos(iTextPaneX, iTextPaneY);417 m_pTextPane->resize(size.width() - 4 * iMargin,418 size.height() - 4 * iMargin - m_iMinimumHeaderHeight);419 /* Show text-pane if still invisible and animation finished: */420 if (!m_pTextPane->isVisible() && !isAnimationRunning())421 m_pTextPane->show();422 }423 423 } 424 424 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.h
r89100 r89101 112 112 /** @name Layout stuff. 113 113 * @{ */ 114 /** Updates layout. */ 115 virtual void updateLayout() /* override */; 116 114 117 /** Returns minimum width-hint. */ 115 118 virtual int minimumWidthHint() const /* override */; … … 197 200 /** @name Layout stuff. 198 201 * @{ */ 199 /** Updates layout. */200 virtual void updateLayout() /* override */;201 202 202 /** Returns minimum width-hint for @a fClosed element. */ 203 203 virtual int minimumHeightHintForElement(bool fClosed) const; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.cpp
r83719 r89101 139 139 } 140 140 141 void UIDetailsElementPreview::updateLayout() 142 { 143 /* Call to base-class: */ 144 UIDetailsElement::updateLayout(); 145 146 /* Show/hide preview: */ 147 if (isClosed() && m_pPreview->isVisible()) 148 m_pPreview->hide(); 149 if (isOpened() && !m_pPreview->isVisible() && !isAnimationRunning()) 150 m_pPreview->show(); 151 152 /* And update preview layout itself: */ 153 const int iMargin = data(ElementData_Margin).toInt(); 154 m_pPreview->setPos(iMargin, 2 * iMargin + minimumHeaderHeight()); 155 m_pPreview->resize(m_pPreview->minimumSizeHint()); 156 } 157 141 158 void UIDetailsElementPreview::sltPreviewSizeHintChanged() 142 159 { … … 202 219 } 203 220 204 void UIDetailsElementPreview::updateLayout()205 {206 /* Call to base-class: */207 UIDetailsElement::updateLayout();208 209 /* Show/hide preview: */210 if (isClosed() && m_pPreview->isVisible())211 m_pPreview->hide();212 if (isOpened() && !m_pPreview->isVisible() && !isAnimationRunning())213 m_pPreview->show();214 215 /* And update preview layout itself: */216 const int iMargin = data(ElementData_Margin).toInt();217 m_pPreview->setPos(iMargin, 2 * iMargin + minimumHeaderHeight());218 m_pPreview->resize(m_pPreview->minimumSizeHint());219 }220 221 221 void UIDetailsElementPreview::updateAppearance() 222 222 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElements.h
r83719 r89101 91 91 UIDetailsElementPreview(UIDetailsSet *pParent, bool fOpened); 92 92 93 /** Updates layout. */ 94 virtual void updateLayout() /* override */; 95 93 96 private slots: 94 97 … … 107 110 * be calculated for the closed element. */ 108 111 int minimumHeightHintForElement(bool fClosed) const; 109 /** Updates layout. */110 void updateLayout();111 112 112 113 /** Updates appearance. */
Note:
See TracChangeset
for help on using the changeset viewer.