Vyskakovací kontextová nabídka
Spousta lidí potřebuje pro TreeView implementovat kontextovou nabídku pod pravé kliknutí, takže abychom vám ušetřili čas, vysvětlíme vám, jak na to. Krom jedné dvou věcí je to stejné, jako normální kontextová nabídka popsaná v kapitole o nabídkách.
- 10.7.1. Obsluha button_press_event
10.7.1. Obsluha button_press_event
To detect a click of the right mouse button, you need to handle the button_press_event signal, and check exactly which button was pressed. Because the TreeView normally handles this signal completely, you need to either override the default signal handler in a derived TreeView class, use connect_notify() or use connect(slot, /* after= */ false). You probably also want to call the default handler before doing anything else, so that the right-click will cause the row to be selected first.
Ukázáné je to v příkladu s vyskakovací kontextovou nabídkou.