epfimi
08-15-2023, 08:33 PM
I've been testing the following patch for a bit today. It will cause the lists/trees in the spawnlist windows to use a fixed height for all cells which reduces the performance hit when the distance column is displayed.
diff --git a/src/spawnlistcommon.cpp b/src/spawnlistcommon.cpp
index 0483573..31ddc9f 100644
--- a/src/spawnlistcommon.cpp
+++ b/src/spawnlistcommon.cpp
@@ -69,6 +69,7 @@ SpawnListItem::~SpawnListItem()
QVariant SpawnListItem::data(int column, int role) const
{
QFont font = treeWidget()->font();
+ QFontMetrics metrics(font);
uint32_t filterFlags = 0;
if (m_item)
filterFlags = m_item->filterFlags();
@@ -114,6 +115,8 @@ QVariant SpawnListItem::data(int column, int role) const
return QColor(Qt::gray);
else
return m_textColor;
+ case Qt::SizeHintRole:
+ return QSize(-1, metrics.lineSpacing());
default:
return SEQListViewItem::data(column, role);
diff --git a/src/spawnlistcommon.cpp b/src/spawnlistcommon.cpp
index 0483573..31ddc9f 100644
--- a/src/spawnlistcommon.cpp
+++ b/src/spawnlistcommon.cpp
@@ -69,6 +69,7 @@ SpawnListItem::~SpawnListItem()
QVariant SpawnListItem::data(int column, int role) const
{
QFont font = treeWidget()->font();
+ QFontMetrics metrics(font);
uint32_t filterFlags = 0;
if (m_item)
filterFlags = m_item->filterFlags();
@@ -114,6 +115,8 @@ QVariant SpawnListItem::data(int column, int role) const
return QColor(Qt::gray);
else
return m_textColor;
+ case Qt::SizeHintRole:
+ return QSize(-1, metrics.lineSpacing());
default:
return SEQListViewItem::data(column, role);