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

A framework for event handling

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes