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. qml.ui file states
QtWS25 Last Chance

qml.ui file states

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlqtquickstates
3 Posts 2 Posters 764 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.
  • T Offline
    T Offline
    tronky
    wrote on last edited by
    #1

    I am trying to do an aplication with qml form item.
    so my UI page would have a bounch of text fields wich would be marked readonly. With the state of the main item changed to edit, the fields would have to be readwrite.

    Since scripts are not supported in the ui file i was wondering how to put the logic for the state transition to the seprate file.

    I have tryed all kinds of stuff but no one givs any results
    Page1Form.ui.qml:

    import QtQuick 2.12
    import QtQuick.Controls 2.12
    import Qt.labs.calendar 1.0
    import QtQuick.Layouts 1.12

    ColumnLayout {
    spacing: 2
    id: mainPage
    property alias mainPage: mainPage
    property alias datumText: datumText

    TextField {
    id: datumText
    Layout.minimumWidth: 250
    Layout.preferredWidth: 250
    placeholderText: qsTr("Vnestite datum")
    readOnly: true
    }
    }

    Page1.qml:

    import QtQuick 2.12
    Page1Form{
    mainPage:{
    states: [
    State {
    name: "edit state"

            PropertyChanges {
                target: datumText
                readOnly:false
    
            }
    

    }]
    }

    but when I try to change the state nothing happens to the UI.

    I wold appriciate one example to see how this things have to be written.

    Thank you.
    Best regards Andrej

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      How & where you are using the Page1.qml ? Where are you creating the object of Page1.qml ?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tronky
        wrote on last edited by
        #3

        Icreate my page1form in main.qml
        inside a stackview.

        ApplicationWindow {
        visible: true
        width: 640
        height: 1134
        title: qsTr("Optika")

        StackView {
            id: stackView
            anchors.fill: parent
        
            Page1Form{
                id: optikaPage
            }
        }
        

        }

        br, andrej

        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