VirtualBox

Changeset 68521 in vbox for trunk


Ignore:
Timestamp:
Aug 24, 2017 10:51:02 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8900: UITabBar: A bit of look&feel changes for Windows/Linux hosts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.cpp

    r68481 r68521  
    301301
    302302    /* Paint: */
    303     painter.fillRect(QRect(iMetric,           iMetric,            width() - iMetric * 2, height() - iMetric * 2), color0);
     303    painter.fillRect(QRect(iMetric, iMetric, width() - iMetric * 2, height() - iMetric * 2), color0);
    304304
    305305    if (m_enmPosition == PositionStyle_Left || m_enmPosition == PositionStyle_Single)
     
    345345    /* Prepare palette colors: */
    346346    const QPalette pal = palette();
    347     const QColor color0 = m_fCurrent ? pal.color(QPalette::Highlight).lighter(150)
    348                         : m_fHovered ? pal.color(QPalette::Highlight).lighter(170)
    349                         :              pal.color(QPalette::Window);
    350     QColor color1 = pal.color(QPalette::Window).lighter(110);
     347    const QColor color0 = m_fCurrent ? pal.color(QPalette::Base)
     348                        : m_fHovered ? pal.color(QPalette::Base).darker(102)
     349                        :              pal.color(QPalette::Button).darker(102);
     350    QColor color1 = color0;
    351351    color1.setAlpha(0);
    352     QColor color2 = pal.color(QPalette::Window).darker(200);
     352    QColor color2 = pal.color(QPalette::Shadow);
    353353
    354354    /* Invent pixel metric: */
    355     const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;
     355    const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    356356
    357357    /* Top-left corner: */
    358358    QRadialGradient grad1(QPointF(iMetric, iMetric), iMetric);
    359359    {
    360         grad1.setColorAt(0, color2);
     360        grad1.setColorAt(0, color0);
     361        grad1.setColorAt(.6, color1);
     362        grad1.setColorAt(.8, color2);
    361363        grad1.setColorAt(1, color1);
    362364    }
     365    /* Bottom-left corner: */
     366    QRadialGradient grad2(QPointF(iMetric, height() - iMetric), iMetric);
     367    {
     368        grad2.setColorAt(0, color0);
     369        grad2.setColorAt(.6, color1);
     370        grad2.setColorAt(.8, color2);
     371        grad2.setColorAt(1, color1);
     372    }
    363373    /* Top-right corner: */
    364     QRadialGradient grad2(QPointF(width() - iMetric, iMetric), iMetric);
    365     {
    366         grad2.setColorAt(0, color2);
    367         grad2.setColorAt(1, color1);
    368     }
    369     /* Bottom-left corner: */
    370     QRadialGradient grad3(QPointF(iMetric, height() - iMetric), iMetric);
    371     {
    372         grad3.setColorAt(0, color2);
     374    QRadialGradient grad3(QPointF(width() - iMetric, iMetric), iMetric);
     375    {
     376        grad3.setColorAt(0, color0);
     377        grad3.setColorAt(.6, color1);
     378        grad3.setColorAt(.8, color2);
    373379        grad3.setColorAt(1, color1);
    374380    }
     
    376382    QRadialGradient grad4(QPointF(width() - iMetric, height() - iMetric), iMetric);
    377383    {
    378         grad4.setColorAt(0, color2);
     384        grad4.setColorAt(0, color0);
     385        grad4.setColorAt(.6, color1);
     386        grad4.setColorAt(.8, color2);
    379387        grad4.setColorAt(1, color1);
    380388    }
    381389
     390    /* Left line: */
     391    QLinearGradient grad5(QPointF(0, height() - iMetric), QPointF(iMetric, height() - iMetric));
     392    {
     393        grad5.setColorAt(0, color1);
     394        grad5.setColorAt(.2, color2);
     395        grad5.setColorAt(.4, color1);
     396        grad5.setColorAt(1, color0);
     397    }
     398    /* Right line: */
     399    QLinearGradient grad6(QPointF(width(), height() - iMetric), QPointF(width() - iMetric, height() - iMetric));
     400    {
     401        grad6.setColorAt(0, color1);
     402        grad6.setColorAt(.2, color2);
     403        grad6.setColorAt(.4, color1);
     404        grad6.setColorAt(1, color0);
     405    }
    382406    /* Top line: */
    383     QLinearGradient grad5(QPointF(iMetric, 0), QPointF(iMetric, iMetric));
    384     {
    385         grad5.setColorAt(0, color1);
    386         grad5.setColorAt(1, color2);
     407    QLinearGradient grad7(QPointF(iMetric, 0), QPointF(iMetric, iMetric));
     408    {
     409        grad7.setColorAt(0, color1);
     410        grad7.setColorAt(.2, color2);
     411        grad7.setColorAt(.4, color1);
     412        grad7.setColorAt(1, color0);
    387413    }
    388414    /* Bottom line: */
    389     QLinearGradient grad6(QPointF(iMetric, height()), QPointF(iMetric, height() - iMetric));
    390     {
    391         grad6.setColorAt(0, color1);
    392         grad6.setColorAt(1, color2);
    393     }
    394     /* Left line: */
    395     QLinearGradient grad7(QPointF(0, height() - iMetric), QPointF(iMetric, height() - iMetric));
    396     {
    397         grad7.setColorAt(0, color1);
    398         grad7.setColorAt(1, color2);
    399     }
    400     /* Right line: */
    401     QLinearGradient grad8(QPointF(width(), height() - iMetric), QPointF(width() - iMetric, height() - iMetric));
     415    QLinearGradient grad8(QPointF(iMetric, height()), QPointF(iMetric, height() - iMetric));
    402416    {
    403417        grad8.setColorAt(0, color1);
    404         grad8.setColorAt(1, color2);
    405     }
    406 
    407     /* Paint shape/shadow: */
    408     painter.fillRect(QRect(iMetric,           iMetric,            width() - iMetric * 2, height() - iMetric * 2), color0);
    409     painter.fillRect(QRect(0,                 0,                  iMetric,               iMetric),                grad1);
    410     painter.fillRect(QRect(width() - iMetric, 0,                  iMetric,               iMetric),                grad2);
    411     painter.fillRect(QRect(0,                 height() - iMetric, iMetric,               iMetric),                grad3);
    412     painter.fillRect(QRect(width() - iMetric, height() - iMetric, iMetric,               iMetric),                grad4);
    413     painter.fillRect(QRect(iMetric,           0,                  width() - iMetric * 2, iMetric),                grad5);
    414     painter.fillRect(QRect(iMetric,           height() - iMetric, width() - iMetric * 2, iMetric),                grad6);
    415     painter.fillRect(QRect(0,                 iMetric,            iMetric,               height() - iMetric * 2), grad7);
    416     painter.fillRect(QRect(width() - iMetric, iMetric,            iMetric,               height() - iMetric * 2), grad8);
     418        grad8.setColorAt(.2, color2);
     419        grad8.setColorAt(.4, color1);
     420        grad8.setColorAt(1, color0);
     421    }
     422
     423    /* Paint: */
     424    painter.fillRect(QRect(iMetric, iMetric, width() - iMetric * 2, height() - iMetric * 2), color0);
     425
     426    if (m_enmPosition == PositionStyle_Left || m_enmPosition == PositionStyle_Single)
     427    {
     428        painter.fillRect(QRect(0,                  0,                  iMetric,            iMetric),           grad1);
     429        painter.fillRect(QRect(0,                  height() - iMetric, iMetric,            iMetric),           grad2);
     430    }
     431    if (m_enmPosition == PositionStyle_Right || m_enmPosition == PositionStyle_Single)
     432    {
     433        painter.fillRect(QRect(width() - iMetric,  0,                  iMetric,            iMetric),           grad3);
     434        painter.fillRect(QRect(width() - iMetric,  height() - iMetric, iMetric,            iMetric),           grad4);
     435    }
     436
     437    int iX = 0;
     438    int iYL = 0;
     439    int iYR = 0;
     440    int iWid = width();
     441    int iHeiL = height();
     442    int iHeiR = height();
     443    if (m_enmPosition == PositionStyle_Left || m_enmPosition == PositionStyle_Single)
     444    {
     445        iX = iMetric;
     446        iYL = iMetric;
     447        iWid -= iMetric;
     448        iHeiL -= iMetric * 2;
     449    }
     450    if (m_enmPosition == PositionStyle_Right || m_enmPosition == PositionStyle_Single)
     451    {
     452        iYR = iMetric;
     453        iWid -= iMetric;
     454        iHeiR -= iMetric * 2;
     455    }
     456
     457    QPainterPath path5;
     458    path5.moveTo(0, 0);
     459    path5.lineTo(iMetric, iMetric);
     460    path5.lineTo(iMetric, height() - iMetric);
     461    path5.lineTo(0, height());
     462    path5.closeSubpath();
     463    painter.setClipPath(path5);
     464    painter.fillRect(QRect(0,                  iYL,                iMetric,            iHeiL),             grad5);
     465    painter.setClipping(false);
     466
     467    QPainterPath path6;
     468    path6.moveTo(width(), 0);
     469    path6.lineTo(width() - iMetric, iMetric);
     470    path6.lineTo(width() - iMetric, height() - iMetric);
     471    path6.lineTo(width(), height());
     472    path6.closeSubpath();
     473    painter.setClipPath(path6);
     474    painter.fillRect(QRect(width() - iMetric,  iYR,                iMetric,            iHeiR),             grad6);
     475    painter.setClipping(false);
     476
     477    QPainterPath path7;
     478    path7.moveTo(0, 0);
     479    path7.lineTo(iMetric, iMetric);
     480    path7.lineTo(width() - iMetric, iMetric);
     481    path7.lineTo(width(), 0);
     482    path7.closeSubpath();
     483    painter.setClipPath(path7);
     484    painter.fillRect(QRect(iX,                 0,                  iWid,               iMetric),           grad7);
     485    painter.setClipping(false);
     486
     487    QPainterPath path8;
     488    path8.moveTo(0, height());
     489    path8.lineTo(iMetric, height() - iMetric);
     490    path8.lineTo(width() - iMetric, height() - iMetric);
     491    path8.lineTo(width(), height());
     492    path8.closeSubpath();
     493    painter.setClipPath(path8);
     494    painter.fillRect(QRect(iX,                 height() - iMetric, iWid,               iMetric),           grad8);
     495    painter.setClipping(false);
    417496
    418497#endif /* !VBOX_WS_MAC */
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