summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2002-09-20 19:24:32 (UTC)
committer cniehaus <cniehaus>2002-09-20 19:24:32 (UTC)
commit681e6e75efaa5577d376d0bb191afdf323cb4e75 (patch) (side-by-side diff)
treed35ee106655e5b288e73491a2701ddc0141f4fde
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 (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/oxygen/calcdlgui.cpp8
-rw-r--r--noncore/apps/oxygen/dataTable.cpp24
-rw-r--r--noncore/apps/oxygen/dataTable.h11
-rw-r--r--noncore/apps/oxygen/datawidgetui.cpp25
-rw-r--r--noncore/apps/oxygen/datawidgetui.h18
-rw-r--r--noncore/apps/oxygen/main.cpp8
-rw-r--r--noncore/apps/oxygen/oxyframe.cpp8
-rw-r--r--noncore/apps/oxygen/oxyframe.h7
-rw-r--r--noncore/apps/oxygen/oxygen.cpp8
-rw-r--r--noncore/apps/oxygen/psewidget.cpp8
-rw-r--r--noncore/apps/oxygen/psewidget.h7
11 files changed, 121 insertions, 11 deletions
diff --git a/noncore/apps/oxygen/calcdlgui.cpp b/noncore/apps/oxygen/calcdlgui.cpp
index e40e2c7..b6dfff3 100644
--- a/noncore/apps/oxygen/calcdlgui.cpp
+++ b/noncore/apps/oxygen/calcdlgui.cpp
@@ -1,17 +1,25 @@
/***************************************************************************
+ application: : Oxygen
+
+ begin : September 2002
+ copyright : ( C ) 2002 by Carsten Niehaus
+ email : cniehaus@handhelds.org
+ **************************************************************************/
+
+/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include "oxygen.h"
#include "calcdlgui.h"
#include "kmolcalc.h"
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
calcDlgUI::calcDlgUI() : CalcDlg()
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,49 +1,62 @@
/***************************************************************************
+ application: : Oxygen
+
+ begin : September 2002
+ copyright : ( C ) 2002 by Carsten Niehaus
+ email : cniehaus@handhelds.org
+ **************************************************************************/
+
+/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include <qpe/config.h>
#include "dataTable.h"
#include <qwidget.h>
#include <qhbox.h>
#include <qlabel.h>
#include <qfont.h>
#include <qlayout.h>
OxydataWidget::OxydataWidget(QWidget *parent) : QWidget(parent)
{
QGridLayout *qgrid = new QGridLayout( this, 2,1 );
+
QHBox *hbox = new QHBox( this );
left = new QLabel( hbox );
middle = new QLabel( hbox );
right = new QLabel( hbox );
- DataTable = new OxydataTable( 9,2, this );
-
+ right->setAlignment( AlignRight );
+ middle->setAlignment( AlignHCenter );
+
QFont bf;
bf.setBold( true );
bf.setPointSize( bf.pointSize()+2 );
middle->setFont( bf );
+ DataTable = new OxydataTable( 9,2, this );
+ DataTable->setColumnWidth ( 1 , 118 );
+ DataTable->setColumnWidth ( 0 , 118 );
setTable();
qgrid->addWidget( hbox,0,0 );
qgrid->addWidget( DataTable,1,0 );
}
void OxydataWidget::setElement( int el )
{
Config configobj( "oxygendata" );
configobj.setGroup( QString::number( el+1 ));
left->setText( configobj.readEntry( "Symbol" ) );
middle->setText( configobj.readEntry( "Name" ) );
right->setText( QString::number( el+1 ) );
DataTable->setText( 0,1,configobj.readEntry( "Weight" ) );
@@ -68,32 +81,39 @@ void OxydataWidget::setTable() const
DataTable->setText( 6,0, tr( "Density" )) ;
DataTable->setText( 7,0, tr( "Boilingpoint" ) );
DataTable->setText( 8,0, tr( "Meltingpoint" ) );
}
OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent,
const char *name) : QTable(numRows, numRows, parent, name)
{
this->setShowGrid( false );
this->setHScrollBarMode(QScrollView::AlwaysOff);
this->horizontalHeader()->hide();
this->verticalHeader()->hide();
this->setTopMargin( 0 );
this->setLeftMargin( 0 );
}
+int OxydataTable::alignment() const
+{
+ return AlignLeft | AlignVCenter;
+};
+
+
+
void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected)
{
if ( cr.width() == 0 || cr.height() == 0 )
return;
selected = FALSE;
QTableItem *itm = item( row, col );
QColorGroup colgrp = colorGroup();
if ( itm )
{
if ( row%2 )
colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) );
else
colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) );
p->save();
itm->paint( p, colgrp, cr, selected );
diff --git a/noncore/apps/oxygen/dataTable.h b/noncore/apps/oxygen/dataTable.h
index ccc4300..00063d4 100644
--- a/noncore/apps/oxygen/dataTable.h
+++ b/noncore/apps/oxygen/dataTable.h
@@ -3,32 +3,33 @@
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#ifndef _DATATABLE_H
#define _DATATABLE_H
#include <qwidget.h>
#include <qtable.h>
class QLabel;
class OxydataTable;
+class QTableItem;
/*
* A OxydataWidget shows all known data of an element. It can
* be used for both the PSE and the pure Data-Dialog. It is
* a simple QHBox with 2 QStrings in it plus a OxydataTable
* which contains the rest of the data.
*
* Author: Carsten Niehaus <cniehaus@handhelds.org>
*/
class OxydataWidget : public QWidget
{
Q_OBJECT
public:
OxydataWidget(QWidget *parent=0);
@@ -46,25 +47,35 @@ class OxydataWidget : public QWidget
/*
* A OxydataTable is derived from QTable. I recoded the paintCell to have
* different colors in the backgound. Furthermore this widget never has a
* grid, thus I removed that code in paintCell.
*
* Author: Carsten Niehaus <cniehaus@handhelds.org>
*/
class OxydataTable : public QTable
{
Q_OBJECT
public:
OxydataTable( int numRows, int numCols,
QWidget *parent = 0, const char *name = 0 );
+ virtual int alignment() const;
+// virtual QTableItem *item( int row, int col ) const;
+
protected:
/*
* This method is reimplemented form QTable. It implements the colourisation
* of every second row.
*/
virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected );
};
+//X class OxydataQTI : QTableItem
+//X {
+//X Q_OBJECT
+//X
+//X public:
+//X OxydataQTI(
+
#endif
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp
index 2e99c0b..4dab109 100644
--- a/noncore/apps/oxygen/datawidgetui.cpp
+++ b/noncore/apps/oxygen/datawidgetui.cpp
@@ -1,42 +1,51 @@
/***************************************************************************
+ application: : Oxygen
+
+ begin : September 2002
+ copyright : ( C ) 2002 by Carsten Niehaus
+ email : cniehaus@handhelds.org
+ **************************************************************************/
+
+/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include "datawidgetui.h"
+#include "dataTable.h"
#include <qpe/config.h>
#include <qstring.h>
#include <qcombobox.h>
#include <qlayout.h>
#include <qhbox.h>
#include <qlabel.h>
dataWidgetUI::dataWidgetUI() : QWidget()
{
this->setCaption( tr( "Chemical Data" ));
-
QGridLayout *qgrid = new QGridLayout( this, 2,1 );
dataCombo = new QComboBox( this );
- OxydataWidget *oxyDW = new OxydataWidget(this);
- oxyDW->setElement( 1 );
- qgrid->addWidget( dataCombo, 0,0);
- qgrid->addWidget( oxyDW , 1,0 );
-
- connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) );
- Config configobj( "oxygendata" );
//read in all names of the 118 elements
+ Config configobj( "oxygendata" );
for ( int i = 1 ; i < 119 ; i++ )
{
configobj.setGroup( QString::number( i ) );
QString foo = configobj.readEntry( "Name" );
dataCombo->insertItem( foo );
}
+
+ OxydataWidget *oxyDW = new OxydataWidget(this);
+ connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) );
+ oxyDW->setElement( 1 );
+
+ qgrid->addWidget( dataCombo, 0,0);
+ qgrid->addWidget( oxyDW , 1,0 );
}
diff --git a/noncore/apps/oxygen/datawidgetui.h b/noncore/apps/oxygen/datawidgetui.h
index 5399c81..cd716ad 100644
--- a/noncore/apps/oxygen/datawidgetui.h
+++ b/noncore/apps/oxygen/datawidgetui.h
@@ -1,25 +1,41 @@
+#ifndef DATAWIDGETUI_H
+#define DATAWIDGETUI_H
+
+
+/***************************************************************************
+ application: : Oxygen
+
+ begin : September 2002
+ copyright : ( C ) 2002 by Carsten Niehaus
+ email : cniehaus@handhelds.org
+ **************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
-#include "dataTable.h"
+
+
+class OxydataWidget;
+class OxydataTable;
class QComboBox;
+#include <qwidget.h>
class dataWidgetUI : public QWidget
{
Q_OBJECT
public:
dataWidgetUI();
private:
OxydataTable *DataTable;
QComboBox *dataCombo;
OxydataWidget *oxyDW;
};
+#endif
diff --git a/noncore/apps/oxygen/main.cpp b/noncore/apps/oxygen/main.cpp
index 31e44dc..c8fcdb4 100644
--- a/noncore/apps/oxygen/main.cpp
+++ b/noncore/apps/oxygen/main.cpp
@@ -1,17 +1,25 @@
/***************************************************************************
+ application: : Oxygen
+
+ begin : September 2002
+ copyright : ( C ) 2002 by Carsten Niehaus
+ email : cniehaus@handhelds.org
+ **************************************************************************/
+
+/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include <qpe/qpeapplication.h>
#include "oxygen.h"
int main(int argc, char **argv)
{
QPEApplication app(argc, argv);
Oxygen *oxi = new Oxygen();
diff --git a/noncore/apps/oxygen/oxyframe.cpp b/noncore/apps/oxygen/oxyframe.cpp
index a5f262e..c61c8e5 100644
--- a/noncore/apps/oxygen/oxyframe.cpp
+++ b/noncore/apps/oxygen/oxyframe.cpp
@@ -1,17 +1,25 @@
/***************************************************************************
+ application: : Oxygen
+
+ begin : September 2002
+ copyright : ( C ) 2002 by Carsten Niehaus
+ email : cniehaus@handhelds.org
+ **************************************************************************/
+
+/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include "oxygen.h"
#include <qpe/config.h>
#include "oxyframe.h"
OxyFrame::OxyFrame(QWidget *parent, const char *name) : QFrame(parent,name)
{
N = name;
this->setFrameStyle( QFrame::Box );
diff --git a/noncore/apps/oxygen/oxyframe.h b/noncore/apps/oxygen/oxyframe.h
index a19f13c..4543504 100644
--- a/noncore/apps/oxygen/oxyframe.h
+++ b/noncore/apps/oxygen/oxyframe.h
@@ -1,16 +1,23 @@
+/***************************************************************************
+ application: : Oxygen
+
+ begin : September 2002
+ copyright : ( C ) 2002 by Carsten Niehaus
+ email : cniehaus@handhelds.org
+ **************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#ifndef _OXYFRAME_H
#define _OXYFRAME_H
#include <qframe.h>
class OxyFrame : public QFrame
diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp
index 4e293c7..b3392e1 100644
--- a/noncore/apps/oxygen/oxygen.cpp
+++ b/noncore/apps/oxygen/oxygen.cpp
@@ -1,17 +1,25 @@
/***************************************************************************
+ application: : Oxygen
+
+ begin : September 2002
+ copyright : ( C ) 2002 by Carsten Niehaus
+ email : cniehaus@handhelds.org
+ **************************************************************************/
+
+/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include "oxygen.h"
#include <qlabel.h>
#include <qapplication.h>
#include <qpushbutton.h>
#include <qvbox.h>
#include "calcdlg.h"
#include "calcdlgui.h"
#include "datawidgetui.h"
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index 78e54d5..a3bb505 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -1,17 +1,25 @@
/***************************************************************************
+ application: : Oxygen
+
+ begin : September 2002
+ copyright : ( C ) 2002 by Carsten Niehaus
+ email : cniehaus@handhelds.org
+ **************************************************************************/
+
+/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include <qpe/config.h>
#include <qlayout.h>
#include <qlist.h>
#include "dataTable.h"
#include "psewidget.h"
#include "oxyframe.h"
diff --git a/noncore/apps/oxygen/psewidget.h b/noncore/apps/oxygen/psewidget.h
index f69eeb3..fdf838e 100644
--- a/noncore/apps/oxygen/psewidget.h
+++ b/noncore/apps/oxygen/psewidget.h
@@ -1,16 +1,23 @@
+/***************************************************************************
+ application: : Oxygen
+
+ begin : September 2002
+ copyright : ( C ) 2002 by Carsten Niehaus
+ email : cniehaus@handhelds.org
+ **************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#ifndef _PSEWIDGET_H
#define _PSEWIDGET_H
#include <qwidget.h>
class QGridLayout;
class OxydataWidget;