Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Dialogs 1.3 as Dialogs1
import QtQuick.XmlListModel 2.13

import easyApp.Gui.Elements 1.0 as EaElements

import Gui.Globals 1.0 as ExGlobals
import Gui.Pages.Sample.Layers 1.0 as ExLayers

EaElements.GroupBox {
// When an item in the above table is selected, this box will become enabled.
// Allowing different parameters and layers to be defined for the item.
id: multilayerGroup
title: qsTr(ExGlobals.Constants.proxy.model.currentItemsName + " editor")
enabled: (itemsTable.model.count > 0) ? true : false //When a layer is selected
collapsible: false
last: true

ExLayers.MultilayerTable{
id: layersTable
}

ExLayers.MultilayerRow{
}
}
44 changes: 44 additions & 0 deletions EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerRow.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.XmlListModel 2.13

import easyApp.Gui.Elements 1.0 as EaElements
import easyApp.Gui.Style 1.0 as EaStyle

import Gui.Globals 1.0 as ExGlobals

Row {
spacing: EaStyle.Sizes.fontPixelSize

EaElements.SideBarButton {
width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2
enabled: true
fontIcon: "plus-circle"
text: qsTr("Add layer")
onClicked: ExGlobals.Constants.proxy.model.addNewLayers()
}

EaElements.SideBarButton {
width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2
enabled: (layersTable.model.count > 0) ? true : false //when item is selected
fontIcon: "clone"
text: qsTr("Duplicate layer")
onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers()
}

EaElements.SideBarButton {
width: EaStyle.Sizes.tableRowHeight
enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected
fontIcon: "arrow-up"
ToolTip.text: qsTr("Move layer up")
onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp()
}

EaElements.SideBarButton {
width: EaStyle.Sizes.tableRowHeight
enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false
fontIcon: "arrow-down"
ToolTip.text: qsTr("Move layer down")
onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Dialogs 1.3 as Dialogs1
import QtQuick.XmlListModel 2.13

import easyApp.Gui.Style 1.0 as EaStyle
import easyApp.Gui.Elements 1.0 as EaElements
import easyApp.Gui.Components 1.0 as EaComponents

import Gui.Globals 1.0 as ExGlobals
import Gui.Pages.Sample.Layers 1.0 as ExLayers

EaElements.GroupBox {
// id: repeatingMultilayerGroup
title: qsTr(ExGlobals.Constants.proxy.model.currentItemsName + " editor")
enabled: (itemsTable.model.count > 0) ? true : false //When a layer is selected
collapsible: false
last: true
Row {
spacing: EaStyle.Sizes.fontPixelSize * 0.5

// This integer defines how many repetitions of the layer structure should be
// used.
EaComponents.TableViewLabel{
horizontalAlignment: Text.AlignRight
width: labelWidth() * 2.1
ToolTip.text: qsTr("To create some repeating multilayer structure")
text: qsTr("Number of repetitions:")
}
EaElements.SpinBox {
id: repsSpinBox
editable: true
from: 1
to: 9999
value: layerRepetionsSpinBoxValue
onValueChanged: {
ExGlobals.Constants.proxy.model.currentItemsRepetitions = value
}
}
}

ExLayers.MultilayerTable{
id: layersTable
}

ExLayers.MultilayerRow{
}
}
162 changes: 162 additions & 0 deletions EasyReflectometryApp/Gui/Pages/Sample/Layers/SurfactantGroup.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.XmlListModel 2.13

import easyApp.Gui.Components 1.0 as EaComponents
import easyApp.Gui.Elements 1.0 as EaElements
import easyApp.Gui.Style 1.0 as EaStyle

import Gui.Globals 1.0 as ExGlobals


EaElements.GroupBox {
id: surfactantGroup
title: qsTr(ExGlobals.Constants.proxy.model.currentItemsName + " editor")
enabled: (itemsTable.model.count > 0) ? true : false //When a layer is selected
collapsible: false
last: true

EaComponents.TableView {
id: surfactantTable

// Table model

model: XmlListModel {
property int layersIndex: ExGlobals.Constants.proxy.model.currentLayersIndex + 1

xml: ExGlobals.Constants.proxy.model.layersAsXml
query: `/root/item[${itemsTable.currentIndex + 1}]/layers/item`

XmlRole { name: "formula"; query: "chemical_structure/string()" }
XmlRole { name: "thick"; query: "thickness/value/number()" }
XmlRole { name: "thick_enabled"; query: "thickness/enabled/string()" }
XmlRole { name: "rough"; query: "roughness/value/number()" }
XmlRole { name: "rough_enabled"; query: "roughness/enabled/string()" }
XmlRole { name: "apm"; query: "area_per_molecule/value/number()" }
XmlRole { name: "apm_enabled"; query: "area_per_molecule/enabled/string()" }
XmlRole { name: "solvation"; query: "solvation/value/number()" }
XmlRole { name: "solvation_enabled"; query: "solvation/enabled/string()" }
XmlRole { name: "solvent"; query: "solvent/name/string()"}
}

// Table rows

delegate: EaComponents.TableViewDelegate {
property var surfactantModel: model

EaComponents.TableViewTextInput {
horizontalAlignment: Text.AlignHCenter
width: EaStyle.Sizes.sideBarContentWidth - (thickLabel.width + roughLabel.width + solvLabel.width + apmLabel.width + solvMatLabel.width + 6 * EaStyle.Sizes.tableColumnSpacing)
headerText: "Formula"
text: surfactantModel.formula
onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersChemStructure(text)
}

EaComponents.TableViewTextInput {
id: thickLabel
horizontalAlignment: Text.AlignHCenter
width: EaStyle.Sizes.fontPixelSize * 5.5
headerText: "Thickness/Å"
enabled: model.thick_enabled == "True"
text: (isNaN(surfactantModel.thick)) ? '--' : surfactantModel.thick.toFixed(2)
onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersThickness(text)
}

EaComponents.TableViewTextInput {
id: roughLabel
horizontalAlignment: Text.AlignHCenter
width: EaStyle.Sizes.fontPixelSize * 6.0
headerText: "Roughness/Å"
enabled: model.rough_enabled == "True"
text: (isNaN(surfactantModel.rough)) ? '--' : surfactantModel.rough.toFixed(2)
onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersRoughness(text)
}

EaComponents.TableViewTextInput {
id: solvLabel
horizontalAlignment: Text.AlignHCenter
width: EaStyle.Sizes.fontPixelSize * 4.5
headerText: "Solvation"
enabled: model.solvation_enabled == "True"
text: (isNaN(surfactantModel.solvation)) ? '--' : surfactantModel.solvation
onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersSolvation(text)
}

EaComponents.TableViewTextInput {
id: apmLabel
horizontalAlignment: Text.AlignHCenter
width: EaStyle.Sizes.fontPixelSize * 4.0
headerText: "APM/Å<sup>2</sup>"
enabled: model.apm_enabled == "True"
text: (isNaN(surfactantModel.apm)) ? '--' : surfactantModel.apm
onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentItemApm(text)
}

EaComponents.TableViewComboBox{
id: solvMatLabel
horizontalAlignment: Text.AlignLeft
width: EaStyle.Sizes.fontPixelSize * 6.5
headerText: "Solvent"
onActivated: {
ExGlobals.Constants.proxy.model.setCurrentLayersSolvent(currentIndex)
}
model: ExGlobals.Constants.proxy.material.materialsName
onModelChanged: {
currentIndex = indexOfValue(surfactantModel.solvent)
}
Component.onCompleted: {
currentIndex = indexOfValue(surfactantModel.solvent)
}
}
}

onCurrentIndexChanged: {
ExGlobals.Constants.proxy.model.currentLayersIndex = surfactantTable.currentIndex
}

}

EaElements.GroupBox {
spacing: EaStyle.Sizes.fontPixelSize * 0.5
collapsible: true
collapsed: true

title: qsTr('Chemical Constraints')
Row {
EaElements.CheckBox {
checked: false
id: apm_check
text: qsTr("Area-per-molecule")
ToolTip.text: qsTr("Checking this box will ensure that the area-per-molecule of the head and tail layers is the same")
onCheckedChanged: ExGlobals.Constants.proxy.model.constrainApm = checked
}
EaElements.CheckBox {
checked: false
id: conformal
text: qsTr("Conformal roughness")
ToolTip.text: qsTr("Checking this box will ensure that the interfacial roughness is the same for all interfaces of the surfactant")
onCheckedChanged: ExGlobals.Constants.proxy.model.conformalRoughness = checked
}
}

Row {
EaElements.CheckBox {
checked: false
id: solvent_rough
text: qsTr("Constrain roughness to item")
enabled: conformal.checked
ToolTip.text: qsTr("Checking this box allows another item to be selected and the conformal roughness will be constrained to this")
onCheckedChanged: checked ? ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(solvent_rough_item.currentText) : ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(null)
}
EaElements.ComboBox {
id: solvent_rough_item
enabled: solvent_rough.checked
onActivated: {
ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(null)
ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(currentText)
}
model: ExGlobals.Constants.proxy.model.itemsNamesConstrain
}
}
}
}
7 changes: 7 additions & 0 deletions EasyReflectometryApp/Gui/Pages/Sample/Layers/qmldir
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module Layers

MultilayerGroup 1.0 MultilayerGroup.qml
MultilayerTable 1.0 MultilayerTable.qml
MultilayerRow 1.0 MultilayerRow.qml
RepeatingMultilayerGroup 1.0 RepeatingMultilayerGroup.qml
SurfactantGroup 1.0 SurfactantGroup.qml
Loading