From 62b5cd2ee8eb65d11467ce7469505788ef2280d5 Mon Sep 17 00:00:00 2001 From: cniehaus Date: Tue, 17 Sep 2002 14:06:12 +0000 Subject: Heureka! It works. Took only 3 hours for 5 LOC. Super --- diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp index f03e973..6c6b9dc 100644 --- a/noncore/apps/oxygen/dataTable.cpp +++ b/noncore/apps/oxygen/dataTable.cpp @@ -16,32 +16,25 @@ OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent, { } - void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected) { - if ( cr.width() == 0 || cr.height() == 0 ) + if ( cr.width() == 0 || cr.height() == 0 ) return; - if ( selected && - row == currentRow() && - col == currentColumn() ) - selected = FALSE; + selected = FALSE; int w = cr.width(); int h = cr.height(); - QTableItem *itm = item( row, col ); - if ( itm ) { + QTableItem *itm = item( row, col ); + QColorGroup colgrp = colorGroup(); + if ( itm ) + { + if ( row%2 ) + colgrp.setColor( QColorGroup::Base, QColor( cyan ) ); + else + colgrp.setColor( QColorGroup::Base, QColor( white ) ); p->save(); - itm->paint( p, colorGroup(), cr, selected ); + itm->paint( p, colgrp, cr, selected ); p->restore(); - } else { - if ( currentRow()%2 ) //every even row - p->fillRect( 0, 0, w, h, selected ? colorGroup().brush( QColorGroup::Highlight ) : colorGroup().brush( QColorGroup::Base ) ); - else //every odd row - p->fillRect( 0, 0, w, h, selected ? colorGroup().brush( QColorGroup::Highlight ) : colorGroup().brush( QColorGroup::Base ) ); } } - - - - diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp index 0f8a146..c8492e5 100644 --- a/noncore/apps/oxygen/datawidgetui.cpp +++ b/noncore/apps/oxygen/datawidgetui.cpp @@ -10,19 +10,19 @@ #include #include "datawidgetui.h" -#include #include #include #include dataWidgetUI::dataWidgetUI() : QDialog() { - this->setCaption("foo"); + this->setCaption("Chemical Data"); QVBoxLayout *vbox = new QVBoxLayout( this ); dataCombo = new QComboBox( this ); DataTable = new OxydataTable( 7,2, this ); + DataTable->setShowGrid( false ); vbox->addWidget( dataCombo ); vbox->addWidget( DataTable ); -- cgit v0.9.0.2