VirtualBox

Changeset 102704 in vbox


Ignore:
Timestamp:
Dec 26, 2023 3:18:43 PM (9 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10513: UIAdvancedSettingsDialog: A bit of painting fixes for UIModeCheckBox; Adjust position, paint frame, optimize clipping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.cpp

    r102697 r102704  
    293293void UIModeCheckBox::paintEvent(QPaintEvent *pEvent)
    294294{
     295    /* Prepare painter: */
     296    QPainter painter(this);
     297    painter.setRenderHint(QPainter::Antialiasing);
     298    painter.setRenderHint(QPainter::TextAntialiasing);
     299    /* Avoid painting more than necessary: */
     300    painter.setClipRect(pEvent->rect());
     301
    295302    /* Acquire useful properties: */
    296     const QPalette pal = QGuiApplication::palette();
    297     QRect contentRect = pEvent->rect();
     303    const QPalette pal = qApp->palette();
     304    QRect contentRect = rect();
    298305#ifdef VBOX_WS_MAC
    299306    contentRect.setLeft(contentRect.left() + 2); /// @todo justify!
     
    301308#endif
    302309
    303     /* Prepare painter: */
    304     QPainter painter(this);
    305 
    306310    /* Prepare left painter paths: */
    307311    QPainterPath painterPath1;
    308     painterPath1.lineTo(contentRect.width() / 2 - 1,                    0);
     312    painterPath1.moveTo(contentRect.x(),                                contentRect.y());
     313    painterPath1.lineTo(contentRect.width() / 2,                        contentRect.y());
    309314    painterPath1.lineTo(contentRect.width() / 2 - contentRect.height(), contentRect.height());
    310     painterPath1.lineTo(0,                                              contentRect.height());
     315    painterPath1.lineTo(contentRect.x(),                                contentRect.height());
    311316    painterPath1.closeSubpath();
    312317
    313318    /* Prepare right painter paths: */
    314319    QPainterPath painterPath2;
    315     painterPath2.moveTo(contentRect.width() / 2 + 1,                        0);
    316     painterPath2.lineTo(contentRect.width(),                                0);
     320    painterPath2.moveTo(contentRect.width() / 2 + 1,                        contentRect.y());
     321    painterPath2.lineTo(contentRect.width(),                                contentRect.y());
    317322    painterPath2.lineTo(contentRect.width() - contentRect.height(),         contentRect.height());
    318323    painterPath2.lineTo(contentRect.width() / 2 + 1 - contentRect.height(), contentRect.height());
     
    337342    /* Paint fancy shape: */
    338343    painter.save();
    339     painter.setClipPath(painterPath1);
    340     painter.fillRect(contentRect, grad1);
    341     painter.setClipPath(painterPath2);
    342     painter.fillRect(contentRect, grad2);
     344    painter.fillPath(painterPath1, grad1);
     345    painter.strokePath(painterPath1, backColor1.darker(110));
     346    painter.fillPath(painterPath2, grad2);
     347    painter.strokePath(painterPath2, backColor2.darker(110));
    343348    painter.restore();
    344349
     
    555560    QFontMetrics fm(m_pLineEdit->font());
    556561    const int iPlaceholderWidth = fm.horizontalAdvance(m_pLineEdit->placeholderText())
    557                                 + 2 * 2 /* left/right panel/frame width, no pixelMetric */
     562                                + 2 * 5 /* left/right panel/frame width, no pixelMetric */
    558563                                + 10 /* left margin, assigned via setStyleSheet */;
    559564    /* Acquire filter editor size-hint: */
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