summaryrefslogtreecommitdiff
path: root/noncore/apps/oxygen/dataTable.cpp
Unidiff
Diffstat (limited to 'noncore/apps/oxygen/dataTable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/dataTable.cpp35
1 files changed, 27 insertions, 8 deletions
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp
index ff01417..f034c45 100644
--- a/noncore/apps/oxygen/dataTable.cpp
+++ b/noncore/apps/oxygen/dataTable.cpp
@@ -56,21 +56,23 @@ void OxydataWidget::setElement( int el )
56 configobj.setGroup( QString::number( el+1 )); 56 configobj.setGroup( QString::number( el+1 ));
57 57
58 left->setText( configobj.readEntry( "Symbol" ) ); 58 left->setText( configobj.readEntry( "Symbol" ) );
59 middle->setText( configobj.readEntry( "Name" ) ); 59 middle->setText( configobj.readEntry( "Name" ) );
60 right->setText( QString::number( el+1 ) ); 60 right->setText( QString::number( el+1 ) );
61 61
62
62 DataTable->setText( 0,1,configobj.readEntry( "Weight" ) ); 63 DataTable->setText( 0,1,configobj.readEntry( "Weight" ) );
63 DataTable->setText( 1,1,configobj.readEntry( "Block" ) ); 64 DataTable->setText( 1,1,configobj.readEntry( "Block" ) );
64 DataTable->setText( 2,1,configobj.readEntry( "Group" ) ); 65 DataTable->setText( 2,1,configobj.readEntry( "Group" ) );
65 DataTable->setText( 3,1,configobj.readEntry( "EN" ) ); 66 DataTable->setText( 3,1,configobj.readEntry( "EN" ) );
66 DataTable->setText( 4,1,configobj.readEntry( "AR" ) ) ; 67 DataTable->setText( 4,1,configobj.readEntry( "AR" ) ) ;
67 DataTable->setText( 5,1,configobj.readEntry( "IE" ) ); 68 DataTable->setText( 5,1,configobj.readEntry( "IE" ) );
68 DataTable->setText( 6,1,configobj.readEntry( "Density" ) ); 69 DataTable->setText( 6,1,configobj.readEntry( "Density" ) );
69 DataTable->setText( 7,1,configobj.readEntry( "BP" ) ); 70 DataTable->setText( 7,1,configobj.readEntry( "BP" ) );
70 DataTable->setText( 8,1,configobj.readEntry( "MP" ) ); 71 DataTable->setText( 8,1,configobj.readEntry( "MP" ) );
72
71} 73}
72 74
73void OxydataWidget::setTable() const 75void OxydataWidget::setTable() const
74{ 76{
75 DataTable->setText( 0,0, tr( "Weight:" ) ); 77 DataTable->setText( 0,0, tr( "Weight:" ) );
76 DataTable->setText( 1,0, tr( "Block" )) ; 78 DataTable->setText( 1,0, tr( "Block" )) ;
@@ -78,32 +80,35 @@ void OxydataWidget::setTable() const
78 DataTable->setText( 3,0, tr( "Electronegativity" )) ; 80 DataTable->setText( 3,0, tr( "Electronegativity" )) ;
79 DataTable->setText( 4,0, tr( "Atomic radius" )) ; 81 DataTable->setText( 4,0, tr( "Atomic radius" )) ;
80 DataTable->setText( 5,0, tr( "Ionizationenergie" )) ; 82 DataTable->setText( 5,0, tr( "Ionizationenergie" )) ;
81 DataTable->setText( 6,0, tr( "Density" )) ; 83 DataTable->setText( 6,0, tr( "Density" )) ;
82 DataTable->setText( 7,0, tr( "Boilingpoint" ) ); 84 DataTable->setText( 7,0, tr( "Boilingpoint" ) );
83 DataTable->setText( 8,0, tr( "Meltingpoint" ) ); 85 DataTable->setText( 8,0, tr( "Meltingpoint" ) );
86
84} 87}
85 88
86OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, 89OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent,
87 const char *name) : QTable(numRows, numRows, parent, name) 90 const char *name) : QTable(numRows, numCols,parent, name)
88{ 91{
92
93 for (int zeile = 0; zeile < numRows; zeile++)
94 for ( int spalte = 0; spalte < numCols; spalte++ )
95 {
96 OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" );
97 setItem(zeile, spalte, (QTableItem*)testus);
98 }
99
100
89 this->setShowGrid( false ); 101 this->setShowGrid( false );
90 this->setHScrollBarMode(QScrollView::AlwaysOff); 102 this->setHScrollBarMode(QScrollView::AlwaysOff);
91 this->horizontalHeader()->hide(); 103 this->horizontalHeader()->hide();
92 this->verticalHeader()->hide(); 104 this->verticalHeader()->hide();
93 this->setTopMargin( 0 ); 105 this->setTopMargin( 0 );
94 this->setLeftMargin( 0 ); 106 this->setLeftMargin( 0 );
95} 107}
96 108
97int OxydataTable::alignment() const
98{
99 return AlignLeft | AlignVCenter;
100};
101
102
103
104void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) 109void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected)
105{ 110{
106 if ( cr.width() == 0 || cr.height() == 0 ) 111 if ( cr.width() == 0 || cr.height() == 0 )
107 return; 112 return;
108 selected = FALSE; 113 selected = FALSE;
109 114
@@ -117,6 +122,20 @@ void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, b
117 colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) ); 122 colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) );
118 p->save(); 123 p->save();
119 itm->paint( p, colgrp, cr, selected ); 124 itm->paint( p, colgrp, cr, selected );
120 p->restore(); 125 p->restore();
121 } 126 }
122} 127}
128
129OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text )
130 : QTableItem ( table, et, text )
131{
132}
133
134int OxydataQTI::alignment() const
135{
136 if ( col()%2 )
137 {
138 return AlignRight | AlignVCenter;
139 }else return AlignLeft | AlignVCenter;
140};
141