summaryrefslogtreecommitdiffstats
path: root/kexi/widget/kexiscrollview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/widget/kexiscrollview.cpp')
-rw-r--r--kexi/widget/kexiscrollview.cpp138
1 files changed, 69 insertions, 69 deletions
diff --git a/kexi/widget/kexiscrollview.cpp b/kexi/widget/kexiscrollview.cpp
index 1cf47378..569d61f8 100644
--- a/kexi/widget/kexiscrollview.cpp
+++ b/kexi/widget/kexiscrollview.cpp
@@ -19,10 +19,10 @@
*/
#include "kexiscrollview.h"
-#include <qcursor.h>
-#include <qobjectlist.h>
-#include <qpainter.h>
-#include <qpixmap.h>
+#include <tqcursor.h>
+#include <tqobjectlist.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
#include <kdebug.h>
#include <kstaticdeleter.h>
@@ -36,31 +36,31 @@
class KexiScrollViewData
{
public:
- QPixmap horizontalOuterAreaPixmapBuffer;
- QPixmap verticalOuterAreaPixmapBuffer;
+ TQPixmap horizontalOuterAreaPixmapBuffer;
+ TQPixmap verticalOuterAreaPixmapBuffer;
};
// @todo warning: not reentrant!
static KStaticDeleter<KexiScrollViewData> KexiScrollView_data_deleter;
KexiScrollViewData* KexiScrollView_data = 0;
-KexiScrollView::KexiScrollView(QWidget *parent, bool preview)
- : QScrollView(parent, "kexiscrollview", WStaticContents)
+KexiScrollView::KexiScrollView(TQWidget *tqparent, bool preview)
+ : TQScrollView(tqparent, "kexiscrollview", WStaticContents)
, m_widget(0)
, m_helpFont(font())
, m_preview(preview)
, m_scrollViewNavPanel(0)
{
- setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
- viewport()->setPaletteBackgroundColor(colorGroup().mid());
- QColor fc = palette().active().foreground(),
+ setFrameStyle(TQFrame::WinPanel | TQFrame::Sunken);
+ viewport()->setPaletteBackgroundColor(tqcolorGroup().mid());
+ TQColor fc = tqpalette().active().foreground(),
bc = viewport()->paletteBackgroundColor();
m_helpColor = KexiUtils::blendedColors(fc, bc, 1, 2);
-// m_helpColor = QColor((fc.red()+bc.red()*2)/3, (fc.green()+bc.green()*2)/3,
+// m_helpColor = TQColor((fc.red()+bc.red()*2)/3, (fc.green()+bc.green()*2)/3,
// (fc.blue()+bc.blue()*2)/3);
m_helpFont.setPointSize( m_helpFont.pointSize() * 3 );
- setFocusPolicy(WheelFocus);
+ setFocusPolicy(TQ_WheelFocus);
//initial resize mode is always manual;
//will be changed on show(), if needed
@@ -73,14 +73,14 @@ KexiScrollView::KexiScrollView(QWidget *parent, bool preview)
m_gridSize = 0;
m_outerAreaVisible = true;
- connect(&m_delayedResize, SIGNAL(timeout()), this, SLOT(refreshContentsSize()));
+ connect(&m_delayedResize, TQT_SIGNAL(timeout()), this, TQT_SLOT(refreshContentsSize()));
m_smodeSet = false;
if (m_preview) {
refreshContentsSizeLater(true, true);
//! @todo allow to hide navigator
updateScrollBars();
m_scrollViewNavPanel = new KexiRecordNavigator(this, leftMargin(), "nav");
- m_scrollViewNavPanel->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Preferred);
+ m_scrollViewNavPanel->tqsetSizePolicy(TQSizePolicy::Minimum,TQSizePolicy::Preferred);
}
}
@@ -89,7 +89,7 @@ KexiScrollView::~KexiScrollView()
}
void
-KexiScrollView::setWidget(QWidget *w)
+KexiScrollView::setWidget(TQWidget *w)
{
addChild(w);
m_widget = w;
@@ -127,9 +127,9 @@ KexiScrollView::refreshContentsSizeLater(bool horizontal, bool vertical)
m_hsmode = hScrollBarMode();
}
// if (vertical)
- setVScrollBarMode(QScrollView::AlwaysOff);
+ setVScrollBarMode(TQScrollView::AlwaysOff);
//if (horizontal)
- setHScrollBarMode(QScrollView::AlwaysOff);
+ setHScrollBarMode(TQScrollView::AlwaysOff);
updateScrollBars();
m_delayedResize.start( 100, true );
}
@@ -152,9 +152,9 @@ KexiScrollView::refreshContentsSize()
// Ensure there is always space to resize Form
int w = contentsWidth(), h = contentsHeight();
bool change = false;
- const int delta_x = QMAX( (KexiScrollView_data ?
+ const int delta_x = TQMAX( (KexiScrollView_data ?
KexiScrollView_data->verticalOuterAreaPixmapBuffer.width() : 0), 300);
- const int delta_y = QMAX( (KexiScrollView_data ?
+ const int delta_y = TQMAX( (KexiScrollView_data ?
KexiScrollView_data->horizontalOuterAreaPixmapBuffer.height() : 0), 300);
if((m_widget->width() + delta_x * 2 / 3) > w) {
w = m_widget->width() + delta_x;
@@ -173,11 +173,11 @@ KexiScrollView::refreshContentsSize()
change = true;
}
if (change) {
- repaint();
- viewport()->repaint();
- repaintContents();
+ tqrepaint();
+ viewport()->tqrepaint();
+ tqrepaintContents();
updateContents(0, 0, 2000,2000);
- clipper()->repaint();
+ clipper()->tqrepaint();
resizeContents(w, h);
}
@@ -199,22 +199,22 @@ KexiScrollView::updateNavPanelGeometry()
}
void
-KexiScrollView::contentsMousePressEvent(QMouseEvent *ev)
+KexiScrollView::contentsMousePressEvent(TQMouseEvent *ev)
{
if(!m_widget)
return;
- QRect r3(0, 0, m_widget->width() + 4, m_widget->height() + 4);
- if(!r3.contains(ev->pos())) // clicked outside form
+ TQRect r3(0, 0, m_widget->width() + 4, m_widget->height() + 4);
+ if(!r3.tqcontains(ev->pos())) // clicked outside form
//m_form->resetSelection();
emit outerAreaClicked();
if(!m_enableResizing)
return;
- QRect r(m_widget->width(), 0, 4, m_widget->height() + 4); // right limit
- QRect r2(0, m_widget->height(), m_widget->width() + 4, 4); // bottom limit
- if(r.contains(ev->pos()) || r2.contains(ev->pos()))
+ TQRect r(m_widget->width(), 0, 4, m_widget->height() + 4); // right limit
+ TQRect r2(0, m_widget->height(), m_widget->width() + 4, 4); // bottom limit
+ if(r.tqcontains(ev->pos()) || r2.tqcontains(ev->pos()))
{
m_resizing = true;
emit resizingStarted();
@@ -222,7 +222,7 @@ KexiScrollView::contentsMousePressEvent(QMouseEvent *ev)
}
void
-KexiScrollView::contentsMouseReleaseEvent(QMouseEvent *)
+KexiScrollView::contentsMouseReleaseEvent(TQMouseEvent *)
{
if(m_resizing) {
m_resizing = false;
@@ -233,7 +233,7 @@ KexiScrollView::contentsMouseReleaseEvent(QMouseEvent *)
}
void
-KexiScrollView::contentsMouseMoveEvent(QMouseEvent *ev)
+KexiScrollView::contentsMouseMoveEvent(TQMouseEvent *ev)
{
if(!m_widget || !m_enableResizing)
return;
@@ -253,17 +253,17 @@ KexiScrollView::contentsMouseMoveEvent(QMouseEvent *ev)
tmpy = contentsY();
// we look for the max widget right() (or bottom()), which would be the limit for form resizing (not to hide widgets)
- QObjectList *list = m_widget->queryList("QWidget", 0, true, false /* not recursive*/);
- for(QObject *o = list->first(); o; o = list->next())
+ TQObjectList *list = m_widget->queryList(TQWIDGET_OBJECT_NAME_STRING, 0, true, false /* not recursive*/);
+ for(TQObject *o = list->first(); o; o = list->next())
{
- QWidget *w = (QWidget*)o;
- tmpx = QMAX(tmpx, (w->geometry().right() + 10));
- tmpy = QMAX(tmpy, (w->geometry().bottom() + 10));
+ TQWidget *w = (TQWidget*)o;
+ tmpx = TQMAX(tmpx, (w->tqgeometry().right() + 10));
+ tmpy = TQMAX(tmpy, (w->tqgeometry().bottom() + 10));
}
delete list;
int neww = -1, newh;
- if(cursor().shape() == QCursor::SizeHorCursor)
+ if(cursor().shape() == TQCursor::SizeHorCursor)
{
if(m_snapToGrid)
neww = int( float(tmpx) / float(m_gridSize) + 0.5 ) * m_gridSize;
@@ -271,7 +271,7 @@ KexiScrollView::contentsMouseMoveEvent(QMouseEvent *ev)
neww = tmpx;
newh = m_widget->height();
}
- else if(cursor().shape() == QCursor::SizeVerCursor)
+ else if(cursor().shape() == TQCursor::SizeVerCursor)
{
neww = m_widget->width();
if(m_snapToGrid)
@@ -279,7 +279,7 @@ KexiScrollView::contentsMouseMoveEvent(QMouseEvent *ev)
else
newh = tmpy;
}
- else if(cursor().shape() == QCursor::SizeFDiagCursor)
+ else if(cursor().shape() == TQCursor::SizeFDiagCursor)
{
if(m_snapToGrid) {
neww = int( float(tmpx) / float(m_gridSize) + 0.5 ) * m_gridSize;
@@ -290,7 +290,7 @@ KexiScrollView::contentsMouseMoveEvent(QMouseEvent *ev)
}
}
//needs update?
- if (neww!=-1 && m_widget->size() != QSize(neww, newh)) {
+ if (neww!=-1 && m_widget->size() != TQSize(neww, newh)) {
m_widget->resize( neww, newh );
refreshContentsSize();
updateContents();
@@ -298,46 +298,46 @@ KexiScrollView::contentsMouseMoveEvent(QMouseEvent *ev)
}
else // update mouse cursor
{
- QPoint p = ev->pos();
- QRect r(m_widget->width(), 0, 4, m_widget->height()); // right
- QRect r2(0, m_widget->height(), m_widget->width(), 4); // bottom
- QRect r3(m_widget->width(), m_widget->height(), 4, 4); // bottom-right corner
-
- if(r.contains(p))
- setCursor(QCursor::SizeHorCursor);
- else if(r2.contains(p))
- setCursor(QCursor::SizeVerCursor);
- else if(r3.contains(p))
- setCursor(QCursor::SizeFDiagCursor);
+ TQPoint p = ev->pos();
+ TQRect r(m_widget->width(), 0, 4, m_widget->height()); // right
+ TQRect r2(0, m_widget->height(), m_widget->width(), 4); // bottom
+ TQRect r3(m_widget->width(), m_widget->height(), 4, 4); // bottom-right corner
+
+ if(r.tqcontains(p))
+ setCursor(TQCursor::SizeHorCursor);
+ else if(r2.tqcontains(p))
+ setCursor(TQCursor::SizeVerCursor);
+ else if(r3.tqcontains(p))
+ setCursor(TQCursor::SizeFDiagCursor);
else
unsetCursor();
}
}
void
-KexiScrollView::setupPixmapBuffer(QPixmap& pixmap, const QString& text, int lines)
+KexiScrollView::setupPixmapBuffer(TQPixmap& pixmap, const TQString& text, int lines)
{
Q_UNUSED( lines );
- QFontMetrics fm(m_helpFont);
- const int flags = Qt::AlignCenter|Qt::AlignTop;
- QRect rect(fm.boundingRect(0,0,1000,1000,flags,text));
+ TQFontMetrics fm(m_helpFont);
+ const int flags = TQt::AlignCenter|TQt::AlignTop;
+ TQRect rect(fm.boundingRect(0,0,1000,1000,flags,text));
const int txtw = rect.width(), txth = rect.height();//fm.width(text), txth = fm.height()*lines;
- pixmap = QPixmap(txtw, txth);
+ pixmap = TQPixmap(txtw, txth);
if (!pixmap.isNull()) {
//create pixmap once
pixmap.fill( viewport()->paletteBackgroundColor() );
- QPainter pb(&pixmap, this);
+ TQPainter pb(&pixmap, this);
pb.setPen(m_helpColor);
pb.setFont(m_helpFont);
- pb.drawText(0, 0, txtw, txth, Qt::AlignCenter|Qt::AlignTop, text);
+ pb.drawText(0, 0, txtw, txth, TQt::AlignCenter|TQt::AlignTop, text);
}
}
void
-KexiScrollView::drawContents( QPainter * p, int clipx, int clipy, int clipw, int cliph )
+KexiScrollView::drawContents( TQPainter * p, int clipx, int clipy, int clipw, int cliph )
{
- QScrollView::drawContents(p, clipx, clipy, clipw, cliph);
+ TQScrollView::drawContents(p, clipx, clipy, clipw, cliph);
if (m_widget) {
if(m_preview || !m_outerAreaVisible)
return;
@@ -345,7 +345,7 @@ KexiScrollView::drawContents( QPainter * p, int clipx, int clipy, int clipw, int
//draw right and bottom borders
const int wx = childX(m_widget);
const int wy = childY(m_widget);
- p->setPen(palette().active().foreground());
+ p->setPen(tqpalette().active().foreground());
p->drawLine(wx+m_widget->width(), wy, wx+m_widget->width(), wy+m_widget->height());
p->drawLine(wx, wy+m_widget->height(), wx+m_widget->width(), wy+m_widget->height());
//kdDebug() << "KexiScrollView::drawContents() " << wy+m_widget->height() << endl;
@@ -363,14 +363,14 @@ KexiScrollView::drawContents( QPainter * p, int clipx, int clipy, int clipw, int
{
if (m_widget->height()>(KexiScrollView_data->verticalOuterAreaPixmapBuffer.height()+20)) {
p->drawPixmap(
- QMAX( m_widget->width(), KexiScrollView_data->verticalOuterAreaPixmapBuffer.width() + 20 ) + 20,
- QMAX( (m_widget->height() - KexiScrollView_data->verticalOuterAreaPixmapBuffer.height())/2, 20 ),
+ TQMAX( m_widget->width(), KexiScrollView_data->verticalOuterAreaPixmapBuffer.width() + 20 ) + 20,
+ TQMAX( (m_widget->height() - KexiScrollView_data->verticalOuterAreaPixmapBuffer.height())/2, 20 ),
KexiScrollView_data->verticalOuterAreaPixmapBuffer
);
}
p->drawPixmap(
- QMAX( (m_widget->width() - KexiScrollView_data->horizontalOuterAreaPixmapBuffer.width())/2, 20 ),
- QMAX( m_widget->height(), KexiScrollView_data->horizontalOuterAreaPixmapBuffer.height() + 20 ) + 20,
+ TQMAX( (m_widget->width() - KexiScrollView_data->horizontalOuterAreaPixmapBuffer.width())/2, 20 ),
+ TQMAX( m_widget->height(), KexiScrollView_data->horizontalOuterAreaPixmapBuffer.height() + 20 ) + 20,
KexiScrollView_data->horizontalOuterAreaPixmapBuffer
);
}
@@ -378,14 +378,14 @@ KexiScrollView::drawContents( QPainter * p, int clipx, int clipy, int clipw, int
}
void
-KexiScrollView::leaveEvent( QEvent *e )
+KexiScrollView::leaveEvent( TQEvent *e )
{
- QWidget::leaveEvent(e);
+ TQWidget::leaveEvent(e);
m_widget->update(); //update form elements on too fast mouse move
}
void
-KexiScrollView::setHBarGeometry( QScrollBar & hbar, int x, int y, int w, int h )
+KexiScrollView::setHBarGeometry( TQScrollBar & hbar, int x, int y, int w, int h )
{
/*todo*/
// kdDebug(44021)<<"KexiScrollView::setHBarGeometry"<<endl;