Adding additional IOutputViewModel

dukju ahn dukjuahn at gmail.com
Mon Jun 11 15:14:12 UTC 2007


2007/6/11, Andreas Pakulat <apaku at gmx.de>:
> 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?

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.




More information about the KDevelop-devel mailing list