Changeset 68208 in vbox
- Timestamp:
- Jul 31, 2017 3:06:46 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 117307
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.cpp
r68206 r68208 27 27 # include <QPainter> 28 28 # include <QStyle> 29 # include <QToolButton> 29 30 30 31 /* GUI includes: */ 31 # include "QIToolButton.h"32 32 # include "UIIconPool.h" 33 33 # include "UITabBar.h" … … 43 43 class QLabel; 44 44 class QStyle; 45 class QToolButton; 45 46 46 47 … … 104 105 105 106 /** Holds the main layout instance. */ 106 QHBoxLayout *m_pLayout; 107 QHBoxLayout *m_pLayout; 108 107 109 /** Holds the icon label instance. */ 108 QLabel 110 QLabel *m_pLabelIcon; 109 111 /** Holds the name label instance. */ 110 QLabel 112 QLabel *m_pLabelName; 111 113 /** Holds the close button instance. */ 112 Q IToolButton *m_pButtonClose;114 QToolButton *m_pButtonClose; 113 115 }; 114 116 … … 147 149 { 148 150 /* Update the hovered state on/off: */ 149 case QEvent::Enter: m_fHovered = true; update(); break; 150 case QEvent::Leave: m_fHovered = false; update(); break; 151 case QEvent::Enter: 152 { 153 m_fHovered = true; 154 update(); 155 break; 156 } 157 case QEvent::Leave: 158 { 159 m_fHovered = false; 160 update(); 161 break; 162 } 151 163 152 164 /* Notify listeners about the item was clicked: */ 153 case QEvent::MouseButtonRelease: emit sigClicked(this); break; 165 case QEvent::MouseButtonRelease: 166 { 167 emit sigClicked(this); 168 break; 169 } 154 170 155 171 default: break; … … 240 256 void UITabBarItem::prepare() 241 257 { 258 /* Configure self: */ 259 setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum); 260 242 261 /* Create main layout: */ 243 262 m_pLayout = new QHBoxLayout(this); … … 260 279 /* Configure label: */ 261 280 m_pLabelIcon->setPixmap(m_icon.pixmap(iMetric)); 262 263 /* Add into layout: */264 m_pLayout->addWidget(m_pLabelIcon);265 281 } 266 282 … … 271 287 /* Configure label: */ 272 288 m_pLabelName->setText(m_strName); 273 274 /* Add into layout: */275 m_pLayout->addWidget(m_pLabelName);276 289 } 277 290 278 291 /* Create close button: */ 279 m_pButtonClose = new Q IToolButton;292 m_pButtonClose = new QToolButton; 280 293 AssertPtrReturnVoid(m_pButtonClose); 281 294 { 282 295 /* Configure button: */ 296 m_pButtonClose->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 283 297 m_pButtonClose->setIconSize(QSize(iMetricCloseButton, iMetricCloseButton)); 284 298 m_pButtonClose->setIcon(UIIconPool::iconSet(":/close_16px.png")); 285 connect(m_pButtonClose, &QIToolButton::clicked, this, &UITabBarItem::sltCloseClicked); 286 287 /* Add into layout: */ 288 m_pLayout->addWidget(m_pButtonClose); 289 } 299 m_pButtonClose->setStyleSheet("QToolButton { border: 0px }"); 300 connect(m_pButtonClose, &QToolButton::clicked, this, &UITabBarItem::sltCloseClicked); 301 } 302 303 /* Add everything into main-layout: */ 304 m_pLayout->addWidget(m_pLabelIcon); 305 m_pLayout->addWidget(m_pLabelName); 306 m_pLayout->addWidget(m_pButtonClose); 290 307 } 291 308 }
Note:
See TracChangeset
for help on using the changeset viewer.