Is there a way to replace the end of this function ?
like: "RETURN( oMBox:exec() == QMessageBox_Yes )"
Hi
Is there a way to replace the end of this function ?
like: "RETURN( oMBox:exec() == QMessageBox_Yes )"
In a better way, I want the Buttom with QMessageBox_YesRole returning the same value as QMessageBox_Yes
RETURN oMBox:exec() == QMessageBox_Yes
will be always ( False )
please read qmessagebox docs: exec will return button pressed only if the buttons are standard, otherwise you need to use buttonclicked.
--
You received this message because you are subscribed to the Google Groups "QtContribs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qtcontribs+...@googlegroups.com.
To post to this group, send email to qtcon...@googlegroups.com.
Visit this group at http://groups.google.com/group/qtcontribs.
For more options, visit https://groups.google.com/groups/opt_out.
Did you tryed the sample ?
When using a QMessageBox with standard buttons, this functions returns a StandardButton value indicating the standard button that was clicked. When using QMessageBox with custom buttons, this function returns an opaque value; use clickedButton() to determine which button was clicked.
I understand from the samples in the docs that "StandardButton" is when you use:msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Save);
msgbox.exec() returns the button pressed like QMessageBox::Save
Instead, you are using "custom buttons" added with :addButton so :exec() returns an "opaque" value and :clickedButton() must be used, as per docs (samples are in c++ but they may be easily converted to Harbour):
QMessageBox msgBox; QPushButton *connectButton = msgBox.addButton(tr("Connect"), QMessageBox::ActionRole); QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort); msgBox.exec(); if (msgBox.clickedButton() == connectButton) { // connect } else if (msgBox.clickedButton() == abortButton) { // abort }
--