Results 1 to 3 of 3

Thread: Qml Context

  1. #1
    Join Date
    Apr 2009
    Posts
    206
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Qml Context

    Hello,

    how can I access the qml context for evaluate some javascript expressing.
    For example when I want to write a console in which I access some qml object and try to run some methods?

    I read on some discussion that I should avoid the using of eval. Is there any reason for that?
    What alternatives have I?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qml Context

    I think Qt Creator's QML debugging mode has a script console, see http://blog.qt.digia.com/blog/2012/0...2-console-api/

    As for eval, I guess there are mainly two reasons:
    1) it is risky since it basically executes the given string. So that string either does not contain any user text or file content or it needs to be really well checked and escaped
    2) in the case of QML, it could lead to people starting to write imperative code because they are so used to it instead of considering the proper declarative solutions

    Cheers,
    _

  3. #3
    Join Date
    Apr 2009
    Posts
    206
    Thanks
    34
    Thanked 2 Times in 2 Posts

    Default Re: Qml Context

    Thank you very much.

    There is an example in examples/qml/shell.

    This kind of stuff is what i am searching for ;o))

    See ya

Similar Threads

  1. Qt Context menu
    By jeyanthinatarajan in forum Newbie
    Replies: 3
    Last Post: 4th April 2012, 22:26
  2. Context menu on tab
    By wolfi3b in forum Newbie
    Replies: 2
    Last Post: 18th October 2010, 17:35
  3. Context Menus
    By qtoptus in forum Newbie
    Replies: 0
    Last Post: 25th June 2010, 15:18
  4. Qwt and context menu
    By giusepped in forum Qwt
    Replies: 1
    Last Post: 9th December 2008, 08:55
  5. Context Menu
    By RY in forum Newbie
    Replies: 1
    Last Post: 10th September 2008, 07:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.