[KDev4] OutputView item fails at runtime

dukju ahn dukjuahn at gmail.com
Sun May 20 18:22:12 UTC 2007


> Remove the need for a outputview interface library,
> IOutputViewItem is now just an interface.

I saw the commit. It compiles but didn't work because dynamic_cast
return 0

The problem is these codes in OutputWidget::slotActivated()

QStandardItem *stditem = stdmodel->itemFromIndex( index );
IOutputViewItem *outitem = dynamic_cast<IOutputViewItem*>( stditem );
if( outitem )
    outitem->activated();

The activated item inherited QStdItem and IOutputViewItem. stditem was
not zero. But dynamic_cast<IOutputViewItem> returns zero because
IOutputViewItem is NOT child or parent of QStdItem.
So we can't rely on dynamic_cast anymore.

One solution is to reimplement QStdItem::type() in each item.
Maybe we should allocate some unique #define for outputviewitem
And every items who want special treatment should return
that unique #define via int type().
Only after OutputView calls type(), we can just do simple C-style cast,
depending on the type() result.

Any idea?




More information about the KDevelop-devel mailing list