summaryrefslogtreecommitdiff
path: root/noncore/apps/oxygen/dataTable.cpp
authorcniehaus <cniehaus>2002-09-20 19:24:32 (UTC)
committer cniehaus <cniehaus>2002-09-20 19:24:32 (UTC)
commit681e6e75efaa5577d376d0bb191afdf323cb4e75 (patch) (unidiff)
treed35ee106655e5b288e73491a2701ddc0141f4fde /noncore/apps/oxygen/dataTable.cpp
parentc958d7cb5069e06b5cf9e9df6e78bcb644ce26a2 (diff)
downloadopie-681e6e75efaa5577d376d0bb191afdf323cb4e75.zip
opie-681e6e75efaa5577d376d0bb191afdf323cb4e75.tar.gz
opie-681e6e75efaa5577d376d0bb191afdf323cb4e75.tar.bz2
before starting to hack QTableItem I wanted to have a safe point in cvs
Diffstat (limited to 'noncore/apps/oxygen/dataTable.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/oxygen/dataTable.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp
index 70b5a6a..ff01417 100644
--- a/noncore/apps/oxygen/dataTable.cpp
+++ b/noncore/apps/oxygen/dataTable.cpp
@@ -1,45 +1,58 @@
1/*************************************************************************** 1/***************************************************************************
2 application: : Oxygen
3
4 begin : September 2002
5 copyright : ( C ) 2002 by Carsten Niehaus
6 email : cniehaus@handhelds.org
7 **************************************************************************/
8
9/***************************************************************************
2 * * 10 * *
3 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
6 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
7 * * 15 * *
8 **************************************************************************/ 16 **************************************************************************/
9 17
10#include <qpe/config.h> 18#include <qpe/config.h>
11 19
12#include "dataTable.h" 20#include "dataTable.h"
13#include <qwidget.h> 21#include <qwidget.h>
14#include <qhbox.h> 22#include <qhbox.h>
15#include <qlabel.h> 23#include <qlabel.h>
16#include <qfont.h> 24#include <qfont.h>
17#include <qlayout.h> 25#include <qlayout.h>
18 26
19OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent) 27OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent)
20{ 28{
21 QGridLayout *qgrid = new QGridLayout( this, 2,1 ); 29 QGridLayout *qgrid = new QGridLayout( this, 2,1 );
30
22 QHBox *hbox = new QHBox( this ); 31 QHBox *hbox = new QHBox( this );
23 left = new QLabel( hbox ); 32 left = new QLabel( hbox );
24 middle = new QLabel( hbox ); 33 middle = new QLabel( hbox );
25 right = new QLabel( hbox ); 34 right = new QLabel( hbox );
26 35
27 DataTable = new OxydataTable( 9,2, this ); 36 right->setAlignment( AlignRight );
37 middle->setAlignment( AlignHCenter );
28 38
29 QFont bf; 39 QFont bf;
30 bf.setBold( true ); 40 bf.setBold( true );
31 bf.setPointSize( bf.pointSize()+2 ); 41 bf.setPointSize( bf.pointSize()+2 );
32 middle->setFont( bf ); 42 middle->setFont( bf );
33 43
44 DataTable = new OxydataTable( 9,2, this );
45 DataTable->setColumnWidth ( 1 , 118 );
46 DataTable->setColumnWidth ( 0 , 118 );
34 setTable(); 47 setTable();
35 48
36 qgrid->addWidget( hbox,0,0 ); 49 qgrid->addWidget( hbox,0,0 );
37 qgrid->addWidget( DataTable,1,0 ); 50 qgrid->addWidget( DataTable,1,0 );
38} 51}
39 52
40void OxydataWidget::setElement( int el ) 53void OxydataWidget::setElement( int el )
41{ 54{
42 Config configobj( "oxygendata" ); 55 Config configobj( "oxygendata" );
43 configobj.setGroup( QString::number( el+1 )); 56 configobj.setGroup( QString::number( el+1 ));
44 57
45 left->setText( configobj.readEntry( "Symbol" ) ); 58 left->setText( configobj.readEntry( "Symbol" ) );
@@ -72,24 +85,31 @@ void OxydataWidget::setTable() const
72 85
73OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, 86OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent,
74 const char *name) : QTable(numRows, numRows, parent, name) 87 const char *name) : QTable(numRows, numRows, parent, name)
75{ 88{
76 this->setShowGrid( false ); 89 this->setShowGrid( false );
77 this->setHScrollBarMode(QScrollView::AlwaysOff); 90 this->setHScrollBarMode(QScrollView::AlwaysOff);
78 this->horizontalHeader()->hide(); 91 this->horizontalHeader()->hide();
79 this->verticalHeader()->hide(); 92 this->verticalHeader()->hide();
80 this->setTopMargin( 0 ); 93 this->setTopMargin( 0 );
81 this->setLeftMargin( 0 ); 94 this->setLeftMargin( 0 );
82} 95}
83 96
97int OxydataTable::alignment() const
98{
99 return AlignLeft | AlignVCenter;
100};
101
102
103
84void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) 104void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected)
85{ 105{
86 if ( cr.width() == 0 || cr.height() == 0 ) 106 if ( cr.width() == 0 || cr.height() == 0 )
87 return; 107 return;
88 selected = FALSE; 108 selected = FALSE;
89 109
90 QTableItem *itm = item( row, col ); 110 QTableItem *itm = item( row, col );
91 QColorGroup colgrp = colorGroup(); 111 QColorGroup colgrp = colorGroup();
92 if ( itm ) 112 if ( itm )
93 { 113 {
94 if ( row%2 ) 114 if ( row%2 )
95 colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) ); 115 colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) );