]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistwidget.cpp
Hide tooltip instantly on filter change
[dolphin.git] / src / kitemviews / kitemlistwidget.cpp
index f92309254f2944b0aeeda6c9b013c5f73a587d0d..c33335ae635412994f3aab44af3dbfc8c985222e 100644 (file)
 #include "kitemlistwidget.h"
 
 #include "kitemlistview.h"
 #include "kitemlistwidget.h"
 
 #include "kitemlistview.h"
-
 #include "private/kitemlistselectiontoggle.h"
 
 #include "private/kitemlistselectiontoggle.h"
 
-
 #include <QApplication>
 #include <QPainter>
 #include <QPropertyAnimation>
 #include <QApplication>
 #include <QPainter>
 #include <QPropertyAnimation>
@@ -111,7 +109,7 @@ QHash<QByteArray, QVariant> KItemListWidget::data() const
 
 void KItemListWidget::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
 {
 
 void KItemListWidget::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
 {
-    Q_UNUSED(option);
+    Q_UNUSED(option)
 
     if (m_alternateBackground) {
         const QColor backgroundColor = m_styleOption.palette.color(QPalette::AlternateBase);
 
     if (m_alternateBackground) {
         const QColor backgroundColor = m_styleOption.palette.color(QPalette::AlternateBase);
@@ -129,7 +127,7 @@ void KItemListWidget::paint(QPainter* painter, const QStyleOptionGraphicsItem* o
 
     if (m_current && m_editedRole.isEmpty()) {
         QStyleOptionFocusRect focusRectOption;
 
     if (m_current && m_editedRole.isEmpty()) {
         QStyleOptionFocusRect focusRectOption;
-        focusRectOption.initFrom(widget);
+        initStyleOption(&focusRectOption);
         focusRectOption.rect = textFocusRect().toRect();
         focusRectOption.state = QStyle::State_Enabled | QStyle::State_Item | QStyle::State_KeyboardFocusChange;
         if (m_selected) {
         focusRectOption.rect = textFocusRect().toRect();
         focusRectOption.state = QStyle::State_Enabled | QStyle::State_Item | QStyle::State_KeyboardFocusChange;
         if (m_selected) {
@@ -193,10 +191,13 @@ qreal KItemListWidget::columnWidth(const QByteArray& role) const
 
 void KItemListWidget::setStyleOption(const KItemListStyleOption& option)
 {
 
 void KItemListWidget::setStyleOption(const KItemListStyleOption& option)
 {
+    if (m_styleOption == option) {
+        return;
+    }
+
     const KItemListStyleOption previous = m_styleOption;
     clearHoverCache();
     m_styleOption = option;
     const KItemListStyleOption previous = m_styleOption;
     clearHoverCache();
     m_styleOption = option;
-
     styleOptionChanged(option, previous);
     update();
 }
     styleOptionChanged(option, previous);
     update();
 }
@@ -393,63 +394,63 @@ QPixmap KItemListWidget::createDragPixmap(const QStyleOptionGraphicsItem* option
 void KItemListWidget::dataChanged(const QHash<QByteArray, QVariant>& current,
                                   const QSet<QByteArray>& roles)
 {
 void KItemListWidget::dataChanged(const QHash<QByteArray, QVariant>& current,
                                   const QSet<QByteArray>& roles)
 {
-    Q_UNUSED(current);
-    Q_UNUSED(roles);
+    Q_UNUSED(current)
+    Q_UNUSED(roles)
 }
 
 void KItemListWidget::visibleRolesChanged(const QList<QByteArray>& current,
                                           const QList<QByteArray>& previous)
 {
 }
 
 void KItemListWidget::visibleRolesChanged(const QList<QByteArray>& current,
                                           const QList<QByteArray>& previous)
 {
-    Q_UNUSED(current);
-    Q_UNUSED(previous);
+    Q_UNUSED(current)
+    Q_UNUSED(previous)
 }
 
 void KItemListWidget::columnWidthChanged(const QByteArray& role,
                                          qreal current,
                                          qreal previous)
 {
 }
 
 void KItemListWidget::columnWidthChanged(const QByteArray& role,
                                          qreal current,
                                          qreal previous)
 {
-    Q_UNUSED(role);
-    Q_UNUSED(current);
-    Q_UNUSED(previous);
+    Q_UNUSED(role)
+    Q_UNUSED(current)
+    Q_UNUSED(previous)
 }
 
 void KItemListWidget::styleOptionChanged(const KItemListStyleOption& current,
                                          const KItemListStyleOption& previous)
 {
 }
 
 void KItemListWidget::styleOptionChanged(const KItemListStyleOption& current,
                                          const KItemListStyleOption& previous)
 {
-    Q_UNUSED(current);
-    Q_UNUSED(previous);
+    Q_UNUSED(current)
+    Q_UNUSED(previous)
 }
 
 void KItemListWidget::currentChanged(bool current)
 {
 }
 
 void KItemListWidget::currentChanged(bool current)
 {
-    Q_UNUSED(current);
+    Q_UNUSED(current)
 }
 
 void KItemListWidget::selectedChanged(bool selected)
 {
 }
 
 void KItemListWidget::selectedChanged(bool selected)
 {
-    Q_UNUSED(selected);
+    Q_UNUSED(selected)
 }
 
 void KItemListWidget::hoveredChanged(bool hovered)
 {
 }
 
 void KItemListWidget::hoveredChanged(bool hovered)
 {
-    Q_UNUSED(hovered);
+    Q_UNUSED(hovered)
 }
 
 void KItemListWidget::alternateBackgroundChanged(bool enabled)
 {
 }
 
 void KItemListWidget::alternateBackgroundChanged(bool enabled)
 {
-    Q_UNUSED(enabled);
+    Q_UNUSED(enabled)
 }
 
 void KItemListWidget::siblingsInformationChanged(const QBitArray& current, const QBitArray& previous)
 {
 }
 
 void KItemListWidget::siblingsInformationChanged(const QBitArray& current, const QBitArray& previous)
 {
-    Q_UNUSED(current);
-    Q_UNUSED(previous);
+    Q_UNUSED(current)
+    Q_UNUSED(previous)
 }
 
 void KItemListWidget::editedRoleChanged(const QByteArray& current, const QByteArray& previous)
 {
 }
 
 void KItemListWidget::editedRoleChanged(const QByteArray& current, const QByteArray& previous)
 {
-    Q_UNUSED(current);
-    Q_UNUSED(previous);
+    Q_UNUSED(current)
+    Q_UNUSED(previous)
 }
 
 void KItemListWidget::resizeEvent(QGraphicsSceneResizeEvent* event)
 }
 
 void KItemListWidget::resizeEvent(QGraphicsSceneResizeEvent* event)
@@ -516,11 +517,11 @@ void KItemListWidget::clearHoverCache()
 void KItemListWidget::drawItemStyleOption(QPainter* painter, QWidget* widget, QStyle::State styleState)
 {
     QStyleOptionViewItem viewItemOption;
 void KItemListWidget::drawItemStyleOption(QPainter* painter, QWidget* widget, QStyle::State styleState)
 {
     QStyleOptionViewItem viewItemOption;
-    viewItemOption.initFrom(widget);
+    initStyleOption(&viewItemOption);
     viewItemOption.state = styleState;
     viewItemOption.viewItemPosition = QStyleOptionViewItem::OnlyOne;
     viewItemOption.showDecorationSelected = true;
     viewItemOption.rect = selectionRect().toRect();
     viewItemOption.state = styleState;
     viewItemOption.viewItemPosition = QStyleOptionViewItem::OnlyOne;
     viewItemOption.showDecorationSelected = true;
     viewItemOption.rect = selectionRect().toRect();
-    widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &viewItemOption, painter, widget);
+    style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &viewItemOption, painter, widget);
 }
 
 }