Results 1 to 7 of 7

Thread: Is it possible to call a c++ class method by string name?

  1. #1
    Join Date
    Apr 2010
    Posts
    3

    Default Is it possible to call a c++ class method by string name?

    Is this possible If I use qobject? Is it possible to call a qobject class method by string name?

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is it possible to call a c++ class method by string name?

    Sure, you could abuse Qt's slot system.

  3. #3
    Join Date
    Apr 2010
    Posts
    3

    Default Re: Is it possible to call a c++ class method by string name?

    But I want to call function/method that are part of qt gui... Is it possible ?

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is it possible to call a c++ class method by string name?

    Yes, how complex and how much work is required from you depends on which methods and what you want to do with those methods.

    What do you want to accomplish? Maybe there is an easier way ?

  5. #5
    Join Date
    Apr 2010
    Posts
    3

    Default Re: Is it possible to call a c++ class method by string name?

    I want to create something like this: www.gtk-server.org...

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is it possible to call a c++ class method by string name?

    In which case, QtScript would probably be better suited.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Is it possible to call a c++ class method by string name?

    To me it is kind of reinventing the wheel if we remember there is PyQt, QtScript and Kross.

Similar Threads

  1. Signal/slot or direct method call within a class
    By mike_the_tv in forum Newbie
    Replies: 6
    Last Post: 11th March 2010, 18:49
  2. How to call super class method from sub class
    By mkkguru in forum Qt Programming
    Replies: 9
    Last Post: 4th February 2010, 05:29
  3. Replies: 0
    Last Post: 20th December 2009, 15:37
  4. Why can't I call base public method?
    By lni in forum Qt Programming
    Replies: 3
    Last Post: 13th April 2009, 20:37
  5. Replies: 3
    Last Post: 16th May 2007, 11:07

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.