diff options
Diffstat (limited to 'krita/ui/kis_gradient_slider_widget.cc')
-rw-r--r-- | krita/ui/kis_gradient_slider_widget.cc | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/krita/ui/kis_gradient_slider_widget.cc b/krita/ui/kis_gradient_slider_widget.cc index 05e724a3..8f282ba3 100644 --- a/krita/ui/kis_gradient_slider_widget.cc +++ b/krita/ui/kis_gradient_slider_widget.cc @@ -19,7 +19,7 @@ #include "kis_gradient_slider_widget.h" -#include <qpainter.h> +#include <tqpainter.h> #include <kdebug.h> #include <kpopupmenu.h> @@ -30,8 +30,8 @@ #define MARGIN 5 #define HANDLE_SIZE 10 -KisGradientSliderWidget::KisGradientSliderWidget(QWidget *parent, const char* name, WFlags f ) - : QWidget( parent, name, f), +KisGradientSliderWidget::KisGradientSliderWidget(TQWidget *tqparent, const char* name, WFlags f ) + : TQWidget( tqparent, name, f), m_currentSegment(0), m_selectedSegment(0), m_drag(0) @@ -43,7 +43,7 @@ KisGradientSliderWidget::KisGradientSliderWidget(QWidget *parent, const char* na m_segmentMenu->insertItem(i18n("Duplicate Segment"), DUPLICATE_SEGMENT); m_segmentMenu->insertItem(i18n("Mirror Segment"), MIRROR_SEGMENT); m_segmentMenu->insertItem(i18n("Remove Segment"), REMOVE_SEGMENT); - connect( m_segmentMenu, SIGNAL( activated(int) ), SLOT( slotMenuAction(int) ) ); + connect( m_segmentMenu, TQT_SIGNAL( activated(int) ), TQT_SLOT( slotMenuAction(int) ) ); } void KisGradientSliderWidget::setGradientResource( KisAutogradientResource* agr) @@ -53,62 +53,62 @@ void KisGradientSliderWidget::setGradientResource( KisAutogradientResource* agr) emit sigSelectedSegment( m_selectedSegment ); } -void KisGradientSliderWidget::paintEvent ( QPaintEvent* pe ) +void KisGradientSliderWidget::paintEvent ( TQPaintEvent* pe ) { - QWidget::paintEvent( pe ); - QPixmap pixmap( width(), height() ); - pixmap.fill( colorGroup().background() ); - QPainter painter( &pixmap ); - painter.setPen( Qt::black ); + TQWidget::paintEvent( pe ); + TQPixmap pixmap( width(), height() ); + pixmap.fill( tqcolorGroup().background() ); + TQPainter painter( &pixmap ); + painter.setPen( TQt::black ); painter.drawRect( MARGIN, MARGIN, width() - 2 * MARGIN, height()- 2 * MARGIN - HANDLE_SIZE ); if(m_autogradientResource) { - QImage img = m_autogradientResource->generatePreview(width()- 2* MARGIN - 2, height()- 2* MARGIN - HANDLE_SIZE - 2); - QPixmap pixmap(img.width(), img.height()); + TQImage img = m_autogradientResource->generatePreview(width()- 2* MARGIN - 2, height()- 2* MARGIN - HANDLE_SIZE - 2); + TQPixmap pixmap(img.width(), img.height()); if (!img.isNull()) { m_pixmapIO.putImage(&pixmap, 0, 0, &img); painter.drawPixmap( MARGIN + 1, MARGIN + 1, pixmap, 0, 0, pixmap.width(), pixmap.height()); } - painter.fillRect( MARGIN + 1, height()- MARGIN - HANDLE_SIZE, width() - 2 * MARGIN, HANDLE_SIZE, QBrush( Qt::white ) ); + painter.fillRect( MARGIN + 1, height()- MARGIN - HANDLE_SIZE, width() - 2 * MARGIN, HANDLE_SIZE, TQBrush( TQt::white ) ); if( m_selectedSegment ) { - QRect selection( qRound( m_selectedSegment->startOffset()*(double)(width()- 2 * MARGIN - 2) ) + 6, + TQRect selection( tqRound( m_selectedSegment->startOffset()*(double)(width()- 2 * MARGIN - 2) ) + 6, height()- HANDLE_SIZE - MARGIN, - qRound( ( m_selectedSegment->endOffset() - m_selectedSegment->startOffset() )*(double)(width()-12) ), + tqRound( ( m_selectedSegment->endOffset() - m_selectedSegment->startOffset() )*(double)(width()-12) ), HANDLE_SIZE ); - painter.fillRect( selection, QBrush( colorGroup().highlight() ) ); + painter.fillRect( selection, TQBrush( tqcolorGroup().highlight() ) ); } - QPointArray triangle(3); - QValueVector<double> handlePositions = m_autogradientResource->getHandlePositions(); + TQPointArray triangle(3); + TQValueVector<double> handlePositions = m_autogradientResource->getHandlePositions(); int position; - painter.setBrush( QBrush( Qt::black) ); + painter.setBrush( TQBrush( TQt::black) ); for (uint i = 0; i < handlePositions.count(); i++) { - position = qRound( handlePositions[i] * (double)( width()-12) ) + 6; - triangle[0] = QPoint(position, height() - HANDLE_SIZE - MARGIN ); - triangle[1] = QPoint(position + (HANDLE_SIZE / 2 - 1), height() - MARGIN ); - triangle[2] = QPoint(position - (HANDLE_SIZE / 2 - 1), height() - MARGIN ); + position = tqRound( handlePositions[i] * (double)( width()-12) ) + 6; + triangle[0] = TQPoint(position, height() - HANDLE_SIZE - MARGIN ); + triangle[1] = TQPoint(position + (HANDLE_SIZE / 2 - 1), height() - MARGIN ); + triangle[2] = TQPoint(position - (HANDLE_SIZE / 2 - 1), height() - MARGIN ); painter.drawPolygon(triangle); } - painter.setBrush( QBrush( Qt::white ) ); - QValueVector<double> middleHandlePositions = m_autogradientResource->getMiddleHandlePositions(); + painter.setBrush( TQBrush( TQt::white ) ); + TQValueVector<double> middleHandlePositions = m_autogradientResource->getMiddleHandlePositions(); for (uint i = 0; i < middleHandlePositions.count(); i++) { - position = qRound( middleHandlePositions[i] * (double)(width()-12) ) + 6; - triangle[0] = QPoint(position, height()-HANDLE_SIZE - MARGIN); - triangle[1] = QPoint(position + (HANDLE_SIZE / 2 - 2), height() - MARGIN); - triangle[2] = QPoint(position - (HANDLE_SIZE / 2 - 2), height() - MARGIN); + position = tqRound( middleHandlePositions[i] * (double)(width()-12) ) + 6; + triangle[0] = TQPoint(position, height()-HANDLE_SIZE - MARGIN); + triangle[1] = TQPoint(position + (HANDLE_SIZE / 2 - 2), height() - MARGIN); + triangle[2] = TQPoint(position - (HANDLE_SIZE / 2 - 2), height() - MARGIN); painter.drawPolygon(triangle); } } - bitBlt( this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(), Qt::CopyROP); + bitBlt( this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(), TQt::CopyROP); } -void KisGradientSliderWidget::mousePressEvent( QMouseEvent * e ) +void KisGradientSliderWidget::mousePressEvent( TQMouseEvent * e ) { - QWidget::mousePressEvent( e ); + TQWidget::mousePressEvent( e ); if( ( e->y() < MARGIN || e->y() > height() - MARGIN ) || ( e->x() < MARGIN || e->x() > width() - MARGIN ) || e-> button() != LeftButton ) return; double t = (double)(e->x() - MARGIN) / (double)(width() - 2 * MARGIN); @@ -117,35 +117,35 @@ void KisGradientSliderWidget::mousePressEvent( QMouseEvent * e ) if(segment != 0) { m_currentSegment = segment; - QRect leftHandle( qRound(m_currentSegment->startOffset() * (double)(width()-2*MARGIN-2)+ MARGIN - (HANDLE_SIZE/2 - 1 )), + TQRect leftHandle( tqRound(m_currentSegment->startOffset() * (double)(width()-2*MARGIN-2)+ MARGIN - (HANDLE_SIZE/2 - 1 )), height() - HANDLE_SIZE, HANDLE_SIZE - 1, HANDLE_SIZE); - QRect middleHandle( qRound(m_currentSegment->middleOffset() * (double)(width()-2*MARGIN-2)+ MARGIN - (HANDLE_SIZE/2 -2) ), + TQRect middleHandle( tqRound(m_currentSegment->middleOffset() * (double)(width()-2*MARGIN-2)+ MARGIN - (HANDLE_SIZE/2 -2) ), height() - HANDLE_SIZE - MARGIN, HANDLE_SIZE - 1, HANDLE_SIZE); - QRect rightHandle( qRound(m_currentSegment->endOffset() * (double)(width()-2*MARGIN-2)+ MARGIN - (HANDLE_SIZE/2 - 1 )), + TQRect rightHandle( tqRound(m_currentSegment->endOffset() * (double)(width()-2*MARGIN-2)+ MARGIN - (HANDLE_SIZE/2 - 1 )), height() - HANDLE_SIZE, HANDLE_SIZE - 1, HANDLE_SIZE); // Change the activation order of the handles to avoid deadlocks if( t > 0.5 ) { - if( leftHandle.contains( e->pos() ) ) + if( leftHandle.tqcontains( e->pos() ) ) m_drag = LEFT_DRAG; - else if( middleHandle.contains( e->pos() ) ) + else if( middleHandle.tqcontains( e->pos() ) ) m_drag = MIDDLE_DRAG; - else if( rightHandle.contains( e->pos() ) ) + else if( rightHandle.tqcontains( e->pos() ) ) m_drag = RIGHT_DRAG; } else { - if( rightHandle.contains( e->pos() ) ) + if( rightHandle.tqcontains( e->pos() ) ) m_drag = RIGHT_DRAG; - else if( middleHandle.contains( e->pos() ) ) + else if( middleHandle.tqcontains( e->pos() ) ) m_drag = MIDDLE_DRAG; - else if( leftHandle.contains( e->pos() ) ) + else if( leftHandle.tqcontains( e->pos() ) ) m_drag = LEFT_DRAG; } @@ -155,18 +155,18 @@ void KisGradientSliderWidget::mousePressEvent( QMouseEvent * e ) emit sigSelectedSegment( m_selectedSegment ); } } - repaint(false); + tqrepaint(false); } -void KisGradientSliderWidget::mouseReleaseEvent ( QMouseEvent * e ) +void KisGradientSliderWidget::mouseReleaseEvent ( TQMouseEvent * e ) { - QWidget::mouseReleaseEvent( e ); + TQWidget::mouseReleaseEvent( e ); m_drag = NO_DRAG; } -void KisGradientSliderWidget::mouseMoveEvent( QMouseEvent * e ) +void KisGradientSliderWidget::mouseMoveEvent( TQMouseEvent * e ) { - QWidget::mouseMoveEvent( e ); + TQWidget::mouseMoveEvent( e ); if( ( e->y() < MARGIN || e->y() > height() - MARGIN ) || ( e->x() < MARGIN || e->x() > width() - MARGIN ) ) return; double t = (double)(e->x() - MARGIN) / (double)(width() - 2 * MARGIN); @@ -186,10 +186,10 @@ void KisGradientSliderWidget::mouseMoveEvent( QMouseEvent * e ) if ( m_drag != NO_DRAG) emit sigChangedSegment( m_currentSegment ); - repaint(false); + tqrepaint(false); } -void KisGradientSliderWidget::contextMenuEvent( QContextMenuEvent * e ) +void KisGradientSliderWidget::contextMenuEvent( TQContextMenuEvent * e ) { m_segmentMenu->setItemEnabled( REMOVE_SEGMENT, m_autogradientResource->removeSegmentPossible() ); m_segmentMenu->popup( e->globalPos()); @@ -213,7 +213,7 @@ void KisGradientSliderWidget::slotMenuAction( int id ) break; } emit sigSelectedSegment( m_selectedSegment ); - repaint(false); + tqrepaint(false); } #include "kis_gradient_slider_widget.moc" |