summaryrefslogtreecommitdiffstats
path: root/kicker-applets/kolourpicker/kolourpicker.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-18 17:00:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-18 17:00:31 +0000
commit395a904bff7b4d6ead445c342f7ac0c5fbf29121 (patch)
tree9829cadb79d2cc7c29a940627fadb28b11e54150 /kicker-applets/kolourpicker/kolourpicker.cpp
parent399f47c376fdf4d19192732a701ea9578d11619d (diff)
downloadtdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.tar.gz
tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.zip
TQt4 port kdeaddons
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1237404 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kicker-applets/kolourpicker/kolourpicker.cpp')
-rw-r--r--kicker-applets/kolourpicker/kolourpicker.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/kicker-applets/kolourpicker/kolourpicker.cpp b/kicker-applets/kolourpicker/kolourpicker.cpp
index cadbb2d..b415032 100644
--- a/kicker-applets/kolourpicker/kolourpicker.cpp
+++ b/kicker-applets/kolourpicker/kolourpicker.cpp
@@ -48,18 +48,18 @@ $Id$
// Applet initialization function
extern "C"
{
- KDE_EXPORT KPanelApplet* init(TQWidget *parent, const TQString& configFile)
+ KDE_EXPORT KPanelApplet* init(TQWidget *tqparent, const TQString& configFile)
{
KGlobal::locale()->insertCatalogue("kolourpicker");
return new KolourPicker(configFile, KPanelApplet::Normal,
KPanelApplet::About,
- parent, "kolourpicker");
+ tqparent, "kolourpicker");
}
}
KolourPicker::KolourPicker(const TQString& configFile, Type type,
- int actions, TQWidget *parent, const char *name)
- : KPanelApplet(configFile, type, actions, parent, name),
+ int actions, TQWidget *tqparent, const char *name)
+ : KPanelApplet(configFile, type, actions, tqparent, name),
m_picking(0)
{
KAboutData *about = new KAboutData("kolourpicker",
@@ -140,7 +140,7 @@ void KolourPicker::slotHistory()
TQPopupMenu *sub = copyPopup(*it, false);
subMenus.append(sub);
popup.insertItem(colorPixmap(*it),
- TQString("%1, %2, %3").arg((*it).red()).arg((*it).green()).arg((*it).blue()),
+ TQString("%1, %2, %3").tqarg((*it).red()).tqarg((*it).green()).tqarg((*it).blue()),
sub);
}
popup.insertSeparator();
@@ -157,7 +157,7 @@ void KolourPicker::slotHistory()
conf->sync();
}
else if (id != -1)
- setClipboard(popup.findItem(id)->text());
+ setClipboard(popup.tqfindItem(id)->text());
}
void KolourPicker::mouseReleaseEvent(TQMouseEvent *e)
@@ -167,14 +167,14 @@ void KolourPicker::mouseReleaseEvent(TQMouseEvent *e)
m_picking = false;
releaseMouse();
releaseKeyboard();
- TQWidget *desktop = TQApplication::desktop();
+ TQWidget *desktop = TQT_TQWIDGET(TQApplication::desktop());
TQPixmap pm = TQPixmap::grabWindow(desktop->winId(),
e->globalPos().x(), e->globalPos().y(), 1, 1);
TQImage img = pm.convertToImage();
TQColor color(img.pixel(0, 0));
// eventually remove a dupe
- TQValueListIterator<TQColor> dupe = m_history.find(color);
+ TQValueListIterator<TQColor> dupe = m_history.tqfind(color);
if (dupe != m_history.end())
m_history.remove(dupe);
@@ -198,7 +198,7 @@ void KolourPicker::mouseReleaseEvent(TQMouseEvent *e)
TQPopupMenu *popup = copyPopup(color, true);
int id = popup->exec(e->globalPos());
if (id != -1)
- setClipboard( popup->findItem(id)->text() );
+ setClipboard( popup->tqfindItem(id)->text() );
delete popup;
}
else
@@ -208,7 +208,7 @@ void KolourPicker::mouseReleaseEvent(TQMouseEvent *e)
// set both clipboard and selection
void KolourPicker::setClipboard(const TQString& text)
{
- QClipboard *clip = TQApplication::clipboard();
+ TQClipboard *clip = TQApplication::tqclipboard();
bool oldMode = clip->selectionModeEnabled();
clip->setSelectionMode(true);
clip->setText(text);
@@ -242,19 +242,19 @@ void KolourPicker::arrangeButtons()
{
int h, w, p;
- if (orientation() == Horizontal)
+ if (orientation() ==Qt::Horizontal)
{
h = height();
if (h > 40)
{
- // vertical layout
+ // vertical tqlayout
p = (h - 40)/3;
m_colourButton->setGeometry(2, p, 20, 20);
m_historyButton->setGeometry(2, 2*p+20, 20, 20);
}
else
{
- // horizontal layout
+ // horizontal tqlayout
p = (h - 20)/2;
m_colourButton->setGeometry(2, p, 20, 20);
m_historyButton->setGeometry(24, p, 20, 20);
@@ -265,14 +265,14 @@ void KolourPicker::arrangeButtons()
w = width();
if (w > 40)
{
- // horizontal layout
+ // horizontal tqlayout
p = (w - 40)/3;
m_colourButton->setGeometry(p, 2, 20, 20);
m_historyButton->setGeometry(2*p+20, 2, 20, 20);
}
else
{
- // vertical layout
+ // vertical tqlayout
p = (w - 20)/2;
m_colourButton->setGeometry(p, 2, 20, 20);
m_historyButton->setGeometry(p, 24, 20, 20);
@@ -294,7 +294,7 @@ TQPopupMenu *KolourPicker::copyPopup(const TQColor &c, bool title) const
// HTML, lower case hex chars
value.sprintf("#%.2x%.2x%.2x", c.red(), c.green(), c.blue());
popup->insertItem(SmallIcon("html"), value);
- if (value.find(TQRegExp("[a-f]")) >= 0)
+ if (value.tqfind(TQRegExp("[a-f]")) >= 0)
{
// HTML, upper case hex chars
value.sprintf("#%.2X%.2X%.2X", c.red(), c.green(), c.blue());
@@ -303,7 +303,7 @@ TQPopupMenu *KolourPicker::copyPopup(const TQColor &c, bool title) const
// lower case hex chars
value.sprintf( "%.2x%.2x%.2x", c.red(), c.green(), c.blue() );
popup->insertItem( SmallIcon( "html" ), value );
- if ( value.find( TQRegExp( "[a-f]" ) ) >= 0 )
+ if ( value.tqfind( TQRegExp( "[a-f]" ) ) >= 0 )
{
// upper case hex chars
value.sprintf( "%.2X%.2X%.2X", c.red(), c.green(), c.blue() );
@@ -336,19 +336,19 @@ TQPixmap KolourPicker::colorPixmap(const TQColor &c) const
if (d < (36 * AAFACTOR * AAFACTOR))
img.setPixel(x, y, c.pixel());
else if (d < (56.25 * AAFACTOR * AAFACTOR))
- img.setPixel(x, y, qRgba(128, 128, 128, 255));
+ img.setPixel(x, y, tqRgba(128, 128, 128, 255));
}
- TQBitmap mask(16, 16);
- mask.fill(Qt::color0);
- TQPainter p(&mask);
- p.setPen(Qt::NoPen);
- p.setBrush(Qt::color1);
+ TQBitmap tqmask(16, 16);
+ tqmask.fill(TQt::color0);
+ TQPainter p(&tqmask);
+ p.setPen(TQt::NoPen);
+ p.setBrush(TQt::color1);
p.drawEllipse(0, 0, 15, 15);
p.end();
TQPixmap pm = TQPixmap(img.smoothScale(16, 16));
- pm.setMask(mask);
+ pm.setMask(tqmask);
return pm;
}