Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved How to Binding a C++ class member to qml UI element property

    QML and Qt Quick
    2
    2
    612
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • lenged
      lenged last edited by

      Can QML Binding type can achieve bind a c++ class member to qml UI property like MS UWP‘s DataBinding

          Binding {
              target: text  // a textblock
              property: "text" //the text property of textblock
              value: viewModel.cnt // a c++ class property exposed to qml
          }
      
      1 Reply Last reply Reply Quote 0
      • J
        JordanHarris last edited by JordanHarris

        You can make C++ members act as properties by using the Q_PROPERTY macro. Check out this page. It makes working between Qml and C++ quite intuitive.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post