author | cniehaus <cniehaus> | 2002-09-18 13:54:36 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-18 13:54:36 (UTC) |
commit | 6008e7d286293a87fca4ff43729bdfa66d700989 (patch) (side-by-side diff) | |
tree | bd0b5067e9914f0aca79540511dceea662a11d62 /noncore/apps/oxygen/datawidgetui.cpp | |
parent | 15ecc4aa71878039ad40ce270fae06282d8e98c2 (diff) | |
download | opie-6008e7d286293a87fca4ff43729bdfa66d700989.zip opie-6008e7d286293a87fca4ff43729bdfa66d700989.tar.gz opie-6008e7d286293a87fca4ff43729bdfa66d700989.tar.bz2 |
This is far better: I use 2 more classes, everything is far more OO
Diffstat (limited to 'noncore/apps/oxygen/datawidgetui.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 76 |
1 files changed, 8 insertions, 68 deletions
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp index 7256777..fa3f40d 100644 --- a/noncore/apps/oxygen/datawidgetui.cpp +++ b/noncore/apps/oxygen/datawidgetui.cpp @@ -9,5 +9,5 @@ #include "oxygen.h" +#include "datawidgetui.h" #include <qpe/config.h> -#include "datawidgetui.h" #include <qstring.h> @@ -23,22 +23,11 @@ dataWidgetUI::dataWidgetUI() : QDialog() - QVBoxLayout *vbox = new QVBoxLayout( this ); + QGridLayout *qgrid = new QGridLayout( this, 2,1 ); dataCombo = new QComboBox( this ); - DataTable = new OxydataTable( 8,2, this ); - DataTable->setShowGrid( false ); - DataTable->setHScrollBarMode(QScrollView::AlwaysOff); - - QHBox *hbox = new QHBox( this ); - left = new QLabel( hbox ); - middle = new QLabel( hbox ); - right = new QLabel( hbox ); - - vbox->addWidget( dataCombo ); - vbox->addWidget( hbox ); - vbox->addWidget( DataTable ); + OxydataWidget *oxyDW = new OxydataWidget(this); + oxyDW->setElement( 1 ); + qgrid->addWidget( dataCombo, 0,0); + qgrid->addWidget( oxyDW , 1,0 ); - DataTable->show(); - dataCombo->show(); - - connect ( dataCombo, SIGNAL( activated(int) ), this, SLOT( slotShowData(int) ) ); + connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); Config test( "/home/opie/Settings/oxygendata", Config::File ); @@ -52,24 +41,4 @@ dataWidgetUI::dataWidgetUI() : QDialog() } - - createTableLayout(); - slotShowData( 1 ); //this way we do always get data here - } -void dataWidgetUI::createTableLayout(){ - DataTable->horizontalHeader()->hide(); - DataTable->verticalHeader()->hide(); - DataTable->setTopMargin( 0 ); - DataTable->setLeftMargin( 0 ); - - DataTable->setText( 0,0,"Weight:" ); - DataTable->setText( 1,0,"Block" ); - DataTable->setText( 2,0,"Group" ); - DataTable->setText( 3,0,"Electronegativity" ); - DataTable->setText( 4,0,"Atomic radius" ); - DataTable->setText( 5,0,"Ionizationenergie" ); - DataTable->setText( 6,0,"Density" ); - DataTable->setText( 7,0, tr( "Boilingpoint" ) ); - DataTable->setText( 8,0, tr( "Meltingpoint" ) ); -} @@ -77,32 +46,3 @@ void dataWidgetUI::createTableLayout(){ void dataWidgetUI::slotShowData(int number){ - Config test( "/home/opie/Settings/oxygendata", Config::File ); - test.setGroup( QString::number( number+1 )); - - left->setText( test.readEntry( "Symbol" ) ); - middle->setText( test.readEntry( "Name" ) ); - right->setText( QString::number( number+1 ) ); - - QFont bf; - bf.setBold( true ); - bf.setPointSize( bf.pointSize()+2 ); - middle->setFont( bf ); - - QString weight = test.readEntry( "Weight" ); - DataTable->setText( 0,1,weight ); - QString block = test.readEntry( "Block" ); - DataTable->setText( 1,1,block ); - QString grp = test.readEntry( "Group" ); - DataTable->setText( 2,1,grp ); - QString en = test.readEntry( "EN" ); - DataTable->setText( 3,1,en ); - QString ar = test.readEntry( "AR" ); - DataTable->setText( 4,1,ar ) ; - QString ion = test.readEntry( "IE" ); - DataTable->setText( 5,1,ion ); - QString dens = test.readEntry( "Density" ); - DataTable->setText( 6,1,dens ); - QString bp = test.readEntry( "BP" ); - DataTable->setText( 7,1,bp ); - QString mp = test.readEntry( "MP" ); - DataTable->setText( 7,1,mp ); + oxyDW->setElement( 6 ); } |