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. Access exported property

Access exported property

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 869 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.
  • P Offline
    P Offline
    PA F
    wrote on last edited by
    #1

    Access exported property
    I am making an app for mobile devices with Qt 5.8 on OS X 10. Starting with a Qt Quick wizard template, using SwipeView, I for instance want changes to have been made also in a textField2 on Page2 when I click a button1 on Page1. In design mode I have exported button1 and thus have "property alias button1: button 1" in Page1Form.ui.qml. In Page2.qml I have "Page1Form.button1.onClicked: {textField2 = ...}", which is formally accepted, but does not work.
    I have searched all Qt documentation and forums without success. The closest idea I have seen is to use the model "attachedObjects: [ Page1Form {id: page1Form} ]" in Page2.qml, but I can't get that accepted.
    How should I do?

    E 1 Reply Last reply
    0
    • P PA F

      Access exported property
      I am making an app for mobile devices with Qt 5.8 on OS X 10. Starting with a Qt Quick wizard template, using SwipeView, I for instance want changes to have been made also in a textField2 on Page2 when I click a button1 on Page1. In design mode I have exported button1 and thus have "property alias button1: button 1" in Page1Form.ui.qml. In Page2.qml I have "Page1Form.button1.onClicked: {textField2 = ...}", which is formally accepted, but does not work.
      I have searched all Qt documentation and forums without success. The closest idea I have seen is to use the model "attachedObjects: [ Page1Form {id: page1Form} ]" in Page2.qml, but I can't get that accepted.
      How should I do?

      E Offline
      E Offline
      Eeli K
      wrote on last edited by
      #2

      @PA-F You can try to bind textField2's text directly to some text property of another item. If you have textField1 in Page1, make alias for the textField1 and bind textField2.text: textField1.text.

      The problem with your code may be that you bind button1.onClicked twice and the binding in Page1 replaces the binding in Page2 (if you have button1.onClicked in Page1, too).

      1 Reply Last reply
      0
      • P Offline
        P Offline
        PA F
        wrote on last edited by
        #3

        Thanks for a good explanation and suggestion! Using the concept you suggest still seems to be clumsy -- it doesn't work without declaration of further properties in both directions. I will try to use model/view concepts instead (doc.qt.io/qt-5/modelview.html).

        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