summaryrefslogtreecommitdiffstats
path: root/lib/kopainter/koColorSlider.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kopainter/koColorSlider.cc')
-rw-r--r--lib/kopainter/koColorSlider.cc122
1 files changed, 61 insertions, 61 deletions
diff --git a/lib/kopainter/koColorSlider.cc b/lib/kopainter/koColorSlider.cc
index 08c8020a..a7674e4b 100644
--- a/lib/kopainter/koColorSlider.cc
+++ b/lib/kopainter/koColorSlider.cc
@@ -19,29 +19,29 @@
#include "koColorSlider.h"
-#include <qpainter.h>
-#include <qcursor.h>
-#include <qpen.h>
+#include <tqpainter.h>
+#include <tqcursor.h>
+#include <tqpen.h>
#include <kdebug.h>
#include <kpixmapeffect.h>
-KoColorFrame::KoColorFrame(QWidget *parent):
-QFrame(parent)
+KoColorFrame::KoColorFrame(TQWidget *tqparent):
+TQFrame(tqparent)
{
setFrameStyle(Panel | Sunken);
setBackgroundMode(NoBackground);
/* default values */
- mC1 = QColor(0, 0, 0);
- mC2 = QColor(255, 255, 255);
+ mC1 = TQColor(0, 0, 0);
+ mC2 = TQColor(255, 255, 255);
mColorChanged = false;
mPixChanged = false;
mDragging = false;
}
-const QColor KoColorFrame::colorAt(const QPoint &p)
+const TQColor KoColorFrame::colorAt(const TQPoint &p)
{
if(mPixChanged)
{
@@ -50,29 +50,29 @@ const QColor KoColorFrame::colorAt(const QPoint &p)
}
if(p.x() >= mPixmap.width() || p.y() >= mPixmap.height())
- return QColor(255,255,255);
+ return TQColor(255,255,255);
- return QColor(mImage.pixel(p.x(), p.y()));
+ return TQColor(mImage.pixel(p.x(), p.y()));
}
-void KoColorFrame::slotSetColor1(const QColor &c)
+void KoColorFrame::slotSetColor1(const TQColor &c)
{
mC1 = c;
mColorChanged = true;
mPixChanged = true;
- repaint();
+ tqrepaint();
}
-void KoColorFrame::slotSetColor2(const QColor &c)
+void KoColorFrame::slotSetColor2(const TQColor &c)
{
mC2 = c;
mColorChanged = true;
- repaint();
+ tqrepaint();
}
-void KoColorFrame::drawContents(QPainter *p)
+void KoColorFrame::drawContents(TQPainter *p)
{
- QRect r = contentsRect();
+ TQRect r = contentsRect();
if((mPixmap.size() != r.size()) || mColorChanged)
{
@@ -85,14 +85,14 @@ void KoColorFrame::drawContents(QPainter *p)
p->drawPixmap(r.left(), r.top(), mPixmap);
}
-void KoColorFrame::mousePressEvent(QMouseEvent *e)
+void KoColorFrame::mousePressEvent(TQMouseEvent *e)
{
- if(e->button() & LeftButton)
+ if(e->button() & Qt::LeftButton)
{
emit clicked(e->pos());
mDragging = true;
- QPoint pos = QPoint(e->pos().x() - contentsRect().left(), e->pos().y() - contentsRect().top());
+ TQPoint pos = TQPoint(e->pos().x() - contentsRect().left(), e->pos().y() - contentsRect().top());
if(pos.x() < 0)
pos.setX(0);
@@ -104,22 +104,22 @@ void KoColorFrame::mousePressEvent(QMouseEvent *e)
else if(pos.y() >= contentsRect().height())
pos.setY(contentsRect().height()-1);
- QColor c = colorAt(pos);
+ TQColor c = colorAt(pos);
emit colorSelected(c);
}
else
- QFrame::mousePressEvent(e);
+ TQFrame::mousePressEvent(e);
}
-void KoColorFrame::mouseReleaseEvent(QMouseEvent *e)
+void KoColorFrame::mouseReleaseEvent(TQMouseEvent *e)
{
- if(e->button() & LeftButton)
+ if(e->button() & Qt::LeftButton)
mDragging = false;
else
- QFrame::mouseReleaseEvent(e);
+ TQFrame::mouseReleaseEvent(e);
}
-void KoColorFrame::mouseMoveEvent(QMouseEvent *e)
+void KoColorFrame::mouseMoveEvent(TQMouseEvent *e)
{
if(mDragging)
{
@@ -154,31 +154,31 @@ void KoColorFrame::mouseMoveEvent(QMouseEvent *e)
}
// if(set)
-// QCursor::setPos(mapToGlobal(QPoint(x,y)));
+// TQCursor::setPos(mapToGlobal(TQPoint(x,y)));
- QPoint pos = QPoint(x - contentsRect().left(), y - contentsRect().top());
+ TQPoint pos = TQPoint(x - contentsRect().left(), y - contentsRect().top());
- QColor c = colorAt(pos);
+ TQColor c = colorAt(pos);
emit colorSelected(c);
}
else
- QFrame::mouseMoveEvent(e);
+ TQFrame::mouseMoveEvent(e);
}
/***********************************************************************************/
-KoSliderWidget::KoSliderWidget(QWidget *parent):
-QWidget(parent)
+KoSliderWidget::KoSliderWidget(TQWidget *tqparent):
+TQWidget(tqparent)
{
mDragging = false;
setFixedHeight(6);
setFixedWidth(11);
}
-void KoSliderWidget::paintEvent(QPaintEvent *)
+void KoSliderWidget::paintEvent(TQPaintEvent *)
{
- QPainter p;
- QPen pen(black, 1);
+ TQPainter p;
+ TQPen pen(black, 1);
p.begin(this);
p.setPen(pen);
@@ -188,35 +188,35 @@ void KoSliderWidget::paintEvent(QPaintEvent *)
p.end();
}
-void KoSliderWidget::mousePressEvent(QMouseEvent *e)
+void KoSliderWidget::mousePressEvent(TQMouseEvent *e)
{
- if(e->button() & LeftButton)
+ if(e->button() & Qt::LeftButton)
{
mPos = e->pos();
mDragging = true;
}
else
- QWidget::mousePressEvent(e);
+ TQWidget::mousePressEvent(e);
}
-void KoSliderWidget::mouseReleaseEvent(QMouseEvent *e)
+void KoSliderWidget::mouseReleaseEvent(TQMouseEvent *e)
{
- if(e->button() & LeftButton)
+ if(e->button() & Qt::LeftButton)
mDragging = false;
else
- QWidget::mouseReleaseEvent(e);
+ TQWidget::mouseReleaseEvent(e);
}
-void KoSliderWidget::mouseMoveEvent(QMouseEvent *e)
+void KoSliderWidget::mouseMoveEvent(TQMouseEvent *e)
{
if(mDragging)
{
- QWidget *p = parentWidget();
+ TQWidget *p = tqparentWidget();
if(!p)
return;
- QPoint newPos = p->mapFromGlobal(QCursor::pos()) - mPos;
+ TQPoint newPos = p->mapFromGlobal(TQCursor::pos()) - mPos;
/* don't drag vertically */
newPos.setY(pos().y());
@@ -230,13 +230,13 @@ void KoSliderWidget::mouseMoveEvent(QMouseEvent *e)
emit positionChanged(newPos.x());
}
else
- QWidget::mouseMoveEvent(e);
+ TQWidget::mouseMoveEvent(e);
}
/***********************************************************************************/
-KoColorSlider::KoColorSlider(QWidget *parent):
-QWidget(parent)
+KoColorSlider::KoColorSlider(TQWidget *tqparent):
+TQWidget(tqparent)
{
mColorFrame = new KoColorFrame(this);
mSlider = new KoSliderWidget(this);
@@ -245,8 +245,8 @@ QWidget(parent)
mMax = 255;
mValue = 0;
- connect(mSlider, SIGNAL(positionChanged(int)), this, SLOT(slotSliderMoved(int)));
- connect(mColorFrame, SIGNAL(clicked(const QPoint &)), this, SLOT(slotFrameClicked(const QPoint &)));
+ connect(mSlider, TQT_SIGNAL(positionChanged(int)), this, TQT_SLOT(slotSliderMoved(int)));
+ connect(mColorFrame, TQT_SIGNAL(clicked(const TQPoint &)), this, TQT_SLOT(slotFrameClicked(const TQPoint &)));
}
KoColorSlider::~KoColorSlider()
@@ -274,21 +274,21 @@ void KoColorSlider::slotSetRange(int min, int max)
mMax = max;
}
-void KoColorSlider::resizeEvent(QResizeEvent *e)
+void KoColorSlider::resizeEvent(TQResizeEvent *e)
{
- QWidget::resizeEvent(e);
+ TQWidget::resizeEvent(e);
// m_pSlider->width()/2 * 2 seems stupid but is not because for example
// m_pSlider->width() == 11 I get 10.
mColorFrame->setGeometry(mSlider->width() / 2, 0, width() - mSlider->width() / 2 * 2, height() - mSlider->height());
slotSetValue(mValue);
}
-void KoColorSlider::slotSetColor1(const QColor &c)
+void KoColorSlider::slotSetColor1(const TQColor &c)
{
mColorFrame->slotSetColor1(c);
}
-void KoColorSlider::slotSetColor2(const QColor &c)
+void KoColorSlider::slotSetColor2(const TQColor &c)
{
mColorFrame->slotSetColor2(c);
}
@@ -310,7 +310,7 @@ void KoColorSlider::slotSetValue(int value)
float factor = v / range;
int x = static_cast<int>(factor * mColorFrame->contentsRect().width());
- mSlider->move(QPoint(x, height() - mSlider->height()));
+ mSlider->move(TQPoint(x, height() - mSlider->height()));
}
void KoColorSlider::slotSliderMoved(int x)
@@ -327,13 +327,13 @@ void KoColorSlider::slotSliderMoved(int x)
mValue = static_cast<int>(factor * range);
emit valueChanged(mValue);
- emit colorSelected(mColorFrame->colorAt(QPoint(x, mColorFrame->contentsRect().height()/2)));
+ emit colorSelected(mColorFrame->colorAt(TQPoint(x, mColorFrame->contentsRect().height()/2)));
}
-void KoColorSlider::slotFrameClicked(const QPoint &p)
+void KoColorSlider::slotFrameClicked(const TQPoint &p)
{
- QPoint local = mColorFrame->mapToParent(p);
- QPoint pos = QPoint(local.x() - mSlider->width() / 2, height() - mSlider->height());
+ TQPoint local = mColorFrame->mapToParent(p);
+ TQPoint pos = TQPoint(local.x() - mSlider->width() / 2, height() - mSlider->height());
if(pos.x() < 0)
pos.setX(0);
@@ -344,11 +344,11 @@ void KoColorSlider::slotFrameClicked(const QPoint &p)
slotSliderMoved(pos.x());
}
-void KoColorSlider::mousePressEvent(QMouseEvent *e)
+void KoColorSlider::mousePressEvent(TQMouseEvent *e)
{
- if(e->button() & LeftButton)
+ if(e->button() & Qt::LeftButton)
{
- QPoint pos = QPoint(e->pos().x() - mSlider->width() / 2, height() - mSlider->height());
+ TQPoint pos = TQPoint(e->pos().x() - mSlider->width() / 2, height() - mSlider->height());
if(pos.x() < 0)
pos.setX(0);
@@ -359,7 +359,7 @@ void KoColorSlider::mousePressEvent(QMouseEvent *e)
slotSliderMoved(pos.x());
}
else
- QWidget::mousePressEvent(e);
+ TQWidget::mousePressEvent(e);
}
#include "koColorSlider.moc"