[PyKDE] QMessageBox.question bug?
John Ridley
ojokimu at yahoo.co.uk
Thu May 19 01:04:15 BST 2005
Martin Wiechert wrote:
> Other than before QMessageBox.question bug does not return the
identity of the
> user-clicked button (which it should according to qt docs, and indeed
did for
> me before), but rather seems to return 0 for the leftmost button, 1
for the
> next and so on. If one closes the dialog without clicking a button it
returns
> the index (not identity) of the rightmost button.
The docs say QMessageBox.question returns an int from an enumeration
starting with QMessageBox.NoButton == 0. And the docs don't lie:
Python 2.4.1 (#1, Mar 31 2005, 21:33:58)
[GCC 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)] on linux2
>>> from qt import *
>>> a = QApplication([])
>>> (QMessageBox.NoButton,QMessageBox.Ok,
... QMessageBox.Cancel,QMessageBox.Yes,
... QMessageBox.No,QMessageBox.Abort,
... QMessageBox.Retry,QMessageBox.Ignore,
... QMessageBox.YesAll,QMessageBox.NoAll)
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
>>> k = QMessageBox.question(None,'','',
... QMessageBox.Yes,QMessageBox.No)
>>> k, type(k)
(3, <type 'int'>)
>>> del a,k
When I click "Yes" (the left-most button) it correctly returns 3
(QMessageBox.Yes == 3) and when I close without choosing it again
correctly returns 0 (QMessageBox.NoButton == 0). So it all seems to
work okay for me. As of qt 3.3.4, the question-mark icon is still
missing, though :-(
HTH
John Ridley
___________________________________________________________
Yahoo! Messenger - want a free and easy way to contact your friends online? http://uk.messenger.yahoo.com
More information about the PyQt
mailing list