diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:44:41 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 04:44:41 +0000 |
commit | a374efce3a207b39514be3c52264091400ce297e (patch) | |
tree | 77bdf654b55826d4f59b53a5621310206bcaead1 /kalzium/src/periodictableview.cpp | |
parent | f81a494f3957d5cf38c787973415597941934727 (diff) | |
download | tdeedu-a374efce3a207b39514be3c52264091400ce297e.tar.gz tdeedu-a374efce3a207b39514be3c52264091400ce297e.zip |
TQt4 port kdeedu
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1236073 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kalzium/src/periodictableview.cpp')
-rw-r--r-- | kalzium/src/periodictableview.cpp | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/kalzium/src/periodictableview.cpp b/kalzium/src/periodictableview.cpp index a09dcf34..0e810aff 100644 --- a/kalzium/src/periodictableview.cpp +++ b/kalzium/src/periodictableview.cpp @@ -41,8 +41,8 @@ #include <tqcolor.h> #include <tqrect.h> -PerodicTableView::PerodicTableView(TQWidget *parent, const char *name) - : TQWidget(parent, name), m_kalziumTip(0), table(0), table2(0) +PerodicTableView::PerodicTableView(TQWidget *tqparent, const char *name) + : TQWidget(tqparent, name), m_kalziumTip(0), table(0), table2(0) { d = KalziumDataObject::instance(); @@ -171,8 +171,8 @@ void PerodicTableView::slotToolTip( int number ) m_tooltipElementNumber = number; TQWidget *p = 0; - if ( dynamic_cast<TQWidget*>( parent() ) ) - p = static_cast<TQWidget*>( parent() ); + if ( dynamic_cast<TQWidget*>( tqparent() ) ) + p = TQT_TQWIDGET( tqparent() ); if( p ) m_kalziumTip->showTip( mapFromGlobal(TQCursor::pos()), @@ -328,7 +328,7 @@ void PerodicTableView::resizeEvent( TQResizeEvent * /*e*/ ) table->resize( width(), height() ); table2->resize( width(), height() ); // XXX: I know it isn't the best way, but otherwise the table won't be redrawn - // on repaint... Feel *free* to remove these two lines if you foind a better + // on tqrepaint... Feel *free* to remove these two lines if you foind a better // solution... doFullDraw = true; update(); @@ -417,14 +417,14 @@ void PerodicTableView::paintCurrentSelection() p.begin(table); TQPen pen; - pen.setStyle( DotLine ); + pen.setStyle( Qt::DotLine ); pen.setWidth( 4 ); - pen.setColor( Qt::blue ); + pen.setColor( TQt::blue ); p.setPen( pen ); p.drawEllipse( x-10,y-10,ELEMENTSIZE+20,ELEMENTSIZE+20 ); pen.setWidth( 3 ); - pen.setColor( Qt::red ); + pen.setColor( TQt::red ); p.setPen( pen ); p.drawEllipse( x-5,y-5,ELEMENTSIZE+10,ELEMENTSIZE+10 ); @@ -491,12 +491,12 @@ void PerodicTableView::drawLegendToolTip( TQPainter* p ) bRect.moveBy( 15, 0 ); } - p->setBrush(Qt::SolidPattern); + p->setBrush(TQt::SolidPattern); p->setBrush( TQColor( 255, 255, 220 ) ); p->drawRect( bRectExt ); - p->setBrush( Qt::black ); - p->setBrush(Qt::NoBrush); + p->setBrush( TQt::black ); + p->setBrush(TQt::NoBrush); p->drawText( bRect, AlignLeft|AlignTop, text ); } @@ -582,9 +582,9 @@ void PerodicTableView::drawLegend( TQPainter* p ) p->fillRect(x1, fieldheight*3, square_w, square_h, c_liquid ); p->fillRect(x1, fieldheight*4, square_w, square_h, c_vapor ); - p->drawText(x1 + textOffset, fieldheight*2, fieldsize, fieldheight, Qt::AlignLeft, i18n("Solid") ); - p->drawText(x1 + textOffset, fieldheight*3, fieldsize, fieldheight, Qt::AlignLeft, i18n("Liquid") ); - p->drawText(x1 + textOffset, fieldheight*4, fieldsize, fieldheight, Qt::AlignLeft, i18n("Vaporous") ); + p->drawText(x1 + textOffset, fieldheight*2, fieldsize, fieldheight, TQt::AlignLeft, i18n("Solid") ); + p->drawText(x1 + textOffset, fieldheight*3, fieldsize, fieldheight, TQt::AlignLeft, i18n("Liquid") ); + p->drawText(x1 + textOffset, fieldheight*4, fieldsize, fieldheight, TQt::AlignLeft, i18n("Vaporous") ); return; } switch ( m_currentScheme ){ @@ -601,14 +601,14 @@ void PerodicTableView::drawLegend( TQPainter* p ) p->fillRect( x2, fieldheight*4, square_w, square_h, color_7); p->fillRect( x2, fieldheight*5, square_w, square_h, color_8 ); - p->drawText( x1 + textOffset , fieldheight*2, fieldsize, fieldheight, Qt::AlignLeft, i18n("Group 1") ); - p->drawText( x1 + textOffset , fieldheight*3, fieldsize, fieldheight, Qt::AlignLeft, i18n("Group 2")); - p->drawText( x1 + textOffset , fieldheight*4, fieldsize, fieldheight, Qt::AlignLeft, i18n("Group 3")); - p->drawText( x1 + textOffset , fieldheight*5, fieldsize, fieldheight, Qt::AlignLeft, i18n("Group 4")); - p->drawText( x2 + textOffset , fieldheight*2, fieldsize, fieldheight, Qt::AlignLeft, i18n("Group 5")); - p->drawText( x2 + textOffset , fieldheight*3, fieldsize, fieldheight, Qt::AlignLeft, i18n("Group 6")); - p->drawText( x2 + textOffset , fieldheight*4, fieldsize, fieldheight, Qt::AlignLeft, i18n("Group 7")); - p->drawText( x2 + textOffset , fieldheight*5, fieldsize, fieldheight, Qt::AlignLeft, i18n("Group 8")); + p->drawText( x1 + textOffset , fieldheight*2, fieldsize, fieldheight, TQt::AlignLeft, i18n("Group 1") ); + p->drawText( x1 + textOffset , fieldheight*3, fieldsize, fieldheight, TQt::AlignLeft, i18n("Group 2")); + p->drawText( x1 + textOffset , fieldheight*4, fieldsize, fieldheight, TQt::AlignLeft, i18n("Group 3")); + p->drawText( x1 + textOffset , fieldheight*5, fieldsize, fieldheight, TQt::AlignLeft, i18n("Group 4")); + p->drawText( x2 + textOffset , fieldheight*2, fieldsize, fieldheight, TQt::AlignLeft, i18n("Group 5")); + p->drawText( x2 + textOffset , fieldheight*3, fieldsize, fieldheight, TQt::AlignLeft, i18n("Group 6")); + p->drawText( x2 + textOffset , fieldheight*4, fieldsize, fieldheight, TQt::AlignLeft, i18n("Group 7")); + p->drawText( x2 + textOffset , fieldheight*5, fieldsize, fieldheight, TQt::AlignLeft, i18n("Group 8")); break; case PerodicTableView::BLOCK: p->fillRect(x1, fieldheight*2, square_w, square_h, color_s ); @@ -616,10 +616,10 @@ void PerodicTableView::drawLegend( TQPainter* p ) p->fillRect(x1, fieldheight*4, square_w, square_h, color_d ); p->fillRect(x1, fieldheight*5, square_w, square_h, color_f ); - p->drawText(x1 + textOffset, fieldheight*2, fieldsize, fieldheight, Qt::AlignLeft, i18n("s-Block") ); - p->drawText(x1 + textOffset, fieldheight*3, fieldsize, fieldheight, Qt::AlignLeft, i18n("p-Block") ); - p->drawText(x1 + textOffset, fieldheight*4, fieldsize, fieldheight, Qt::AlignLeft, i18n("d-Block") ); - p->drawText(x1 + textOffset, fieldheight*5, fieldsize, fieldheight, Qt::AlignLeft, i18n("f-Block") ); + p->drawText(x1 + textOffset, fieldheight*2, fieldsize, fieldheight, TQt::AlignLeft, i18n("s-Block") ); + p->drawText(x1 + textOffset, fieldheight*3, fieldsize, fieldheight, TQt::AlignLeft, i18n("p-Block") ); + p->drawText(x1 + textOffset, fieldheight*4, fieldsize, fieldheight, TQt::AlignLeft, i18n("d-Block") ); + p->drawText(x1 + textOffset, fieldheight*5, fieldsize, fieldheight, TQt::AlignLeft, i18n("f-Block") ); break; case PerodicTableView::ACIDIC: p->fillRect(x1, fieldheight*2, square_w, square_h, color_ba ); @@ -627,10 +627,10 @@ void PerodicTableView::drawLegend( TQPainter* p ) p->fillRect(x1, fieldheight*4, square_w, square_h, color_ac ); p->fillRect(x1, fieldheight*5, square_w, square_h, color_amp ); - p->drawText(x1 + textOffset, fieldheight*2, fieldsize, fieldheight, Qt::AlignLeft, i18n("Basic") ); - p->drawText(x1 + textOffset, fieldheight*3, fieldsize, fieldheight, Qt::AlignLeft, i18n("Neutral") ); - p->drawText(x1 + textOffset, fieldheight*4, fieldsize, fieldheight, Qt::AlignLeft, i18n("Acidic") ); - p->drawText(x1 + textOffset, fieldheight*5, fieldsize, fieldheight, Qt::AlignLeft, i18n("both acidic and basic behaviour","Amphoteric") ); + p->drawText(x1 + textOffset, fieldheight*2, fieldsize, fieldheight, TQt::AlignLeft, i18n("Basic") ); + p->drawText(x1 + textOffset, fieldheight*3, fieldsize, fieldheight, TQt::AlignLeft, i18n("Neutral") ); + p->drawText(x1 + textOffset, fieldheight*4, fieldsize, fieldheight, TQt::AlignLeft, i18n("Acidic") ); + p->drawText(x1 + textOffset, fieldheight*5, fieldsize, fieldheight, TQt::AlignLeft, i18n("both acidic and basic behaviour","Amphoteric") ); break; case PerodicTableView::FAMILY: p->fillRect( x1, fieldheight*2, square_w, square_h, c_alkaline ); @@ -643,28 +643,28 @@ void PerodicTableView::drawLegend( TQPainter* p ) p->fillRect( x2, fieldheight*5, square_w, square_h, c_noble_gas ); p->fillRect( x1, fieldheight*6, square_w, square_h, c_metalloid ); - p->drawText( x1 + textOffset , fieldheight*2, fieldsize, fieldheight, Qt::AlignLeft, i18n("Alkaline") ); - p->drawText( x2 + textOffset , fieldheight*2, fieldsize, fieldheight, Qt::AlignLeft, i18n("Rare Earth")); - p->drawText( x1 + textOffset , fieldheight*3, fieldsize, fieldheight, Qt::AlignLeft, i18n("Non-Metals")); - p->drawText( x2 + textOffset , fieldheight*3, fieldsize, fieldheight, Qt::AlignLeft, i18n("Alkalie-Metals")); - p->drawText( x1 + textOffset , fieldheight*4, fieldsize, fieldheight, Qt::AlignLeft, i18n("Other Metal")); - p->drawText( x2 + textOffset , fieldheight*4, fieldsize, fieldheight, Qt::AlignLeft, i18n("Halogene")); - p->drawText( x1 + textOffset , fieldheight*5, fieldsize, fieldheight, Qt::AlignLeft, i18n("Transition Metal")); - p->drawText( x2 + textOffset , fieldheight*5, fieldsize, fieldheight, Qt::AlignLeft, i18n("Noble Gas")); - p->drawText( x1 + textOffset , fieldheight*6, fieldsize, fieldheight, Qt::AlignLeft, i18n("Metalloid")); + p->drawText( x1 + textOffset , fieldheight*2, fieldsize, fieldheight, TQt::AlignLeft, i18n("Alkaline") ); + p->drawText( x2 + textOffset , fieldheight*2, fieldsize, fieldheight, TQt::AlignLeft, i18n("Rare Earth")); + p->drawText( x1 + textOffset , fieldheight*3, fieldsize, fieldheight, TQt::AlignLeft, i18n("Non-Metals")); + p->drawText( x2 + textOffset , fieldheight*3, fieldsize, fieldheight, TQt::AlignLeft, i18n("Alkalie-Metals")); + p->drawText( x1 + textOffset , fieldheight*4, fieldsize, fieldheight, TQt::AlignLeft, i18n("Other Metal")); + p->drawText( x2 + textOffset , fieldheight*4, fieldsize, fieldheight, TQt::AlignLeft, i18n("Halogene")); + p->drawText( x1 + textOffset , fieldheight*5, fieldsize, fieldheight, TQt::AlignLeft, i18n("Transition Metal")); + p->drawText( x2 + textOffset , fieldheight*5, fieldsize, fieldheight, TQt::AlignLeft, i18n("Noble Gas")); + p->drawText( x1 + textOffset , fieldheight*6, fieldsize, fieldheight, TQt::AlignLeft, i18n("Metalloid")); break; case PerodicTableView::CRYSTAL: - p->fillRect(x1, fieldheight*2, square_w, square_h, Qt::cyan ); - p->fillRect(x1, fieldheight*3, square_w, square_h, Qt::red ); - p->fillRect(x1, fieldheight*4, square_w, square_h, Qt::yellow ); - p->fillRect(x1, fieldheight*5, square_w, square_h, Qt::green ); - p->fillRect(x1, fieldheight*6, square_w, square_h, Qt::white ); - - p->drawText(x1 + textOffset, fieldheight*2, fieldsize, fieldheight, Qt::AlignLeft, i18n("Own") ); - p->drawText(x1 + textOffset, fieldheight*3, fieldsize, fieldheight, Qt::AlignLeft, i18n("bcc, body centered cubic") ); - p->drawText(x1 + textOffset, fieldheight*4, fieldsize, fieldheight, Qt::AlignLeft, i18n("hdp, hexagonal") ); - p->drawText(x1 + textOffset, fieldheight*5, fieldsize, fieldheight, Qt::AlignLeft, i18n("ccp, cubic close packed") ); - p->drawText(x1 + textOffset, fieldheight*6, fieldsize, fieldheight, Qt::AlignLeft, i18n("Unknown") ); + p->fillRect(x1, fieldheight*2, square_w, square_h, TQt::cyan ); + p->fillRect(x1, fieldheight*3, square_w, square_h, TQt::red ); + p->fillRect(x1, fieldheight*4, square_w, square_h, TQt::yellow ); + p->fillRect(x1, fieldheight*5, square_w, square_h, TQt::green ); + p->fillRect(x1, fieldheight*6, square_w, square_h, TQt::white ); + + p->drawText(x1 + textOffset, fieldheight*2, fieldsize, fieldheight, TQt::AlignLeft, i18n("Own") ); + p->drawText(x1 + textOffset, fieldheight*3, fieldsize, fieldheight, TQt::AlignLeft, i18n("bcc, body centered cubic") ); + p->drawText(x1 + textOffset, fieldheight*4, fieldsize, fieldheight, TQt::AlignLeft, i18n("hdp, hexagonal") ); + p->drawText(x1 + textOffset, fieldheight*5, fieldsize, fieldheight, TQt::AlignLeft, i18n("ccp, cubic close packed") ); + p->drawText(x1 + textOffset, fieldheight*6, fieldsize, fieldheight, TQt::AlignLeft, i18n("Unknown") ); break; } } @@ -679,19 +679,19 @@ void PerodicTableView::drawNumeration( TQPainter* p ) case PerodicTableView::CAS: for(int i = 0; i < 18 ; ++i ) { - p->drawText( i*ELEMENTSIZE,0 ,ELEMENTSIZE,ELEMENTSIZE, Qt::AlignCenter, TQString::number(i+1)); + p->drawText( i*ELEMENTSIZE,0 ,ELEMENTSIZE,ELEMENTSIZE, TQt::AlignCenter, TQString::number(i+1)); } break; case PerodicTableView::IUPAC: for(int i = 0; i < 18 ; ++i ) { - p->drawText( i*ELEMENTSIZE,0 ,ELEMENTSIZE,ELEMENTSIZE, Qt::AlignCenter, m_IUPAClist[i]); + p->drawText( i*ELEMENTSIZE,0 ,ELEMENTSIZE,ELEMENTSIZE, TQt::AlignCenter, m_IUPAClist[i]); } break; case PerodicTableView::IUPACOLD: for(int i = 0; i < 18 ; ++i ) { - p->drawText( i*ELEMENTSIZE,0 ,ELEMENTSIZE,ELEMENTSIZE, Qt::AlignCenter, m_IUPACOLDlist[i]); + p->drawText( i*ELEMENTSIZE,0 ,ELEMENTSIZE,ELEMENTSIZE, TQt::AlignCenter, m_IUPACOLDlist[i]); } break; } @@ -741,7 +741,7 @@ void PerodicTableView::mouseMoveEvent( TQMouseEvent * /*mouse*/ ) //JH: only update() if we were showing a tooltip if ( m_tooltipElementNumber || m_showLegendTooltip ) { - //this invalidates the number. If the mouse + //this tqinvalidates the number. If the mouse //is moved, the number is invalid. m_tooltipElementNumber = 0; m_showLegendTooltip = false; @@ -977,7 +977,7 @@ void PerodicTableView::calculateGradient( TQPainter *p ) void PerodicTableView::drawGradientPerodicTableView( TQPainter *p, const double min, const double max ) { - TQString title = TQString::null; + TQString title = TQString(); const double var = max-min; EList::ConstIterator it = d->ElementList.begin(); @@ -1103,7 +1103,7 @@ void PerodicTableView::drawGradientPerodicTableView( TQPainter *p, const double // Create the gradient image. TQSize s( ELEMENTSIZE*7+20, 20 ); - TQImage img = KImageEffect::gradient ( s, Qt::white, Qt::red, + TQImage img = KImageEffect::gradient ( s, TQt::white, TQt::red, KImageEffect::HorizontalGradient ); TQPixmap pm( img ); @@ -1122,7 +1122,7 @@ void PerodicTableView::drawGradientPerodicTableView( TQPainter *p, const double font.setPointSize(maxSize); p->setFont(font); - p->drawText( x+5, y+50, ELEMENTSIZE*10,20, Qt::AlignCenter, title ); + p->drawText( x+5, y+50, ELEMENTSIZE*10,20, TQt::AlignCenter, title ); p->drawPixmap( x+50, y+80, pm ); if ( m_gradientType == Element::EA ) @@ -1130,13 +1130,13 @@ void PerodicTableView::drawGradientPerodicTableView( TQPainter *p, const double // FIXME: In the lines below, "30" is the max allowed text // height. This should be calculated from the font // metrics, not hard coded. - p->drawText( x+50,y+100,ELEMENTSIZE*7+20,30, Qt::AlignRight, TQString::number( min ) ); - p->drawText( x+50,y+100,ELEMENTSIZE*7+20,30, Qt::AlignLeft, TQString::number( max ) ); + p->drawText( x+50,y+100,ELEMENTSIZE*7+20,30, TQt::AlignRight, TQString::number( min ) ); + p->drawText( x+50,y+100,ELEMENTSIZE*7+20,30, TQt::AlignLeft, TQString::number( max ) ); } else { - p->drawText( x+50,y+100,ELEMENTSIZE*7+20,30, Qt::AlignRight, TQString::number( max ) ); - p->drawText( x+50,y+100,ELEMENTSIZE*7+20,30, Qt::AlignLeft, TQString::number( min ) ); + p->drawText( x+50,y+100,ELEMENTSIZE*7+20,30, TQt::AlignRight, TQString::number( max ) ); + p->drawText( x+50,y+100,ELEMENTSIZE*7+20,30, TQt::AlignLeft, TQString::number( min ) ); } } @@ -1178,13 +1178,13 @@ void PerodicTableView::drawGradientButton( TQPainter *p, Element* e, double coef e->drawGradient( p, v, c ); } else - e->drawGradient( p, i18n("It means: Not Available. Translators: keep it as short as you can!", "N/A"), Qt::lightGray ); + e->drawGradient( p, i18n("It means: Not Available. Translators: keep it as short as you can!", "N/A"), TQt::lightGray ); } TQColor PerodicTableView::calculateColor( const double coeff ) { - const TQColor color2 = Qt::white; - const TQColor color1 = Qt::red; + const TQColor color2 = TQt::white; + const TQColor color1 = TQt::red; int red = (int)( (color1.red() - color2.red()) * coeff + color2.red() ); int green = (int)( (color1.green() - color2.green()) * coeff + color2.green() ); @@ -1347,15 +1347,15 @@ void PerodicTableView::setLook( PerodicTableView::SCHEMETYPE type, int which ) { structure = ( *it )->crystalstructure(); if ( structure == "own") - (*it)->setElementColor( Qt::cyan ); + (*it)->setElementColor( TQt::cyan ); else if ( structure == "bcc" ) - (*it)->setElementColor( Qt::red ); + (*it)->setElementColor( TQt::red ); else if ( structure == "hdp" ) - (*it)->setElementColor( Qt::yellow ); + (*it)->setElementColor( TQt::yellow ); else if ( structure == "ccp" ) - (*it)->setElementColor( Qt::green ); + (*it)->setElementColor( TQt::green ); else - (*it)->setElementColor( Qt::white ); + (*it)->setElementColor( TQt::white ); ++it; } setGradient( false ); |