Subclasses of QListViewItems: Re: [Fwd: Re: [PyKDE] Typecasting]

Mark Kimsal chugadie.geo at yahoo.com
Wed Nov 15 22:33:12 GMT 2000


Okay, this is wierd.  I can get all of these things to work.

I can uncomment any of those connections and they all work.  Some of them I
had to delete the space in between QListViewItem and * but it did make a
difference.  Now, my other problem with sub-classes of QListViewItem seems to
dissapear in this examples.  I can give a subclass any attribute, say namae,
and then print that attribute in a slot callback function.

The only difference I can spot is that this example uses both a subclass of
QListViewItem AND QListView.  I'm going to try this and if you don't hear more
from me about the AttributeError problem then this is the solution.

Sorry I couldn't help with all the SIGNAL problems Boudewijn.


Boudewijn Rempt wrote:

> I've been experimenting with QListView - and I don't really understand my
> findings. If you look at the attached code, you see that the same signal
> fits one function, but not the other, even though they have the same
> number of arguments.
>
> Actually, all commented out connections gave an error like:
>
> Traceback (most recent call last):
>   File "qlsv_sig.py", line 77, in ?
>     main()
>   File "qlsv_sig.py", line 71, in main
>     toplevel=frmListView()
>   File "qlsv_sig.py", line 39, in __init__
>     self.connect(self, SIGNAL("onItem(QListViewItem*)"), self.slotOneArg)
> RuntimeError: Signal has wrong argument types for slot
>
> And when I arrived at ...SIGNAL("mouseButtonClicked")... (line 53), I got
> another error as well:
>
> bash-2.03$ python qlsv_sig.py
> QObject::connect: No such signal QObject::onViewport()
> QObject::connect:  (sender name:   'unnamed')
> QObject::connect:  (receiver name: 'unnamed')
> QObject::connect: No such signal QObject::selectionChanged()
> QObject::connect:  (sender name:   'unnamed')
> QObject::connect:  (receiver name: 'unnamed')
> Traceback (most recent call last):
>   File "qlsv_sig.py", line 83, in ?
>     main()
>   File "qlsv_sig.py", line 77, in main
>     toplevel=frmListView()
>   File "qlsv_sig.py", line 53, in __init__
>     self.connect(self, SIGNAL("mouseButtonClicked(int, QListViewItem*,
> constQPoint&, int)"), self.slotFourArg)
> RuntimeError: Signal has wrong argument types for slot
>
> I'm using Qt 2.2.2, PyQt 2.2 and Python 2.0.
>
>   ------------------------------------------------------------------------
>                   Name: qlsv_sig.py
>    qlsv_sig.py    Type: Plain Text (TEXT/PLAIN)
>               Encoding: BASE64





More information about the PyQt mailing list