summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/dataTable.cpp29
-rw-r--r--noncore/apps/oxygen/dataTable.h16
-rw-r--r--noncore/apps/oxygen/datawidgetui.cpp2
-rw-r--r--noncore/apps/oxygen/datawidgetui.h2
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
14dataTable::dataTable() : QTable() 14OxydataTable::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
18void dataTable::paintCell( QPainter *p, int, int, const QRect &cr, bool ) 19
20void 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
13class dataTable : public QTable 17class 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;