PYQT5 Open menu on cursor position in QTextEditor - pyqt

I have a QTextEditor which I would like to open a menu for user to choose when he press Ctrl+Space.
I was able to capture the key events and create the menu and trigger it.
My problem is to open the menu on the text cursor position.
How do i get the QPoint of the textcursor and not the mouse position?

QTextEdit.cursorRect returns a rectangle (in viewport coordinates) that includes the cursor.
You're probably imlementing autocompletion/intellisense, it which case I'd recommend using QCompleter instead of QMenu. Take a look at Custom Completer Example.
You can override QTextEdit.keyPressEvent or use eventFilter to capture Ctrl+Space shortcuts and call completer.complete(rect) to show popup.

Related

In nvim, how can I I make it so the mouse will select a split, but not select any text. I only want the mouse to control window focus

I want to be able to toggle on and off this potential feature too. Sometimes, I don't want to change the cursor position, but I want to use my mouse to select a split to focus on.
I tried disabling mouse and fiddling with in by typing :h mouse in nvim, but nothing I could find in the docks helped

How can I change project view on eclipse to hierarchical only using Linux terminal command?

How can I change project view on eclipse from flat to hierarchical only using Linux terminal command without right click on the menu?
Although there is no command line option for this, it is possible to switch the presention between flat and hierarchical using only the keyboard, if you are already in the Project Explorer view.
Press Ctrl+F10 to display the view menu. Use the arrow keys to highlight the menu item you want (in this case, the Presentation menu item is the first, so just one press on the down arrow), then use the right arrow to show the sub-menu for that item. From there, you can either use the hot key (underlined in the submenu, so "f" for "Flat, "h" for "Hierarchical) or use the up and down arrow keys, then hit Enter when on the item you want.

Android studio documentation popup

Is there a way when documentation popup on AS to not hide immediately after it is showed by moving mouse on some class. What I mean. I move mouse cursor above Activity class and documentation is popup is showed, but when I try to move mouse above this popup (because I have to scroll it) it disappears. I can hold ctrl and then is will not hide, but if I press on it while holdint ctrl down it will disappear (so I should move cursor above it, release ctrl and after that to start scrolling). So is there an option to change this behaviour to be like in eclipse - documentation pop up is showed and if you move mouse above it you can scroll, otherwise it is closed.
There are a lot of bugs surrounding this UI element. I'm currently having the opposite problem where it won't go away unless I manually close it. I suspect in your case, a timeout is triggering too early, or some other event is erroneously hiding the window.
This workaround may be helpful. You can explicitly pop the documentation window from the View > Tool Windows > Documentation menu option. This will cause the tool window tab to appear on the right gutter by default. Right-clicking on the Documentation tab will pop up a menu that will allow you to pin the window, or dock it permanently in the UI by disabling "Floating Mode" and optionally moving it to the other side or the bottom.

JavaFX + Scene Builder Mnemonics

I've added Mnemonics to a menu bar using JavaFX 2.2 and Scene Builder, but it doesn't work 100% well.
This is my menu:
When I press Alt, it looks like this, which is correct:
Then I press "D", and the menu opens, but the Mnemonics inside the menu are not underlined:
The lines do appear when I press Alt again; however, then the line under the "D" of "Datei" disappears:
So it seems to be some kind of buggy toggling function in JavaFX.
Anyway, I want the Mnemonics to be underlined all at once, just like when I click the menu:
When you click the menus with the mouse and then press Alt all Mnemonics are correctly underlined at once. Pressing Alt again will toggle between underlined and not underlined. This is the normal, expected behavior.
So I think when opening a menu via Mnemonics, the Oracle guys just forgot to call some kind of "underlineMnemonics()" method for the submenu. Does anybody know what method that is, so I can call it myself when opening a menu? Or does anyone have another workaround?
For example, I know that you can make the underlines of the main menu bar visible via CSS:
.mnemonic-underline {
-fx-stroke: -fx-text-base-color;
}
But I failed to make this work on the submenus. (Also, this would not be an ideal solution, because this way the underlines couldn't be toggled off again.)

Move command in Dialog based aplications

I working on Dialog based applications once i right click on the Dialog Title bar a drop down list is coming with two options 1. Move and 2. Alt+F4 close. Once the User Press Move and he can able to drag the window as he desired and I add the On NC Hits Test to stop dragging its stopping normal dragging but it is not working in this particular context can any body help me in fixing this Bug.
When the user use the keyboard interface, he can move a windows with the arrow keys, without using the mouse.
If you want to limit the position of your dialog, process the WM_MOVING message.

Resources