Lighttable plugins key shortcuts5/5/2023 ![]() ![]() ![]() Following suggestion, I can see the shortcut displayed in the QGIS Keyboard Shortcuts window, but it doesn't work no matter how I set it. I don't think it's possible to add an action in a custom plugin as a viable shortcut by using registerMainWindowAction(). when I'm not using the keyboard shortcut to open the dialog, but rather run the code under n ? Because it doesn't work when I try this. Update: As suggested below, I've added a push button in the dialog which allows me to just run the code needed without closing the dialog: .connect(n)īut is it still correct to try to use a shortcut using self.keyAction = QAction(u"Copy the Attributes", ()) Keeping the dialog open and using a shortcut key would allow the user to perform multiple plugin actions on the same layers, but with different feature selections on the canvas.Īny thoughts on where my approach goes wrong? I'm struggling to understand if I'm even going in the right direction with this registering and unregistering, if I want a single keyboard shortcut key to mimic the press of the OK button in my plugin dialog - while keeping the dialog box open. """Removes the plugin menu item and icon from QGIS GUI.""" My unload function is also probably wrong as well: def unload(self): I've tried setting the shortcut in Settings -> Configure Shortcuts, but that doesn't result in anything happening either. (n)īut that doesn't seem to do anything when I press F6. ![]() My initGUI function looks like this: self.keyAction = QAction(u"Copy the Attributes", ()) I've had a look at this method here, but I couldn't get it to trigger the run function where most of my code sits. However I can't seem to get a keyboard short cut enabled, one that would allow the user to keep the plugin dialog open and a keyboard shortcut that would accomplish the same thing as clicking the OK button but without closing the dialog. The user makes combobox layer selections, then makes feature selections on the canvas, then presses ok to run some code based on those choices and selections. The plugin has one dialog with a few combo boxes, and an ok/cancel button. I've created a QGIS plugin using plugin builder which works just fine when I enable the plugin dialog from the toolbar button or the plugin menu item. ![]()
0 Comments
Leave a Reply. |