-rw-r--r-- | noncore/apps/oxygen/datawidget.ui | 24 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 59 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.h | 6 |
3 files changed, 54 insertions, 35 deletions
diff --git a/noncore/apps/oxygen/datawidget.ui b/noncore/apps/oxygen/datawidget.ui index a4dcab2..4dc91ea 100644 --- a/noncore/apps/oxygen/datawidget.ui +++ b/noncore/apps/oxygen/datawidget.ui @@ -10,9 +10,9 @@ <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>249</width> + <width>245</width> <height>276</height> </rect> </property> <property stdset="1"> @@ -20,29 +20,11 @@ <string>Chemical Data</string> </property> <widget> <class>QComboBox</class> - <item> - <property> - <name>text</name> - <string>Helium</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>Carbon</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>Oxygen</string> - </property> - </item> <property stdset="1"> <name>name</name> - <cstring>ComboBox2</cstring> + <cstring>dataCombo</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> @@ -69,9 +51,9 @@ </rect> </property> <property stdset="1"> <name>numRows</name> - <number>6</number> + <number>8</number> </property> <property stdset="1"> <name>numCols</name> <number>2</number> diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp index 5b34cf5..67f59d9 100644 --- a/noncore/apps/oxygen/datawidgetui.cpp +++ b/noncore/apps/oxygen/datawidgetui.cpp @@ -11,30 +11,61 @@ #include <qpe/config.h> #include "datawidgetui.h" #include <qtable.h> #include <qstring.h> +#include <qcombobox.h> dataWidgetUI::dataWidgetUI() : dataWidget() { - Config test( "oxygendata" ); - test.setGroup( "1" ); + connect ( dataCombo, SIGNAL( activated(int) ), this, SLOT( slotShowData(int) ) ); + Config test( "/home/opie/Settings/oxygendata", Config::File ); - if ( test.hasKey( "Name" ) ) + //read in all names of the 118 elements + for ( int i = 1 ; i < 119 ; i++ ) { - qDebug ( "geht" ); - }else qDebug( "geht nicht" ); + test.setGroup( QString::number( i ) ); + QString foo = test.readEntry( "Name" ); + dataCombo->insertItem( foo ); + } - QString foo = test.readEntry( "Name" ); - //test.writeEntry( "Name", "test123" ); + createTableLayout(); + slotShowData( 1 ); //this way we do always get data here - qDebug( "hier sollte was kommen" ); - qDebug( foo ); - +} + +void dataWidgetUI::createTableLayout(){ dataTable->horizontalHeader()->hide(); dataTable->verticalHeader()->hide(); dataTable->setTopMargin( 0 ); dataTable->setLeftMargin( 0 ); - dataTable->setText( 0,0,"Atomic Radius" ); - dataTable->setText( 0,1,"17 nm" ); - dataTable->setText( 1,0,"Elec. neg." ); - dataTable->setText( 1,1,"234 Joule" ); + + 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,"Boilingpoint" ); +} + + +void dataWidgetUI::slotShowData(int number){ + Config test( "/home/opie/Settings/oxygendata", Config::File ); + test.setGroup( QString::number( number+1 )); + 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 ); } diff --git a/noncore/apps/oxygen/datawidgetui.h b/noncore/apps/oxygen/datawidgetui.h index 47d9698..582bc19 100644 --- a/noncore/apps/oxygen/datawidgetui.h +++ b/noncore/apps/oxygen/datawidgetui.h @@ -16,5 +16,11 @@ class dataWidgetUI : public dataWidget Q_OBJECT public: dataWidgetUI(); + + private: + void createTableLayout(); + + private slots: + void slotShowData(int); }; |