KJanusWidget and Model-View (was: Re: KDialog / KDialogBase)

Benjamin Meyer ben at meyerhome.net
Sun Jan 1 14:51:39 GMT 2006

> Wouldn't it be possible to use the Qt4 Model-View interfaces for the
> dialogs. Just a short sketch:


> class KDialogView : public QAbstractItemView
> This shows a standart KDE Dialog and uses the model to determine whether it
> needs to show a tree or an iconview for navigating the pages (and perhaps,
> if there's only one page, not showing any navigation).

Well you wouldn't want to call it KDialogView because it wont implement a 
QAbstractItemView, but you could have KDialog take a Model and then display 
it in a view.

> The page widgets, 
> icon, name and all that are available through the standard
> QAbstractItemModel::data method.
> In addition to KDialogView there can be a KDialogWidget that provides the
> insertPage functions for users that don't want to implement a Model to
> populate the dialog.
> This way we get a lot more flexibility (for example with regard to creating
> a sort order in the navigation view - this took a lot of code in
> KSettings::*) while still keeping the simple interface.
> I'd be happy to do it, but I won't until I get KDE multimedia in shape.

I think it is a very good idea and I have done this very idea in my 
ksystemsettings in work/kde.  I populate a QStandardItemModel with the icons, 
names etc and then display the model in a tableview (but you could have any 
view).  It is very handy and easy for me to switch to new views, sorting, 
filtering and adding eye candy with delegates.  Using models would provide 
much more flexability and (hopefully) a smaller nicer api

-Benjamin Meyer

aka icefox
Public Key: http://www.icefox.net/public_key.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060101/735c2fa5/attachment.sig>

More information about the kde-core-devel mailing list