[Interest] Struggling with moveEvent()

Murphy, Sean smurphy at walbro.com
Wed Oct 3 15:27:11 CEST 2018


> > Regarding your setMenu question, I did consider it, but I didn't think it would
> > work for my needs - although I could be wrong about that. Here's my requirements:
> > 1. I need a widget that pops up when the user clicks on a button So this requirement
> >  *could* be handled by QPushButton::setMenu(), but I believe it's the subsequent 
> >  requirements that get me into trouble
> > 2. I want the popup to have a "caption bubble" look to it as shown here 
>https://imagebin.ca/v/4Hi83WgTMrmp where the little triangle is lined up 
> >  with and touching the pushbutton that was pushed to trigger this menu being shown
> > 3. I want the "menu" to allow me to put my own interactive widget in it, not just
> >  QAction-based menu items. For example, one pushbutton will allow the user to 
> >  select a color from a color picker. So clicking that pushbutton should pop up a "menu" 
> >  that looks like this https://imagebin.ca/v/4Hi9KpUg8Vk8 where there are no menu 
> >  items like you'd normally find on a QMenu, just the color picker that the user can interact
> >  with
>
> I'm not sure about #2, but I think you should be able to implement what you want by 
> creating a QMenu which has a single action. The action would need to be a QWidgetAction, 
> not a regular QAction. Your QWidgetAction would provide a widget to do the actual 
> color picking.  We do this in our application.

This looks promising - I had never stumbled across QWidgetAction before. Although now 
that you point it out, I've discovered the section of the QMenu documentation that I 
previously skimmed over that mentions it!

Is the code in your paintEvent() something you can share, if there's anything noteworthy
happening in there?

Sean



This message has been scanned for malware by Forcepoint. www.forcepoint.com


More information about the Interest mailing list