The QKeyEvent class, part of the Qt framework, describes a key event.
Questions tagged [qkeyevent]
73 questions
2
votes
1 answer
PyQt equivalent of "keydown" event?
In PyQt I could define a keyPress and a keyRelease event, however, the keyPress event is triggered continously as long as the key is down, whereas I'd prefer an event that is triggered once when the key is first pressed down.
Is there such a…

Zuoanqh
- 942
- 4
- 10
- 26
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
0 answers
QKeyEvent with multiple shift/control modifiers
I have a USB device with 6 buttons that I am trying to use with my app. The document for the device lists the key mappings for each button. One of these button for example is said to map to Ctrl+Shift+F20.
Coding this though does not work:
The code…

TenG
- 3,843
- 2
- 25
- 42
2
votes
1 answer
QWebEngineView, post KeyEvents inside the View
I have my own "Virtual Keyboard". I already got to transform buttons clicked into KeyEvents and deliver it to QTextEdit and so on. My problem now is that I want to do the same for writable areas inside a QWebEngineView.
For example, I use my…

yurisnm
- 1,630
- 13
- 29
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
2
votes
1 answer
QLineEdit not updating text with QKeyEvent
I'm trying to implement a virtual keyboard widget. The simplest way I could think of is to create QKeyEvent instances and send them with QApplication.postEvent() to the widget in focus.
First, I'm trying to update a fixed QLineEdit that I have, so…

Daniel Severo
- 1,768
- 2
- 15
- 22
2
votes
1 answer
QKeyEvent handling non-latin layouts
What is the way to handle non-latin keys pressed with Qt?
For example, for 'W' key pressed QKeyEvent::key() returns 87, but for 'Ц' - the same key in the russian layout - it returns 1062.
So I can't use constants like Qt::Key_W for checking which…

mvlabat
- 577
- 4
- 17
2
votes
2 answers
Qt - know whether a pressed key is just a modifier
I'd like the child's handling of QKeyEvent not to be executed when it's just a modifier key that's being pressed. The following code does the job, but it's unwieldy to list them all like that. Is there a built-in way to do that?
void…

LogicStuff
- 19,397
- 6
- 54
- 74
2
votes
2 answers
QKeyEvent in my app does not work
I want to program a retro snaker that responds to my keyevents, here's my code:
paint.h
#ifndef PAINT_H
#define PAINT_H
#include
#include
#include
#include
class paint:public QWidget
{
Q_OBJECT
public:
…

socket
- 1,153
- 3
- 13
- 22
2
votes
1 answer
QApplication does not handle key event?
QApplication app(argc, 0);
MyDialog * pDlg = new MyDialog(0, Qt::WindowTitleHint | Qt::CustomizeWindowHint);
if (qApp) qApp->installEventFilter(pDlg);
In main(), I just install a event filter for qApp. Then in MyDialog.cpp:
bool…

Royt
- 199
- 4
- 14
1
vote
2 answers
Qt - Capturing QKeyEvent from /dev/input/event1 in embedded linux device (EGLFS)
I'm trying to get QKeyEvents on keypress/keyrelease on linux embedded device(EGLFS) which uses custom keypad.
/dev/input/event1 is the keyevent file.
With evtest the output is as expected. But in the Qt application running on EGLFS platform, the…

Chandana
- 21
- 3
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(){
…

Karthikgr
- 81
- 13
1
vote
1 answer
QKeyEvent::text() doesn't return accent letter on Linux
Does anyone know why QKeyEvent::text() for typing ` + a returns one empty string and one letter a instead of one empty string and à on Linux? Under Windows this seems to be working fine (same application running under Windows and Linux).
I'm…

Damir Porobic
- 681
- 1
- 8
- 21
1
vote
2 answers
Trouble with Event Filter for key presses
I am trying to learn how to make software with GUIs using QtCreator. I've done some programming before, but never anything this involved. So far, I have made a window with 5 items: 2 labels, 1 button, 1 lineEdit, and 1 listWidget.
My goal is to be…

wftmate
- 11
- 1
- 2
1
vote
1 answer
Qt widget does not receive keyPressEvent
My child widget does not get keyPressEvents, while if I put the same widget as top level window, it does. I try to set it get focus, but it has no effect on this. Code is below, showing what I try to get to work.
#include
#include…

hyde
- 60,639
- 21
- 115
- 176