Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I recently created a context menu widget for my own project, and I thought it might be beneficial to others. This is just a standard context menu, the type that we are all familiar with. It supports arbitrarily nested submenus, and can delete itself automatically after it is done being used. This means it can be created directly inside an event handler. Here's a screenshot of example1 modified to open a context menu when right clicking the background:
The context menu deactivates itself upon losing focus (i.e. when anything other than the menu is clicked on). To get this to work, I needed to make a small modification to the Screen::updateFocus method. The change simply avoids sending a de-focus event to widgets in the old focus path if that widget is also in the new focus path (meaning that widget is not really being de-focused anyway). I personally think this is more aligned with the expected behavior of the focus system, but if there is a reason it shouldn't be done this way I believe I could modify the context menu widget to work with the old behavior.
Unfortunately, I have not included python bindings yet because I'm having trouble with mkdoc.py. Could anyone guide me through the process of how py_doc.h should be generated?