diff options
| author | 2011-02-09 23:52:39 +0000 | |
|---|---|---|
| committer | 2011-02-09 23:52:39 +0000 | |
| commit | 8b4fe75907a20f8425e8b1e9d187b266a92834f6 (patch) | |
| tree | ae96f690e9e304b8af734f3ceaef54ee8adf9041 /src/modules | |
| parent | ambossarm: try this? (diff) | |
| download | KVIrc-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')
| -rw-r--r-- | src/modules/list/ListWindow.cpp | 20 | ||||
| -rw-r--r-- | src/modules/list/ListWindow.h | 2 |
2 files changed, 11 insertions, 11 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); diff --git a/src/modules/list/ListWindow.h b/src/modules/list/ListWindow.h index 00bc56698..73c497a29 100644 --- a/src/modules/list/ListWindow.h +++ b/src/modules/list/ListWindow.h @@ -68,7 +68,7 @@ class ChannelTreeWidgetItem : public QTreeWidgetItem { friend class ListWindow; public: - ChannelTreeWidgetItem(QTreeWidget * pWidget, ChannelTreeWidgetItemData * pData); + ChannelTreeWidgetItem(ChannelTreeWidgetItemData * pData); ~ChannelTreeWidgetItem(); private: ChannelTreeWidgetItemData * m_pData; |
