From 747a86573feb65e2ffe57cdae7dedf6ad272e789 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 12 Mar 2011 18:45:59 +0100 Subject: Details view optimization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Constructing a KColorScheme object is very expensive because of a number of tint computations. When scrolling a big list more than 30 % of the time was spent here. Instead, we can precompute and store the inactive text color. (see https://git.reviewboard.kde.org/r/100826/) Thanks to Samuel Rødal for the patch! --- src/views/dolphinfileitemdelegate.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/views/dolphinfileitemdelegate.h') diff --git a/src/views/dolphinfileitemdelegate.h b/src/views/dolphinfileitemdelegate.h index 5eb559a79..ab4a9fd20 100644 --- a/src/views/dolphinfileitemdelegate.h +++ b/src/views/dolphinfileitemdelegate.h @@ -37,6 +37,7 @@ class QAbstractProxyModel; */ class DolphinFileItemDelegate : public KFileItemDelegate { + Q_OBJECT public: explicit DolphinFileItemDelegate(QObject* parent = 0); virtual ~DolphinFileItemDelegate(); @@ -60,6 +61,9 @@ public: */ static int nameColumnWidth(const QString& name, const QStyleOptionViewItem& option); +private slots: + void handleDisplayPaletteChange(); + private: static void adjustOptionWidth(QStyleOptionViewItemV4& option, const QAbstractProxyModel* proxyModel, @@ -75,6 +79,8 @@ private: bool m_hasMinimizedNameColumn; mutable QSize m_cachedSize; mutable QPixmap m_cachedEmblems[KVersionControlPlugin::LocallyModifiedUnstagedVersion + 1]; + mutable QColor m_cachedInactiveTextColor; + mutable bool m_cachedInactiveTextColorDirty; }; inline void DolphinFileItemDelegate::setMinimizedNameColumn(bool minimized) -- cgit v1.3