1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2011 by Dominik Riebeling
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
22 #include "comboboxviewdelegate.h"
24 void ComboBoxViewDelegate::paint(QPainter
*painter
,
25 const QStyleOptionViewItem
&option
, const QModelIndex
&index
) const
30 font
= painter
->font();
34 if(option
.state
& QStyle::State_Selected
) {
35 painter
->setPen(QPen(Qt::NoPen
));
36 painter
->setBrush(QApplication::palette().highlight());
37 painter
->drawRect(option
.rect
);
40 pen
.setColor(QApplication::palette().color(QPalette::HighlightedText
));
43 pen
.setColor(QApplication::palette().color(QPalette::Text
));
47 painter
->drawText(option
.rect
, Qt::AlignLeft
, index
.data().toString());
49 // draw user data right aligned, italic
51 painter
->setFont(font
);
52 painter
->drawText(option
.rect
, Qt::AlignRight
, index
.data(Qt::UserRole
).toString());