author | tille <tille> | 2002-11-17 17:41:36 (UTC) |
---|---|---|
committer | tille <tille> | 2002-11-17 17:41:36 (UTC) |
commit | 8b7363e22c3d8ba53baf14e6eb31ea3958b43e9c (patch) (side-by-side diff) | |
tree | f9ada7584e39e37402e588b9c67f276c845ee832 | |
parent | c7e7142bc83a8f3d526452bce56c410f4e88c750 (diff) | |
download | opie-8b7363e22c3d8ba53baf14e6eb31ea3958b43e9c.zip opie-8b7363e22c3d8ba53baf14e6eb31ea3958b43e9c.tar.gz opie-8b7363e22c3d8ba53baf14e6eb31ea3958b43e9c.tar.bz2 |
added atom symbols in table
-rw-r--r-- | noncore/apps/oxygen/oxyframe.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/oxygen/oxyframe.h | 6 | ||||
-rw-r--r-- | noncore/apps/oxygen/psewidget.cpp | 2 |
3 files changed, 13 insertions, 5 deletions
diff --git a/noncore/apps/oxygen/oxyframe.cpp b/noncore/apps/oxygen/oxyframe.cpp index c61c8e5..2ce40e7 100644 --- a/noncore/apps/oxygen/oxyframe.cpp +++ b/noncore/apps/oxygen/oxyframe.cpp @@ -1,33 +1,41 @@ /*************************************************************************** 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) +OxyFrame::OxyFrame(QWidget *parent, const char *name, QString symbol ) + : QLabel(parent,name) { N = name; this->setFrameStyle( QFrame::Box ); this->setLineWidth( 0 ); this->setMidLineWidth( 1 ); this->setFrameShadow( QFrame::Sunken ); + setMinimumSize(6,6); + setScaledContents( true ); + QFont font; + font.setWeight(QFont::Light); + font.setPixelSize(3); + setFont( font ); + setText( symbol ); } void OxyFrame::mousePressEvent ( QMouseEvent * e ){ emit num( N ); }; diff --git a/noncore/apps/oxygen/oxyframe.h b/noncore/apps/oxygen/oxyframe.h index 4543504..9736ea9 100644 --- a/noncore/apps/oxygen/oxyframe.h +++ b/noncore/apps/oxygen/oxyframe.h @@ -1,41 +1,41 @@ /*************************************************************************** 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> +#include <qlabel.h> -class OxyFrame : public QFrame +class OxyFrame : public QLabel { Q_OBJECT public: - OxyFrame( QWidget *parent=0, const char *name=0); + OxyFrame( QWidget *parent=0, const char *name=0, QString symbol="" ); void mousePressEvent( QMouseEvent *); QString N; signals: /* * this signal emits the name ( the elemen-number ) */ void num(QString); }; #endif diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp index 18b41c3..d742e9c 100644 --- a/noncore/apps/oxygen/psewidget.cpp +++ b/noncore/apps/oxygen/psewidget.cpp @@ -11,65 +11,65 @@ * 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 <qpe/qpeapplication.h> #include <qlist.h> #include "dataTable.h" #include "psewidget.h" #include "oxyframe.h" PSEWidget::PSEWidget() : QWidget() { this->setCaption( tr( "Periodic System" ) ); QVBoxLayout *vlay = new QVBoxLayout( this ); QGridLayout *grid = new QGridLayout( 18,10 ); int h=0, v=0; Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File ); for( int n = 0 ; n < 118 ; n++ ) { configobj.setGroup( QString::number( n+1 )); position( n+1,h,v ); QList<OxyFrame> PSEframe; - PSEframe.append( new OxyFrame( this , QString::number(n) ) ); + PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) ); grid->addWidget( PSEframe.current() , v/40+1 , h/40 ); PSEframe.current()->setMinimumHeight( 11 ); PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) ); connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) )); } oxyDW = new OxydataWidget(this); oxyDW->setElement( 0 ); oxyDW->setLayout(); vlay->addLayout( grid ); vlay->addWidget( oxyDW ); } QColor PSEWidget::PSEColor( QString block ) { QColor c; if ( block == "s" ) c.setRgb( 213 , 233 , 231 ); else if ( block == "d" ) c.setRgb( 200,230,160 ); else if ( block == "p" ) c.setRgb( 238,146,138 ); else if ( block == "f" ) c.setRgb( 190 , 190 , 190 ); return c; }; void PSEWidget::slotShowElement(QString number) { oxyDW->setElement( number.toInt() ); }; void PSEWidget::position(int n, int& h, int& v) { //Hydrogen |