VirtualBox

Ignore:
Timestamp:
Jan 17, 2024 1:32:37 PM (11 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10513: VM settings / Storage page: Simplifying StorageDelegate painting procedure to be more abstract; This is necessary to work with proxy/filter model without changes.

File:
1 edited

Legend:

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

    r102922 r102923  
    27812781{
    27822782    /* Sanity check: */
    2783     if (!index.isValid())
    2784         return;
     2783    AssertReturnVoid(index.isValid());
    27852784
    27862785    /* Acquire model: */
    2787     const StorageModel *pModel = qobject_cast<const StorageModel*>(index.model());
     2786    const QAbstractItemModel *pModel = index.model();
    27882787    AssertPtrReturnVoid(pModel);
    27892788
     
    27992798    /* Setup foreground settings: */
    28002799    QPalette::ColorGroup cg = enmState & QStyle::State_Active ? QPalette::Active : QPalette::Inactive;
    2801     bool fSelected = enmState & QStyle::State_Selected;
    2802     bool fFocused = enmState & QStyle::State_HasFocus;
    2803     bool fGrayOnLoosingFocus = QApplication::style()->styleHint(QStyle::SH_ItemView_ChangeHighlightOnFocus, &option) != 0;
     2800    const bool fSelected = enmState & QStyle::State_Selected;
     2801    const bool fFocused = enmState & QStyle::State_HasFocus;
     2802    const bool fGrayOnLoosingFocus = QApplication::style()->styleHint(QStyle::SH_ItemView_ChangeHighlightOnFocus, &option) != 0;
    28042803    pPainter->setPen(option.palette.color(cg, fSelected &&(fFocused || !fGrayOnLoosingFocus) ?
    28052804                                          QPalette::HighlightedText : QPalette::Text));
     
    28072806    pPainter->translate(rect.x(), rect.y());
    28082807
    2809     /* Draw Item Pixmap: */
     2808    /* Draw item pixmap: */
    28102809    const bool fHasChildren = enmState & QStyle::State_Children;
    28112810    const bool fOpened = enmState & QStyle::State_Open;
     
    28452844    pPainter->drawText(textPosition, strShortText);
    28462845
    2847     /* Draw Controller Additions: */
     2846    /* Draw controller additions: */
    28482847    if (pModel->data(index, StorageModel::R_IsController).toBool() && enmState & QStyle::State_Selected)
    28492848    {
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