aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/list/ListWindow.cpp
diff options
context:
space:
mode:
authorGravatar Szymon Tomasz Stefanek2011-02-09 23:52:39 +0000
committerGravatar Szymon Tomasz Stefanek2011-02-09 23:52:39 +0000
commit8b4fe75907a20f8425e8b1e9d187b266a92834f6 (patch)
treeae96f690e9e304b8af734f3ceaef54ee8adf9041 /src/modules/list/ListWindow.cpp
parentambossarm: try this? (diff)
downloadKVIrc-8b4fe75907a20f8425e8b1e9d187b266a92834f6.tar.gz
KVIrc-8b4fe75907a20f8425e8b1e9d187b266a92834f6.tar.bz2
KVIrc-8b4fe75907a20f8425e8b1e9d187b266a92834f6.zip
Yet another attempt at fixing #1093
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5446 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/list/ListWindow.cpp')
-rw-r--r--src/modules/list/ListWindow.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/modules/list/ListWindow.cpp b/src/modules/list/ListWindow.cpp
index 8de6d8759..11366c444 100644
--- a/src/modules/list/ListWindow.cpp
+++ b/src/modules/list/ListWindow.cpp
@@ -68,8 +68,8 @@ ChannelTreeWidgetItemData::~ChannelTreeWidgetItemData()
}
-ChannelTreeWidgetItem::ChannelTreeWidgetItem(QTreeWidget * v,ChannelTreeWidgetItemData * pData)
-: QTreeWidgetItem(v), m_pData(pData)
+ChannelTreeWidgetItem::ChannelTreeWidgetItem(ChannelTreeWidgetItemData * pData)
+: QTreeWidgetItem(), m_pData(pData)
{
setToolTip(0, m_pData->m_szChan);
setToolTip(1, m_pData->m_szUsers);
@@ -114,13 +114,6 @@ QSize ChannelTreeWidgetItemDelegate::sizeHint( const QStyleOptionViewItem &sovIt
ChannelTreeWidget* treeWidget = (ChannelTreeWidget*)parent();
int iHeight=treeWidget->fontMetrics().lineSpacing();
- // Model-View-Delegate-Crappiness...
- //
- // This function is called when items aren't fully constructed. In particular
- // when the ChannelTreeWidgetItem constructor calls the base class constructor
- // this function is sometimes called with the newly inserted item which is not
- // a ChannelTreeWidgetItem yet.
-
ChannelTreeWidgetItem * item = dynamic_cast<ChannelTreeWidgetItem*>(treeWidget->itemFromIndex(index));
if(!item)
@@ -546,7 +539,14 @@ void ListWindow::flush()
m_pTreeWidget->setUpdatesEnabled(false); /* for v_scroolbar */
while(ChannelTreeWidgetItemData * d = m_pItemList->first())
{
- (void)new ChannelTreeWidgetItem(m_pTreeWidget,d);
+ // Model-View-Delegate-Crappiness...
+ //
+ // Don't use the constructor that takes QTreeWidget as parent
+ // as it will insert the item and call the delegate's sizeHint()
+ // function when the item is not yet fully constructed.
+
+ m_pTreeWidget->addTopLevelItem(new ChannelTreeWidgetItem(d));
+
m_pItemList->removeFirst();
}
m_pTreeWidget->setUpdatesEnabled(true);