summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/oxygen/dataTable.cpp35
-rw-r--r--noncore/apps/oxygen/dataTable.h23
-rw-r--r--noncore/apps/oxygen/datawidgetui.cpp2
-rw-r--r--noncore/apps/oxygen/psewidget.cpp2
4 files changed, 42 insertions, 20 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
@@ -59,6 +59,7 @@ void OxydataWidget::setElement( int el )
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" ) );
@@ -68,6 +69,7 @@ void OxydataWidget::setElement( int el )
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
@@ -81,11 +83,21 @@ void OxydataWidget::setTable() const
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();
@@ -94,13 +106,6 @@ OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent,
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 )
@@ -120,3 +125,17 @@ void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, b
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
diff --git a/noncore/apps/oxygen/dataTable.h b/noncore/apps/oxygen/dataTable.h
index 00063d4..a4a3b18 100644
--- a/noncore/apps/oxygen/dataTable.h
+++ b/noncore/apps/oxygen/dataTable.h
@@ -16,7 +16,6 @@
16 16
17class QLabel; 17class QLabel;
18class OxydataTable; 18class OxydataTable;
19class QTableItem;
20 19
21/* 20/*
22 * A OxydataWidget shows all known data of an element. It can 21 * A OxydataWidget shows all known data of an element. It can
@@ -60,9 +59,6 @@ class OxydataTable : public QTable
60 OxydataTable( int numRows, int numCols, 59 OxydataTable( int numRows, int numCols,
61 QWidget *parent = 0, const char *name = 0 ); 60 QWidget *parent = 0, const char *name = 0 );
62 61
63 virtual int alignment() const;
64// virtual QTableItem *item( int row, int col ) const;
65
66 protected: 62 protected:
67 /* 63 /*
68 * This method is reimplemented form QTable. It implements the colourisation 64 * This method is reimplemented form QTable. It implements the colourisation
@@ -70,12 +66,19 @@ class OxydataTable : public QTable
70 */ 66 */
71 virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); 67 virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected );
72}; 68};
69/*
70 * A OxydataQTI is a QTableItem which has the ability to set an alignment.
71 * In Oxygen we only have two colums so I can use the simple col()%2.
72 *
73 * Author: Robert Gogolok <robertgogolok@gmx.de>
74 */
73 75
74//X class OxydataQTI : QTableItem 76class OxydataQTI : public QTableItem
75//X { 77{
76//X Q_OBJECT 78 public:
77//X 79 OxydataQTI(QTable * table, EditType et, const QString & text );
78//X public: 80
79//X OxydataQTI( 81 virtual int alignment() const;
82};
80 83
81#endif 84#endif
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp
index 4dab109..422b6f8 100644
--- a/noncore/apps/oxygen/datawidgetui.cpp
+++ b/noncore/apps/oxygen/datawidgetui.cpp
@@ -43,7 +43,7 @@ dataWidgetUI::dataWidgetUI() : QWidget()
43 43
44 OxydataWidget *oxyDW = new OxydataWidget(this); 44 OxydataWidget *oxyDW = new OxydataWidget(this);
45 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) ); 45 connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) );
46 oxyDW->setElement( 1 ); 46 oxyDW->setElement( 0 );
47 47
48 qgrid->addWidget( dataCombo, 0,0); 48 qgrid->addWidget( dataCombo, 0,0);
49 qgrid->addWidget( oxyDW , 1,0 ); 49 qgrid->addWidget( oxyDW , 1,0 );
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index a3bb505..449afef 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -47,7 +47,7 @@ PSEWidget::PSEWidget() : QWidget()
47 } 47 }
48 48
49 oxyDW = new OxydataWidget(this); 49 oxyDW = new OxydataWidget(this);
50 oxyDW->setElement( 1 ); 50 oxyDW->setElement( 0 );
51 51
52 vlay->addLayout( grid ); 52 vlay->addLayout( grid );
53 vlay->addWidget( oxyDW ); 53 vlay->addWidget( oxyDW );