Adding additional IOutputViewModel

Andreas Pakulat apaku at gmx.de
Mon Jun 11 14:52:35 UTC 2007


On 11.06.07 09:46:18, dukju ahn wrote:
> 2007/6/11, Andreas Pakulat <apaku at gmx.de>:
> > On 11.06.07 04:04:28, dukju ahn wrote:
> > > 1. think about makebuilders' show next error stuff, which I implemented.
> > > Although the item can be activated, item cannot be selected in GUI
> > > because item selection is done in QAbsItemView::setCurrentIndex().
> > > And it's a bad idea to provides IOutputView::setCurrentIndex() stuff
> > > because view are hided from outside world.
> > > By above interface, outputview knows which item to highlight.
> >
> > I don't see how the above would help here, but maybe I just can't
> > imagine enough :) Would you please provide a compilable patch for this
> > part at least.
> 
> Some skelecton code would be more understandable than full code patch.

Thanks.

> // user clicked menu, menu slot is executed.
> 
> StdOutputView::slotSearchNext()
> {
>     emit searchNext();
> }
>
> OutputViewWidget::slotSearchNext()
> {
>     foreach( each registered tab )
>     {
>         if( this tab was set default )
>         {
>             OutputListView view = dynamic_cast<OutputListView*> (tab->widget());

This is not needed, the outputwidget already has a list of the
listviews. But thats just minor :)

> class OutputListView : public QListView
> {
>     void highlightNext()
>     {
>         OutputViewModel *model = dynamic_cast<OutputViewModel>(this->model());
>         QModelIndex tobeHighlightedIndex = model->highlightNext();
>         setCurrentIndex( tobeHighlightedIndex );
>     }
> 
>     void activate( QModelIndex index )
>     {
>         OutputViewModel *model = dynamic_cast<OutputViewModel>(this->model());
>         model->activate( index );
>     }
> }
> 
> class OutputViewModel : public QStandardItemModel, public IOutputViewModel
> {
>     virtual QModelIndex hightlightNext() = 0;
>     virtual void activate( QModelIndex index ) = 0;
> }
> 
> class MakeBuilderModel : public OutputViewModel
> {

Uhm, for what do you need the IOutputViewModel? Just put the two new
functions into the already existing OutputModel class and you're done.
Then of course all plugins have to use our OutputModel as base class and
we can change the IOutputView interface to only take OutputModels.

There's no need for the IOutputViewModel, in fact it is confusing,
because if a plugin only uses IOutputViewModel your OutputListView will
break, because that one expects OutputModel.

Andreas

-- 
You have a strong desire for a home and your family interests come first.




More information about the KDevelop-devel mailing list