shortcut = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Shift), MayaMainWindow)
shortcut.setContext(QtCore.Qt.ApplicationShortcut)
I have a system in place for overloading Maya shortcuts, as and when needed. I want to do this with the shift key, however simply writing it as above seems to do nothing. Not even an error message.
I have tried
QtGui.QKeySequence(QtCore.Qt.Key_Shift)
QtGui.QKeySequence(QtCore.Qt.Key_Shift + QtCore.Qt.SHIFT)
QtGui.QKeySequence(QtCore.Qt.Key_Shift + QtCore.Qt.NoModifier)
QtGui.QKeySequence(QtCore.Qt.Key_Shift + QtCore.Qt.NoButton)
I want to run a custom shortcut when only the shift key is pressed.
Related
I can do Ctrl+Shift+P (linux) in Goland on a variable name to get the type of object it is (in a tooltip). Is there a quick way to go to the definition of that type? Usually I have to type in the name again (either via search or tapping shift twice).
Ctrl (Command) + Shift + B or Ctrl (Command) + Shift + Left-click.
Please see: https://www.jetbrains.com/help/go/navigating-through-the-source-code.html#go_to_declaration
I would like to start a julia script by using the keyboard shortcut Ctrl+Shift+H.
When the script starts, the keys Ctrl and Shift may still be pressed (depending on how quickly I remove my fingers).
I would like to be sure that these two keys are released before executing the rest of the script. To do that I need to test if the key are pressed.
Note that triggering an event when the key are released would not be enough as the keys may not be pressed when the script starts.
I found several references to detect when a key is pressed in Julia but I did not find one to test if a key is currently pressed.
Do you know how I could do that?
Here is a minimal example of why I would like to do that.
You can find here a file in the cnee format which enables to write "azerty" in the window which has the focus. If you type the following command in a terminal, "azerty" is typed in it as expected:
cnee --replay -sp 0 -f ./recorded_macro.xnl
In order to write "azerty" in any window (not just terminals), I create a keyboard shortcut Ctrl+Shift+H which executes this command. If I use the shortcut, the keys Ctrl and Shift are likely to be pressed when the command is executed (except if I use the shortcut very quickly) and instead of typing "azerty", the window with the focus will get Ctrl+Shift+a, Ctrl+Shift+z, Ctrl+Shift+e, Ctrl+Shift+r, Ctrl+Shift+t and Ctrl+Shift+y which will trigger actions in the window but will not write "azerty".
So, I would like instead to start a python script with this shortcut which waits for Ctrl and Shift to be non-pressed before executing the cnee command. Note again that waiting for the keys to be released with a listener is not a solution as the keys Ctrl and Shift may not be pressed at the start of the python script if I use the shortcut quickly (and so I will have to press again Ctrl and Shift before executing the cnee command which I do not want).
The following Gtk program will detect the release of shift, control, and alt that are already pressed before the program starts or gets the focus. Note that my keyboard at least seems to not always detect multiple keystrokes, so perhaps depending on your keyboard you may have to just detect one of those releases.
using Gtk
function keypresswindow()
txt = "Press and Release a Key"
state = ""
win = GtkWindow("Key Release Test", 500, 30) |> (GtkFrame() |> ((vbox = GtkBox(:v)) |> (lab = GtkLabel(txt))))
function keyreleasecall(w, event)
event.keyval == 65505 && (state *= "SHIFT ")
event.keyval == 65507 && (state *= "CONTROL ")
event.keyval == 65513 && (state *= "ALT ")
set_gtk_property!(lab, :label, "You have released: $state")
end
signal_connect(keyreleasecall, win, "key-release-event")
cond = Condition()
endit(w) = notify(cond)
signal_connect(endit, win, :destroy)
showall(win)
wait(cond)
end
keypresswindow()
I'm new to Qt and advanced Programming. In my project, I have a QKeySequence shortcut CTRL + PLUS & CTRL + MINUS keys. They work fine in numerical PLUS & MINUS Keys but, they don't trigger required action if used in OEM PLUS & MINUS Keys for German and Italian keyboard layout. I tested them in a simple program with KeyPressEvent() to print debug message, still it did not trigger the action. I used nativeVirtualKey() and I was able to print the debug message. I used Qt 5.5.0 and 5.5.1 and test them using windows onscreen keyboard. Is there anyway to use CTRL + + shortcut in QKeySequence for keyboards without numerical keys.
Another observation in same issue is faced in Qt Creator. The CTRL + PLUS shortcut to increase font size does not work in German keyboard and for the Danish keyboard it's the CTRL + MINUS that does not work.
QKeySequnce:
const QKeySequence g_markerIncrease = QKeySequence(CTRL + Key_Plus);
This is how I used nativevirtualkey():
if ( event->nativeVirtualKey() == 187 ) //virtualkeycode for Non numeric PLUS
{
qDebug() << "message";
}
Edit 1:
187 is the integer value of VirtualKey hex value in VK List as per suggestion in Qt centre forum
My code is designed to rename a jpeg and capitalize the attributes in order to trick my Nintendo 3DS into thinking it took the image as a photo this code down here is the converter ran on a pc to convert an image to the right type and name.
Prefix = "HNI_";
Midfex = floor(random(9999));
Suffex = ".JPG";
gt_file=get_open_filename("jpeg image|*.jpg", "");
file_rename(gt_file, Prefix + Midfex + Suffex);
Where "Midfex" is, a random number with four digits is created.
and "Prefix" and "Suffex" are, they just what they are called and supposed to do.
When running the game, I get this error:
FATAL ERROR in
action number 1
of Mouse Event for Left Pressed
for object object0:
DoAdd :: Execution Error
at gml_Object_object0_LeftButtonPressed_1 (line 10) - file_rename(gt_file,Prefix + Midfex + Suffex)
There are probably too many variables in the "Rename_File" function. I have tried this on GameMaker 8.0 and it still does not work. How can I fix this?
I am using the standard version of GameMaker Studio, not the free version. I have attached a screenshot of my code in Gm:s Drive.Google.com/file/0b....
When you use + you are trying to add the number Midfex to Prefix and Suffix. Changing it to Prefix + string(Midfex) + Suffex should solve your issue as it is now in a string format.
Also for your convenience you can use irandom(9999) instead of floor(random(9999)) to achieve the same result for Midfex.
You cant use + between string and real.
Prefix = "HNI_";
Midfex = string(irandom(9999));
Suffex = ".JPG";
or
file_rename(gt_file, Prefix + string(Midfex) + Suffex);
First off I am not a programmer or else I should probably know how to do this already. I have a situation where I am receiving an MS Jscript runtime 800a1391 indicating whereClause is undefined. I am fairly certain in previous portion of the ASP page it is attempting to gather values and is most likely failing to return values or is returning something like a null that is later breaking the script on this line.
Here is the line it is failing on:
{
url += "&chartType=" +chartType + "&selClause=" + selClause + "&whereTrendTimeClause=" + whereClause + "&TrendTypeForReport=" + TrendType + "&ReportDisplayType=" + Request("ReportDisplayType") + showModes + "&whereProtocolClause=" + protocolClause + "&groupClause=" + groupClause + "&joinClause=" + joinClause + "&groupIDClause=" + groupIDClause;
}
What I am trying to figure is how to output (either to text) or even printed to screen the returns each time the whereClause does something within this page. Even if I have to manually enter some bit of code for each instance of whereClause that is fine. I am not looking for an easy solution just a method that works and returns what I need which is a very verbose output. The reason a verbose output is needed is I can compare a working environment vs a non-working one. I just need to get the "logging" to work first.
thanks,
To monitor your variable and see what your variable have you can use Google Chrome, and opening by the Console (right click on the page, click Inspect Element, then Select Console) you can see the errors that you have on page.
And you can use the console.log() to write on it from your javascript code.
You can learn more on this tutorial - Debug the web