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/kalziumtip.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/kalziumtip.cpp')
-rw-r--r-- | kalzium/src/kalziumtip.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/kalzium/src/kalziumtip.cpp b/kalzium/src/kalziumtip.cpp index ba2a8252..794c9f25 100644 --- a/kalzium/src/kalziumtip.cpp +++ b/kalzium/src/kalziumtip.cpp @@ -38,9 +38,9 @@ #include <klocale.h> #include <kstandarddirs.h> -KalziumTip::KalziumTip( TQWidget * parent, const char * name, WFlags f ) : TQWidget( parent, name, f ) +KalziumTip::KalziumTip( TQWidget * tqparent, const char * name, WFlags f ) : TQWidget( tqparent, name, f ) { - setFocusPolicy(NoFocus); //the widget don't get the keyboard focus + setFocusPolicy(TQ_NoFocus); //the widget don't get the keyboard focus setBackgroundMode(NoBackground); // widget has no background resize(0,0); hide(); //initailly hide it @@ -54,8 +54,8 @@ KalziumTip::KalziumTip( TQWidget * parent, const char * name, WFlags f ) : TQWid void KalziumTip::showTip( TQPoint mouse, Element* element, int visibleWidth, int visibleHeight ) { TQWidget *p = 0; - if ( dynamic_cast<TQWidget*>( parent() ) ) - p = static_cast<TQWidget*>( parent() ); + if ( dynamic_cast<TQWidget*>( tqparent() ) ) + p = TQT_TQWIDGET( tqparent() ); if ( p ) { @@ -82,8 +82,8 @@ void KalziumTip::showTip( TQPoint mouse, Element* element, int visibleWidth, int if( element == m_tippedElement ) { // Avoid moving out of the current screen - if (m_mousePointer.x()+width() > qApp->desktop()->width()) - m_mousePointer.setX(qApp->desktop()->width() - width()); + if (m_mousePointer.x()+width() > tqApp->desktop()->width()) + m_mousePointer.setX(tqApp->desktop()->width() - width()); move(m_mousePointer); //do not paint again if already painted } @@ -113,7 +113,7 @@ void KalziumTip::paintEvent(TQPaintEvent* e) void KalziumTip::mouseMoveEvent(TQMouseEvent * e) { - // delegate the mouse move event to the parent (actually the elements table) + // delegate the mouse move event to the tqparent (actually the elements table) // so that this tooltip doesn't stop to be updated e->ignore(); } @@ -128,10 +128,10 @@ void KalziumTip::display() TQString elementname = m_tippedElement->elname(); TQString number = i18n( "Number: %1" ) - .arg( TQString::number(m_tippedElement->number()) ); + .tqarg( TQString::number(m_tippedElement->number()) ); TQString mass = i18n( "Mass: %1" ) - .arg( KalziumUtils::localizedValue(m_tippedElement->mass(), 6) ); + .tqarg( KalziumUtils::localizedValue(m_tippedElement->mass(), 6) ); m_richText = new TQSimpleRichText("<qt><h1>" + elementname + "</h1><p>" + number + "</p><p>" @@ -139,7 +139,7 @@ void KalziumTip::display() m_richText->setWidth(400); - m_maskEffect = isVisible() ? Plain : Dissolve; + m_tqmaskEffect = isVisible() ? Plain : Dissolve; m_dissolveSize = 24; m_dissolveDelta = -1; @@ -167,18 +167,18 @@ void KalziumTip::displayInternal() textRect.addCoords(0,0,2,2); int margin = KDialog::marginHint(); - int height = QMAX(m_icon.height(), textRect.height()) + 2 * margin; + int height = TQMAX(m_icon.height(), textRect.height()) + 2 * margin; int textX = 2 + m_icon.width() + 2 * margin; int width = textX + textRect.width() + margin; int textY = (height - textRect.height()) / 2; - //resize pixmap, mask and widget - m_mask.resize(width, height); + //resize pixmap, tqmask and widget + m_tqmask.resize(width, height); m_pixmap.resize(width, height); resize(width, height); - // create and set transparency mask - switch(m_maskEffect) + // create and set transparency tqmask + switch(m_tqmaskEffect) { case Plain: plainMask(); @@ -191,7 +191,7 @@ void KalziumTip::displayInternal() // draw background TQPainter bufferPainter(&m_pixmap); - bufferPainter.setPen(Qt::black); + bufferPainter.setPen(TQt::black); bufferPainter.setBrush(backgroundColor()); bufferPainter.drawRoundRect(0, 0, width, height, 1600 / width, 1600 / height); @@ -206,32 +206,32 @@ void KalziumTip::displayInternal() } // draw text shadow - TQColorGroup cg = colorGroup(); + TQColorGroup cg = tqcolorGroup(); cg.setColor(TQColorGroup::Text, cg.background().dark(115)); int shadowOffset = TQApplication::reverseLayout() ? -1 : 1; m_richText->draw(&bufferPainter, 5 + textX + shadowOffset, textY + 1, TQRect(), cg); // draw text - cg = colorGroup(); + cg = tqcolorGroup(); m_richText->draw(&bufferPainter, 5 + textX, textY, rect(), cg); } void KalziumTip::dissolveMask() { - TQPainter maskPainter(&m_mask); + TQPainter tqmaskPainter(&m_tqmask); - m_mask.fill(Qt::black); + m_tqmask.fill(TQt::black); - maskPainter.setBrush(Qt::white); - maskPainter.setPen(Qt::white); - maskPainter.drawRoundRect(m_mask.rect(), 1600 / m_mask.rect().width(), - 1600 / m_mask.rect().height()); + tqmaskPainter.setBrush(TQt::white); + tqmaskPainter.setPen(TQt::white); + tqmaskPainter.drawRoundRect(m_tqmask.rect(), 1600 / m_tqmask.rect().width(), + 1600 / m_tqmask.rect().height()); m_dissolveSize += m_dissolveDelta; if (m_dissolveSize > 0) { - maskPainter.setRasterOp(Qt::EraseROP); + tqmaskPainter.setRasterOp(TQt::EraseROP); int x, y, s; const int size = 16; @@ -247,7 +247,7 @@ void KalziumTip::dissolveMask() { s = 0; } - maskPainter.drawEllipse(x - s / 2, y - s / 2, s, s); + tqmaskPainter.drawEllipse(x - s / 2, y - s / 2, s, s); } } } @@ -257,7 +257,7 @@ void KalziumTip::dissolveMask() m_dissolveDelta = 1; } - setMask(m_mask); + setMask(m_tqmask); } void KalziumTip::hide() @@ -269,15 +269,15 @@ void KalziumTip::hide() void KalziumTip::plainMask() { - TQPainter maskPainter(&m_mask); + TQPainter tqmaskPainter(&m_tqmask); - m_mask.fill(Qt::black); + m_tqmask.fill(TQt::black); - maskPainter.setBrush(Qt::white); - maskPainter.setPen(Qt::white); - maskPainter.drawRoundRect(m_mask.rect(), 1600 / m_mask.rect().width(), - 1600 / m_mask.rect().height()); - setMask(m_mask); + tqmaskPainter.setBrush(TQt::white); + tqmaskPainter.setPen(TQt::white); + tqmaskPainter.drawRoundRect(m_tqmask.rect(), 1600 / m_tqmask.rect().width(), + 1600 / m_tqmask.rect().height()); + setMask(m_tqmask); m_frameTimer.stop(); } @@ -293,7 +293,7 @@ void KalziumTip::loadIcon() if ( !iconpath.isEmpty() ) { TQImage img ( iconpath, "JPEG" ); - img = img.smoothScale ( 128, 128, TQImage::ScaleMin ); + img = img.smoothScale ( 128, 128, TQ_ScaleMin ); m_icon.convertFromImage( img ); } |