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

Matthias Kretz Matthias.Kretz at urz.uni-heidelberg.de
Mon May 8 22:41:13 BST 2006


On Monday, 8. May 2006 17:28, Tobias Koenig wrote:
> On Sat, Dec 31, 2005 at 11:34:26AM +0100, Matthias Kretz wrote:
> > 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). The page
> > widgets, icon, name and all that are available through the standard
> > QAbstractItemModel::data method.
>
> Passing the icon, name and title through a QVariant is fine, but how to
> you want to pass the QWidget pointer?

QWidget* test = new QWidget;
QVariant testvar = QVariant::fromValue( test );
QWidget* test2 = qvariant_cast<QWidget*>( testvar );
=> test == test2

interesting to note, the following compiles:
QWidget* test = new QWidget;
QVariant testvar( test );
QWidget* test2 = qvariant_cast<QWidget*>( testvar );
but => test != test

> > 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.
>
> Sounds good.
>
> In conclusion to that, Mirko mentioned that it would make more sense to
> have a separated dialog class for every face type. Is this a common
> consensus?
>
> Switching face types at runtime sounds interesting, but the current
> implementation didn't support it as well and I can't see any real advantage
> in this feature...

Well we might want to have a standard way to figure out what dialog face to 
use depending on the structure of the model:
one page -> plain dialog
flat list of (not too many) pages -> iconview dialog
tree of pages -> treelist dialog

-- 
C'ya
        Matthias
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- 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/20060508/028d1688/attachment.sig>


More information about the kde-core-devel mailing list