Automatically update density of found

This commit is contained in:
salman 2015-02-20 18:27:40 +01:00
parent 550c5b44f6
commit ab5b8480cf
3 changed files with 28 additions and 9 deletions

View File

@ -928,17 +928,19 @@ Copyright 2009-2013 by Zaher Salman.
sub findDensity()
{
use Chem;
# This is needed only for changes in the first column
my $col = this->{ui}->layerTable->currentColumn();
my $row = this->{ui}->layerTable->currentRow();
if ($col == 0) {
# Get sender name to know which layer
my $sender = this->sender()->objectName();
# Generate the name of the density field
my $rhoSender = substr($sender,0,6)."rho";
my $sender = this->{ui}->layerTable->currentItem();
# Get the compound formula
my $Compound = this->sender()->text();
my $Compound = $sender->text();
# See if you have the density
my $Density=Chem::Densities($Compound);
# If the density is in the database submit it
my $rho = child("Qt::LineEdit",$rhoSender);
$rho->setText($Density);
if ($Density != 0 ) {this->{ui}->layerTable->item($row,$col+1)->setText($Density);}
}
}
# Subroutine: keep for tests and debugging

View File

@ -2088,6 +2088,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>layerTable</sender>
<signal>cellChanged(int,int)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>233</x>
<y>332</y>
</hint>
<hint type="destinationlabel">
<x>360</x>
<y>310</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>DirectoryBrowse()</slot>

View File

@ -3,9 +3,9 @@
###############################################################################
#################################################################################
## Form generated from reading UI file 'TrimSPGUI4-test.ui'
## Form generated from reading UI file 'TrimSPGUI4.ui'
##
## Created: Fri Feb 20 17:48:51 2015
## Created: Fri Feb 20 18:27:08 2015
## by: Qt User Interface Compiler version 4.8.6
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
@ -1307,6 +1307,7 @@ sub setupUi {
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()' );
Qt::Object::connect($layerTable, SIGNAL 'cellChanged(int,int)' , $trimSPGUI4, SLOT 'findDensity()' );
$tabs->setCurrentIndex( 0 );