Changeset 68209 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 31, 2017 3:11:13 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.cpp
r68208 r68209 26 26 # include <QLabel> 27 27 # include <QPainter> 28 # ifdef VBOX_WS_MAC 29 # include <QStackedLayout> 30 # endif 28 31 # include <QStyle> 29 32 # include <QToolButton> … … 42 45 class QHBoxLayout; 43 46 class QLabel; 47 #ifdef VBOX_WS_MAC 48 class QStackedLayout; 49 #endif 44 50 class QStyle; 45 51 class QToolButton; … … 105 111 106 112 /** Holds the main layout instance. */ 107 QHBoxLayout *m_pLayout; 113 QHBoxLayout *m_pLayout; 114 #ifdef VBOX_WS_MAC 115 /** Holds the stacked layout instance. */ 116 QStackedLayout *m_pLayoutStacked; 117 #endif 108 118 109 119 /** Holds the icon label instance. */ … … 127 137 , m_fHovered(false) 128 138 , m_pLayout(0) 139 #ifdef VBOX_WS_MAC 140 , m_pLayoutStacked(0) 141 #endif 129 142 , m_pLabelIcon(0) 130 143 , m_pLabelName(0) … … 151 164 case QEvent::Enter: 152 165 { 166 #ifdef VBOX_WS_MAC 167 m_pLayoutStacked->setCurrentWidget(m_pButtonClose); 168 #endif 153 169 m_fHovered = true; 154 170 update(); … … 157 173 case QEvent::Leave: 158 174 { 175 #ifdef VBOX_WS_MAC 176 m_pLayoutStacked->setCurrentWidget(m_pLabelIcon); 177 #endif 159 178 m_fHovered = false; 160 179 update(); … … 267 286 const int iMargin = iMetric / 2; 268 287 const int iSpacing = iMargin / 2; 288 #ifdef VBOX_WS_MAC 289 const int iMetricCloseButton = iMetric * 3 / 4; 290 #else 269 291 const int iMetricCloseButton = iMetric * 2 / 3; 292 #endif 270 293 271 294 /* Configure layout: */ 295 #ifdef VBOX_WS_MAC 296 m_pLayout->setContentsMargins(iMargin + iSpacing, 0, iMargin + iSpacing, 0); 297 #else 272 298 m_pLayout->setContentsMargins(iMargin + iSpacing, 0, iMargin, 0); 299 #endif 273 300 m_pLayout->setSpacing(iSpacing); 274 301 … … 301 328 } 302 329 330 #ifdef VBOX_WS_MAC 331 /* Create stacked-layout: */ 332 m_pLayoutStacked = new QStackedLayout(m_pLayout); 333 { 334 m_pLayoutStacked->setAlignment(Qt::AlignCenter); 335 336 /* Add icon-label and close-button into stacked-layout: */ 337 m_pLayoutStacked->addWidget(m_pLabelIcon); 338 m_pLayoutStacked->addWidget(m_pButtonClose); 339 m_pLayoutStacked->setAlignment(m_pLabelIcon, Qt::AlignCenter); 340 m_pLayoutStacked->setAlignment(m_pButtonClose, Qt::AlignCenter); 341 342 /* Add stacked-layout into main-layout: */ 343 m_pLayout->addLayout(m_pLayoutStacked); 344 } 345 346 /* Add name-label into main-layout: */ 347 m_pLayout->addWidget(m_pLabelName); 348 #else /* !VBOX_WS_MAC */ 303 349 /* Add everything into main-layout: */ 304 350 m_pLayout->addWidget(m_pLabelIcon); 305 351 m_pLayout->addWidget(m_pLabelName); 306 352 m_pLayout->addWidget(m_pButtonClose); 353 #endif /* !VBOX_WS_MAC */ 307 354 } 308 355 }
Note:
See TracChangeset
for help on using the changeset viewer.