int m = 0;

m += m++;

System.out.println(m);


prints to 0
but i thought m will be post incremented and finally be 1.
Would someone please explain.

Note: i know how post increment works (atleast i think i do :P). But what i am trying to figure out is that when i say m + = m++ lets assume it means m = m + m++ which will evaluate m++ after sending the value of m, 0 in this case, and evaluate to m = 0 + 0 then increment the value of m because of the post increment. now if post increment has occured, why is m not 1


Question: Adding new menu item to QGIS Desktop app
Answer: You can add a custom menu to the QGIS GUI this way:

self.menu = QMenu( "&amp;My tools", self.iface.mainWindow().menuBar() )
actions = self.iface.mainWindow().menuBar().actions()
lastAction = actions[-1]
self.iface.mainWindow().menuBar().insertMenu( lastAction, self.menu )


As you can see in the code snippet above, you are adding a menu to the second to last position of the menu bar, right before the Help menu.



Then, you can add an action to your newly added menu this way:

self.menu.addAction( self.action )


You may already know, but just to make it clear, such GUI configuration should normally be located in the initGui() method of your plugin.