diff options
| author | 2011-02-09 22:42:27 +0000 | |
|---|---|---|
| committer | 2011-02-09 22:42:27 +0000 | |
| commit | 41edacd10c4cd4241ad0cc735034e9df86bf32da (patch) | |
| tree | d117a19814b51869cedcc93e8f541464b31a0f7f /src/modules/list/ListWindow.cpp | |
| parent | Fix a small hole in the /foreach command (diff) | |
| download | KVIrc-41edacd10c4cd4241ad0cc735034e9df86bf32da.tar.gz KVIrc-41edacd10c4cd4241ad0cc735034e9df86bf32da.tar.bz2 KVIrc-41edacd10c4cd4241ad0cc735034e9df86bf32da.zip | |
Maybe fix #1093
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5443 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/list/ListWindow.cpp')
| -rw-r--r-- | src/modules/list/ListWindow.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/modules/list/ListWindow.cpp b/src/modules/list/ListWindow.cpp index ce760e5ba..4621393c5 100644 --- a/src/modules/list/ListWindow.cpp +++ b/src/modules/list/ListWindow.cpp @@ -112,9 +112,20 @@ ChannelTreeWidgetItemDelegate::~ChannelTreeWidgetItemDelegate() QSize ChannelTreeWidgetItemDelegate::sizeHint( const QStyleOptionViewItem &sovItem, const QModelIndex &index) const { ChannelTreeWidget* treeWidget = (ChannelTreeWidget*)parent(); - ChannelTreeWidgetItem * item = (ChannelTreeWidgetItem*)treeWidget->itemFromIndex(index); 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) + return QSize(100,iHeight); + QFontMetrics fm(sovItem.font); switch(index.column()) { |
