Hi,

That's because a context menu is a system level window, not a widget.
And what you call focus is in fact not focus, but active window. See
QApplication::activeWindow

You create such a window by creating a QWidget with no parent and a
WindowFlag:

QWidget(0, Qt::Popup);

2017-03-16 15:56 GMT+01:00 Nicolas Krieger <
nicolas.krieger-medeco...@orange.fr>:

> Hi,
>
> I try to have a contextual menu with a semi-transparent background. I
> didnt manage to to it with QMenu, so I decided to use a custom widget.
>
> I have no problem to have a widget with a semi-transparent background, I
> just changed the alpha of the background color.
>
> My problem is that I want this widget to behave like a contextual menu,
> that is to say, I want it to be closed when focus is lost. But this is lot
> as soon as I clic on a children-widget of this menu. I don't know how to do.
>
> Nicolas Krieger
>
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to