Adding additional IOutputViewModel
dukju ahn
dukjuahn at gmail.com
Mon Jun 11 19:21:14 UTC 2007
2007/6/11, Andreas Pakulat <apaku at gmx.de>:
> 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 :)
You are right. We use IOutputViewModel. We don't need OutputViewModel.
I attatched real working code patch. I didn't commit yet because it assumes
that there's only one view, and current tab is an active one, the temporary
assumptions that will be addressed eventually.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: builder.patch
Type: text/x-diff
Size: 5919 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20070611/9f74e162/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: outview.patch
Type: text/x-diff
Size: 9196 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20070611/9f74e162/attachment-0001.bin>
More information about the KDevelop-devel
mailing list