zoukankan      html  css  js  c++  java
  • Attached Properties

    Attached Properties

    Certain objects provide additional properties by attaching properties to other objects. For example, the Keys element have properties that can attach to other QML objects to provide keyboard handling.

     Component {
         id: listdelegate
         Text {
             text: "Hello"
             color: ListView.isCurrentItem ? "red" : "blue"
         }
     }
     ListView {
         delegate: listdelegate
     }

    The element ListView provides the delegate, listdelegate, the property isCurrentItem as an attached property. TheListView.isCurrentItem attached property provides highlight information to the delegate. Effectively, the ListView element attaches the ListView.isCurrentItem property to each delegate it creates.

    Attached Signal Handlers

    Attached signal handlers are similar to attached properties in that they attach to objects to provide additional functionality to objects. Two prominent elements, Component and Keys element provide signal handlers as attached signal handlers.

     Item {
         Keys.onPressed: console.log("Key Press Detected")
         Component.onCompleted: console.log("Completed initialization")
     }

    Read the QML Signal and Handler Event System and the Keyboard Focus in QML articles for more information.

  • 相关阅读:
    Sword 17
    Sword 16
    Sword 15
    Sword 14-II
    Sword 14-I
    Sword 13
    Sword 11
    Sword 10-II
    Sword 10
    【python+selenium】三种等待方式
  • 原文地址:https://www.cnblogs.com/cute/p/2428989.html
Copyright © 2011-2022 走看看