Advertisement
Guest User

PropertiesView

a guest
Feb 18th, 2021
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 2.86 KB | None | 0 0
  1. import QtQuick 2.12
  2. import QtQuick.Layouts 1.12
  3. import QtQuick.Controls 2.12
  4.  
  5. ItemDelegate {
  6.     id: delegate
  7.  
  8.     checkable: true
  9.  
  10.     contentItem:
  11.         ColumnLayout {
  12.         spacing: 10
  13.  
  14.         GridLayout {
  15.             id: gridLabels
  16.             columnSpacing: 40
  17.             rows: 1
  18.             columns: 3
  19.  
  20.             Rectangle {
  21.                 id: rect_hostname
  22.                 width: 60
  23.                 Text {
  24.                     text: hostname
  25.                     font.bold: true
  26.                     anchors.fill: parent
  27.                     horizontalAlignment: Text.AlignHCenter
  28.                     verticalAlignment: Text.AlignVCenter
  29.                 }
  30.             }
  31.             Rectangle {
  32.                 id: rect_model
  33.                 width: 60
  34.                 Text {
  35.                     text: model_name
  36.                     font.pixelSize: 9
  37.                     anchors.fill: parent
  38.                     horizontalAlignment: Text.AlignHCenter
  39.                     verticalAlignment: Text.AlignVCenter
  40.                 }
  41.                 Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
  42.             }
  43.             Rectangle {
  44.                 id: rect_status
  45.                 width: 60
  46.                 Text {
  47.                     text: status
  48.                     font.pixelSize: 9
  49.                     anchors.fill: parent
  50.                     horizontalAlignment: Text.AlignHCenter
  51.                     verticalAlignment: Text.AlignVCenter
  52.                 }
  53.                 Layout.alignment: Qt.AlignLeft | Qt.AlignBaseline
  54.             }
  55.         }
  56.  
  57.         GridLayout {
  58.             id: grid
  59.             visible: false
  60.  
  61.             columns: 2
  62.             rowSpacing: 10
  63.             columnSpacing: 5
  64.  
  65.             Rectangle {
  66.                 id: rect_space_left
  67.                 height: 20
  68.                 Layout.leftMargin: 60
  69.             }
  70.  
  71.             Label {
  72.                 id: rect_space_right
  73.                 height: 20
  74.                 Layout.fillWidth: true
  75.             }
  76.  
  77.             Label {
  78.                 text: qsTr("date install:")
  79.                 Layout.leftMargin: 60
  80.             }
  81.  
  82.             Label {
  83.                 text: date_install
  84.                 font.bold: true
  85.                 elide: Text.ElideLeft
  86.                 Layout.fillWidth: true
  87.             }
  88.  
  89.             Label {
  90.                 text: qsTr("date change:")
  91.                 Layout.leftMargin: 60
  92.             }
  93.  
  94.             Label {
  95.                 text: date_change
  96.                 font.bold: true
  97.                 elide: Text.ElideRight
  98.                 Layout.fillWidth: true
  99.             }
  100.         }
  101.     }
  102.  
  103.     states: [
  104.         State {
  105.             name: "expanded"
  106.             when: delegate.checked
  107.  
  108.             PropertyChanges {
  109.                 target: grid
  110.                 visible: true
  111.             }
  112.         }
  113.     ]
  114. }
  115.  
  116.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement