Unlimited number of layers in GUI.

This commit is contained in:
salman 2015-02-20 17:55:05 +01:00
parent 1b01dfca9a
commit 29ed79890b
4 changed files with 125 additions and 609 deletions

View File

@ -41,7 +41,7 @@
<attribute name="title">
<string>Layers</string>
</attribute>
<widget class="QGroupBox" name="groupBox1">
<widget class="QGroupBox" name="groupLayer">
<property name="geometry">
<rect>
<x>10</x>
@ -62,7 +62,7 @@
<height>481</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="layerLayout">
<item row="0" column="0">
<widget class="QLabel" name="textLabel1_4">
<property name="text">
@ -2072,6 +2072,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>numLayer</sender>
<signal>valueChanged(int)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>PrepLayers()</slot>
<hints>
<hint type="sourcelabel">
<x>169</x>
<y>90</y>
</hint>
<hint type="destinationlabel">
<x>360</x>
<y>310</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>DirectoryBrowse()</slot>

View File

@ -163,16 +163,8 @@ sub PrepLayers()
my %All=();
# Get number of layers to define
$All{"numLayer"}=this->{ui}->numLayer->value();
# Enable required number
for (my $i=2;$i<=7;$i++) {
my $LayerName = "boxL".$i;
my $LayerAttrib = child("Qt::GroupBox",$LayerName);
if ($i<=$All{"numLayer"}) {
$LayerAttrib->setDisabled(0);
} else {
$LayerAttrib->setDisabled(1);
}
}
# Set appropriate number of rows
this->{ui}->layerTable->setRowCount($All{"numLayer"});
}
# Subroutine: Set sane default values for projectile energy distribution and angles

View File

@ -41,7 +41,7 @@
<attribute name="title">
<string>Layers</string>
</attribute>
<widget class="QGroupBox" name="groupBox1">
<widget class="QGroupBox" name="groupLayer">
<property name="geometry">
<rect>
<x>10</x>
@ -53,456 +53,97 @@
<property name="title">
<string>Layers</string>
</property>
<widget class="QWidget" name="layout27">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>5</x>
<y>20</y>
<width>421</width>
<x>10</x>
<y>21</y>
<width>411</width>
<height>481</height>
</rect>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>3</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="textLabel1_4">
<property name="text">
<string>Number of Layers</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="numLayer">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>7</number>
</property>
</widget>
</item>
<item>
<spacer name="spacer2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>251</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="textLabel2_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Chemical formula</string>
</property>
<property name="text">
<string>Composition</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="spacer1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>101</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="textLabel3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Density [g/cm&lt;sup&gt;3&lt;/sup&gt;]</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="textLabel4">
<property name="text">
<string>Thickness [Å]</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="boxL1">
<property name="title">
<string>Layer 1</string>
<layout class="QGridLayout" name="layerLayout">
<item row="0" column="0">
<widget class="QLabel" name="textLabel1_4">
<property name="text">
<string>Number of Layers</string>
</property>
<widget class="QLineEdit" name="layer1Comp">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="numLayer">
<property name="whatsThis">
<string>Select the number of the layers of your structure (maximum 7 layers).</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="spacer2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>240</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="3">
<widget class="QTableWidget" name="layerTable">
<property name="rowCount">
<number>1</number>
</property>
<property name="columnCount">
<number>3</number>
</property>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>30</number>
</attribute>
<row/>
<column>
<property name="text">
<string>Composition</string>
</property>
<property name="toolTip">
<string>Chemical formula of L1</string>
</column>
<column>
<property name="text">
<string>Density [g/cm^3]</string>
</property>
</column>
<column>
<property name="text">
<string>Thickness [A]</string>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>SrTiO3</string>
</property>
</widget>
<widget class="QLineEdit" name="layer1rho">
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</item>
<item row="0" column="1">
<property name="text">
<string>5.12</string>
</property>
</widget>
<widget class="QLineEdit" name="layer1d">
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</item>
<item row="0" column="2">
<property name="text">
<string>200</string>
<string>1000</string>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="boxL2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Layer 2</string>
</property>
<widget class="QLineEdit" name="layer2Comp">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="layer2rho">
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="layer2d">
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="boxL3">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Layer 3</string>
</property>
<widget class="QLineEdit" name="layer3Comp">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="layer3rho">
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="layer3d">
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="boxL4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Layer 4</string>
</property>
<widget class="QLineEdit" name="layer4Comp">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="layer4rho">
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="layer4d">
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="boxL5">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Layer 5</string>
</property>
<widget class="QLineEdit" name="layer5Comp">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="layer5rho">
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="layer5d">
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="boxL6">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Layer 6</string>
</property>
<widget class="QLineEdit" name="layer6Comp">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="layer6rho">
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="layer6d">
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="boxL7">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Layer 7</string>
</property>
<widget class="QLineEdit" name="layer7Comp">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="layer7rho">
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="layer7d">
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</widget>
</item>
</layout>
@ -2040,28 +1681,6 @@
<layoutdefault spacing="6" margin="11"/>
<tabstops>
<tabstop>tabs</tabstop>
<tabstop>numLayer</tabstop>
<tabstop>layer1Comp</tabstop>
<tabstop>layer1rho</tabstop>
<tabstop>layer1d</tabstop>
<tabstop>layer2Comp</tabstop>
<tabstop>layer2rho</tabstop>
<tabstop>layer2d</tabstop>
<tabstop>layer3Comp</tabstop>
<tabstop>layer3rho</tabstop>
<tabstop>layer3d</tabstop>
<tabstop>layer4Comp</tabstop>
<tabstop>layer4rho</tabstop>
<tabstop>layer4d</tabstop>
<tabstop>layer5Comp</tabstop>
<tabstop>layer5rho</tabstop>
<tabstop>layer5d</tabstop>
<tabstop>layer6Comp</tabstop>
<tabstop>layer6rho</tabstop>
<tabstop>layer6d</tabstop>
<tabstop>layer7Comp</tabstop>
<tabstop>layer7rho</tabstop>
<tabstop>layer7d</tabstop>
<tabstop>projComboBox</tabstop>
<tabstop>numberProj</tabstop>
<tabstop>z0</tabstop>
@ -2117,22 +1736,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>numLayer</sender>
<signal>valueChanged(int)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>PrepLayers()</slot>
<hints>
<hint type="sourcelabel">
<x>193</x>
<y>114</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>Browse</sender>
<signal>clicked()</signal>
@ -2470,114 +2073,18 @@
</hints>
</connection>
<connection>
<sender>layer1Comp</sender>
<signal>textChanged(QString)</signal>
<sender>numLayer</sender>
<signal>valueChanged(int)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<slot>PrepLayers()</slot>
<hints>
<hint type="sourcelabel">
<x>131</x>
<y>219</y>
<x>169</x>
<y>90</y>
</hint>
<hint type="destinationlabel">
<x>722</x>
<y>391</y>
</hint>
</hints>
</connection>
<connection>
<sender>layer2Comp</sender>
<signal>textChanged(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>108</x>
<y>271</y>
</hint>
<hint type="destinationlabel">
<x>721</x>
<y>357</y>
</hint>
</hints>
</connection>
<connection>
<sender>layer3Comp</sender>
<signal>textChanged(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>90</x>
<y>320</y>
</hint>
<hint type="destinationlabel">
<x>720</x>
<y>427</y>
</hint>
</hints>
</connection>
<connection>
<sender>layer4Comp</sender>
<signal>textChanged(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>79</x>
<y>382</y>
</hint>
<hint type="destinationlabel">
<x>718</x>
<y>458</y>
</hint>
</hints>
</connection>
<connection>
<sender>layer5Comp</sender>
<signal>textChanged(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>102</x>
<y>434</y>
</hint>
<hint type="destinationlabel">
<x>718</x>
<y>488</y>
</hint>
</hints>
</connection>
<connection>
<sender>layer6Comp</sender>
<signal>textEdited(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>88</x>
<y>481</y>
</hint>
<hint type="destinationlabel">
<x>719</x>
<y>603</y>
</hint>
</hints>
</connection>
<connection>
<sender>layer7Comp</sender>
<signal>textChanged(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>71</x>
<y>532</y>
</hint>
<hint type="destinationlabel">
<x>714</x>
<y>-7</y>
<x>360</x>
<y>310</y>
</hint>
</hints>
</connection>

View File

@ -5,7 +5,7 @@
#################################################################################
## Form generated from reading UI file 'TrimSPGUI4-test.ui'
##
## Created: Fri Feb 20 16:50:06 2015
## Created: Fri Feb 20 17:48:51 2015
## by: Qt User Interface Compiler version 4.8.6
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
@ -82,16 +82,16 @@ sub layersTab {
return shift->{layersTab};
}
sub groupBox1 {
return shift->{groupBox1};
sub groupLayer {
return shift->{groupLayer};
}
sub layoutWidget {
return shift->{layoutWidget};
}
sub gridLayout1 {
return shift->{gridLayout1};
sub layerLayout {
return shift->{layerLayout};
}
sub textLabel1_4 {
@ -581,26 +581,26 @@ sub setupUi {
my $layersTab = Qt::Widget( );
$self->{layersTab} = $layersTab;
$layersTab->setObjectName( "layersTab" );
my $groupBox1 = Qt::GroupBox( $layersTab );
$self->{groupBox1} = $groupBox1;
$groupBox1->setObjectName( "groupBox1" );
$groupBox1->setGeometry( Qt::Rect(10, 10, 431, 511) );
my $layoutWidget = Qt::Widget( $groupBox1 );
my $groupLayer = Qt::GroupBox( $layersTab );
$self->{groupLayer} = $groupLayer;
$groupLayer->setObjectName( "groupLayer" );
$groupLayer->setGeometry( Qt::Rect(10, 10, 431, 511) );
my $layoutWidget = Qt::Widget( $groupLayer );
$self->{layoutWidget} = $layoutWidget;
$layoutWidget->setObjectName( "layoutWidget" );
$layoutWidget->setGeometry( Qt::Rect(10, 21, 411, 481) );
my $gridLayout1 = Qt::GridLayout( $layoutWidget );
$self->{gridLayout1} = $gridLayout1;
$gridLayout1->setSpacing( 6 );
$gridLayout1->setMargin( 11 );
$gridLayout1->setObjectName( "gridLayout1" );
$gridLayout1->setContentsMargins(0, 0, 0, 0 );
my $layerLayout = Qt::GridLayout( $layoutWidget );
$self->{layerLayout} = $layerLayout;
$layerLayout->setSpacing( 6 );
$layerLayout->setMargin( 11 );
$layerLayout->setObjectName( "layerLayout" );
$layerLayout->setContentsMargins(0, 0, 0, 0 );
my $textLabel1_4 = Qt::Label( $layoutWidget );
$self->{textLabel1_4} = $textLabel1_4;
$textLabel1_4->setObjectName( "textLabel1_4" );
$textLabel1_4->setWordWrap( 0 );
$gridLayout1->addWidget( $textLabel1_4, 0, 0, 1, 1 );
$layerLayout->addWidget( $textLabel1_4, 0, 0, 1, 1 );
my $numLayer = Qt::SpinBox( $layoutWidget );
$self->{numLayer} = $numLayer;
@ -608,11 +608,11 @@ sub setupUi {
$numLayer->setMinimum( 1 );
$numLayer->setMaximum( 100 );
$gridLayout1->addWidget( $numLayer, 0, 1, 1, 1 );
$layerLayout->addWidget( $numLayer, 0, 1, 1, 1 );
my $spacer2 = Qt::SpacerItem( 240, 20, Qt::SizePolicy::Expanding(), Qt::SizePolicy::Minimum() );
$gridLayout1->addItem( $spacer2, 0, 2, 1, 1 );
$layerLayout->addItem( $spacer2, 0, 2, 1, 1 );
my $layerTable = Qt::TableWidget( $layoutWidget );
$self->{layerTable} = $layerTable;
@ -620,7 +620,7 @@ sub setupUi {
$layerTable->setRowCount( 1 );
$layerTable->setColumnCount( 3 );
$gridLayout1->addWidget( $layerTable, 1, 0, 1, 3 );
$layerLayout->addWidget( $layerTable, 1, 0, 1, 3 );
my $projParam = Qt::GroupBox( $layersTab );
$self->{projParam} = $projParam;
@ -1306,6 +1306,7 @@ sub setupUi {
Qt::Object::connect($projComboBox, SIGNAL 'currentIndexChanged(int)' , $trimSPGUI4, SLOT 'ProjSmartDefaults()' );
Qt::Object::connect($trimBinBrowse, SIGNAL 'clicked()' , $trimSPGUI4, SLOT 'TrimBin()' );
Qt::Object::connect($guiPathBrowse, SIGNAL 'clicked()' , $trimSPGUI4, SLOT 'GUIPath()' );
Qt::Object::connect($numLayer, SIGNAL 'valueChanged(int)' , $trimSPGUI4, SLOT 'PrepLayers()' );
$tabs->setCurrentIndex( 0 );
@ -1354,7 +1355,7 @@ sub retranslateUi {
$self->{fileOpenAction}->setShortcut( Qt::KeySequence( Qt::Application::translate( 'TrimSPGUI4', "Ctrl+O", undef, Qt::Application::UnicodeUTF8() ) ) );
$self->{plotMeanAction}->setText( Qt::Application::translate( 'TrimSPGUI4', "Plot Mean/Stragg.", undef, Qt::Application::UnicodeUTF8() ) );
$self->{plotMeanAction}->setShortcut( Qt::KeySequence( Qt::Application::translate( 'TrimSPGUI4', "Ctrl+P, Ctrl+M", undef, Qt::Application::UnicodeUTF8() ) ) );
$self->{groupBox1}->setTitle( Qt::Application::translate( 'TrimSPGUI4', "Layers", undef, Qt::Application::UnicodeUTF8() ) );
$self->{groupLayer}->setTitle( Qt::Application::translate( 'TrimSPGUI4', "Layers", undef, Qt::Application::UnicodeUTF8() ) );
$self->{textLabel1_4}->setText( Qt::Application::translate( 'TrimSPGUI4', "Number of Layers", undef, Qt::Application::UnicodeUTF8() ) );
$self->{numLayer}->setWhatsThis( Qt::Application::translate( 'TrimSPGUI4', "Select the number of the layers of your structure (maximum 7 layers).", undef, Qt::Application::UnicodeUTF8() ) );
my $layerTable = $self->{layerTable};