+ 1

QMenu in PyQt Questions

Hi everyone, I need some insights on PyQt QMenus that I am doing. I have a 'nested', a 2-tiered qmenus in which I have created a context menu for renaming and deleting. I created a subclass for the QMenus in hopes of making my code cleaner as I am unable to use eventFilter in my current code as it messes some functionalities.. For the renaming part, while it renames the first tiered, as soon as I tried to do the same for the second-tiered item, the prompt actually renames the first-tiered item. The following is a code portion of the QMenu subclass that I did and if you do the following: 1. Right click and add in a new object called `main` 2. In `main`, create another object called `sub` 3. (This is an extra right-click) If you perform another right-mouse click on `main` and select `rename` options, and have it changed to 'newMain', this works 4. Perform the same action as detailed in point #3, but this time, rename on `sub` to `newSub` 5. If you open up the overall menu, noticed that `newMain` was changed to `newSub`, while sub remains unchanged. Could someone kindly shed some light towards my QMenu subclass on where I have done it wrong? This is my code - https://pastebin.com/ccBb4Zdr (The formatting here was bad and hence I linked it from somewhere...)

19th Mar 2019, 1:01 AM
Teh Ki
Teh Ki - avatar
1 Antwort
+ 5
Hi Prince PS Where did you get the impression that unanswered questions should be removed?
22nd Apr 2019, 7:06 AM
Janning⭐
Janning⭐ - avatar