author | cniehaus <cniehaus> | 2002-09-16 18:21:45 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-16 18:21:45 (UTC) |
commit | 5502a0dc488a96eed8105762a9183f53ef4fe50c (patch) (side-by-side diff) | |
tree | 38f57c98ffe84a4c01d8820237042c468a816a45 | |
parent | 79b8169dfefae4c3b6bfe0652270bb66a04a6b3f (diff) | |
download | opie-5502a0dc488a96eed8105762a9183f53ef4fe50c.zip opie-5502a0dc488a96eed8105762a9183f53ef4fe50c.tar.gz opie-5502a0dc488a96eed8105762a9183f53ef4fe50c.tar.bz2 |
ok, fixed the stupid bugs :)) Works now (click on "Data")
-rw-r--r-- | noncore/apps/oxygen/datawidget.ui | 24 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 57 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.h | 6 |
3 files changed, 53 insertions, 34 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 @@ -1,85 +1,67 @@ <!DOCTYPE UI><UI> <class>dataWidget</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>dataWidget</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>249</width> + <width>245</width> <height>276</height> </rect> </property> <property stdset="1"> <name>caption</name> <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> <x>10</x> <y>10</y> <width>230</width> <height>50</height> </rect> </property> </widget> <widget> <class>QTable</class> <property stdset="1"> <name>name</name> <cstring>dataTable</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>80</y> <width>240</width> <height>190</height> </rect> </property> <property stdset="1"> <name>numRows</name> - <number>6</number> + <number>8</number> </property> <property stdset="1"> <name>numCols</name> <number>2</number> </property> <property stdset="1"> <name>showGrid</name> <bool>false</bool> </property> </widget> </widget> </UI> 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 @@ -1,40 +1,71 @@ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include "oxygen.h" #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" ); - //test.writeEntry( "Name", "test123" ); + dataCombo->insertItem( foo ); + } - qDebug( "hier sollte was kommen" ); - qDebug( foo ); + 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,"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 @@ -1,20 +1,26 @@ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include "datawidget.h" class QTable; class dataWidgetUI : public dataWidget { Q_OBJECT public: dataWidgetUI(); + + private: + void createTableLayout(); + + private slots: + void slotShowData(int); }; |