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 Material Theme Properties in a .ui.qml file

Access Material Theme Properties in a .ui.qml file

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 387 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.
  • S Offline
    S Offline
    SwyssX
    wrote on last edited by SwyssX
    #1

    Hello,

    I have a QtQuick UI Form that has a designer editable .ui.qml using the Material Theme

    Page {
        width: 1700
        height: 750
        property alias busyIndicator1: busyIndicator1
            BusyIndicator {
                id: busyIndicator1
                x: 391
                y: 391
            }
    
    }
    

    And i the .qml file I want to change the The Material Accent

    import QtQuick 2.4
    import QtQuick.Controls 2.4
    import QtQuick.Controls.Material 2.4
    
    AutomaticModeForm {
    
      busyIndicator1{
          Material.accent: Material.Red
      }
    }
    

    If I start I get the QML Error qrc:/AutomaticMode.qml:19 Attached properties cannot be used here

    Which is clear as I have to make the Material property accessible.

    I also tried per Hand to add property alias Material: accent to the qml.ui
    but this does not seem to work.

    Page {
        width: 1700
        height: 750
        property alias busyIndicator1: busyIndicator1
        property alias Material: accent
            BusyIndicator {
                id: busyIndicator1
                x: 391
                y: 391
            }
    
    }
    

    What is the correct way to make the Material property accessible?

    Kindest Regards & Big thanks

    Erik

    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