Results 1 to 15 of 15

Thread: Arduino serial input qml display text, conflict of previous declaration error.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,328
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Arduino serial input qml display text, conflict of previous declaration error.

    The Q_PROPERTY macro defines the member variable oil_pressure_volt for you. Line 48 is adding a duplicate definition and thus causing the error. Delete that line. Get rid of m_oil_pressure_volt also, since it is just a duplicate of the property.

    You would confuse yourself less if you didn't use the name "oil_pressure_volt" everywhere. C++ doesn't care what the argument names are, so in the set method, use "newValue" or something like that. Likewise in your definition of the signal.

    If you want the -name- of the property that is exposed to QML to be something different from the member variable name, then use the MEMBER form of Q_PROPERTY:

    Qt Code:
    1. Q_PROPERTY( double oilPressureVoltage MEMBER m_oil_pressure_volt WRITE set_oil_pressure_volt NOTIFY oil_pressure_volt_Changed )
    To copy to clipboard, switch view to plain text mode 

    You will refer to it as "oilPressureVoltage" from QML.
    Last edited by d_stranz; 15th June 2017 at 21:26.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 0
    Last Post: 5th December 2013, 06:46
  2. Replies: 2
    Last Post: 5th March 2013, 17:40
  3. Replies: 12
    Last Post: 24th July 2012, 08:19
  4. linker error during signal declaration
    By riarioriu3 in forum Newbie
    Replies: 1
    Last Post: 28th June 2012, 00:02
  5. error ISO C++ forbids declaration of 'obj' with no type
    By naturalpsychic in forum Qt Programming
    Replies: 1
    Last Post: 26th January 2011, 06:23

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
  •  
Qt is a trademark of The Qt Company.