diff options
Diffstat (limited to 'kexi/widget/relations/kexirelationviewtable.cpp')
-rw-r--r-- | kexi/widget/relations/kexirelationviewtable.cpp | 198 |
1 files changed, 99 insertions, 99 deletions
diff --git a/kexi/widget/relations/kexirelationviewtable.cpp b/kexi/widget/relations/kexirelationviewtable.cpp index 97beaa87..c850d722 100644 --- a/kexi/widget/relations/kexirelationviewtable.cpp +++ b/kexi/widget/relations/kexirelationviewtable.cpp @@ -20,15 +20,15 @@ #include <stdlib.h> -#include <qheader.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qpushbutton.h> -#include <qcursor.h> -#include <qpoint.h> -#include <qapplication.h> -#include <qbitmap.h> -#include <qstyle.h> +#include <tqheader.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqpushbutton.h> +#include <tqcursor.h> +#include <tqpoint.h> +#include <tqapplication.h> +#include <tqbitmap.h> +#include <tqstyle.h> #include <kdebug.h> #include <kiconloader.h> @@ -43,10 +43,10 @@ #include "kexirelationview.h" KexiRelationViewTableContainer::KexiRelationViewTableContainer( - KexiRelationView *parent, KexiDB::TableOrQuerySchema *schema) - : QFrame(parent,"KexiRelationViewTableContainer" ) + KexiRelationView *tqparent, KexiDB::TableOrQuerySchema *schema) + : TQFrame(tqparent,"KexiRelationViewTableContainer" ) // , m_table(t) - , m_parent(parent) + , m_parent(tqparent) // , m_mousePressed(false) { @@ -54,29 +54,29 @@ KexiRelationViewTableContainer::KexiRelationViewTableContainer( //js: resize(100, 150); //setMouseTracking(true); - setFrameStyle( QFrame::WinPanel | QFrame::Raised ); + setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); - QVBoxLayout *lyr = new QVBoxLayout(this,4,1); //js: using Q*BoxLayout is a good idea + TQVBoxLayout *lyr = new TQVBoxLayout(this,4,1); //js: using Q*BoxLayout is a good idea m_tableHeader = new KexiRelationViewTableContainerHeader(schema->name(), this); m_tableHeader->unsetFocus(); - m_tableHeader->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed)); + m_tableHeader->tqsetSizePolicy(TQSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::Fixed)); lyr->addWidget(m_tableHeader); - connect(m_tableHeader,SIGNAL(moved()),this,SLOT(moved())); - connect(m_tableHeader, SIGNAL(endDrag()), this, SIGNAL(endDrag())); + connect(m_tableHeader,TQT_SIGNAL(moved()),this,TQT_SLOT(moved())); + connect(m_tableHeader, TQT_SIGNAL(endDrag()), this, TQT_SIGNAL(endDrag())); - m_tableView = new KexiRelationViewTable(schema, parent, this, "KexiRelationViewTable"); + m_tableView = new KexiRelationViewTable(schema, tqparent, this, "KexiRelationViewTable"); //m_tableHeader->setFocusProxy( m_tableView ); - m_tableView->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); + m_tableView->tqsetSizePolicy(TQSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::Minimum)); - m_tableView->setMaximumSize( m_tableView->sizeHint() ); + m_tableView->setMaximumSize( m_tableView->tqsizeHint() ); -// m_tableView->resize( m_tableView->sizeHint() ); +// m_tableView->resize( m_tableView->tqsizeHint() ); lyr->addWidget(m_tableView, 0); - connect(m_tableView, SIGNAL(tableScrolling()), this, SLOT(moved())); - connect(m_tableView, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)), - this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&))); + connect(m_tableView, TQT_SIGNAL(tableScrolling()), this, TQT_SLOT(moved())); + connect(m_tableView, TQT_SIGNAL(contextMenu(KListView*, TQListViewItem*, const TQPoint&)), + this, TQT_SLOT(slotContextMenu(KListView*, TQListViewItem*, const TQPoint&))); } KexiRelationViewTableContainer::~KexiRelationViewTableContainer() @@ -88,7 +88,7 @@ KexiDB::TableOrQuerySchema* KexiRelationViewTableContainer::schema() const return m_tableView->schema(); } -void KexiRelationViewTableContainer::slotContextMenu(KListView *, QListViewItem *, const QPoint &p) +void KexiRelationViewTableContainer::slotContextMenu(KListView *, TQListViewItem *, const TQPoint &p) { // m_parent->executePopup(p); emit contextMenuRequest( p ); @@ -99,24 +99,24 @@ void KexiRelationViewTableContainer::moved() { emit moved(this); } -int KexiRelationViewTableContainer::globalY(const QString &field) +int KexiRelationViewTableContainer::globalY(const TQString &field) { // kdDebug() << "KexiRelationViewTableContainer::globalY()" << endl; -// QPoint o = mapFromGlobal(QPoint(0, (m_tableView->globalY(field))/*+m_parent->contentsY()*/)); +// TQPoint o = mapFromGlobal(TQPoint(0, (m_tableView->globalY(field))/*+m_parent->contentsY()*/)); - QPoint o(0, (m_tableView->globalY(field)) + m_parent->contentsY()); + TQPoint o(0, (m_tableView->globalY(field)) + m_parent->contentsY()); // kdDebug() << "KexiRelationViewTableContainer::globalY() db2" << endl; return m_parent->viewport()->mapFromGlobal(o).y(); } #if 0//js -QSize KexiRelationViewTableContainer::sizeHint() +TQSize KexiRelationViewTableContainer::tqsizeHint() { -#ifdef Q_WS_WIN - QSize s = m_tableView->sizeHint() - + QSize( 2 * 5 , m_tableHeader->height() + 2 * 5 ); +#ifdef TQ_WS_WIN + TQSize s = m_tableView->tqsizeHint() + + TQSize( 2 * 5 , m_tableHeader->height() + 2 * 5 ); #else - QSize s = m_tableView->sizeHint(); + TQSize s = m_tableView->tqsizeHint(); s.setWidth(s.width() + 4); s.setHeight(m_tableHeader->height() + s.height()); #endif @@ -134,13 +134,13 @@ void KexiRelationViewTableContainer::setFocus() } m_tableHeader->setFocus(); m_tableView->setFocus(); -/* QPalette p = qApp->palette(); - p.setColor( QPalette::Active, QColorGroup::Highlight, KGlobalSettings::highlightColor() ); - p.setColor( QPalette::Active, QColorGroup::HighlightedText, KGlobalSettings::highlightedTextColor() ); +/* TQPalette p = tqApp->palette(); + p.setColor( TQPalette::Active, TQColorGroup::Highlight, KGlobalSettings::highlightColor() ); + p.setColor( TQPalette::Active, TQColorGroup::HighlightedText, KGlobalSettings::highlightedTextColor() ); m_tableView->setPalette(p);*/ raise(); - repaint(); + tqrepaint(); emit gotFocus(); } @@ -155,18 +155,18 @@ void KexiRelationViewTableContainer::unsetFocus() m_tableView->clearSelection(); // m_tableView->unsetPalette(); -/* QPalette p = m_tableView->palette(); -// p.setColor( QPalette::Active, QColorGroup::Highlight, KGlobalSettings::highlightColor() ); -// p.setColor( QPalette::Active, QColorGroup::HighlightedText, KGlobalSettings::highlightedTextColor() ); - p.setColor( QPalette::Active, QColorGroup::Highlight, p.color(QPalette::Active, QColorGroup::Background ) ); -// p.setColor( QPalette::Active, QColorGroup::Highlight, gray ); - p.setColor( QPalette::Active, QColorGroup::HighlightedText, p.color(QPalette::Active, QColorGroup::Foreground ) ); -// p.setColor( QPalette::Active, QColorGroup::Highlight, green ); -// p.setColor( QPalette::Active, QColorGroup::HighlightedText, blue ); +/* TQPalette p = m_tableView->palette(); +// p.setColor( TQPalette::Active, TQColorGroup::Highlight, KGlobalSettings::highlightColor() ); +// p.setColor( TQPalette::Active, TQColorGroup::HighlightedText, KGlobalSettings::highlightedTextColor() ); + p.setColor( TQPalette::Active, TQColorGroup::Highlight, p.color(TQPalette::Active, TQColorGroup::Background ) ); +// p.setColor( TQPalette::Active, TQColorGroup::Highlight, gray ); + p.setColor( TQPalette::Active, TQColorGroup::HighlightedText, p.color(TQPalette::Active, TQColorGroup::Foreground ) ); +// p.setColor( TQPalette::Active, TQColorGroup::Highlight, green ); +// p.setColor( TQPalette::Active, TQColorGroup::HighlightedText, blue ); m_tableView->setPalette(p);*/ clearFocus(); - repaint(); + tqrepaint(); } @@ -176,8 +176,8 @@ void KexiRelationViewTableContainer::unsetFocus() //BEGIN KexiRelatoinViewTableContainerHeader KexiRelationViewTableContainerHeader::KexiRelationViewTableContainerHeader( - const QString& text,QWidget *parent) - :QLabel(text,parent),m_dragging(false) + const TQString& text,TQWidget *tqparent) + :TQLabel(text,tqparent),m_dragging(false) { setMargin(1); m_activeBG = KGlobalSettings::activeTitleColor(); @@ -204,17 +204,17 @@ void KexiRelationViewTableContainerHeader::unsetFocus() setPaletteForegroundColor(m_inactiveFG); } -bool KexiRelationViewTableContainerHeader::eventFilter(QObject *, QEvent *ev) +bool KexiRelationViewTableContainerHeader::eventFilter(TQObject *, TQEvent *ev) { - if (ev->type()==QEvent::MouseMove) + if (ev->type()==TQEvent::MouseMove) { - if (m_dragging && static_cast<QMouseEvent*>(ev)->state()==Qt::LeftButton) { + if (m_dragging && TQT_TQMOUSEEVENT(ev)->state()==Qt::LeftButton) { int diffX,diffY; - diffX=static_cast<QMouseEvent*>(ev)->globalPos().x()-m_grabX; - diffY=static_cast<QMouseEvent*>(ev)->globalPos().y()-m_grabY; + diffX=TQT_TQMOUSEEVENT(ev)->globalPos().x()-m_grabX; + diffY=TQT_TQMOUSEEVENT(ev)->globalPos().y()-m_grabY; if ((abs(diffX)>2) || (abs(diffY)>2)) { - QPoint newPos=parentWidget()->pos()+QPoint(diffX,diffY); + TQPoint newPos=tqparentWidget()->pos()+TQPoint(diffX,diffY); //correct the x position if (newPos.x()<0) { m_offsetX+=newPos.x(); @@ -244,9 +244,9 @@ bool KexiRelationViewTableContainerHeader::eventFilter(QObject *, QEvent *ev) } //move and update helpers - parentWidget()->move(newPos); - m_grabX=static_cast<QMouseEvent*>(ev)->globalPos().x(); - m_grabY=static_cast<QMouseEvent*>(ev)->globalPos().y(); + tqparentWidget()->move(newPos); + m_grabX=TQT_TQMOUSEEVENT(ev)->globalPos().x(); + m_grabY=TQT_TQMOUSEEVENT(ev)->globalPos().y(); // kdDebug()<<"HEADER:emitting moved"<<endl; emit moved(); } @@ -256,9 +256,9 @@ bool KexiRelationViewTableContainerHeader::eventFilter(QObject *, QEvent *ev) return false; } -void KexiRelationViewTableContainerHeader::mousePressEvent(QMouseEvent *ev) { +void KexiRelationViewTableContainerHeader::mousePressEvent(TQMouseEvent *ev) { kdDebug()<<"KexiRelationViewTableContainerHeader::Mouse Press Event"<<endl; - parentWidget()->setFocus(); + tqparentWidget()->setFocus(); ev->accept(); if (ev->button()==Qt::LeftButton) { m_dragging=true; @@ -266,20 +266,20 @@ void KexiRelationViewTableContainerHeader::mousePressEvent(QMouseEvent *ev) { m_grabY=ev->globalPos().y(); m_offsetX=0; m_offsetY=0; - setCursor(Qt::SizeAllCursor); + setCursor(TQt::SizeAllCursor); return; } if (ev->button()==Qt::RightButton) { - emit static_cast<KexiRelationViewTableContainer*>(parentWidget()) + emit static_cast<KexiRelationViewTableContainer*>(tqparentWidget()) ->contextMenuRequest(ev->globalPos()); } -// QLabel::mousePressEvent(ev); +// TQLabel::mousePressEvent(ev); } -void KexiRelationViewTableContainerHeader::mouseReleaseEvent(QMouseEvent *ev) { +void KexiRelationViewTableContainerHeader::mouseReleaseEvent(TQMouseEvent *ev) { kdDebug()<<"KexiRelationViewTableContainerHeader::Mouse Release Event"<<endl; if (m_dragging && ev->button() & Qt::LeftButton) { - setCursor(Qt::ArrowCursor); + setCursor(TQt::ArrowCursor); m_dragging=false; emit endDrag(); } @@ -292,37 +292,37 @@ void KexiRelationViewTableContainerHeader::mouseReleaseEvent(QMouseEvent *ev) { //===================================================================================== KexiRelationViewTable::KexiRelationViewTable(KexiDB::TableOrQuerySchema* tableOrQuerySchema, - KexiRelationView *view, QWidget *parent, const char *name) - : KexiFieldListView(parent, name, KexiFieldListView::ShowAsterisk) + KexiRelationView *view, TQWidget *tqparent, const char *name) + : KexiFieldListView(tqparent, name, KexiFieldListView::ShowAsterisk) , m_view(view) { setSchema(tableOrQuerySchema); header()->hide(); - connect(this, SIGNAL(dropped(QDropEvent *, QListViewItem *)), this, SLOT(slotDropped(QDropEvent *))); - connect(this, SIGNAL(contentsMoving(int, int)), this, SLOT(slotContentsMoving(int,int))); + connect(this, TQT_SIGNAL(dropped(TQDropEvent *, TQListViewItem *)), this, TQT_SLOT(slotDropped(TQDropEvent *))); + connect(this, TQT_SIGNAL(contentsMoving(int, int)), this, TQT_SLOT(slotContentsMoving(int,int))); } KexiRelationViewTable::~KexiRelationViewTable() { } -QSize KexiRelationViewTable::sizeHint() const +TQSize KexiRelationViewTable::tqsizeHint() const { - QFontMetrics fm(fontMetrics()); + TQFontMetrics fm(fontMetrics()); // kdDebug() << schema()->name() << " cw=" << columnWidth(0) + fm.width("i") // << ", " << fm.width(schema()->name()+" ") << endl; int maxWidth = -1; const int iconWidth = IconSize(KIcon::Small) + fm.width("i")+20; - for (QListViewItem *item = firstChild(); item; item = item->nextSibling()) - maxWidth = QMAX(maxWidth, iconWidth + fm.width(item->text(0))); + for (TQListViewItem *item = firstChild(); item; item = item->nextSibling()) + maxWidth = TQMAX(maxWidth, iconWidth + fm.width(item->text(0))); - const uint rowCount = QMIN( 8, childCount() ); + const uint rowCount = TQMIN( 8, childCount() ); - QSize s( - QMAX( maxWidth, fm.width(schema()->name()+" ")), + TQSize s( + TQMAX( maxWidth, fm.width(schema()->name()+" ")), rowCount*firstChild()->totalHeight() + 4 ); return s; } @@ -336,58 +336,58 @@ void KexiRelationViewTable::setReadOnly(bool b) #endif int -KexiRelationViewTable::globalY(const QString &item) +KexiRelationViewTable::globalY(const TQString &item) { - QListViewItem *i = findItem(item, 0); + TQListViewItem *i = tqfindItem(item, 0); if (!i) return -1; - int y = itemRect(i).y() + (itemRect(i).height() / 2); + int y = tqitemRect(i).y() + (tqitemRect(i).height() / 2); if (contentsY() > itemPos(i)) y = 0; else if (y == 0) y = height(); - return mapToGlobal(QPoint(0, y)).y(); + return mapToGlobal(TQPoint(0, y)).y(); } bool -KexiRelationViewTable::acceptDrag(QDropEvent *ev) const +KexiRelationViewTable::acceptDrag(TQDropEvent *ev) const { // kdDebug() << "KexiRelationViewTable::acceptDrag()" << endl; - QListViewItem *receiver = itemAt(ev->pos() - QPoint(0,contentsY())); + TQListViewItem *receiver = itemAt(ev->pos() - TQPoint(0,contentsY())); if (!receiver || !KexiFieldDrag::canDecodeSingle(ev)) return false; - QString sourceMimeType; - QString srcTable; - QString srcField; + TQString sourceMimeType; + TQString srcTable; + TQString srcField; if (!KexiFieldDrag::decodeSingle(ev,sourceMimeType,srcTable,srcField)) return false; if (sourceMimeType!="kexi/table" && sourceMimeType=="kexi/query") return false; - QString f = receiver->text(0).stripWhiteSpace(); - if (!srcField.stripWhiteSpace().startsWith("*") && !f.startsWith("*") && ev->source() != (QWidget*)this) + TQString f = receiver->text(0).stripWhiteSpace(); + if (!srcField.stripWhiteSpace().startsWith("*") && !f.startsWith("*") && ev->source() != (TQWidget*)this) return true; return false; } void -KexiRelationViewTable::slotDropped(QDropEvent *ev) +KexiRelationViewTable::slotDropped(TQDropEvent *ev) { - QListViewItem *recever = itemAt(ev->pos() - QPoint(0,contentsY())); + TQListViewItem *recever = itemAt(ev->pos() - TQPoint(0,contentsY())); if (!recever || !KexiFieldDrag::canDecodeSingle(ev)) { ev->ignore(); return; } - QString sourceMimeType; - QString srcTable; - QString srcField; + TQString sourceMimeType; + TQString srcTable; + TQString srcField; if (!KexiFieldDrag::decodeSingle(ev,sourceMimeType,srcTable,srcField)) return; if (sourceMimeType!="kexi/table" && sourceMimeType=="kexi/query") return; // kdDebug() << "KexiRelationViewTable::slotDropped() srcfield: " << srcField << endl; - QString rcvField = recever->text(0); + TQString rcvField = recever->text(0); SourceConnection s; s.masterTable = srcTable; @@ -408,22 +408,22 @@ KexiRelationViewTable::slotContentsMoving(int,int) emit tableScrolling(); } -void KexiRelationViewTable::contentsMousePressEvent(QMouseEvent *ev) +void KexiRelationViewTable::contentsMousePressEvent(TQMouseEvent *ev) { - parentWidget()->setFocus(); + tqparentWidget()->setFocus(); setFocus(); KListView::contentsMousePressEvent(ev); // if (ev->button()==Qt::RightButton) -// static_cast<KexiRelationView*>(parentWidget())->executePopup(ev->pos()); +// static_cast<KexiRelationView*>(tqparentWidget())->executePopup(ev->pos()); } -QRect KexiRelationViewTable::drawItemHighlighter(QPainter *painter, QListViewItem *item) +TQRect KexiRelationViewTable::drawItemHighlighter(TQPainter *painter, TQListViewItem *item) { if (painter) { - style().drawPrimitive(QStyle::PE_FocusRect, painter, itemRect(item), colorGroup(), - QStyle::Style_FocusAtBorder); + tqstyle().tqdrawPrimitive(TQStyle::PE_FocusRect, painter, tqitemRect(item), tqcolorGroup(), + TQStyle::Style_FocusAtBorder); } - return itemRect(item); + return tqitemRect(item); } #include "kexirelationviewtable.moc" |