Skip to content

Instantly share code, notes, and snippets.

@vvzen
Last active September 14, 2019 13:58
Show Gist options
  • Save vvzen/14feeb186477de8f04e9ac9d5d468139 to your computer and use it in GitHub Desktop.
Save vvzen/14feeb186477de8f04e9ac9d5d468139 to your computer and use it in GitHub Desktop.
Learning QML - Layouts (sketch for fbf-publish)
import QtQuick 2.0
ListModel {
id: assetModel
ListElement {
name: 'env_building_020'
cbPublishAsset: true
assetsComponents:[
ListElement {
passName: 'position'
path: '/mnt/vindaloo_projects/mbf2/02_seq/ep_02/mbf2_110_010/publish/mbf2_110_010_lighting/v002/p'
cbPublishComponent: true
},
ListElement {
passName: 'z'
path: '/mnt/vindaloo_projects/mbf2/02_seq/ep_02/mbf2_110_010/publish/mbf2_110_010_lighting/v002/z'
cbPublishComponent: true
},
ListElement {
passName: 'crypto'
path: '/mnt/vindaloo_projects/mbf2/02_seq/ep_02/mbf2_110_010/publish/mbf2_110_010_lighting/v002/crypto'
cbPublishComponent: true
},
ListElement {
passName: 'normals'
path: '/mnt/vindaloo_projects/mbf2/02_seq/ep_02/mbf2_110_010/publish/mbf2_110_010_lighting/v002/normals'
cbPublishComponent: true
},
ListElement {
name: 'id1'
path: '/mnt/vindaloo_projects/mbf2/02_seq/ep_02/mbf2_110_010/publish/mbf2_110_010_lighting/v002/id1'
cbPublishComponent: true
}
]
}
ListElement {
name: 'env_building_020'
cbPublishAsset: true
assetsComponents: [
ListElement {
passName: 'position'
path: '/mnt/vindaloo_projects/mbf2/02_seq/ep_02/mbf2_110_010/publish/mbf2_110_010_lighting/v001/p'
cbPublishComponent: true
},
ListElement {
passName: 'z'
path: '/mnt/vindaloo_projects/mbf2/02_seq/ep_02/mbf2_110_010/publish/mbf2_110_010_lighting/v001/z'
cbPublishComponent: true
},
ListElement {
passName: 'crypto'
path: '/mnt/vindaloo_projects/mbf2/02_seq/ep_02/mbf2_110_010/publish/mbf2_110_010_lighting/v007/crypto'
cbPublishComponent: true
}
]
}
ListElement {
name: 'env_building_030'
cbPublishAsset: true
}
ListElement {
name: 'env_building_040'
cbPublishAsset: true
}
ListElement {
name: 'env_building_050'
cbPublishAsset: true
}
ListElement {
name: 'env_building_060'
cbPublishAsset: true
}
}
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.0
ApplicationWindow {
id: root
visible: true
width: 700
minimumWidth: 700
//maximumWidth: assetsColumnLayout.implicitWidth
//height: 300
minimumHeight: 300
//maximumHeight: assetsColumnLayout.implicitHeight
title: qsTr('FBF Publish')
ColumnLayout {
id: assetsColumnLayout
// Makes the layout fill its parent
anchors.fill: parent
Item { height: 16 }
// Title Row
RowLayout {
id: assetsRowLayout
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignTop
spacing: 4
Item { width: 8 }
RowLayout {
ColumnLayout {
Text {
text: '<b>' + 'FBF Publish' + '</b>'
font.pointSize: 18
}
RowLayout {
Layout.alignment: Qt.AlignCenter
Text {
text: 'v1.0.0'
font.pointSize: 14
}
}
}
/*
Rectangle {
width: 100
height: 100
color: 'green'
Layout.fillWidth: true
}
*/
Item { width: 8 }
}
}
Item { width: 6 }
ListView {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignCenter
clip: true
model: AssetModel {}
delegate: ColumnLayout {
Layout.fillHeight: true
Layout.fillWidth: true
RowLayout {
Layout.fillHeight: true
ButtonGroup {
id: passesButtonGroup
exclusive: false
checkState: parentBox.checkState
}
CheckBox {
id: parentBox
text: '<b>' + name + '</b>'
checkState: passesButtonGroup.checkState
font.pointSize: 14
}
}
Repeater {
//Layout.fillWidth: true
//Layout.fillHeight: true
//Layout.alignment: Qt.AlignCenter
model: assetsComponents
delegate: RowLayout {
Item { width: 8 }
CheckBox {
checked: cbPublishComponent
ButtonGroup.group: passesButtonGroup
}
Text {
text: '<b>' + passName + '</b>'
}
TextEdit {
text: path
selectByMouse: true
readOnly: true
color: '#555'
}
}
}
Item { width: 12 }
}
ScrollBar.vertical: ScrollBar {}
}
RowLayout {
Layout.alignment: Qt.AlignRight
Button {
id: publishButton
text: 'Publish'
background: Rectangle {
implicitWidth: 100
implicitHeight: 40
color: publishButton.down ? "#9ED624" : "#ABE827"
radius: 4
}
}
Item { width: 8 }
}
Item { width: 8 }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment