Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to Binding a C++ class member to qml UI element property
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 746 Views 1 Watching
  • 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.
  • lengedL Offline
    lengedL Offline
    lenged
    wrote on last edited by
    #1

    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
    0
    • J Offline
      J Offline
      JordanHarris
      wrote on last edited by JordanHarris
      #2

      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
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved