summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/oxygen/dataTable.cpp35
-rw-r--r--noncore/apps/oxygen/dataTable.h23
-rw-r--r--noncore/apps/oxygen/datawidgetui.cpp2
-rw-r--r--noncore/apps/oxygen/psewidget.cpp2
4 files changed, 42 insertions, 20 deletions
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp
index ff01417..f034c45 100644
--- a/noncore/apps/oxygen/dataTable.cpp
+++ b/noncore/apps/oxygen/dataTable.cpp
@@ -60,4 +60,5 @@ void OxydataWidget::setElement( int el )
right->setText( QString::number( el+1 ) );
+
DataTable->setText( 0,1,configobj.readEntry( "Weight" ) );
DataTable->setText( 1,1,configobj.readEntry( "Block" ) );
@@ -69,4 +70,5 @@ void OxydataWidget::setElement( int el )
DataTable->setText( 7,1,configobj.readEntry( "BP" ) );
DataTable->setText( 8,1,configobj.readEntry( "MP" ) );
+
}
@@ -82,9 +84,19 @@ void OxydataWidget::setTable() const
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)
+ const char *name) : QTable(numRows, numCols,parent, name)
{
+
+ for (int zeile = 0; zeile < numRows; zeile++)
+ for ( int spalte = 0; spalte < numCols; spalte++ )
+ {
+ OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" );
+ setItem(zeile, spalte, (QTableItem*)testus);
+ }
+
+
this->setShowGrid( false );
this->setHScrollBarMode(QScrollView::AlwaysOff);
@@ -95,11 +107,4 @@ OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent,
}
-int OxydataTable::alignment() const
-{
- return AlignLeft | AlignVCenter;
-};
-
-
-
void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected)
{
@@ -121,2 +126,16 @@ void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, b
}
}
+
+OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text )
+ : QTableItem ( table, et, text )
+{
+}
+
+int OxydataQTI::alignment() const
+{
+ if ( col()%2 )
+ {
+ return AlignRight | AlignVCenter;
+ }else return AlignLeft | AlignVCenter;
+};
+
diff --git a/noncore/apps/oxygen/dataTable.h b/noncore/apps/oxygen/dataTable.h
index 00063d4..a4a3b18 100644
--- a/noncore/apps/oxygen/dataTable.h
+++ b/noncore/apps/oxygen/dataTable.h
@@ -17,5 +17,4 @@
class QLabel;
class OxydataTable;
-class QTableItem;
/*
@@ -61,7 +60,4 @@ class OxydataTable : public QTable
QWidget *parent = 0, const char *name = 0 );
- virtual int alignment() const;
-// virtual QTableItem *item( int row, int col ) const;
-
protected:
/*
@@ -71,11 +67,18 @@ class OxydataTable : public QTable
virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected );
};
+/*
+ * A OxydataQTI is a QTableItem which has the ability to set an alignment.
+ * In Oxygen we only have two colums so I can use the simple col()%2.
+ *
+ * Author: Robert Gogolok <robertgogolok@gmx.de>
+ */
-//X class OxydataQTI : QTableItem
-//X {
-//X Q_OBJECT
-//X
-//X public:
-//X OxydataQTI(
+class OxydataQTI : public QTableItem
+{
+ public:
+ OxydataQTI(QTable * table, EditType et, const QString & text );
+
+ virtual int alignment() const;
+};
#endif
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp
index 4dab109..422b6f8 100644
--- a/noncore/apps/oxygen/datawidgetui.cpp
+++ b/noncore/apps/oxygen/datawidgetui.cpp
@@ -44,5 +44,5 @@ dataWidgetUI::dataWidgetUI() : QWidget()
OxydataWidget *oxyDW = new OxydataWidget(this);
connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) );
- oxyDW->setElement( 1 );
+ oxyDW->setElement( 0 );
qgrid->addWidget( dataCombo, 0,0);
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index a3bb505..449afef 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -48,5 +48,5 @@ PSEWidget::PSEWidget() : QWidget()
oxyDW = new OxydataWidget(this);
- oxyDW->setElement( 1 );
+ oxyDW->setElement( 0 );
vlay->addLayout( grid );