VirtualBox

Changeset 9773 in vbox


Ignore:
Timestamp:
Jun 17, 2008 2:53:21 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt4-Win: Fixed selector background problem with the windows style.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMListView.cpp

    r8907 r9773  
    767767                               const QModelIndex &aIndex) const
    768768{
     769    QStyleOptionViewItem option (aOption);
     770    /* Highlight background if an item is selected in any case.
     771     * (Fix for selector in the windows style.) */
     772    option.showDecorationSelected = true;
    769773    // Name and decoration
    770774    const QString vmName = aIndex.data(Qt::DisplayRole).toString();
    771775    const QFont nameFont = aIndex.data (Qt::FontRole).value<QFont>();
    772     const QPixmap osType = aIndex.data(Qt::DecorationRole).value<QIcon>().pixmap (aOption.decorationSize, iconMode (aOption.state), iconState (aOption.state));
     776    const QPixmap osType = aIndex.data(Qt::DecorationRole).value<QIcon>().pixmap (option.decorationSize, iconMode (option.state), iconState (option.state));
    773777
    774778    const QString shot = aIndex.data(VBoxVMModel::SnapShotDisplayRole).toString();
     
    777781    const QString state = aIndex.data(VBoxVMModel::SessionStateDisplayRole).toString();
    778782    const QFont stateFont = aIndex.data (VBoxVMModel::SessionStateFontRole).value<QFont>();
    779     const QPixmap stateIcon = aIndex.data(VBoxVMModel::SessionStateDecorationRole).value<QIcon>().pixmap (QSize (16, 16), iconMode (aOption.state), iconState (aOption.state));
     783    const QPixmap stateIcon = aIndex.data(VBoxVMModel::SessionStateDecorationRole).value<QIcon>().pixmap (QSize (16, 16), iconMode (option.state), iconState (option.state));
    780784
    781785    /* Get the sizes for all items */
    782     QRect osTypeRT = rect (aOption, aIndex, Qt::DecorationRole);
    783     QRect vmNameRT = rect (aOption, aIndex, Qt::DisplayRole);
    784     QRect shotRT = rect (aOption, aIndex, VBoxVMModel::SnapShotDisplayRole);
    785     QRect stateIconRT = rect (aOption, aIndex, VBoxVMModel::SessionStateDecorationRole);
    786     QRect stateRT = rect (aOption, aIndex, VBoxVMModel::SessionStateDisplayRole);
     786    QRect osTypeRT = rect (option, aIndex, Qt::DecorationRole);
     787    QRect vmNameRT = rect (option, aIndex, Qt::DisplayRole);
     788    QRect shotRT = rect (option, aIndex, VBoxVMModel::SnapShotDisplayRole);
     789    QRect stateIconRT = rect (option, aIndex, VBoxVMModel::SessionStateDecorationRole);
     790    QRect stateRT = rect (option, aIndex, VBoxVMModel::SessionStateDisplayRole);
    787791
    788792    /* Calculate the positions for all items */
    789793    calcLayout (aIndex, &osTypeRT, &vmNameRT, &shotRT, &stateIconRT, &stateRT);
    790794
    791     /* Get the appropiate pen for the current state */
    792     QPalette pal = aOption.palette;
     795    /* Get the appropriate pen for the current state */
     796    QPalette pal = option.palette;
    793797    QPen pen = pal.color (QPalette::Active, QPalette::Text);
    794     if (aOption.state & QStyle::State_Selected)
     798    if (option.state & QStyle::State_Selected)
    795799        pen =  pal.color (QPalette::Active, QPalette::HighlightedText);
    796800    /* Start drawing */
    797     drawBackground (aPainter, aOption, aIndex);
     801    drawBackground (aPainter, option, aIndex);
    798802    aPainter->save();
    799803    /* Set the current pen */
    800804    aPainter->setPen (pen);
    801805    /* Move the painter to the initial position */
    802     aPainter->translate (aOption.rect.x(), aOption.rect.y());
     806    aPainter->translate (option.rect.x(), option.rect.y());
    803807    /* os type icon */
    804808    aPainter->drawPixmap (osTypeRT, osType);
     
    821825//    aPainter->drawRect (boundingRect);
    822826    aPainter->restore();
    823     drawFocus(aPainter, aOption, aOption.rect);
     827    drawFocus(aPainter, option, option.rect);
    824828}
    825829
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