Confused by QDialogButtonBox
-
It's simple when it has two buttons, one of which has the AcceptRole and the other has RejectRole.
Now I have a QDialog which has a buttonbox that has three buttons:
Save(AcceptRole), Discard(DestructiveRole) and Cancel(RejectRole)
How should I code the (modal) QDialog to handle this
Should I connect clicked() to a handler that records the button pressed (by saving its Role perhaps?) and then does an accept() for Save and Discard and reject for Cancel? Or will that fail because Save and Cancel emit accepted() and rejected() signals first (are they connected to accept() / reject() slots by default or not)?
If not that, then what should I do?
I could of course revert to a QDialog with three buttons, but I chose to use a button box for its cross platform layout handling.
Many thanks
David -
@Perdrix said in Confused by QDialogButtonBox:
Should I connect clicked() to a handler that records the button pressed and then does an accept() for Save and Discard and reject for Cancel? Or will that fail because Save and Cancel emit accepted() and rejected() signals first (are they connected to accept() / reject() slots by default or not)?
There is no automatic connection between some QPushButtons and a QDialog (as long as you don't use the stupid auto-connection feature).