[PyKDE] PyQt4 Update
David Boddie
david at boddie.org.uk
Tue Dec 6 13:01:03 GMT 2005
On Mon, 5 Dec 2005 16:21:56, Phil Thompson wrote:
>On Saturday 03 December 2005 6:56 pm, David Boddie wrote:
>> Just to clarify: subclasses of QAbstractListModel that don't
>> reimplement columnCount() should automatically inherit the base
>> class's behaviour and return 1. It seems that the inheritance
>> mechanism wasn't working correctly for these classes, possibly
>> because QAbstractListModel implements columnCount() as a private
>> function. I don't know how SIP deals with this.
>
>Are you sure? Doesn't the private implementation effectively block
>the method from being propagated to more specific classes?
I think you're correct here. You can't access that method from
subclasses like QStringListModel.
>Try and compile:
>
> QModelIndex i;
> QStringListModel m;
>
> m.columnCount(i);
Yes, I was thinking of something like
QStringListModel model;
qDebug() << ((QAbstractItemModel &)model).columnCount();
which returns 1.
In Python, you can achieve the same thing with
model = QStringListModel()
QAbstractItemModel.columnCount(model)
Since views use the abstract interface to interact with models,
this syntax isn't too surprising. I just got a little confused
when thinking about the correct way to get at the column
information using Python. :-/
David
___________________________________________________________
$0 Web Hosting with up to 200MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com
More information about the PyQt
mailing list