Discussion Board

Results 1 to 10 of 10

Threaded View

  1. #1
    Registered User
    Join Date
    Aug 2010
    Athens, Greece

    C++ signal and custom type variable use in QML

    I have created a custom type inheriting from QObject.
    I have declared the type with Q_DECLARE_METATYPE() with qmlDeclareType() and also with qRegisterMetaType().

    From another object declared as a component in QML I emit a signal which has the type as a parameter now when the signal is handled from the QML I cannot access any of the properties of the type.
    In debug output while debugging

    Error: Cannot assign [undefined] to QString
    is shown whenever I try to access any property of the variable and

    Error: <variableName> is not defined
    is shown.

    my signal is declared as follows:

        void readTagBCard(const BCard& tagc);
    and handled in qml as follows:

                txtFullName.text = tagc.lastName;
    the method is lastName is declared as follows:

    QString lastName() const {return mlastName;};
    How can I access methods on custom type variables in QML?
    Last edited by penguin_chris; 2011-05-20 at 11:25.

Similar Threads

  1. QML: disconnect signal object from all slots from QML
    By semlanik in forum [Archived] Qt Quick
    Replies: 1
    Last Post: 2012-03-07, 02:39
  2. How to pass and use extern variable in thread
    By sudeepa2005 in forum Open C/C++
    Replies: 1
    Last Post: 2009-07-06, 10:22
  3. Replies: 1
    Last Post: 2008-05-10, 10:13
  4. Signal Strength and Type
    By Osprey in forum Symbian
    Replies: 4
    Last Post: 2006-09-22, 12:45

Posting Permissions

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