Thanks for taking a crack at it. I appreciate the way that you cleaned up my code; just a little nudge to make it a bit more sane. I had tried emitting the trigger method to no avail, but I see how you made the QMenu the parent rather than the QMainWindow which helped close the menu when click come in.
I feel like I am approaching this incorrectly by controlling the hover state with a style sheet. The other menu items are not unhighlighting and keyboard navigation is not working. I can dig a little deeper and try to find the correct signals and slots to wire up, but there is probably a better way implement this. Also, Thanks for that link, I see that some other folks were doing similar things. This sort of discussion is more suited for Qt forum. If I find a cleaner way to handle it, I'll try to post my solution back to this thread. I'd expect that some other folks want to emulate the maya extended menu items. Cheers, jesse On Wed, Sep 18, 2013 at 7:26 PM, Justin Israel <[email protected]>wrote: > Seems like you are on the right path to implementing that solution. Here > are a couple adjustments that might help: > http://pastebin.com/tscd7LTk > > First off, I think there is a bug in the menu not properly responding to a > QWidgetAction trigger. The docs say your custom widget should be calling > that to notify it of a trigger action. Even after I added it to your code, > it wasn't working. Ref this post: > http://www.qtcentre.org/threads/29035-Correct-way-for-QMenu-exec%28%29-to-return-QWidgetAction > So I added that workaround, and it seems to work right. It also requires > that you properly parent your actions to the menu instead of the main > window. > > Also, you can make your stylesheet changes more manageable by adding them > all in one place to your widget, and using object names to specifically > target certain ones. I made some changes to the style that gets the entire > row to change color on hover. There is a bit of a delay though between when > your mouse is hovering the container widget vs when it enters the label. > Maybe you can fix that with forwarding an event or something so it gets the > hover event earlier. > > > > > On Thursday, September 19, 2013 6:52:03 AM UTC+12, Jesse wrote: > > I really like the secondary option offered on Maya menus presented as a > little square showing that there are other settings that can be tweaked. > > > > > > I'd like to use this idea for some of my studio's internal tools. I have > a partially working implementation by subclassing QAction, but my new > QActions are not quite working as I want. They don't hover or hide the menu > when clicked. > > > > > > > > > > Does anyone know of a way to implement the maya style secondary menu > actions? I can't seem to find the right search terms to yield anything from > google searches. > > > > > > Cheers, > > > > > > jesse > > -- > 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 post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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 post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
