×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    63

    How to connect c++ methods to QML

    Hi all,
    I have 2 questions;
    First, in case I already have a class that contain some methods, should I add signals to all the Q_INVOKABLE methods ?
    Also, I want to know if I already have an user interafce (containing classes with methods running operations on a Data Base!) and I want to got the same in QML should I rewrite all classes to make them Shape to be used in QML ?

    Thank u for any help

  2. #2
    Regular Contributor
    Join Date
    Apr 2011
    Posts
    89

    Re: How to connect c++ methods to QML


  3. #3
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    63

    Re: How to connect c++ methods to QML

    thanks for the link and how about my second question ?

  4. #4
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    63

    Re: How to connect c++ methods to QML

    I want to know when I already have an user interafce (containing classes with methods running operations on a Data Base!) and I want to got the same in QML should I rewrite all classes to make them Shape to be used in QML ?

  5. #5
    Registered User
    Join Date
    Nov 2010
    Posts
    17

    Re: How to connect c++ methods to QML

    If your classes doesn't have any shape and you uses only pure methods, properties etc. the answer is not. In addition your class shoud inherit from QObject. In other case, if your class have shape it should inherit from QDeclarativeItem. There are many examples and tutorials. Try to read one.
    Furthermore you shoud register your classes to use with qml: qmlRegisterType<your_class_as_type>("Library_name", version_nr, revision_nr, "Name_of_type_useable_in_qml");
    And in qml file add import Library_name 1.0 (version.revision)

Similar Threads

  1. How to call/load another QML file from QML ?
    By cadlg in forum [Archived] Qt Quick
    Replies: 5
    Last Post: 2011-07-28, 09:15
  2. How to export a C++ method to QML?
    By useryy2 in forum [Archived] Qt Quick
    Replies: 2
    Last Post: 2011-05-15, 11:36
  3. How to create and save object to put in another qml?
    By VVNart in forum [Archived] Qt Quick
    Replies: 4
    Last Post: 2011-05-08, 06:57
  4. How to debug qml app to nokia n97
    By Supernova746 in forum [Archived] Beginning Qt
    Replies: 1
    Last Post: 2011-03-14, 20:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •