Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-646

A framework for event handling

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Out of scope
    • Icon: P3: Somewhat important P3: Somewhat important
    • Some future release
    • None
    • Qt Script
    • None

      QtScript does not have any support for associating a script function with a C++ event. You have to do all the work yourself, e.g.

      • subclass a widget in C++
      • reimplement event()
      • call the proper script function

      This is quite a bit of work that you have to do just to be able to implement a simple key- or mouse-event handler in script.

      It would be nice if QtScript provided some means of simplifying this. In an ideal world, you could simply do

      widget.keyPressEvent = function(e) {
      switch (e.key)

      { .... }

      }

      We had built-in support for event handlers in QtScript a while back, using event filters to do the magic. But it was removed because we weren't sure that it was the right way to do it... So this needs to be researched.

      This is not just relevant for QObject-derived classes; the QtScript bindings for GraphicsView would be that much more powerful if you could easily set your own event handlers in scripts.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kenthans Kent Hansen (Inactive)
            ezf ezf
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes