summaryrefslogtreecommitdiff
path: root/noncore/apps/oxygen
Unidiff
Diffstat (limited to 'noncore/apps/oxygen') (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
@@ -11,14 +11,37 @@
11#include "dataTable.h" 11#include "dataTable.h"
12#include <qtable.h> 12#include <qtable.h>
13 13
14dataTable::dataTable() : QTable() 14OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent,
15 const char *name) : QTable(numRows, numRows, parent, name)
15{ 16{
16} 17}
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}
22 44
23 45
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
@@ -8,15 +8,27 @@
8 * * 8 * *
9 **************************************************************************/ 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{
15 Q_OBJECT 19 Q_OBJECT
16 20
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
@@ -22,7 +22,7 @@ dataWidgetUI::dataWidgetUI() : QDialog()
22 QVBoxLayout *vbox = new QVBoxLayout( this ); 22 QVBoxLayout *vbox = new QVBoxLayout( this );
23 23
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
27 vbox->addWidget( dataCombo ); 27 vbox->addWidget( dataCombo );
28 vbox->addWidget( DataTable ); 28 vbox->addWidget( DataTable );
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
@@ -22,7 +22,7 @@ class dataWidgetUI : public QDialog
22 22
23 private: 23 private:
24 void createTableLayout(); 24 void createTableLayout();
25 QTable *DataTable; 25 OxydataTable *DataTable;
26 QComboBox *dataCombo; 26 QComboBox *dataCombo;
27 27
28 private slots: 28 private slots: