Changeset 106245 in vbox
- Timestamp:
- Oct 8, 2024 5:24:14 PM (7 weeks ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.cpp
r106244 r106245 989 989 switch (pEvent->type()) 990 990 { 991 /* Only enabled-change events useful for us: */991 /* Only enabled-change and resize events useful for us: */ 992 992 case QEvent::EnabledChange: 993 case QEvent::Resize: 993 994 { 994 995 /* Start (or restart) corresponding timer: */ … … 1644 1645 font.setItalic(!pWidget->isEnabledTo(0)); 1645 1646 pWidget->setFont(font); 1647 1648 /* If widget is disabled and non of his parents have mask assigned: */ 1649 if (!pWidget->isEnabledTo(0) && !isOneOfWidgetParentsHasMask(pWidget)) 1650 { 1651 /* Compose striped mask using tricky QImage=>QBitmap conversion: */ 1652 QImage img(pWidget->width(), pWidget->height(), QImage::Format_Mono); 1653 for (int j = 0; j < img.height(); ++j) 1654 for (int i = 0; i < img.width(); ++i) 1655 img.setPixel(i, j, (i+j) % 10 == 0 ? 1 : 0); 1656 /* Adjust mask to be striped for disabled widget: */ 1657 pWidget->setMask(QBitmap::fromImage(img, Qt::MonoOnly)); 1658 } 1659 else 1660 { 1661 /* Disable mask for good: */ 1662 pWidget->clearMask(); 1663 } 1664 pWidget->update(); 1665 } 1666 1667 /* static */ 1668 bool UIAdvancedSettingsDialog::isOneOfWidgetParentsHasMask(QWidget *pWidget) 1669 { 1670 AssertPtrReturn(pWidget, false); 1671 if (QWidget *pParent = pWidget->parentWidget()) 1672 return !pParent->mask().isNull() || isOneOfWidgetParentsHasMask(pParent); 1673 return false; 1646 1674 } 1647 1675 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.h
r106244 r106245 237 237 * @param pWidget Brings the widget to adjust look&feel for. */ 238 238 static void adjustLookAndFeelForDisabledWidget(QWidget *pWidget); 239 /** Returns whether one of @a pWidget parents in hierarchy has mask assigned. */ 240 static bool isOneOfWidgetParentsHasMask(QWidget *pWidget); 239 241 240 242 /** Holds configuration access level. */
Note:
See TracChangeset
for help on using the changeset viewer.