author | cniehaus <cniehaus> | 2002-09-20 21:45:30 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-20 21:45:30 (UTC) |
commit | d5db444cb70986baceda8ad1e01b0fb8384d12b4 (patch) (unidiff) | |
tree | 65cab6b3cfb9c67336ce4f3e61d3e9df2476d8ca /noncore/apps/oxygen/dataTable.cpp | |
parent | 20c93734a4eada53d056f13558cbf60d6eff5bac (diff) | |
download | opie-d5db444cb70986baceda8ad1e01b0fb8384d12b4.zip opie-d5db444cb70986baceda8ad1e01b0fb8384d12b4.tar.gz opie-d5db444cb70986baceda8ad1e01b0fb8384d12b4.tar.bz2 |
from now on I consider Oxygen as almost done :)
* the strange display-bug in the QTable is fixed. Now there are really only
two colums and not a million or so
* now the alingment is correct. I reimplemented virtual void alignment() in
a class derived from QTableItem
* s/setElement( 1 )/setElement( 0 )/ as that method starts with 0 and not 1
Credits to Robert Gogolok who did most of the reimplementation of the
alignment.
Diffstat (limited to 'noncore/apps/oxygen/dataTable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 35 |
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 | |||
@@ -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 | ||
73 | void OxydataWidget::setTable() const | 75 | void 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 | ||
86 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, | 89 | OxydataTable::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 | ||
97 | int OxydataTable::alignment() const | ||
98 | { | ||
99 | return AlignLeft | AlignVCenter; | ||
100 | }; | ||
101 | |||
102 | |||
103 | |||
104 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) | 109 | void 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 | |||
129 | OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text ) | ||
130 | : QTableItem ( table, et, text ) | ||
131 | { | ||
132 | } | ||
133 | |||
134 | int OxydataQTI::alignment() const | ||
135 | { | ||
136 | if ( col()%2 ) | ||
137 | { | ||
138 | return AlignRight | AlignVCenter; | ||
139 | }else return AlignLeft | AlignVCenter; | ||
140 | }; | ||
141 | |||