Adding additional IOutputViewModel

Andreas Pakulat apaku at gmx.de
Mon Jun 11 15:25:53 UTC 2007


On 11.06.07 11:14:12, dukju ahn wrote:
> 2007/6/11, Andreas Pakulat <apaku at gmx.de>:
> > On 11.06.07 09:46:18, dukju ahn wrote:
> > > 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?
> 
> As I said in original message, to invoke
> QAbstractItemView::setCurrentIndex( tobeHighlightedIndex ).
> The external user should be able to select any item by calling setCurrentIndex()
> , but the view is hidden behind ViewPlugin.

You misunderstand me :) What I was asking was: Why do you have
OutputViewModel and IOutputViewModel, but don't allow to use the latter
one? You're casting the view's model() to OutputViewModel in
highlightNext/Prev and activate. Thus any user of the outputview
interface has to create an OutputViewModel subclass. Then the
IOutputViewModel class is totally useless.

If that was just a typo, then I haven't said anything :) 

Andreas

-- 
You will be surprised by a loud noise.




More information about the KDevelop-devel mailing list