VirtualBox

Ignore:
Timestamp:
Dec 27, 2023 10:08:20 AM (12 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10513: UIAdvancedSettingsDialog: Separate method in UIFilterEditor to prepare painter path for the rect specified.

File:
1 edited

Legend:

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

    r102707 r102708  
    176176    void cleanup();
    177177
     178    /** Returns painter path for the passed @a pathRect. */
     179    QPainterPath cookPainterPath(const QRect &pathRect);
     180
    178181    /** Adjusts editor geometry. */
    179182    void adjustEditorGeometry();
     
    469472    /* Prepare base/frame painter path: */
    470473    const QRegion totalRegion = QRegion(m_pLineEdit->geometry()) + QRegion(m_pToolButton->geometry());
    471     const QRect widgetRect = totalRegion.boundingRect();
    472     const QSizeF arcSize(2 * m_iRadius, 2 * m_iRadius);
    473     QPainterPath path;
    474     path.moveTo(widgetRect.x() + m_iRadius, widgetRect.y());
    475     path.arcTo(QRectF(path.currentPosition(), arcSize).translated(-m_iRadius, 0), 90, 90);
    476     path.lineTo(path.currentPosition().x(), path.currentPosition().y() + widgetRect.height() - 2 * m_iRadius);
    477     path.arcTo(QRectF(path.currentPosition(), arcSize).translated(0, -m_iRadius), 180, 90);
    478     path.lineTo(path.currentPosition().x() + widgetRect.width() - 2 * m_iRadius, path.currentPosition().y());
    479     path.arcTo(QRectF(path.currentPosition(), arcSize).translated(-m_iRadius, -2 * m_iRadius), 270, 90);
    480     path.lineTo(path.currentPosition().x(), path.currentPosition().y() - widgetRect.height() + 2 * m_iRadius);
    481     path.arcTo(QRectF(path.currentPosition(), arcSize).translated(-2 * m_iRadius, -m_iRadius), 0, 90);
    482     path.closeSubpath();
     474    QRect widgetRect = totalRegion.boundingRect();
     475    const QPainterPath widgetPath = cookPainterPath(widgetRect);
    483476
    484477    /* Draw base/frame: */
    485     painter.fillPath(path, colorBase);
    486     painter.strokePath(path, colorFrame);
     478    painter.fillPath(widgetPath, colorBase);
     479    painter.strokePath(widgetPath, colorFrame);
    487480}
    488481
     
    551544    delete m_pAnimation;
    552545    m_pAnimation = 0;
     546}
     547
     548QPainterPath UIFilterEditor::cookPainterPath(const QRect &pathRect)
     549{
     550    QPainterPath path;
     551    const QSizeF arcSize(2 * m_iRadius, 2 * m_iRadius);
     552    path.moveTo(pathRect.x() + m_iRadius, pathRect.y());
     553    path.arcTo(QRectF(path.currentPosition(), arcSize).translated(-m_iRadius, 0), 90, 90);
     554    path.lineTo(path.currentPosition().x(), path.currentPosition().y() + pathRect.height() - 2 * m_iRadius);
     555    path.arcTo(QRectF(path.currentPosition(), arcSize).translated(0, -m_iRadius), 180, 90);
     556    path.lineTo(path.currentPosition().x() + pathRect.width() - 2 * m_iRadius, path.currentPosition().y());
     557    path.arcTo(QRectF(path.currentPosition(), arcSize).translated(-m_iRadius, -2 * m_iRadius), 270, 90);
     558    path.lineTo(path.currentPosition().x(), path.currentPosition().y() - pathRect.height() + 2 * m_iRadius);
     559    path.arcTo(QRectF(path.currentPosition(), arcSize).translated(-2 * m_iRadius, -m_iRadius), 0, 90);
     560    path.closeSubpath();
     561    return path;
    553562}
    554563
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