Further confirmation, I am running the KDE desktop on Ubuntu 12.04 which explains the re-ordering.

It seems like we should set a generic button style that follows the programmer's desire rather than someone else's UI guidelines. It doesn't work well for a developer to write one Octave/Matlab GUI application and then have the buttons re-ordered depending on where it is run.

So we have two (different desktop environments?) Ubuntu 12.04 desktops with the same Qt version with different orderings.

The problem seems likely to be that QMessageBox intentionally changes the order of buttons depending on the platform, which possibly also includes the desktop environment or window manager. The ButtonRole enum is used along with the system environment to determine the button order.

The order of buttons when using a dialog function, such as questdlg, differs depending on whether the CLI or the GUI is running. In the CLI case, Java is used to create the dialog boxes. In the GUI case, Qt is used to create the dialog boxes.

In either case the results should be the same. It appears that the results for the GUI are exactly backward, right to left, from the CLI.

Sample code:

In this example, the buttons are actually ordered 3->2->1 instead of 1->2->3.