#include <KDebug>
+#include <KGlobalSettings>
#include <QApplication>
#include <QPainter>
#include <QPropertyAnimation>
focusRectOption.rect = textBounds.adjusted(1, 1, -1, -1);
}
- focusRectOption.state = QStyle::State_Enabled | QStyle::State_Item;
+ focusRectOption.state = QStyle::State_Enabled | QStyle::State_Item | QStyle::State_KeyboardFocusChange;
if (m_selected) {
focusRectOption.state |= QStyle::State_Selected;
}
if (!m_hoverAnimation) {
m_hoverAnimation = new QPropertyAnimation(this, "hoverOpacity", this);
- m_hoverAnimation->setDuration(200);
+ const int duration = (KGlobalSettings::graphicEffectsLevel() == KGlobalSettings::NoEffects) ? 1 : 200;
+ m_hoverAnimation->setDuration(duration);
connect(m_hoverAnimation, SIGNAL(finished()), this, SLOT(slotHoverAnimationFinished()));
}
m_hoverAnimation->stop();
void KItemListWidget::drawItemStyleOption(QPainter* painter, QWidget* widget, QStyle::State styleState)
{
- const QRect iconBounds = iconRect().toRect();
const QRect textBounds = textRect().toRect();
QStyleOptionViewItemV4 viewItemOption;
viewItemOption.state = styleState;
viewItemOption.viewItemPosition = QStyleOptionViewItemV4::OnlyOne;
viewItemOption.showDecorationSelected = true;
-
- if (iconBounds.bottom() > textBounds.top()) {
- viewItemOption.rect = iconBounds | textBounds;
- widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &viewItemOption, painter, widget);
- } else {
- viewItemOption.rect = iconBounds;
- widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &viewItemOption, painter, widget);
-
- viewItemOption.rect = textBounds.adjusted(1, 1, -1, -1);
- widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &viewItemOption, painter, widget);
- }
+ viewItemOption.rect = textBounds;
+ widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &viewItemOption, painter, widget);
}
#include "kitemlistwidget.moc"