Qt-interest Archive, March 2007
QEvent questions
Message 1 in thread
I must be missing something, but I cannot find how to get the time the mouse
(or key) went down or up in the QEvent. I know this must be held somewhere
or else the double-click event could not be determined. I want to add a
triple-click event (which comes through as a mouseButtonPress), but to do
so, I need the time the user pressed the mouse down, not the time I am
processing the event. Other things (like long repaints) could have happened
in between click processing to prevent a valid measurement at processing
time. Where do I get the actual QEvent time instead of using the process
time?
The other thing I can't find is how to change the modifiers (or the key in a
keyPressEvent) without creating a whole new event and copying it over the
old event. (A simple example would be an upper-case class derived from
QLineEdit that would automatically change all lowercase keys to uppercase,
but I need to do more complex things.) Is there any other way? I can get the
key (QKeyEvet::key()], but not set the key (QKeyEvet::setKey(int(newkey)] in
an event. There should be a simple way to do this, but I can't find it.
Anyone have any ideas or knowledge on how to do these properly instead of
the kludges I've come up with?
Keith
Message 2 in thread
Hi Keith,
"Keith Esau" <keith.esau@xxxxxxx> wrote in message
news:C22B305C.8E02%keith.esau@xxxxxxxxxx
>I must be missing something, but I cannot find how to get the time the
>mouse
> (or key) went down or up in the QEvent. I know this must be held somewhere
> or else the double-click event could not be determined. I want to add a
> triple-click event (which comes through as a mouseButtonPress), but to do
> so, I need the time the user pressed the mouse down, not the time I am
> processing the event. Other things (like long repaints) could have
> happened
> in between click processing to prevent a valid measurement at processing
> time. Where do I get the actual QEvent time instead of using the process
> time?
QEvent does not store and provides no access to the time the event was
generated. Double clicks are generated by the windowing system, not by Qt.
Qt just translates the system-specific event data into a QEvent.
> The other thing I can't find is how to change the modifiers (or the key in
> a
> keyPressEvent) without creating a whole new event and copying it over the
> old event. (A simple example would be an upper-case class derived from
> QLineEdit that would automatically change all lowercase keys to uppercase,
> but I need to do more complex things.) Is there any other way? I can get
> the
> key (QKeyEvet::key()], but not set the key (QKeyEvet::setKey(int(newkey)]
> in
> an event. There should be a simple way to do this, but I can't find it.
>
> Anyone have any ideas or knowledge on how to do these properly instead of
> the kludges I've come up with?
Creating a new QKeyEvent is the correct solution.
Volker
--
[ signature omitted ]