1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

[AdBlockTreeWidget] Greatly speedup loading rules from subscriptions

Don't use per-pixel scrolling. For some reason, it massively slows
rendering of TreeWidget

See #1169
This commit is contained in:
nowrep 2014-01-25 21:13:14 +01:00
parent 4a7423b02f
commit b4377767c0
4 changed files with 3 additions and 5 deletions

View File

@ -235,6 +235,7 @@ void AdBlockTreeWidget::refresh()
m_topItem = new QTreeWidgetItem(this); m_topItem = new QTreeWidgetItem(this);
m_topItem->setText(0, m_subscription->title()); m_topItem->setText(0, m_subscription->title());
m_topItem->setFont(0, boldFont); m_topItem->setFont(0, boldFont);
m_topItem->setExpanded(true);
addTopLevelItem(m_topItem); addTopLevelItem(m_topItem);
const QVector<AdBlockRule*> &allRules = m_subscription->allRules(); const QVector<AdBlockRule*> &allRules = m_subscription->allRules();
@ -253,7 +254,6 @@ void AdBlockTreeWidget::refresh()
++index; ++index;
} }
expandAll();
showRule(0); showRule(0);
m_itemChangingBlock = false; m_itemChangingBlock = false;
} }

View File

@ -18,8 +18,6 @@
#ifndef ADBLOCKTREEWIDGET_H #ifndef ADBLOCKTREEWIDGET_H
#define ADBLOCKTREEWIDGET_H #define ADBLOCKTREEWIDGET_H
#include <QTreeWidget>
#include "qz_namespace.h" #include "qz_namespace.h"
#include "treewidget.h" #include "treewidget.h"

View File

@ -32,8 +32,6 @@ TreeWidget::TreeWidget(QWidget* parent)
, m_refreshAllItemsNeeded(true) , m_refreshAllItemsNeeded(true)
, m_showMode(ItemsCollapsed) , m_showMode(ItemsCollapsed)
{ {
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(sheduleRefresh())); connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(sheduleRefresh()));
} }
@ -325,6 +323,7 @@ QList<QTreeWidgetItem*> TreeWidget::allItems()
iterateAllItems(0); iterateAllItems(0);
m_refreshAllItemsNeeded = false; m_refreshAllItemsNeeded = false;
} }
return m_allTreeItems; return m_allTreeItems;
} }

View File

@ -31,6 +31,7 @@ public:
ItemShowMode defaultItemShowMode() { return m_showMode; } ItemShowMode defaultItemShowMode() { return m_showMode; }
void setDefaultItemShowMode(ItemShowMode mode) { m_showMode = mode; } void setDefaultItemShowMode(ItemShowMode mode) { m_showMode = mode; }
QList<QTreeWidgetItem*> allItems(); QList<QTreeWidgetItem*> allItems();
bool appendToParentItem(const QString &parentText, QTreeWidgetItem* item); bool appendToParentItem(const QString &parentText, QTreeWidgetItem* item);
bool appendToParentItem(QTreeWidgetItem* parent, QTreeWidgetItem* item); bool appendToParentItem(QTreeWidgetItem* parent, QTreeWidgetItem* item);
bool prependToParentItem(const QString &parentText, QTreeWidgetItem* item); bool prependToParentItem(const QString &parentText, QTreeWidgetItem* item);