Changeset 72715 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jun 28, 2018 10:21:28 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123249
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.cpp
r69260 r72715 104 104 protected: 105 105 106 /** Handles any Qt @a pEvent. */ 107 virtual bool event(QEvent *pEvent) /* override */; 108 106 109 /** Handles translation event. */ 107 110 virtual void retranslateUi() /* override */; … … 130 133 /** Prepares all. */ 131 134 void prepare(); 135 /** Update pixmap. */ 136 void updatePixmap(); 132 137 133 138 /** Holds the item ID. */ … … 212 217 /* And call for repaint: */ 213 218 update(); 219 } 220 221 bool UITabBarItem::event(QEvent *pEvent) 222 { 223 /* Handle know event types: */ 224 switch (pEvent->type()) 225 { 226 case QEvent::Show: 227 case QEvent::ScreenChangeInternal: 228 { 229 /* Update pixmap: */ 230 updatePixmap(); 231 break; 232 } 233 default: 234 break; 235 } 236 237 /* Call to base-class: */ 238 return QIWithRetranslateUI<QWidget>::event(pEvent); 214 239 } 215 240 … … 552 577 pDrag->setMimeData(pMimeData); 553 578 const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); 554 pDrag->setPixmap(m_pAction->icon().pixmap( iMetric, iMetric));579 pDrag->setPixmap(m_pAction->icon().pixmap(window()->windowHandle(), QSize(iMetric, iMetric))); 555 580 pDrag->exec(); 556 581 } … … 593 618 /* Create main layout: */ 594 619 m_pLayout = new QHBoxLayout(this); 595 AssertPtrReturnVoid(m_pLayout);620 if (m_pLayout) 596 621 { 597 622 /* Invent pixel metric: */ … … 619 644 /* Create icon label: */ 620 645 m_pLabelIcon = new QLabel; 621 AssertPtrReturnVoid(m_pLabelIcon);646 if (m_pLabelIcon) 622 647 { 623 648 /* Configure label: */ 624 649 m_pLabelIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 625 m_pLabelIcon->setPixmap(m_pAction->icon().pixmap(iMetric));626 650 } 627 651 628 652 /* Create name label: */ 629 653 m_pLabelName = new QLabel; 630 AssertPtrReturnVoid(m_pLabelName);654 if (m_pLabelName) 631 655 { 632 656 /* Configure label: */ … … 636 660 /* Create close button: */ 637 661 m_pButtonClose = new QToolButton; 638 AssertPtrReturnVoid(m_pButtonClose);662 if (m_pButtonClose) 639 663 { 640 664 /* Configure button: */ … … 653 677 /* Create stacked-layout: */ 654 678 m_pLayoutStacked = new QStackedLayout(m_pLayout); 679 if (m_pLayoutStacked) 655 680 { 656 681 m_pLayoutStacked->setAlignment(Qt::AlignCenter); … … 676 701 } 677 702 703 /* Update pixmap: */ 704 updatePixmap(); 705 678 706 /* Apply language settings: */ 679 707 retranslateUi(); 708 } 709 710 void UITabBarItem::updatePixmap() 711 { 712 /* Configure label icon: */ 713 const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); 714 m_pLabelIcon->setPixmap(m_pAction->icon().pixmap(window()->windowHandle(), QSize(iMetric, iMetric))); 680 715 } 681 716
Note:
See TracChangeset
for help on using the changeset viewer.