summaryrefslogtreecommitdiffstats
path: root/lib/kopainter/koIconChooser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kopainter/koIconChooser.cc')
-rw-r--r--lib/kopainter/koIconChooser.cc98
1 files changed, 49 insertions, 49 deletions
diff --git a/lib/kopainter/koIconChooser.cc b/lib/kopainter/koIconChooser.cc
index 57fda8d8..ae4bc613 100644
--- a/lib/kopainter/koIconChooser.cc
+++ b/lib/kopainter/koIconChooser.cc
@@ -22,18 +22,18 @@
#include <koIconChooser.h>
#include <kglobal.h>
-#include <qpainter.h>
-#include <qcursor.h>
-#include <qapplication.h>
-#include <qhbox.h>
-#include <qlayout.h>
+#include <tqpainter.h>
+#include <tqcursor.h>
+#include <tqapplication.h>
+#include <tqhbox.h>
+#include <tqlayout.h>
#include <kdebug.h>
-KoPixmapWidget::KoPixmapWidget(const QPixmap &aPixmap, QWidget *parent, const char *name):
-QFrame(parent, name, WType_Popup)
+KoPixmapWidget::KoPixmapWidget(const TQPixmap &aPixmap, TQWidget *tqparent, const char *name):
+TQFrame(tqparent, name, WType_Popup)
{
kdDebug() << "Popup created: " << name << "\n";
- setFrameStyle(QFrame::WinPanel | QFrame::Raised);
+ setFrameStyle(TQFrame::WinPanel | TQFrame::Raised);
mPixmap = aPixmap;
int w = mPixmap.width() + 2 * lineWidth();
int h = mPixmap.height() + 2 * lineWidth();
@@ -46,25 +46,25 @@ KoPixmapWidget::~KoPixmapWidget()
}
// paint the centered pixmap; don't overpaint the frame
-void KoPixmapWidget::paintEvent(QPaintEvent *e)
+void KoPixmapWidget::paintEvent(TQPaintEvent *e)
{
- QFrame::paintEvent(e);
- QPainter p(this);
+ TQFrame::paintEvent(e);
+ TQPainter p(this);
p.setClipRect(e->rect());
p.drawPixmap(lineWidth(), lineWidth(), mPixmap);
}
-void KoPixmapWidget::mouseReleaseEvent(QMouseEvent *)
+void KoPixmapWidget::mouseReleaseEvent(TQMouseEvent *)
{
hide();
}
-KoIconChooser::KoIconChooser(QSize aIconSize, QWidget *parent, const char *name, bool sort):
-QGridView(parent, name)
+KoIconChooser::KoIconChooser(TQSize aIconSize, TQWidget *tqparent, const char *name, bool sort):
+TQGridView(tqparent, name)
{
- QGridView::setBackgroundColor(Qt::white);
+ TQGridView::setBackgroundColor(TQt::white);
mMargin = 2;
setCellWidth(aIconSize.width() + 2 * mMargin);
@@ -92,7 +92,7 @@ KoIconChooser::~KoIconChooser()
void KoIconChooser::addItem(KoIconItem *item)
{
- Q_INT32 n = mItemCount;
+ TQ_INT32 n = mItemCount;
KoIconItem *current = currentItem();
Q_ASSERT(item);
@@ -125,7 +125,7 @@ void KoIconChooser::addItem(KoIconItem *item)
bool KoIconChooser::removeItem(KoIconItem *item)
{
- int index = mIconList.find(item);
+ int index = mIconList.tqfind(item);
bool ok = mIconList.remove(item);
if( ok )
{
@@ -155,7 +155,7 @@ KoIconItem *KoIconChooser::currentItem()
// does NOT emit selected() (should it?)
void KoIconChooser::setCurrentItem(KoIconItem *item)
{
- int index = mIconList.find(item);
+ int index = mIconList.tqfind(item);
// item is available
if(index != -1 && mNCols > 0)
@@ -166,21 +166,21 @@ void KoIconChooser::setCurrentItem(KoIconItem *item)
mCurRow = index / mNCols;
mCurCol = index % mNCols;
- // repaint the old and the new item
- repaintCell(oldRow, oldCol);
- repaintCell(mCurRow, mCurCol);
+ // tqrepaint the old and the new item
+ tqrepaintCell(oldRow, oldCol);
+ tqrepaintCell(mCurRow, mCurCol);
ensureCellVisible(mCurRow, mCurCol);
}
}
// eventually select the item, clicked on
-void KoIconChooser::mousePressEvent(QMouseEvent *e)
+void KoIconChooser::mousePressEvent(TQMouseEvent *e)
{
- QGridView::mousePressEvent(e);
+ TQGridView::mousePressEvent(e);
}
-void KoIconChooser::mouseMoveEvent(QMouseEvent *e)
+void KoIconChooser::mouseMoveEvent(TQMouseEvent *e)
{
if(mMouseButtonDown && mDragEnabled )
{
@@ -191,7 +191,7 @@ void KoIconChooser::mouseMoveEvent(QMouseEvent *e)
mPixmapWidget = 0L;
}
#endif
- if( ( mDragStartPos - e->pos() ).manhattanLength() > QApplication::startDragDistance() )
+ if( ( mDragStartPos - e->pos() ).manhattanLength() > TQApplication::startDragDistance() )
startDrag();
}
}
@@ -202,16 +202,16 @@ KoIconChooser::startDrag()
mMouseButtonDown = false;
}
-void KoIconChooser::mouseReleaseEvent(QMouseEvent * e)
+void KoIconChooser::mouseReleaseEvent(TQMouseEvent * e)
{
mMouseButtonDown = true;
- if(e->button() == LeftButton)
+ if(e->button() == Qt::LeftButton)
{
- QPoint p = e->pos();
+ TQPoint p = e->pos();
mDragStartPos = p;
int x = contentsX() + p.x();
int y = contentsY() + p.y();
- QSize gridExtent = gridSize();
+ TQSize gridExtent = gridSize();
if (x < gridExtent.width() && y < gridExtent.height())
{
@@ -221,7 +221,7 @@ void KoIconChooser::mouseReleaseEvent(QMouseEvent * e)
KoIconItem *item = itemAt(row, col);
if(item)
{
- const QPixmap &pix = item->pixmap();
+ const TQPixmap &pix = item->pixmap();
if(pix.width() > mItemWidth || pix.height() > mItemHeight)
showFullPixmap(pix, p);
@@ -233,16 +233,16 @@ void KoIconChooser::mouseReleaseEvent(QMouseEvent * e)
}
// FIXME: implement keyboard navigation
-void KoIconChooser::keyPressEvent(QKeyEvent *e)
+void KoIconChooser::keyPressEvent(TQKeyEvent *e)
{
- QGridView::keyPressEvent(e);
+ TQGridView::keyPressEvent(e);
}
// recalculate the number of items that fit into one row
// set the current item again after calculating the new grid
-void KoIconChooser::resizeEvent(QResizeEvent *e)
+void KoIconChooser::resizeEvent(TQResizeEvent *e)
{
- QGridView::resizeEvent(e);
+ TQGridView::resizeEvent(e);
KoIconItem *item = currentItem();
int oldNCols = mNCols;
@@ -264,13 +264,13 @@ void KoIconChooser::resizeEvent(QResizeEvent *e)
// paint one cell
// mark the current item and center items smaller than the cellSize
// TODO: scale down big pixmaps and paint the size as text into the pixmap
-void KoIconChooser::paintCell(QPainter *p, int row, int col)
+void KoIconChooser::paintCell(TQPainter *p, int row, int col)
{
KoIconItem *item = itemAt(row, col);
if(item)
{
- const QPixmap &pix = item->pixmap();
+ const TQPixmap &pix = item->pixmap();
int x = mMargin;
int y = mMargin;
@@ -289,7 +289,7 @@ void KoIconChooser::paintCell(QPainter *p, int row, int col)
p->drawPixmap(x, y, pix, 0, 0, mItemWidth, mItemHeight);
else
{
- const QPixmap &thumbpix = item->thumbPixmap();
+ const TQPixmap &thumbpix = item->thumbPixmap();
x = mMargin;
y = mMargin;
pw = thumbpix.width();
@@ -322,7 +322,7 @@ void KoIconChooser::paintCell(QPainter *p, int row, int col)
else
{
// empty cell
- p->fillRect(0, 0, cellWidth(), cellHeight(), QBrush(Qt::white));
+ p->fillRect(0, 0, cellWidth(), cellHeight(), TQBrush(TQt::white));
}
}
@@ -371,13 +371,13 @@ void KoIconChooser::calculateCells()
}
// show the full pixmap of a large item in an extra widget
-void KoIconChooser::showFullPixmap(const QPixmap &pix, const QPoint &/*p*/)
+void KoIconChooser::showFullPixmap(const TQPixmap &pix, const TQPoint &/*p*/)
{
//delete mPixmapWidget;
mPixmapWidget = new KoPixmapWidget(pix, this);
// center widget under mouse cursor
- QPoint p = QCursor::pos();
+ TQPoint p = TQCursor::pos();
int w = mPixmapWidget->width();
int h = mPixmapWidget->height();
mPixmapWidget->move(p.x() - w / 2, p.y() - h / 2);
@@ -431,22 +431,22 @@ int KoIconChooser::sortInsertionIndex(const KoIconItem *item)
return index;
}
-KoPatternChooser::KoPatternChooser( const QPtrList<KoIconItem> &list, QWidget *parent, const char *name )
- : QWidget( parent, name )
+KoPatternChooser::KoPatternChooser( const TQPtrList<KoIconItem> &list, TQWidget *tqparent, const char *name )
+ : TQWidget( tqparent, name )
{
// only serves as beautifier for the iconchooser
- //frame = new QHBox( this );
- //frame->setFrameStyle( QFrame::Panel | QFrame::Sunken );
- chooser = new KoIconChooser( QSize(30,30), this, "pattern chooser" );
+ //frame = new TQHBox( this );
+ //frame->setFrameStyle( TQFrame::Panel | TQFrame::Sunken );
+ chooser = new KoIconChooser( TQSize(30,30), this, "pattern chooser" );
- QObject::connect( chooser, SIGNAL(selected( KoIconItem * ) ),
- this, SIGNAL( selected( KoIconItem * )));
+ TQObject::connect( chooser, TQT_SIGNAL(selected( KoIconItem * ) ),
+ this, TQT_SIGNAL( selected( KoIconItem * )));
- QPtrListIterator<KoIconItem> itr( list );
+ TQPtrListIterator<KoIconItem> itr( list );
for( itr.toFirst(); itr.current(); ++itr )
chooser->addItem( itr.current() );
- QVBoxLayout *mainLayout = new QVBoxLayout( this, 1, -1, "main layout" );
+ TQVBoxLayout *mainLayout = new TQVBoxLayout( this, 1, -1, "main tqlayout" );
mainLayout->addWidget( chooser, 10 );
}