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 Update on Monday, May 27th 2025

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 741 Views
  • 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.
  • L Offline
    L Offline
    lenged
    wrote on 18 Apr 2016, 06:35 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 19 Apr 2016, 14:56 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

      1/2

      18 Apr 2016, 06:35

      • Login

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