Changeset 72824 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 3, 2018 2:33:58 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123369
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIDesktopPane.cpp
r69726 r72824 131 131 void prepare(); 132 132 133 /** Updates pixmap. */ 134 void updatePixmap(); 135 133 136 /** Holds the action reference. */ 134 137 QAction *m_pAction; … … 180 183 protected: 181 184 185 /** Handles any Qt @a pEvent. */ 186 virtual bool event(QEvent *pEvent) /* override */; 187 182 188 /** Handles translation event. */ 183 189 void retranslateUi(); … … 188 194 /** Prepares tools pane. */ 189 195 void prepareToolsPane(); 196 197 /** Updates pixmap. */ 198 void updatePixmap(); 190 199 191 200 private: … … 212 221 /** Holds the tools pane icon label instance. */ 213 222 QLabel *m_pLabelToolsPaneIcon; 223 224 /** Holds the tools pane icon instance. */ 225 QIcon m_icon; 214 226 }; 215 227 … … 308 320 switch (pEvent->type()) 309 321 { 322 case QEvent::Show: 323 case QEvent::ScreenChangeInternal: 324 { 325 /* Update pixmap: */ 326 updatePixmap(); 327 break; 328 } 329 310 330 /* Update the hovered state on/off: */ 311 331 case QEvent::Enter: … … 493 513 /* Configure label: */ 494 514 m_pLabelIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 495 m_pLabelIcon->setPixmap(m_pAction->icon().pixmap(iMetric));496 515 497 516 /* Add into layout: */ … … 500 519 } 501 520 } 521 522 /* Update pixmap: */ 523 updatePixmap(); 524 } 525 526 void UIToolWidget::updatePixmap() 527 { 528 const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) * 1.375; 529 m_pLabelIcon->setPixmap(m_pAction->icon().pixmap(window()->windowHandle(), QSize(iMetric, iMetric))); 502 530 } 503 531 … … 546 574 prepareToolsPane(); 547 575 548 /* Assign corresponding icon: */ 549 const QList<QSize> aSizes = icon.availableSizes(); 550 const QSize firstOne = aSizes.isEmpty() ? QSize(200, 200) : aSizes.first(); 551 const double dRatio = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize) / 32; 552 m_pLabelToolsPaneIcon->setPixmap(icon.pixmap(QSize(firstOne.width() * dRatio, firstOne.height() * dRatio))); 576 /* Save icon: */ 577 m_icon = icon; 578 /* Update pixmap: */ 579 updatePixmap(); 553 580 554 581 /* Raise corresponding widget: */ … … 585 612 delete pChild; 586 613 } 614 } 615 616 bool UIDesktopPanePrivate::event(QEvent *pEvent) 617 { 618 /* Handle know event types: */ 619 switch (pEvent->type()) 620 { 621 case QEvent::Show: 622 case QEvent::ScreenChangeInternal: 623 { 624 /* Update pixmap: */ 625 updatePixmap(); 626 break; 627 } 628 default: 629 break; 630 } 631 632 /* Call to base-class: */ 633 return QIWithRetranslateUI<QStackedWidget>::event(pEvent); 587 634 } 588 635 … … 743 790 } 744 791 792 void UIDesktopPanePrivate::updatePixmap() 793 { 794 /* Assign corresponding icon: */ 795 const QList<QSize> aSizes = m_icon.availableSizes(); 796 const QSize firstOne = aSizes.isEmpty() ? QSize(200, 200) : aSizes.first(); 797 const double dRatio = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize) / 32; 798 m_pLabelToolsPaneIcon->setPixmap(m_icon.pixmap(window()->windowHandle(), QSize(firstOne.width() * dRatio, firstOne.height() * dRatio))); 799 } 800 745 801 746 802 /*********************************************************************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.