[PyKDE] Call for ideas - more operators for Qt Widgets
Torsten Marek
shlomme at gmx.net
Wed Aug 13 16:30:01 BST 2003
Hello pythonistas,
in agreement with Phil, I want to ask YOU what operators you want for Qt
widgets in PyQt.
By now, all reasonable operators for QPoint, QRect, QString, QSize,
QRegion and QWMMatrix have been implemented and are in the current
snapshots or still under testing, so please do not recommend any of
those classes. This refers to most of the equality testing operators
available in Qt, too
The question is: In which classes do operators make sense, improve the
intuitiveness/handling and keep the "spirit" of the original Qt roots?
An example would be the __getitem__ operator for QTabWidget or QListBox,
because they provide item access over indices.
Another example could be using
listbox[1] = "test"
to set the text of QListBoxItems.
(The examples should just give you the scent of the survey and are not
garanteed to be senseful.)
Just to show what is possible, an (imcomplete) listing of all operators:
Comparison operators:
__eq__ ==
__ge__ >=
__gt__ >
__le__ <=
__lt__ <
__ne__ !=
or
__cmp__ all-in-one solution, see qstring.sip
Container operators:
__getitem__ cont[i]
__setitem__ cont[i] = "test"
__delitem__ del cont[i]
__len__ len(cont)
__contains__ i in cont
Arithmetic operators
all of +, -, *, /, ** and their augmented version
__invert__ ~
all bitwise operator like &, |, ^, <<, >> and their augmented version
Misc:
__nonzero__ e.g. for containers to assert non-emptyness or sanity
testing (QDateTime.isValid() for example)
__str__ conversion to python strings
__unicode__ conversion to python unicode string
I'm curious about your suggestions, so feel free to post.
greetings
Torsten
--
Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- fingerprint 1902 0002 5DFC 856B F146 894C 7CC5 451E
A244 C858
www.keyserver.net -- wwwkeys.eu.pgp.net
< information must flow >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 252 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20030813/8b4b6d3e/attachment.bin
More information about the PyQt
mailing list