-void KItemListWidget::drawFocusIndicator(QPainter* painter)
-{
- // Ideally style()->drawPrimitive(QStyle::PE_FrameFocusRect...)
- // should be used, but Oxygen only draws indicators within classes
- // derived from QAbstractItemView or Q3ListView. As a workaround
- // the indicator is drawn manually. Code copied from oxygenstyle.cpp
- // Copyright ( C ) 2009-2010 Hugo Pereira Da Costa <hugo@oxygen-icons.org>
- // TODO: Clarify with Oxygen maintainers how to proceed with this.
-
- const KItemListStyleOption& option = styleOption();
- const QPalette palette = option.palette;
- const QRect rect = textBoundingRect().toRect().adjusted(0, 0, 0, -1);
-
- QLinearGradient gradient(rect.bottomLeft(), rect.bottomRight());
- gradient.setColorAt(0.0, Qt::transparent);
- gradient.setColorAt(1.0, Qt::transparent);
- gradient.setColorAt(0.2, palette.color(QPalette::Text));
- gradient.setColorAt(0.8, palette.color(QPalette::Text));
-
- painter->setRenderHint(QPainter::Antialiasing, false);
- painter->setPen(QPen(gradient, 1));
- painter->drawLine(rect.bottomLeft(), rect.bottomRight());
- painter->setRenderHint(QPainter::Antialiasing, true);
-}
-