author | cniehaus <cniehaus> | 2002-09-17 11:26:33 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-17 11:26:33 (UTC) |
commit | bb15715567b88dd01f074092c1c4c3b7e0702693 (patch) (unidiff) | |
tree | 01bbe60177230f5e9b5b482c4e436e454b5c933e | |
parent | 92b88813ad8d6352fbf74964fc56dfc1a2aada8c (diff) | |
download | opie-bb15715567b88dd01f074092c1c4c3b7e0702693.zip opie-bb15715567b88dd01f074092c1c4c3b7e0702693.tar.gz opie-bb15715567b88dd01f074092c1c4c3b7e0702693.tar.bz2 |
first attempt of a reimplementation of paintCell
-rw-r--r-- | noncore/apps/oxygen/dataTable.cpp | 29 | ||||
-rw-r--r-- | noncore/apps/oxygen/dataTable.h | 16 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/oxygen/datawidgetui.h | 2 |
4 files changed, 42 insertions, 7 deletions
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp index 80c0311..f03e973 100644 --- a/noncore/apps/oxygen/dataTable.cpp +++ b/noncore/apps/oxygen/dataTable.cpp | |||
@@ -13,3 +13,4 @@ | |||
13 | 13 | ||
14 | dataTable::dataTable() : QTable() | 14 | OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, |
15 | const char *name) : QTable(numRows, numRows, parent, name) | ||
15 | { | 16 | { |
@@ -17,5 +18,26 @@ dataTable::dataTable() : QTable() | |||
17 | 18 | ||
18 | void dataTable::paintCell( QPainter *p, int, int, const QRect &cr, bool ) | 19 | |
20 | void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) | ||
19 | { | 21 | { |
20 | if ( currentRow()%2) qDebug("foo" ); | 22 | if ( cr.width() == 0 || cr.height() == 0 ) |
23 | return; | ||
24 | if ( selected && | ||
25 | row == currentRow() && | ||
26 | col == currentColumn() ) | ||
27 | selected = FALSE; | ||
28 | |||
29 | int w = cr.width(); | ||
30 | int h = cr.height(); | ||
31 | |||
32 | QTableItem *itm = item( row, col ); | ||
33 | if ( itm ) { | ||
34 | p->save(); | ||
35 | itm->paint( p, colorGroup(), cr, selected ); | ||
36 | p->restore(); | ||
37 | } else { | ||
38 | if ( currentRow()%2 ) //every even row | ||
39 | p->fillRect( 0, 0, w, h, selected ? colorGroup().brush( QColorGroup::Highlight ) : colorGroup().brush( QColorGroup::Base ) ); | ||
40 | else //every odd row | ||
41 | p->fillRect( 0, 0, w, h, selected ? colorGroup().brush( QColorGroup::Highlight ) : colorGroup().brush( QColorGroup::Base ) ); | ||
42 | } | ||
21 | } | 43 | } |
@@ -24 +46,2 @@ void dataTable::paintCell( QPainter *p, int, int, const QRect &cr, bool ) | |||
24 | 46 | ||
47 | |||
diff --git a/noncore/apps/oxygen/dataTable.h b/noncore/apps/oxygen/dataTable.h index 7fd9517..5adbcc2 100644 --- a/noncore/apps/oxygen/dataTable.h +++ b/noncore/apps/oxygen/dataTable.h | |||
@@ -10,5 +10,9 @@ | |||
10 | 10 | ||
11 | #ifndef _DATATABLE_H | ||
12 | #define _DATATABLE_H | ||
13 | |||
14 | |||
11 | #include <qtable.h> | 15 | #include <qtable.h> |
12 | 16 | ||
13 | class dataTable : public QTable | 17 | class OxydataTable : public QTable |
14 | { | 18 | { |
@@ -17,6 +21,14 @@ class dataTable : public QTable | |||
17 | public: | 21 | public: |
18 | dataTable(); | 22 | OxydataTable(); |
23 | OxydataTable( int numRows, int numCols, | ||
24 | QWidget *parent = 0, const char *name = 0 ); | ||
19 | 25 | ||
20 | protected: | 26 | protected: |
27 | /* | ||
28 | * This method is reimplemented form QTable. It implements the colourisation | ||
29 | * of every second row. | ||
30 | */ | ||
21 | virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); | 31 | virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); |
22 | }; | 32 | }; |
33 | |||
34 | #endif | ||
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp index 79d35e5..0f8a146 100644 --- a/noncore/apps/oxygen/datawidgetui.cpp +++ b/noncore/apps/oxygen/datawidgetui.cpp | |||
@@ -24,3 +24,3 @@ dataWidgetUI::dataWidgetUI() : QDialog() | |||
24 | dataCombo = new QComboBox( this ); | 24 | dataCombo = new QComboBox( this ); |
25 | DataTable = new QTable( 7,2, this ); | 25 | DataTable = new OxydataTable( 7,2, this ); |
26 | 26 | ||
diff --git a/noncore/apps/oxygen/datawidgetui.h b/noncore/apps/oxygen/datawidgetui.h index 0911f03..9427adf 100644 --- a/noncore/apps/oxygen/datawidgetui.h +++ b/noncore/apps/oxygen/datawidgetui.h | |||
@@ -24,3 +24,3 @@ class dataWidgetUI : public QDialog | |||
24 | void createTableLayout(); | 24 | void createTableLayout(); |
25 | QTable *DataTable; | 25 | OxydataTable *DataTable; |
26 | QComboBox *dataCombo; | 26 | QComboBox *dataCombo; |