summaryrefslogtreecommitdiffstats
path: root/src/kcolorcombo2.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-17 08:20:48 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-17 08:20:48 +0000
commitaa0726b20f398264f0a2abc60215be044b106f9c (patch)
tree070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/kcolorcombo2.cpp
parentd3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff)
downloadbasket-aa0726b20f398264f0a2abc60215be044b106f9c.tar.gz
basket-aa0726b20f398264f0a2abc60215be044b106f9c.zip
TQt4 port basket
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kcolorcombo2.cpp')
-rw-r--r--src/kcolorcombo2.cpp242
1 files changed, 121 insertions, 121 deletions
diff --git a/src/kcolorcombo2.cpp b/src/kcolorcombo2.cpp
index b5ac1e3..e898e46 100644
--- a/src/kcolorcombo2.cpp
+++ b/src/kcolorcombo2.cpp
@@ -18,21 +18,21 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include <qapplication.h>
-#include <qpixmap.h>
-#include <qbitmap.h>
-#include <qpainter.h>
-#include <qlistbox.h>
+#include <tqapplication.h>
+#include <tqpixmap.h>
+#include <tqbitmap.h>
+#include <tqpainter.h>
+#include <tqlistbox.h>
#include <kglobalsettings.h>
#include <klocale.h>
#include <kcolordialog.h>
-#include <qclipboard.h>
+#include <tqclipboard.h>
#include <kstdaccel.h>
#include <kcolordrag.h>
#include "kcolorcombo2.h"
-//#include "qeffects.h"
+//#include "tqeffects.h"
//#define DEBUG_COLOR_ARRAY
//#define OUTPUT_GIMP_PALETTE
@@ -52,23 +52,23 @@ const int KColorPopup::MARGIN = 1;
const int KColorPopup::FRAME_WIDTH = 1;
-KColorPopup::KColorPopup(KColorCombo2 *parent)
- : QWidget(/*parent=*/0, /*name=*/0, WType_Popup | WNoAutoErase),
- m_selector(parent)
+KColorPopup::KColorPopup(KColorCombo2 *tqparent)
+ : TQWidget(/*tqparent=*/0, /*name=*/0, WType_Popup | WNoAutoErase),
+ m_selector(tqparent)
{
hide();
setMouseTracking(true);
//resize(20, 20);
- //setWFlags(Qt::WNoAutoErase);
+ //setWFlags(TQt::WNoAutoErase);
}
KColorPopup::~KColorPopup()
{
}
-#include <qcursor.h>
+#include <tqcursor.h>
-void KColorPopup::relayout() // FIXME: relayout should NOT redraw the pixmap!
+void KColorPopup::retqlayout() // FIXME: retqlayout should NOT redraw the pixmap!
{
int columnCount = m_selector->columnCount();
int rowCount = m_selector->rowCount();
@@ -83,14 +83,14 @@ void KColorPopup::relayout() // FIXME: relayout should NOT redraw the pixmap!
// Initialize the pixmap:
m_pixmap.resize(width, height);
- QPainter painter(&m_pixmap);
+ TQPainter painter(&m_pixmap);
painter.fillRect(0, 0, width, height, KGlobalSettings::baseColor());
painter.setPen(KGlobalSettings::textColor());
painter.drawRect(0, 0, width, height);
// Needed to draw:
int x, y;
- QRect selectionRect;
+ TQRect selectionRect;
// Draw the color array:
for (int i = 0; i < columnCount; ++i) {
@@ -98,7 +98,7 @@ void KColorPopup::relayout() // FIXME: relayout should NOT redraw the pixmap!
x = 1 + MARGIN + (colorWidth + MARGIN) * i;
y = 1 + MARGIN + (colorHeight + MARGIN) * j;
if (i == m_selectedColumn && j == m_selectedRow) {
- selectionRect = QRect(x - 2, y - 2, colorWidth + 4, colorHeight + 4);
+ selectionRect = TQRect(x - 2, y - 2, colorWidth + 4, colorHeight + 4);
painter.fillRect(selectionRect, KGlobalSettings::highlightColor());
}
m_selector->drawColorRect(painter, x, y, m_selector->colorAt(i, j), /*isDefault=*/false, colorWidth, colorHeight);
@@ -111,11 +111,11 @@ void KColorPopup::relayout() // FIXME: relayout should NOT redraw the pixmap!
// Draw the "(Default)" and "Other..." colors:
y = height - (colorHeight + MARGIN) - 1;
- QColor textColor;
+ TQColor textColor;
if (m_selector->defaultColor().isValid()) {
x = 1 + MARGIN;
if (m_selectedColumn < m_columnOther && rowCount == m_selectedRow) {
- selectionRect = QRect(x - 2, y - 2, defaultCellWidth, colorHeight + 4);
+ selectionRect = TQRect(x - 2, y - 2, defaultCellWidth, colorHeight + 4);
painter.fillRect(selectionRect, KGlobalSettings::highlightColor());
textColor = KGlobalSettings::highlightedTextColor();
} else
@@ -127,7 +127,7 @@ void KColorPopup::relayout() // FIXME: relayout should NOT redraw the pixmap!
}
x = 1 + MARGIN + m_columnOther * (colorWidth + MARGIN);
if (m_selectedColumn >= m_columnOther && rowCount == m_selectedRow) {
- selectionRect = QRect(x - 2, y - 2, otherCellWidth, colorHeight + 4);
+ selectionRect = TQRect(x - 2, y - 2, otherCellWidth, colorHeight + 4);
painter.fillRect(selectionRect, KGlobalSettings::highlightColor());
textColor = KGlobalSettings::highlightedTextColor();
} else
@@ -137,7 +137,7 @@ void KColorPopup::relayout() // FIXME: relayout should NOT redraw the pixmap!
painter.setPen(textColor);
painter.drawText(x + 2 + colorWidth, y, /*width=*/5000, colorHeight, AlignLeft | AlignVCenter | DontClip, i18n("Other..."));
-// QPoint pos = mapFromGlobal(QCursor::pos());
+// TQPoint pos = mapFromGlobal(TQCursor::pos());
// painter.drawRect(pos.x(), pos.y(), 5000, 5000);
}
@@ -163,7 +163,7 @@ void KColorPopup::updateCell(int column, int row)
void KColorPopup::doSelection()
{
- m_otherColor = QColor();
+ m_otherColor = TQColor();
// If the selected color is not the default one, try to find it in the array:
if (m_selector->color().isValid()) {
@@ -196,15 +196,15 @@ void KColorPopup::validate()
if (m_selectedRow != m_selector->rowCount()) // A normal row:
m_selector->setColor(m_selector->colorAt(m_selectedColumn, m_selectedRow));
else if (m_selectedColumn < m_columnOther) // The default color:
- m_selector->setColor(QColor());
+ m_selector->setColor(TQColor());
else { // The user want to choose one:
- QColor color = m_selector->effectiveColor();
- if (KColorDialog::getColor(color, this) == QDialog::Accepted)
+ TQColor color = m_selector->effectiveColor();
+ if (KColorDialog::getColor(color, this) == TQDialog::Accepted)
m_selector->setColor(color);
}
}
-void KColorPopup::mousePressEvent(QMouseEvent *event)
+void KColorPopup::mousePressEvent(TQMouseEvent *event)
{
int x = event->pos().x();
int y = event->pos().y();
@@ -217,15 +217,15 @@ void KColorPopup::mousePressEvent(QMouseEvent *event)
event->accept();
}
-void KColorPopup::paintEvent(QPaintEvent *event)
+void KColorPopup::paintEvent(TQPaintEvent *event)
{
- QPainter painter(this);
+ TQPainter painter(this);
painter.drawPixmap(0, 0, m_pixmap);
- painter.setPen(Qt::black);
+ painter.setPen(TQt::black);
painter.drawRect(event->rect());
}
-void KColorPopup::mouseMoveEvent(QMouseEvent *event)
+void KColorPopup::mouseMoveEvent(TQMouseEvent *event)
{
int x = event->pos().x();
int y = event->pos().y();
@@ -240,11 +240,11 @@ void KColorPopup::mouseMoveEvent(QMouseEvent *event)
m_selectedColumn = (x - FRAME_WIDTH - MARGIN + 2) / (colorWidth + MARGIN);
m_selectedRow = (y - FRAME_WIDTH - MARGIN + 2) / (colorHeight + MARGIN);
- relayout();
+ retqlayout();
update();
}
-void KColorPopup::keyPressEvent(QKeyEvent *event)
+void KColorPopup::keyPressEvent(TQKeyEvent *event)
{
int column = m_selectedColumn;
int row = m_selectedRow;
@@ -252,7 +252,7 @@ void KColorPopup::keyPressEvent(QKeyEvent *event)
int rowCount = m_selector->rowCount();
switch (event->key()) {
- case Qt::Key_Right:
+ case TQt::Key_Right:
if (m_selectedRow != rowCount) // A normal row:
column = (column + 1) % columnCount;
else {
@@ -261,7 +261,7 @@ void KColorPopup::keyPressEvent(QKeyEvent *event)
column = (m_selectedColumn < m_columnOther ? m_columnOther : 0);
}
break;
- case Qt::Key_Left:
+ case TQt::Key_Left:
if (m_selectedRow != rowCount) { // A normal row:
column = (column - 1);
if (column < 0)
@@ -272,32 +272,32 @@ void KColorPopup::keyPressEvent(QKeyEvent *event)
column = (m_selectedColumn < m_columnOther ? m_columnOther : 0);
}
break;
- case Qt::Key_Up: row = (row - 1); if (row < 0) row = rowCount; break;
- case Qt::Key_Down: row = (row + 1) % (rowCount+1); break;
- case Qt::Key_PageDown: row += 10; if (row > rowCount) row = rowCount; break;
- case Qt::Key_PageUp: row -= 10; if (row < 0) row = 0; break;
- case Qt::Key_Home: row = 0; column = 0; break;
- case Qt::Key_End: row = rowCount; column = columnCount - 1; break;
- case Qt::Key_Return:
+ case TQt::Key_Up: row = (row - 1); if (row < 0) row = rowCount; break;
+ case TQt::Key_Down: row = (row + 1) % (rowCount+1); break;
+ case TQt::Key_PageDown: row += 10; if (row > rowCount) row = rowCount; break;
+ case TQt::Key_PageUp: row -= 10; if (row < 0) row = 0; break;
+ case TQt::Key_Home: row = 0; column = 0; break;
+ case TQt::Key_End: row = rowCount; column = columnCount - 1; break;
+ case TQt::Key_Return:
validate();
break;
default:
- QWidget::keyPressEvent(event);
+ TQWidget::keyPressEvent(event);
}
if (row != m_selectedRow || column != m_selectedColumn) {
m_selectedRow = row;
m_selectedColumn = column;
- relayout();
+ retqlayout();
update();
}
}
/** Helper function: */
-QColor Tool_mixColors(const QColor &color1, const QColor &color2)
+TQColor Tool_mixColors(const TQColor &color1, const TQColor &color2)
{
- QColor mixedColor;
+ TQColor mixedColor;
mixedColor.setRgb( (color1.red() + color2.red()) / 2,
(color1.green() + color2.green()) / 2,
(color1.blue() + color2.blue()) / 2 );
@@ -318,15 +318,15 @@ class KColorCombo2::KColorCombo2Private
* Some other piece of code comes from KColorButton (in libkdeui) to enable color drag, drop, copy and paste.
*/
-KColorCombo2::KColorCombo2(const QColor &color, const QColor &defaultColor, QWidget *parent, const char *name)
- : QComboBox(/*editable=*/false, parent, name),
+KColorCombo2::KColorCombo2(const TQColor &color, const TQColor &defaultColor, TQWidget *tqparent, const char *name)
+ : TQComboBox(/*editable=*/false, tqparent, name),
m_color(color), m_defaultColor(defaultColor)
{
init();
}
-KColorCombo2::KColorCombo2(const QColor &color, QWidget *parent, const char *name)
- : QComboBox(/*editable=*/false, parent, name),
+KColorCombo2::KColorCombo2(const TQColor &color, TQWidget *tqparent, const char *name)
+ : TQComboBox(/*editable=*/false, tqparent, name),
m_color(color), m_defaultColor()
{
init();
@@ -358,7 +358,7 @@ KColorCombo2::~KColorCombo2()
deleteColorArray();
}
-void KColorCombo2::setColor(const QColor &color)
+void KColorCombo2::setColor(const TQColor &color)
{
// Do nothing if the color should be set to the default one and there is no such default color allowed:
if (!color.isValid() && !m_defaultColor.isValid()) {
@@ -373,12 +373,12 @@ void KColorCombo2::setColor(const QColor &color)
}
}
-QColor KColorCombo2::color() const
+TQColor KColorCombo2::color() const
{
return m_color;
}
-QColor KColorCombo2::effectiveColor() const
+TQColor KColorCombo2::effectiveColor() const
{
if (m_color.isValid())
return m_color;
@@ -407,14 +407,14 @@ void KColorCombo2::setRainbowPreset(int colorColumnCount, int lightRowCount, int
// With light colors:
for (int j = 1; j <= lightRowCount; ++j) { // Start to 1 because we don't want a row full of white!
int saturation = j * 255 / (lightRowCount + 1);
- setColorAt(i, j - 1, QColor(hue, saturation, 255, QColor::Hsv));
+ setColorAt(i, j - 1, TQColor(hue, saturation, 255, TQColor::Hsv));
}
// With pure colors:
- setColorAt(i, lightRowCount, QColor(hue, 255, 255, QColor::Hsv));
+ setColorAt(i, lightRowCount, TQColor(hue, 255, 255, TQColor::Hsv));
// With dark colors:
for (int j = 1; j <= darkRowCount; ++j) {
int value = 255 - j * 255 / (darkRowCount + 1);
- setColorAt(i, lightRowCount + j, QColor(hue, 255, value, QColor::Hsv));
+ setColorAt(i, lightRowCount + j, TQColor(hue, 255, value, TQColor::Hsv));
}
}
@@ -422,7 +422,7 @@ void KColorCombo2::setRainbowPreset(int colorColumnCount, int lightRowCount, int
if (withGray) {
for (int i = 0; i < rowCount; ++i) {
int gray = ( rowCount == 1 ? 128 : 255 - (i * 255 / (rowCount - 1)) );
- setColorAt(columnCount-1, i, QColor(gray, gray, gray));
+ setColorAt(columnCount-1, i, TQColor(gray, gray, gray));
}
}
@@ -458,18 +458,18 @@ int KColorCombo2::rowCount() const
return m_rowCount;
}
-QColor KColorCombo2::colorAt(int column, int row)/* const*/
+TQColor KColorCombo2::colorAt(int column, int row)/* const*/
{
if (!m_colorArray)
setRainbowPreset();
if (column < 0 || row < 0 || column >= m_columnCount || row >= m_rowCount)
- return QColor();
+ return TQColor();
return m_colorArray[column][row];
}
-QColor KColorCombo2::defaultColor() const
+TQColor KColorCombo2::defaultColor() const
{
return m_defaultColor;
}
@@ -487,14 +487,14 @@ void KColorCombo2::newColorArray(int columnCount, int rowCount)
// Create a new array of the wanted dimentions:
m_columnCount = columnCount;
m_rowCount = rowCount;
- m_colorArray = new QColor* [columnCount];
+ m_colorArray = new TQColor* [columnCount];
for (int i = 0; i < columnCount; ++i)
- m_colorArray[i] = new QColor[rowCount];
+ m_colorArray[i] = new TQColor[rowCount];
- m_popup->relayout();
+ m_popup->retqlayout();
}
-void KColorCombo2::setColorAt(int column, int row, const QColor &color)
+void KColorCombo2::setColorAt(int column, int row, const TQColor &color)
{
if (!m_colorArray)
setRainbowPreset();
@@ -507,40 +507,40 @@ void KColorCombo2::setColorAt(int column, int row, const QColor &color)
m_colorArray[column][row] = color;
}
-void KColorCombo2::setDefaultColor(const QColor &color)
+void KColorCombo2::setDefaultColor(const TQColor &color)
{
m_defaultColor = color;
if (!m_defaultColor.isValid() && !m_color.isValid())
- m_color = Qt::white; // FIXME: Use the first one.
+ m_color = TQt::white; // FIXME: Use the first one.
}
-QPixmap KColorCombo2::colorRectPixmap(const QColor &color, bool isDefault, int width, int height)
+TQPixmap KColorCombo2::colorRectPixmap(const TQColor &color, bool isDefault, int width, int height)
{
// Prepare to draw:
- QPixmap pixmap(width, height);
- QBitmap mask(width, height);
- QPainter painter(&pixmap);
- QPainter maskPainter(&mask);
+ TQPixmap pixmap(width, height);
+ TQBitmap tqmask(width, height);
+ TQPainter painter(&pixmap);
+ TQPainter tqmaskPainter(&tqmask);
// Draw pixmap:
drawColorRect(painter, 0, 0, color, isDefault, width, height);
- // Draw mask (make the four corners transparent):
- maskPainter.fillRect(0, 0, width, height, Qt::color1); // opaque
- maskPainter.setPen(Qt::color0); // transparent
- maskPainter.drawPoint(0, 0);
- maskPainter.drawPoint(0, height - 1);
- maskPainter.drawPoint(width - 1, height - 1);
- maskPainter.drawPoint(width - 1, 0);
+ // Draw tqmask (make the four corners transparent):
+ tqmaskPainter.fillRect(0, 0, width, height, TQt::color1); // opaque
+ tqmaskPainter.setPen(TQt::color0); // transparent
+ tqmaskPainter.drawPoint(0, 0);
+ tqmaskPainter.drawPoint(0, height - 1);
+ tqmaskPainter.drawPoint(width - 1, height - 1);
+ tqmaskPainter.drawPoint(width - 1, 0);
// Finish:
painter.end();
- maskPainter.end();
- pixmap.setMask(mask);
+ tqmaskPainter.end();
+ pixmap.setMask(tqmask);
return pixmap;
}
-void KColorCombo2::drawColorRect(QPainter &painter, int x, int y, const QColor &color, bool isDefault, int width, int height)
+void KColorCombo2::drawColorRect(TQPainter &painter, int x, int y, const TQColor &color, bool isDefault, int width, int height)
{
// Fill:
if (color.isValid())
@@ -552,7 +552,7 @@ void KColorCombo2::drawColorRect(QPainter &painter, int x, int y, const QColor &
int hue = i * 360 / (width-2);
for (int j = 0; j < height-2; ++j) {
int saturation = 255 - (j * 255 / (height-2));
- painter.setPen( QColor(hue, saturation, /*value=*/255, QColor::Hsv) );
+ painter.setPen( TQColor(hue, saturation, /*value=*/255, TQColor::Hsv) );
painter.drawPoint(x + i + 1, y + j + 1);
}
}
@@ -560,8 +560,8 @@ void KColorCombo2::drawColorRect(QPainter &painter, int x, int y, const QColor &
// Stroke:
int dontCare, value;
- color.getHsv(/*hue:*/dontCare, /*saturation:*/dontCare, value);
- QColor stroke = (color.isValid() ? color.dark(125) : KGlobalSettings::textColor());
+ color.getHsv(/*hue:*/&dontCare, /*saturation:*/&dontCare, &value);
+ TQColor stroke = (color.isValid() ? color.dark(125) : KGlobalSettings::textColor());
painter.setPen(/*color);//*/stroke);
painter.drawLine(x + 1, y, x + width - 2, y);
painter.drawLine(x, y + 1, x, y + height - 2);
@@ -569,7 +569,7 @@ void KColorCombo2::drawColorRect(QPainter &painter, int x, int y, const QColor &
painter.drawLine(x + width - 1, y + 1, x + width - 1, y + height - 2);
// Round corners:
- QColor antialiasing;
+ TQColor antialiasing;
if (color.isValid()) {
antialiasing = Tool_mixColors(color, stroke);
painter.setPen(antialiasing);
@@ -579,12 +579,12 @@ void KColorCombo2::drawColorRect(QPainter &painter, int x, int y, const QColor &
painter.drawPoint(x + width - 2, y + 1);
} else {
// The two top corners:
- antialiasing = Tool_mixColors(Qt::red, stroke);
+ antialiasing = Tool_mixColors(TQt::red, stroke);
painter.setPen(antialiasing);
painter.drawPoint(x + 1, y + 1);
painter.drawPoint(x + width - 2, y + 1);
// The two bottom ones:
- antialiasing = Tool_mixColors(Qt::white, stroke);
+ antialiasing = Tool_mixColors(TQt::white, stroke);
painter.setPen(antialiasing);
painter.drawPoint(x + 1, y + height - 2);
painter.drawPoint(x + width - 2, y + height - 2);
@@ -620,7 +620,7 @@ void KColorCombo2::deleteColorArray()
void KColorCombo2::updateComboBox()
{
int height = colorRectHeight()*2/3; // fontMetrics().boundingRect(i18n("(Default)")).height() + 2
- QPixmap pixmap = colorRectPixmap(effectiveColor(), !m_color.isValid(), colorRectWidthForHeight(height), height); // TODO: isDefaultColorSelected()
+ TQPixmap pixmap = colorRectPixmap(effectiveColor(), !m_color.isValid(), colorRectWidthForHeight(height), height); // TODO: isDefaultColorSelected()
changeItem(pixmap, (m_color.isValid() ? "" : i18n("(Default)")), /*index=*/0);
}
@@ -630,17 +630,17 @@ void KColorCombo2::popup()
setRainbowPreset();
// Compute where to show the popup:
- QRect desk = KGlobalSettings::desktopGeometry(this);
+ TQRect desk = KGlobalSettings::desktopGeometry(this);
- QPoint popupPoint = mapToGlobal(QPoint(0, 0));
+ TQPoint popupPoint = mapToGlobal(TQPoint(0, 0));
- int popupHeight = m_popup->sizeHint().height();
+ int popupHeight = m_popup->tqsizeHint().height();
if (popupPoint.y() + height() + popupHeight > desk.bottom())
popupPoint.setY(popupPoint.y() - popupHeight);
else
popupPoint.setY(popupPoint.y() + height());
- int popupWidth = m_popup->sizeHint().width();
+ int popupWidth = m_popup->tqsizeHint().width();
if (popupPoint.x() + popupWidth > desk.right())
popupPoint.setX(desk.right() - popupWidth);
@@ -654,12 +654,12 @@ void KColorCombo2::popup()
m_popup->move(popupPoint);
//m_popup->setColor(m_color);
m_popup->doSelection();
- m_popup->relayout(); // FIXME: In aboutToShow() ?
+ m_popup->retqlayout(); // FIXME: In aboutToShow() ?
#if 0
-//#ifndef QT_NO_EFFECTS
- if (QApplication::isEffectEnabled(UI_AnimateCombo)) {
- if (m_popup->y() < mapToGlobal(QPoint(0,0)).y())
- qScrollEffect(m_popup, QEffects::UpScroll);
+//#ifndef TQT_NO_EFFECTS
+ if (TQApplication::isEffectEnabled(UI_AnimateCombo)) {
+ if (m_popup->y() < mapToGlobal(TQPoint(0,0)).y())
+ qScrollEffect(m_popup, TQEffects::UpScroll);
else
qScrollEffect(m_popup);
} else
@@ -669,25 +669,25 @@ void KColorCombo2::popup()
// The combo box is now shown pressed. Make it show not pressed again
// by causing its (invisible) list box to emit a 'selected' signal.
// Simulate an Enter to unpress it:
- QListBox *lb = listBox();
+ TQListBox *lb = listBox();
if (lb) {
lb->setCurrentItem(0);
- QKeyEvent* keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Enter, 0, 0);
- QApplication::postEvent(lb, keyEvent);
+ TQKeyEvent* keyEvent = new TQKeyEvent(TQEvent::KeyPress, TQt::Key_Enter, 0, 0);
+ TQApplication::postEvent(lb, keyEvent);
}
}
-bool KColorCombo2::eventFilter(QObject */*object*/, QEvent *event)
+bool KColorCombo2::eventFilter(TQObject */*object*/, TQEvent *event)
{
- QMouseEvent *mouseEvent;
+ TQMouseEvent *mouseEvent;
switch (event->type()) {
- case QEvent::MouseButtonDblClick:
- case QEvent::MouseButtonPress:
- mouseEvent = (QMouseEvent*)event;
- if ( !m_popup->rect().contains(mouseEvent->pos()) ) {
- QPoint globalPos = m_popup->mapToGlobal(mouseEvent->pos());
- if (QApplication::widgetAt(globalPos, /*child=*/true) == this) {
+ case TQEvent::MouseButtonDblClick:
+ case TQEvent::MouseButtonPress:
+ mouseEvent = (TQMouseEvent*)event;
+ if ( !TQT_TQRECT_OBJECT(m_popup->rect()).tqcontains(mouseEvent->pos()) ) {
+ TQPoint globalPos = m_popup->mapToGlobal(mouseEvent->pos());
+ if (TQApplication::widgetAt(globalPos, /*child=*/true) == this) {
// The popup is being closed by a click on the KColorCombo2 widget.
// Avoid popping it up again immediately:
m_discardNextMousePress = true;
@@ -702,24 +702,24 @@ bool KColorCombo2::eventFilter(QObject */*object*/, QEvent *event)
return false;
}
-void KColorCombo2::mousePressEvent(QMouseEvent *event)
+void KColorCombo2::mousePressEvent(TQMouseEvent *event)
{
m_dragStartPos = event->pos();
if (event->button() == Qt::LeftButton && m_discardNextMousePress)
m_discardNextMousePress = false;
else
- QComboBox::mousePressEvent(event);
+ TQComboBox::mousePressEvent(event);
}
-void KColorCombo2::mouseMoveEvent(QMouseEvent *event)
+void KColorCombo2::mouseMoveEvent(TQMouseEvent *event)
{
if( (event->state() & Qt::LeftButton) &&
(event->pos() - m_dragStartPos).manhattanLength() > KGlobalSettings::dndEventDelay() ) {
// Drag color object:
KColorDrag *colorDrag = new KColorDrag(effectiveColor(), this);
// Replace the drag pixmap with our own rounded one, at the same position and dimetions:
- QPixmap pixmap = colorDrag->pixmap();
+ TQPixmap pixmap = colorDrag->pixmap();
pixmap = colorRectPixmap(effectiveColor(), /*isDefault=*/false, pixmap.width(), pixmap.height());
colorDrag->setPixmap(pixmap, colorDrag->pixmapHotSpot());
colorDrag->dragCopy();
@@ -727,38 +727,38 @@ void KColorCombo2::mouseMoveEvent(QMouseEvent *event)
}
}
-void KColorCombo2::dragEnterEvent(QDragEnterEvent *event)
+void KColorCombo2::dragEnterEvent(TQDragEnterEvent *event)
{
event->accept(isEnabled() && KColorDrag::canDecode(event));
}
-void KColorCombo2::dropEvent(QDropEvent *event)
+void KColorCombo2::dropEvent(TQDropEvent *event)
{
- QColor color;
+ TQColor color;
if (KColorDrag::decode(event, color))
setColor(color);
}
-void KColorCombo2::keyPressEvent(QKeyEvent *event)
+void KColorCombo2::keyPressEvent(TQKeyEvent *event)
{
KKey key(event);
if (KStdAccel::copy().contains(key)) {
- QMimeSource *mime = new KColorDrag(effectiveColor());
- QApplication::clipboard()->setData(mime, QClipboard::Clipboard);
+ TQMimeSource *mime = new KColorDrag(effectiveColor());
+ TQApplication::tqclipboard()->setData(mime, TQClipboard::Clipboard);
} else if (KStdAccel::paste().contains(key)) {
- QColor color;
- KColorDrag::decode(QApplication::clipboard()->data(QClipboard::Clipboard), color);
+ TQColor color;
+ KColorDrag::decode(TQApplication::tqclipboard()->data(TQClipboard::Clipboard), color);
setColor(color);
} else
- QComboBox::keyPressEvent(event);
+ TQComboBox::keyPressEvent(event);
}
-void KColorCombo2::fontChange(const QFont &oldFont)
+void KColorCombo2::fontChange(const TQFont &oldFont)
{
// Since the color-rectangle is the same height of the text, we should resize it if the font change:
updateComboBox();
- QComboBox::fontChange(oldFont); // To update geometry.
+ TQComboBox::fontChange(oldFont); // To update tqgeometry.
}
void KColorCombo2::virtual_hook(int /*id*/, void */*data*/)