On Wed, Oct 17, 2018, 2:29 AM <[email protected]> wrote: > On Tuesday, October 16, 2018 at 1:52:51 AM UTC-4, Michael Boon wrote: > > It depends a lot on the context you're in. If you have created a custom > Qt button and you want to give it a right-click menu, a lot of the time you > have to do something like this in the __init__ function: > > > > > > self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) > > self.customContextMenuRequested.connect(self.showCustomContextMenu) > > and then write your own showCustomContextMenu(self, point) function that > creates a QMenu and assigns QActions to it, then shows the menu using > something like > > > > > > > > menu.popup(self.mapToGlobal(point)) > > > > > > If you're accessing your widget through maya.cmds, or you're trying to > add a right-click menu to existing Maya controls it would be different. > > > > > > If your button is a QPushButton, note that you can use setMenu() to give > it a little drop-down menu with an arrow (see here), which might be simpler > and friendlier. > > > > On Tuesday, 16 October 2018 15:17:10 UTC+11, Adam Baker wrote:Hey all, > > > > > > > > I am new to using Qt to design UI’s, as my only background is using > maya.cmds. I am slowly learning that you able todo a lot of complex > things, but with that it creates a larger learning curve. > > > > > > > > I am trying to learn how to recreate the maya - cmds.popupMenu() [this > is a right click menu on a button] using only qt to allow me to add; > buttons,checkboxes , radial collectives and text fields inside this pop up > menu. > > > > > > > > > > > > Any information would be greatly appreciated > > > > > > > > - Adam B > > Hey Michael, > > Thanks for the reply, I am sorta following what your saying but I think I > need more clarification on what you're saying. I was about to create a menu > like you talked about at the end (https://pastebin.com/EFJ4TisK) but this > is not really what I'm looking todo. > > I am really truing to create a popup menu on a QPushButton() like this: > https://pasteboard.co/HIILBT2.gif > > > What qualities, specifically, are you after, that are not covered by the code examples? Pictures are fun, but it doesn't clarify if it's left or right click behaviour, if the content of the menu is the focus, if it's the position.
> Hope this helps, as I am a little confused on how to implement what you > are saying. > > - Adam B. > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/04963cac-2347-4ef3-bbc3-8b321864881b%40googlegroups.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3ROLmDDiHTstwpvAmtyN%2BZXKXPcXJNqGcQ7zfGncusew%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
