VirtualBox

Changeset 73990 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Aug 31, 2018 9:55:26 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: VirtualBox Manager UI: Chooser pane re-styling: Machine item: Larger margin, shade background, frame for all cases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp

    r73989 r73990  
    618618    {
    619619        /* Layout hints: */
    620         case MachineItemData_Margin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;
     620        case MachineItemData_Margin:       return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 3 * 2;
    621621        case MachineItemData_MajorSpacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    622622        case MachineItemData_MinorSpacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;
    623         case MachineItemData_TextSpacing: return 0;
     623        case MachineItemData_TextSpacing:  return 0;
    624624
    625625        /* Pixmaps: */
     
    926926        bgGrad.setColorAt(0, highlight.lighter(m_iHoverLightnessMax));
    927927        bgGrad.setColorAt(1, highlight.lighter(m_iHoverLightnessMin));
     928        pPainter->fillRect(rect, bgGrad);
     929    }
     930    /* Default background: */
     931    else
     932    {
     933        /* Prepare color: */
     934        QColor usual = pal.color(QPalette::Active, QPalette::Mid);
     935        /* Draw gradient: */
     936        QLinearGradient bgGrad(rect.topLeft(), rect.bottomLeft());
     937        bgGrad.setColorAt(0, usual.lighter(m_iHoverLightnessMax));
     938        bgGrad.setColorAt(1, usual.lighter(m_iHoverLightnessMin));
    928939        pPainter->fillRect(rect, bgGrad);
    929940    }
     
    960971void UIChooserItemMachine::paintFrameRectangle(QPainter *pPainter, const QRect &rect)
    961972{
    962     /* Only chosen and/or hovered item should have a frame: */
    963     if (!model()->currentItems().contains(this) && !isHovered())
    964         return;
    965 
    966973    /* Simple frame: */
    967974    pPainter->save();
    968975    QPalette pal = palette();
    969     QColor strokeColor = pal.color(QPalette::Active,
    970                                    model()->currentItems().contains(this) ?
    971                                    QPalette::Mid : QPalette::Highlight);
     976    QColor strokeColor;
     977
     978    /* Selection frame: */
     979    if (model()->currentItems().contains(this))
     980        strokeColor = pal.color(QPalette::Active, QPalette::Mid).darker(110);
     981    /* Default frame: */
     982    else
     983        strokeColor = pal.color(QPalette::Active, QPalette::Midlight).darker(110);
     984
    972985    pPainter->setPen(strokeColor);
    973986    pPainter->drawRect(rect);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette