Changeset 9773 in vbox
- Timestamp:
- Jun 17, 2008 2:53:21 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMListView.cpp
r8907 r9773 767 767 const QModelIndex &aIndex) const 768 768 { 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; 769 773 // Name and decoration 770 774 const QString vmName = aIndex.data(Qt::DisplayRole).toString(); 771 775 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)); 773 777 774 778 const QString shot = aIndex.data(VBoxVMModel::SnapShotDisplayRole).toString(); … … 777 781 const QString state = aIndex.data(VBoxVMModel::SessionStateDisplayRole).toString(); 778 782 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)); 780 784 781 785 /* 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); 787 791 788 792 /* Calculate the positions for all items */ 789 793 calcLayout (aIndex, &osTypeRT, &vmNameRT, &shotRT, &stateIconRT, &stateRT); 790 794 791 /* Get the approp iate pen for the current state */792 QPalette pal = aOption.palette;795 /* Get the appropriate pen for the current state */ 796 QPalette pal = option.palette; 793 797 QPen pen = pal.color (QPalette::Active, QPalette::Text); 794 if ( aOption.state & QStyle::State_Selected)798 if (option.state & QStyle::State_Selected) 795 799 pen = pal.color (QPalette::Active, QPalette::HighlightedText); 796 800 /* Start drawing */ 797 drawBackground (aPainter, aOption, aIndex);801 drawBackground (aPainter, option, aIndex); 798 802 aPainter->save(); 799 803 /* Set the current pen */ 800 804 aPainter->setPen (pen); 801 805 /* 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()); 803 807 /* os type icon */ 804 808 aPainter->drawPixmap (osTypeRT, osType); … … 821 825 // aPainter->drawRect (boundingRect); 822 826 aPainter->restore(); 823 drawFocus(aPainter, aOption, aOption.rect);827 drawFocus(aPainter, option, option.rect); 824 828 } 825 829
Note:
See TracChangeset
for help on using the changeset viewer.