Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
I have a GUI Application which is developed in C++ and Tilcon GUI tool.
Tilcon will provide facility to design Ui pages and API to handle Ui file.
For handling event: "TRT_GETINPUT(...)" will return a structure which will having information about event like
eventId, parent window, state of widget, time, text on object etc..
Now we are planning to migrate above same GUI application into Qt, C++.
Is there any such function which can give information about event.
I have studied signals and slot but i need better way of handling of event.
please suggest some solution.
You can have a look at "this":http://qt-project.org/doc/qt-5/eventsandfilters.html chapter from the documentation which explains the event system used by Qt.
There's an equivalent chapter for QML
Thank you .. it is working.I am get event on window/ widget click but how to get event on button click or button state change or change item in combo box ...etc..
I dont want any event on window click .
I need event on mouse click on any widget like button , check box ..
and i need event info like event generate widget id, state ..etc..
can you please help me.
Then you should take a look at the eventFilter function. Do you really need that level of details ? If so, why ?
yes i need all info about event because the existing GUI application design is such a way that,
each events have some set of actions to excite based on some preconditions.
Ex: Event ID = button1
precondition = "read text on button2
Action = if precondition oK then write text on button3.
so all events, preconditions and Actions are configurable.
Each time will check event Id which is return from TRT_GETINPUT(..) with configuration events if both are matching then we check precondition and perform action.
so that why i need a function which return event info.
AFAIK you can't match that pattern without creating e.g. your own events with these parameters. Or maybe a state machine.
Actually eventID and precondition and action is not pattren.
Actual Config format is
EventId = button1 //Object ID
ObjectID = button2 //object id for precondition
Attribut = text // read text on button2
precondition value = Hello //if text on button is hello
objectId = button3
action = 3 /
Argumet = hello /// set text "hello" on button 3 ; we have set of function 3 equivalent to set text.
EventFilter is called for mouse button press on button object.
i have added installEventFilter in constructor.?
Can we need to include any .h or any thing in .pro file
my code is:
bool eventFilter(QObject *object, QEvent *event);
mainwindow :: mainwindow(....)
bool mainwindow::eventFilter(QObject *object, QEvent *event)
if(event->type() == QEvent::MouseButtonPress)
can you plz help me how work with event filter
bool eventfilter(Qobject* , QEvent* );
is working if i create a project with base class of Qwidget but it is not working if i create project with base class of QMainWindow.
Why this is any reason for it?
How can make it work for base class Qmainwindow.
QMainWindow is a way more complex widget (docks/central widget etc…) You may have to install your event filter on multiple widgets.
I have install event filter with function "button->installEventFilter(this)"
i am try to install on button
i am installing event filter after setupUi(..);
i am not getting window after run the program.
i am getting message like "The program has unexpectedly finished"
and " c:\Qt_practice\mouse_event.exe existed with code -1073741819".
What does a run through the debugger tells you ?