PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 7 - QMessageBox warning, critical, question
: QMessageBox warning, critical, question
Status: CLOSED INVALID
Product: PySide
Classification: Unclassified
Component: QtGui
: 0.1.0
: All All
: P5 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2009-08-20 10:58 EEST by Ahmed Youssef
Modified: 2009-08-21 10:52 EEST (History)
4 users (show)

See Also:


Attachments
check warningMessage, questionMessage, and criticalMessage (12.59 KB, text/x-python)
2009-08-20 10:58 EEST, Ahmed Youssef
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmed Youssef 2009-08-20 10:58:12 EEST
Created attachment 8 [details]
check warningMessage, questionMessage, and criticalMessage

There's a Boost.Python.ArgumentError raised foreach of QMessageBox.critical,
QMessageBox.warning, and QMessageBox.question:


Code is in standarddialogs.py example:

    def criticalMessage(self):    
        reply = QtGui.QMessageBox.critical(self,
self.tr("QMessageBox.showCritical()"),
                                           Dialog.MESSAGE,
QtGui.QMessageBox.Abort,
                                           QtGui.QMessageBox.Retry,
                                           QtGui.QMessageBox.Ignore)
        if reply == QtGui.QMessageBox.Abort:
            self.criticalLabel.setText(self.tr("Abort"))
        elif reply == QtGui.QMessageBox.Retry:
            self.criticalLabel.setText(self.tr("Retry"))
        else:
            self.criticalLabel.setText(self.tr("Ignore"))

    def questionMessage(self):    
        reply = QtGui.QMessageBox.question(self,
self.tr("QMessageBox.showQuestion()"),
                                           Dialog.MESSAGE,
QtGui.QMessageBox.Yes,
                                           QtGui.QMessageBox.No,
                                           QtGui.QMessageBox.Cancel)
        if reply == QtGui.QMessageBox.Yes:
            self.questionLabel.setText(self.tr("Yes"))
        elif reply == QtGui.QMessageBox.No:
            self.questionLabel.setText(self.tr("No"))
        else:
            self.questionLabel.setText(self.tr("Cancel"))

    def warningMessage(self):    
        reply = QtGui.QMessageBox.warning(self,
self.tr("QMessageBox.showWarning()"),
                                          Dialog.MESSAGE, self.tr("Save
&Again"),
                                          self.tr("&Continue"))
        if reply == 0:
            self.warningLabel.setText(self.tr("Save Again"))
        else:
            self.warningLabel.setText(self.tr("Continue"))

Expected result: showing critical, question and warning messages.

What happens?
[ahmed@localhost examples]$ python dialogs/standarddialogs.py 
Traceback (most recent call last):
  File "dialogs/standarddialogs.py", line 228, in questionMessage
    QtGui.QMessageBox.Cancel)
Boost.Python.ArgumentError: Python argument types in
    QMessageBox.question(Dialog, QString, str, StandardButton, StandardButton,
StandardButton)
did not match C++ signature:
    question(QWidget* parent, QString title, QString text,
QMessageBox::StandardButton button0, QMessageBox::StandardButton button1)
    question(QWidget* parent, QString title, QString text,
QFlags<QMessageBox::StandardButton> buttons=1024, QMessageBox::StandardButton
defaultButton=PySide.QtGui.StandardButton.NoButton)
Traceback (most recent call last):
  File "dialogs/standarddialogs.py", line 239, in warningMessage
    self.tr("&Continue"))
Boost.Python.ArgumentError: Python argument types in
    QMessageBox.warning(Dialog, QString, str, QString, QString)
did not match C++ signature:
    warning(QWidget* parent, QString title, QString text,
QMessageBox::StandardButton button0, QMessageBox::StandardButton button1)
    warning(QWidget* parent, QString title, QString text,
QFlags<QMessageBox::StandardButton> buttons=1024, QMessageBox::StandardButton
defaultButton=PySide.QtGui.StandardButton.NoButton)
Traceback (most recent call last):
  File "dialogs/standarddialogs.py", line 212, in criticalMessage
    QtGui.QMessageBox.Ignore)
Boost.Python.ArgumentError: Python argument types in
    QMessageBox.critical(Dialog, QString, str, StandardButton, StandardButton,
StandardButton)
did not match C++ signature:
    critical(QWidget* parent, QString title, QString text,
QMessageBox::StandardButton button0, QMessageBox::StandardButton button1)
    critical(QWidget* parent, QString title, QString text,
QFlags<QMessageBox::StandardButton> buttons=1024, QMessageBox::StandardButton
defaultButton=PySide.QtGui.StandardButton.NoButton)
Comment 1 renato filho 2009-08-20 14:08:40 EEST
this signature of QMessageBox.question:
int
question(QWidget, QString, QString, int, int=0, int=0);

is obsolete.

Try this new one:

StandardButton 
question(QWidget, QString, QString, StandardButtons, StandardButton =
NoButton);

the same for the others functions.

more information in:
http://www.pyside.org/docs/pyside/PySide/QtGui/QMessageBox.html
Comment 2 Ahmed Youssef 2009-08-20 22:16:05 EEST
(In reply to comment #1)
> this signature of QMessageBox.question:
> int
> question(QWidget, QString, QString, int, int=0, int=0);
> 
> is obsolete.
> 
> Try this new one:
> 
> StandardButton 
> question(QWidget, QString, QString, StandardButtons, StandardButton =
> NoButton);
> 
> the same for the others functions.
> 
> more information in:
> http://www.pyside.org/docs/pyside/PySide/QtGui/QMessageBox.html

It works now thanks!
Comment 3 Hugo Parente Lima 2009-08-21 10:52:56 EEST
We do not support Qt deprecated methods.