Questions tagged [qkeysequence]

The QKeySequence class, part of the Qt framework, encapsulates a key sequence as used by shortcuts.

In its most common form, a key sequence describes a combination of keys that must be used together to perform some action. Key sequences are used with QAction objects to specify which keyboard shortcuts can be used to trigger actions.

20 questions
12
votes
3 answers

QKeySequence to QKeyEvent

I'm in a situation whereby I am trying to read in a JSON config file which dictates what key commands map to given actions. For example: ... { "Action": "Quit", "Combo" : "CTRL+Q" }, ... Constructing a QKeySequence from the combo tag is…
Sonoman
  • 3,379
  • 9
  • 45
  • 61
5
votes
0 answers

QKeySequence using mouse scroll

I'm trying to create a QAction that will trigger when user uses Shift + mouse scroll up/down. Is there a way to create a QKeySequence corresponding to this, to set the QAction shortcut ? If not, what could I do, besides overriding my widget's…
Gatien G.
  • 83
  • 9
4
votes
1 answer

qt How to pass a QkeySequence of a qshortcut() to function through connect(Signal,Slot)?

I'm trying to connect several shortcuts to a slot,in order to get their key value and append it to a variable. Something like text input, so i do something like this: button_1 = new…
psnot
  • 43
  • 5
3
votes
4 answers

Limit QKeySequence/QKeySequenceEdit to only one shortcut

Is it possible to limit QKeySequence to show only one shortcut in QKeySequenceEdit? Currently now it supports up to 4 shortcuts. My application supports key sequences of only one shortcut, e.g. Ctrl+A or Ctrl+C and not e.g. Ctrl+A, D or Ctrl+C, X,…
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
3
votes
1 answer

QKeySequence::Backspace

In Qt, QKeySequence::Delete corresponds to deleteForward: message in MacOS. What is the Qt equivalent of deleteBackward: from MacOS? If there is no such thing, how to capture the deleteBackward: event in Qt? Qt documentation on key sequences does…
Ecir Hana
  • 10,864
  • 13
  • 67
  • 117
2
votes
0 answers

How to post Key Combination events in Qt like CTRL-L

I know how to post single key event QKeyEvent *poKeyEvent = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier); QCoreApplication::postEvent (this, poKeyEvent); Now I want to post a combination of key events for example…
Simon
  • 1,522
  • 2
  • 12
  • 24
2
votes
2 answers

send keystrokes from unicode string pyqt pyside

I need to simulate keystrokes in pyqt4 or pyside, I already have the following code which is fine but it adds only capital Latin letters, no small or other languages letters are allowed def sendkeys(self, char, modifier=QtCore.Qt.NoModifier): …
Mohamed Yousof
  • 725
  • 1
  • 9
  • 38
1
vote
1 answer

How to call qt_sequence_no_mnemonics?

With regards to qt_sequence_no_mnemonics(), the qt documentation says "This function is not declared in any of Qt's header files. To use it in your application, declare the function prototype before calling it." But what does that mean? I only see…
user41010
  • 91
  • 8
1
vote
1 answer

QShortcut & QKeySequence with Shift+Return in a QPlainTextEdit element

I have an element, editorBox which is of the PyQt5 element type QPlainTextEdit. My target goal is to call a function when the hotkey Shift + Return is pressed, and my goal with this function is that it will also insert text into the editorBox…
Xiddoc
  • 3,369
  • 3
  • 11
  • 37
1
vote
1 answer

How to call defined slots from keypress event in qt / How to connect keypressed event with QPushbutton on gui?

I am beginner to qt. I was working on calculator gui application, I have already defined slots like numPressed() when any of the number pushbutton is pressed on the calculator that will be displayed on the lineEdit. void Calculator::numPressed(){ …
1
vote
2 answers

How to make shortcuts trigger in a custom QMenu?

I have a context menu (QMenu) and add a copy action to it like this: m_copyNodeAction = new QAction(tr("Copy node"),…
juzzlin
  • 45,029
  • 5
  • 38
  • 50
1
vote
1 answer

PySide2 | Finding out which QKeySequence was pressed 2

I had a previous question about QKeySequence here. It worked but when I applied it to my code there seemed to be an error when the QKeySequence comes after line when the button click event goes before the QKeySequence line. Note: The GUI consists of…
Teacher Mik
  • 147
  • 3
  • 9
1
vote
1 answer

Finding out which QKeySequence was pressed

I'm using PySide2 and I want to have multiple shortcuts that carry out the same function but also would depend on which key was pressed. I tried to link the functions as such inside a…
Teacher Mik
  • 147
  • 3
  • 9
1
vote
1 answer

Right justify QKeySequence in PyQt QAction Menu

How I can right justify the QKeySequence in PyQt5? copy_absolute_path_action = ( create_action(self, _("Copy Absolute Path"), QKeySequence( get_shortcut('explorer', 'copy absolute path')), …
Khalil Al Hooti
  • 4,207
  • 5
  • 23
  • 40
1
vote
0 answers

QKeySequence 'CTRL + PLUS' shortcut doesn't work for german keyboard layout

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…
1
2