[PyQt] arbitrary instance attributes on qt widgets?

2008-05-05 Thread Wilbert Berendsen
Hi, Is this legal?

q = QListBoxText(listbox)
q.bla = 3

this sets a new attribute 'bla' to 3. I could use this to have the listboxitem 
carry some other data.

Or should I subclass QListBoxItem to add such an attribute?

with best regards,
Wilbert Berendsen

-- 
http://www.wilbertberendsen.nl/
You must be the change you wish to see in the world.
-- Mahatma Gandhi
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Re: [PyQt] arbitrary instance attributes on qt widgets?

2008-05-05 Thread Erick Tryzelaar
On Mon, May 5, 2008 at 12:17 PM, Wilbert Berendsen [EMAIL PROTECTED] wrote:
 Hi, Is this legal?

  q = QListBoxText(listbox)
  q.bla = 3

  this sets a new attribute 'bla' to 3. I could use this to have the 
 listboxitem
  carry some other data.

Yes it is legal.

  Or should I subclass QListBoxItem to add such an attribute?

Thats up to you :) One thing to be aware of is that if you access the
field directly instead of through setters that you can't use it as a
target for a slot.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt