Diffstat (limited to 'noncore/apps/oxygen/dataTable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp index bb786ea..642a8be 100644 --- a/noncore/apps/oxygen/dataTable.cpp +++ b/noncore/apps/oxygen/dataTable.cpp | |||
@@ -7,11 +7,88 @@ | |||
7 | * * | 7 | * * |
8 | **************************************************************************/ | 8 | **************************************************************************/ |
9 | 9 | ||
10 | #include <qpe/config.h> | ||
11 | |||
10 | #include "dataTable.h" | 12 | #include "dataTable.h" |
13 | #include <qwidget.h> | ||
14 | #include <qhbox.h> | ||
15 | #include <qvbox.h> | ||
16 | #include <qlabel.h> | ||
17 | #include <qfont.h> | ||
18 | #include <qlayout.h> | ||
19 | |||
20 | OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) | ||
21 | { | ||
22 | QGridLayout *qgrid = new QGridLayout( this, 2,1 ); | ||
23 | QHBox *hbox = new QHBox( this ); | ||
24 | left = new QLabel( hbox ); | ||
25 | middle = new QLabel( hbox ); | ||
26 | right = new QLabel( hbox ); | ||
27 | |||
28 | DataTable = new OxydataTable( 9,2, this ); | ||
29 | |||
30 | QFont bf; | ||
31 | bf.setBold( true ); | ||
32 | bf.setPointSize( bf.pointSize()+2 ); | ||
33 | middle->setFont( bf ); | ||
34 | |||
35 | setTable(); | ||
36 | |||
37 | qgrid->addWidget( hbox,0,0 ); | ||
38 | qgrid->addWidget( DataTable,1,0 ); | ||
39 | } | ||
40 | |||
41 | void OxydataWidget::setElement( int el ) | ||
42 | { | ||
43 | Config test( "/home/opie/Settings/oxygendata", Config::File ); | ||
44 | test.setGroup( QString::number( el+1 )); | ||
45 | |||
46 | left->setText( test.readEntry( "Symbol" ) ); | ||
47 | middle->setText( test.readEntry( "Name" ) ); | ||
48 | right->setText( QString::number( el+1 ) ); | ||
49 | |||
50 | QString weight = test.readEntry( "Weight" ); | ||
51 | DataTable->setText( 0,1,weight ); | ||
52 | QString block = test.readEntry( "Block" ); | ||
53 | DataTable->setText( 1,1,block ); | ||
54 | QString grp = test.readEntry( "Group" ); | ||
55 | DataTable->setText( 2,1,grp ); | ||
56 | QString en = test.readEntry( "EN" ); | ||
57 | DataTable->setText( 3,1,en ); | ||
58 | QString ar = test.readEntry( "AR" ); | ||
59 | DataTable->setText( 4,1,ar ) ; | ||
60 | QString ion = test.readEntry( "IE" ); | ||
61 | DataTable->setText( 5,1,ion ); | ||
62 | QString dens = test.readEntry( "Density" ); | ||
63 | DataTable->setText( 6,1,dens ); | ||
64 | QString bp = test.readEntry( "BP" ); | ||
65 | DataTable->setText( 7,1,bp ); | ||
66 | QString mp = test.readEntry( "MP" ); | ||
67 | DataTable->setText( 8,1,mp ); | ||
68 | } | ||
69 | |||
70 | void OxydataWidget::setTable() | ||
71 | { | ||
72 | DataTable->setText( 0,0, tr( "Weight:" ) ); | ||
73 | DataTable->setText( 1,0, tr( "Block" )) ; | ||
74 | DataTable->setText( 2,0, tr( "Group" )) ; | ||
75 | DataTable->setText( 3,0, tr( "Electronegativity" )) ; | ||
76 | DataTable->setText( 4,0, tr( "Atomic radius" )) ; | ||
77 | DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; | ||
78 | DataTable->setText( 6,0, tr( "Density" )) ; | ||
79 | DataTable->setText( 7,0, tr( "Boilingpoint" ) ); | ||
80 | DataTable->setText( 8,0, tr( "Meltingpoint" ) ); | ||
81 | } | ||
11 | 82 | ||
12 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, | 83 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, |
13 | const char *name) : QTable(numRows, numRows, parent, name) | 84 | const char *name) : QTable(numRows, numRows, parent, name) |
14 | { | 85 | { |
86 | this->setShowGrid( false ); | ||
87 | this->setHScrollBarMode(QScrollView::AlwaysOff); | ||
88 | this->horizontalHeader()->hide(); | ||
89 | this->verticalHeader()->hide(); | ||
90 | this->setTopMargin( 0 ); | ||
91 | this->setLeftMargin( 0 ); | ||
15 | } | 92 | } |
16 | 93 | ||
17 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) | 94 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) |