Qt-interest Archive, October 2006
QEvent and Modal dialog
Message 1 in thread
Hi all
I am developing an application that records all the events on a given Qt
Application and store them on a XML file.Later i am using this XML file and
posting all the events to the same Qt Application , so far i was able to
drive the Qt Application with mouse and key board events, but now the
problem is that whenever a modal dialog is executed (say for eg a message
box) the Application's event loop is locked in the sense that is waits for
user input on the modal dialog.I am aware that modal dialog has its own
event loop and it will come out of that loop only when user close that
dialog.
Can anybody have an idea how to send/post events to modal dialogs.
code snippet
class MyDriver : public QThread
{
void run()
{
// Get the widget pointer
// Read the event
// Reads the event form XML file and construct a QEvent
QApplication::postEvent(widget, event); // This works for normal mouse
and key events but for modal dialog it is locked/ wait for modal dialog to
be closed
qApp->processEvents();
}
} ;
Thanks for help in advance
Thanga Perumal
Message 2 in thread
On 03.10.06 02:43:30, Thanga Perumal Ganesan wrote:
> I am developing an application that records all the events on a given Qt
> Application and store them on a XML file.Later i am using this XML file and
> posting all the events to the same Qt Application , so far i was able to
> drive the Qt Application with mouse and key board events, but now the
> problem is that whenever a modal dialog is executed (say for eg a message
> box) the Application's event loop is locked in the sense that is waits for
> user input on the modal dialog.I am aware that modal dialog has its own
> event loop and it will come out of that loop only when user close that
> dialog.
>
> Can anybody have an idea how to send/post events to modal dialogs.
>
> code snippet
>
> class MyDriver : public QThread
> {
> void run()
> {
> // Get the widget pointer
> // Read the event
> // Reads the event form XML file and construct a QEvent
> QApplication::postEvent(widget, event); // This works for normal mouse
> and key events but for modal dialog it is locked/ wait for modal dialog to
> be closed
> qApp->processEvents();
> }
> } ;
If you're using Qt4 I suggest you have a look at the QtTest Framework,
it already contains code to send various Keyboard/Mouse events to a
widget. Maybe that can give you some inspiration.
Andreas
--
[ signature omitted ]