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
@@ -6,19 +6,42 @@
6 * ( at your option ) any later version. * 6 * ( at your option ) any later version. *
7 * * 7 * *
8 **************************************************************************/ 8 **************************************************************************/
9#include "oxygen.h" 9#include "oxygen.h"
10 10
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
@@ -3,20 +3,32 @@
3 * * 3 * *
4 * This program is free software; you can redistribute it and/or modify * 4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by * 5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or * 6 * the Free Software Foundation; either version 2 of the License, or *
7 * ( at your option ) any later version. * 7 * ( at your option ) any later version. *
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
@@ -17,17 +17,17 @@
17 17
18dataWidgetUI::dataWidgetUI() : QDialog() 18dataWidgetUI::dataWidgetUI() : QDialog()
19{ 19{
20 this->setCaption("foo"); 20 this->setCaption("foo");
21 21
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 );
29 29
30 DataTable->show(); 30 DataTable->show();
31 dataCombo->show(); 31 dataCombo->show();
32 32
33 connect ( dataCombo, SIGNAL( activated(int) ), this, SLOT( slotShowData(int) ) ); 33 connect ( dataCombo, SIGNAL( activated(int) ), this, SLOT( slotShowData(int) ) );
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
@@ -17,14 +17,14 @@ class dataWidgetUI : public QDialog
17{ 17{
18 Q_OBJECT 18 Q_OBJECT
19 19
20 public: 20 public:
21 dataWidgetUI(); 21 dataWidgetUI();
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:
29 void slotShowData(int); 29 void slotShowData(int);
30}; 30};