Qt emit equivalent. in wxWindows

56 views
Skip to first unread message

Michael W. Hall

unread,
Sep 11, 2004, 1:08:59 AM9/11/04
to wxWindow User List
I am porting some code from Qt to wxWindows. In the code, the keyword
emit is used as follows:

emit perfsChanged();

I am wondering how to handle this in wxWindows. Would you use events?
If so, could someone give me an example of how? I would like to see the
Qt code and the wxWindows equivalent.

Thanks,
Michael

--
Michael W. Hall <mwh...@hiwaay.net>


Chris Mellon

unread,
Sep 11, 2004, 2:40:30 AM9/11/04
to wx-u...@lists.wxwidgets.org
On 11 Sep 2004 00:08:59 -0500, Michael W. Hall <mwh...@hiwaay.net> wrote:
> I am porting some code from Qt to wxWindows. In the code, the keyword
> emit is used as follows:
>
> emit perfsChanged();

The equivilent in wxWidgets would be raising a custom event. The
wxWidgets event model is a lot different than the Qt signal/slot model
- if you wanted to port your Qt code as directly as possible you'll
want some some sort of dispatch system. There's a few other options,
like handling global events (which this looks like) in the application
object, or broadcasting to all top level windows....

This sort of broadcast is a weakness of the wx event model (wxPython
can do it fine, though). Writing a dispatch/event manager class is
pretty easy but takes a little more book keeping

Anyway, take a look at the custom event page on the wiki
(http://wiki.wxwidgets.org/wiki.pl?Custom_Events) for an overview on
how to create
your own event types. I'm not familiar enough with Qt to write a
specific conversion tutorial, though...


> I am wondering how to handle this in wxWindows. Would you use events?
> If so, could someone give me an example of how? I would like to see the
> Qt code and the wxWindows equivalent.
>
> Thanks,
> Michael
>
> --
> Michael W. Hall <mwh...@hiwaay.net>
>

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-u...@lists.wxwidgets.org
> For additional commands, e-mail: wx-use...@lists.wxwidgets.org
>
>

Stefan Csomor

unread,
Sep 11, 2004, 3:35:56 AM9/11/04
to wx-u...@lists.wxwidgets.org, Chris Mellon
Hi

> This sort of broadcast is a weakness of the wx event model (wxPython
> can do it fine, though). Writing a dispatch/event manager class is
> pretty easy but takes a little more book keeping

If you want to stay close to a event source - event sink connection of Qt,
you could use the Connect method that allows you to perform something
similar.

HTH

Stefan

Reply all
Reply to author
Forward
0 new messages