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 | |
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.
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 35 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.h | 23 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 2 |
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 | |||
@@ -61,2 +61,3 @@ void OxydataWidget::setElement( int el ) | |||
61 | 61 | ||
62 | |||
62 | DataTable->setText( 0,1,configobj.readEntry( "Weight" ) ); | 63 | DataTable->setText( 0,1,configobj.readEntry( "Weight" ) ); |
@@ -70,2 +71,3 @@ void OxydataWidget::setElement( int el ) | |||
70 | DataTable->setText( 8,1,configobj.readEntry( "MP" ) ); | 71 | DataTable->setText( 8,1,configobj.readEntry( "MP" ) ); |
72 | |||
71 | } | 73 | } |
@@ -83,2 +85,3 @@ void OxydataWidget::setTable() const | |||
83 | DataTable->setText( 8,0, tr( "Meltingpoint" ) ); | 85 | DataTable->setText( 8,0, tr( "Meltingpoint" ) ); |
86 | |||
84 | } | 87 | } |
@@ -86,4 +89,13 @@ void OxydataWidget::setTable() const | |||
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 ); |
@@ -96,9 +108,2 @@ OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, | |||
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) |
@@ -122 +127,15 @@ void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, b | |||
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 | |||
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 | |||
@@ -18,3 +18,2 @@ class QLabel; | |||
18 | class OxydataTable; | 18 | class OxydataTable; |
19 | class QTableItem; | ||
20 | 19 | ||
@@ -62,5 +61,2 @@ class OxydataTable : public QTable | |||
62 | 61 | ||
63 | virtual int alignment() const; | ||
64 | // virtual QTableItem *item( int row, int col ) const; | ||
65 | |||
66 | protected: | 62 | protected: |
@@ -72,9 +68,16 @@ class OxydataTable : public QTable | |||
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 | 76 | class 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 | ||
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 | |||
@@ -45,3 +45,3 @@ dataWidgetUI::dataWidgetUI() : QWidget() | |||
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 | ||
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 | |||
@@ -49,3 +49,3 @@ PSEWidget::PSEWidget() : QWidget() | |||
49 | oxyDW = new OxydataWidget(this); | 49 | oxyDW = new OxydataWidget(this); |
50 | oxyDW->setElement( 1 ); | 50 | oxyDW->setElement( 0 ); |
51 | 51 | ||