Questions tagged [qt-events]
28 questions
15
votes
2 answers
Event propagation in Qt
I've just the documentation on the Qt event system and the QEvent class. I'm interested in the behavior of the QObject::event() method. The documentation states:
This virtual function receives events to an object and should return true if the…

André Caron
- 44,541
- 12
- 67
- 125
9
votes
2 answers
Qt GUI event recording and playback
I'm attempting to implement a simple, lightweight system for recording Qt GUI events and playing them back from a script. I thought this would be fairly straightforward using the magic of Qt's event system, but I'm running into a problem I don't…

Stuart Berg
- 17,026
- 12
- 67
- 99
4
votes
0 answers
Why isn't my Qt eventFilter picking up mouse events?
I have basically this code to intercept certain QTreeWidget events.
MyWidget :: MyWidget ()
{
m_tree = new QTreeWidget ();
// ...
m_tree -> installEventFilter (this);
}
bool MyWidget :: eventFilter (QObject * obj, QEvent * e)
{
…

spraff
- 32,570
- 22
- 121
- 229
4
votes
1 answer
Propagate QML events to C++
I would like to propagate event from a QML signal handler to C++ procedure but don't know how to pass the "event object". Take a look at this situation and pay particular attention to SomeType.
First I create a custom QML item with a slot that can…

Marcin Kaczmarek
- 1,063
- 2
- 9
- 20
3
votes
2 answers
QT How to check if key is pressed?
I would like to be able to check if the key is pressed at any time. I imagine such a solution:
void MyQQuickPaintedItem::keyPressEvent(QKeyEvent * event)
{
isKeyPressed[ event->key() ] = 1;
}
void MyQQuickPaintedItem::keyReleaseEvent(QKeyEvent…

yomol777
- 463
- 4
- 16
3
votes
1 answer
Navigating through keyboard in QStackedWidget Item
I am trying to navigate QStackedWidget Item by using KeyPressEvent. But am not able to do it. What Signal function we should use for keyPressEvent?
My Code:
mywindow::mywindow() : QMainWindow()
{
stack = new QStackedWidget();
list1 =…

Suresh
- 745
- 4
- 11
- 25
2
votes
2 answers
Qt postEvent() and event filter
I want to filter some unwanted events sent to my worker QThread by QCoreApplication::postEvent(...), before it actually processed in event loop.
When is event actually filtered by event filter: in postEvent() in the calling thread or later in…

saul_tarvitz
- 33
- 7
2
votes
1 answer
How to get a direct jump in QSlider without damaging performance
I am now creating a simple video player in QT.
I created a slider that is connected with Connect to a multimedia player (he is responsible for running the movie back and forth) and I want it to be moved by a mouse click anywhere on the slide and not…

YOKO
- 119
- 1
- 7
2
votes
1 answer
Hide or Show QStackedWidget Items in Qt
I want to show or hide items in QStackedWidget. When I press Enter button it should show a stacked element and when I press say a left button it should hide.
I use QStackedWidget and QListWidget. My code:
mymainwindow.h:
#ifndef…

Suresh
- 745
- 4
- 11
- 25
2
votes
2 answers
Using Hover Events
I am having trouble capturing the hover enter and hover leave events in a QGraphicsRectItem.
I have subclassed this object, and reimplemented the hover enter and hover leave handlers... or at least I think I have. I also set accepts hover event to…

Luke
- 2,434
- 9
- 39
- 64
1
vote
1 answer
QTouchEvent always called 4 times with any interaction
QTouchEvent always called 4 times with any interaction with the screen. Even if i just touch the screen for a 0.1 second (not moving and not released the finger). So i can`t get an information when the touch is actually was ends or updated.
bool…

Паша Саенко
- 63
- 3
1
vote
2 answers
Is Qt's event loop thread safe or atomic? How is it synchronised when dealing with `QueuedConnection`?
Suppose 2 QThreads are running with following relation:
connect(&Object1OfThread1, &Object1::Signal,
&Object2OfThread2, &Object2::Slot, Qt::QueuedConnection);
So when an object from one thread raises a signal, the other thread's slot is…

iammilind
- 68,093
- 33
- 169
- 336
1
vote
1 answer
Disable KeyEvent for "unneeded QWidget?
I have a QDockWidget in my Mainwindow with a QTableWidget and two QPushbuttons.
Of course, I can click the buttons with my mouse, but I want also to "click" them with left- and right-arrow-key.
It nearly works perfect. But before they are clicked…

erniberni
- 313
- 5
- 17
1
vote
1 answer
Qt QTreeView mouse entered/left event?
There is a "entered" signal for a QTreeView Widget, which I can use to check if my mouse moves over an item.
Is there a way to implement an "left" signal?
Why:
I have a treeView with a lot of items which I also plot via QChart. I want to highlight…

user7431005
- 3,899
- 4
- 22
- 49
1
vote
0 answers
qt mouse event filter
I have a QWidget with a QGraphicsView and a push button. The QGraphicsView has to take mouse press and release events to detect a swipe .At the same time push button should run a small function on clicked. I used an event filter in the QWidget to…

ANIRUDH NJ
- 59
- 2
- 8