diff options
Diffstat (limited to 'kexi/widget/tableview/kexitableview.cpp')
-rw-r--r-- | kexi/widget/tableview/kexitableview.cpp | 690 |
1 files changed, 345 insertions, 345 deletions
diff --git a/kexi/widget/tableview/kexitableview.cpp b/kexi/widget/tableview/kexitableview.cpp index 108b1696..229f909c 100644 --- a/kexi/widget/tableview/kexitableview.cpp +++ b/kexi/widget/tableview/kexitableview.cpp @@ -24,18 +24,18 @@ Original Project: buX (www.bux.at) */ -#include <qpainter.h> -#include <qkeycode.h> -#include <qlineedit.h> -#include <qcombobox.h> -#include <qwmatrix.h> -#include <qtimer.h> -#include <qpopupmenu.h> -#include <qcursor.h> -#include <qstyle.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qwhatsthis.h> +#include <tqpainter.h> +#include <tqkeycode.h> +#include <tqlineedit.h> +#include <tqcombobox.h> +#include <tqwmatrix.h> +#include <tqtimer.h> +#include <tqpopupmenu.h> +#include <tqcursor.h> +#include <tqstyle.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> #include <kglobal.h> #include <klocale.h> @@ -59,16 +59,16 @@ #include <widget/utils/kexidisplayutils.h> #include <kexidb/cursor.h> -KexiTableView::Appearance::Appearance(QWidget *widget) +KexiTableView::Appearance::Appearance(TQWidget *widget) : alternateBackgroundColor( KGlobalSettings::alternateBackgroundColor() ) { //set defaults - if (qApp) { - QPalette p = widget ? widget->palette() : qApp->palette(); + if (tqApp) { + TQPalette p = widget ? widget->palette() : tqApp->palette(); baseColor = p.active().base(); textColor = p.active().text(); - borderColor = QColor(200,200,200); - emptyAreaColor = p.active().color(QColorGroup::Base); + borderColor = TQColor(200,200,200); + emptyAreaColor = p.active().color(TQColorGroup::Base); rowHighlightingColor = KexiUtils::blendedColors(p.active().highlight(), baseColor, 33, 66); rowMouseOverHighlightingColor = KexiUtils::blendedColors(p.active().highlight(), baseColor, 10, 90); rowMouseOverAlternateHighlightingColor = KexiUtils::blendedColors(p.active().highlight(), alternateBackgroundColor, 10, 90); @@ -87,31 +87,31 @@ KexiTableView::Appearance::Appearance(QWidget *widget) //----------------------------------------- //! @internal A special What's This class displaying information about a given column -class KexiTableView::WhatsThis : public QWhatsThis +class KexiTableView::WhatsThis : public TQWhatsThis { public: - WhatsThis(KexiTableView* tv) : QWhatsThis(tv), m_tv(tv) + WhatsThis(KexiTableView* tv) : TQWhatsThis(tv), m_tv(tv) { Q_ASSERT(tv); } virtual ~WhatsThis() { } - virtual QString text( const QPoint & pos) + virtual TQString text( const TQPoint & pos) { const int leftMargin = m_tv->verticalHeaderVisible() ? m_tv->verticalHeader()->width() : 0; //const int topMargin = m_tv->horizontalHeaderVisible() ? m_tv->d->pTopHeader->height() : 0; //const int bottomMargin = m_tv->d->appearance.navigatorEnabled ? m_tv->m_navPanel->height() : 0; - if (KexiUtils::hasParent(m_tv->verticalHeader(), m_tv->childAt(pos))) { + if (KexiUtils::hasParent(TQT_TQOBJECT(m_tv->verticalHeader()), TQT_TQOBJECT(m_tv->tqchildAt(pos)))) { return i18n("Contains a pointer to the currently selected row"); } - else if (KexiUtils::hasParent(m_tv->m_navPanel, m_tv->childAt(pos))) { + else if (KexiUtils::hasParent(TQT_TQOBJECT(m_tv->m_navPanel), TQT_TQOBJECT(m_tv->tqchildAt(pos)))) { return i18n("Row navigator"); -// return QWhatsThis::textFor(m_tv->m_navPanel, QPoint( pos.x(), pos.y() - m_tv->height() + bottomMargin )); +// return TQWhatsThis::textFor(m_tv->m_navPanel, TQPoint( pos.x(), pos.y() - m_tv->height() + bottomMargin )); } KexiDB::Field *f = m_tv->field( m_tv->columnAt(pos.x()-leftMargin) ); if (!f) - return QString::null; + return TQString(); return f->description().isEmpty() ? f->captionOrName() : f->description(); } protected: @@ -121,19 +121,19 @@ class KexiTableView::WhatsThis : public QWhatsThis //----------------------------------------- KexiTableViewCellToolTip::KexiTableViewCellToolTip( KexiTableView * tableView ) - : QToolTip(tableView->viewport()) + : TQToolTip(tableView->viewport()) , m_tableView(tableView) { } KexiTableViewCellToolTip::~KexiTableViewCellToolTip() { - remove(parentWidget()); + remove(tqparentWidget()); } -void KexiTableViewCellToolTip::maybeTip( const QPoint & p ) +void KexiTableViewCellToolTip::maybeTip( const TQPoint & p ) { - const QPoint cp( m_tableView->viewportToContents( p ) ); + const TQPoint cp( m_tableView->viewportToContents( p ) ); const int row = m_tableView->rowAt( cp.y(), true/*ignoreEnd*/ ); const int col = m_tableView->columnAt( cp.x() ); @@ -147,21 +147,21 @@ void KexiTableViewCellToolTip::maybeTip( const QPoint & p ) int h = m_tableView->rowHeight(); int x = 0; int y_offset = 0; - int align = Qt::SingleLine | Qt::AlignVCenter; - QString txtValue; - QVariant cellValue; + int align = TQt::SingleLine | TQt::AlignVCenter; + TQString txtValue; + TQVariant cellValue; KexiTableViewColumn *tvcol = m_tableView->column(col); if (!m_tableView->getVisibleLookupValue(cellValue, editor, item, tvcol)) cellValue = insertRowSelected ? editor->displayedField()->defaultValue() : item->at(col); //display default value if available const bool focused = m_tableView->selectedItem() == item && col == m_tableView->currentColumn(); editor->setupContents( 0, focused, cellValue, txtValue, align, x, y_offset, w, h ); - QRect realRect(m_tableView->columnPos(col)-m_tableView->contentsX(), + TQRect realRect(m_tableView->columnPos(col)-m_tableView->contentsX(), m_tableView->rowPos(row)-m_tableView->contentsY(), w, h); //m_tableView->cellGeometry( row, col )); if (editor->showToolTipIfNeeded( - txtValue.isEmpty() ? item->at(col) : QVariant(txtValue), + txtValue.isEmpty() ? item->at(col) : TQVariant(txtValue), realRect, m_tableView->fontMetrics(), focused)) { - QString squeezedTxtValue; + TQString squeezedTxtValue; if (txtValue.length() > 50) squeezedTxtValue = txtValue.left(100) + "..."; else @@ -174,8 +174,8 @@ void KexiTableViewCellToolTip::maybeTip( const QPoint & p ) //----------------------------------------- -KexiTableView::KexiTableView(KexiTableViewData* data, QWidget* parent, const char* name) -: QScrollView(parent, name, /*Qt::WRepaintNoErase | */Qt::WStaticContents /*| Qt::WResizeNoErase*/) +KexiTableView::KexiTableView(KexiTableViewData* data, TQWidget* tqparent, const char* name) +: TQScrollView(tqparent, name, /*TQt::WRepaintNoErase | */TQt::WStaticContents /*| TQt::WResizeNoErase*/) , KexiRecordNavigatorHandler() , KexiSharedActionClient() , KexiDataAwareObjectInterface() @@ -184,32 +184,32 @@ KexiTableView::KexiTableView(KexiTableViewData* data, QWidget* parent, const cha d = new KexiTableViewPrivate(this); - connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); + connect( kapp, TQT_SIGNAL( settingsChanged(int) ), TQT_SLOT( slotSettingsChanged(int) ) ); slotSettingsChanged(KApplication::SETTINGS_SHORTCUTS); m_data = new KexiTableViewData(); //to prevent crash because m_data==0 m_owner = true; //-this will be deleted if needed setResizePolicy(Manual); - viewport()->setBackgroundMode(Qt::NoBackground); -// viewport()->setFocusPolicy(StrongFocus); - viewport()->setFocusPolicy(WheelFocus); - setFocusPolicy(WheelFocus); //<--- !!!!! important (was NoFocus), - // otherwise QApplication::setActiveWindow() won't activate + viewport()->setBackgroundMode(TQt::NoBackground); +// viewport()->setFocusPolicy(TQ_StrongFocus); + viewport()->setFocusPolicy(TQ_WheelFocus); + setFocusPolicy(TQ_WheelFocus); //<--- !!!!! important (was NoFocus), + // otherwise TQApplication::setActiveWindow() won't activate // this widget when needed! // setFocusProxy(viewport()); viewport()->installEventFilter(this); //setup colors defaults - setBackgroundMode(Qt::PaletteBackground); -// setEmptyAreaColor(d->appearance.baseColor);//palette().active().color(QColorGroup::Base)); + setBackgroundMode(TQt::PaletteBackground); +// setEmptyAreaColor(d->appearance.baseColor);//palette().active().color(TQColorGroup::Base)); -// d->baseColor = colorGroup().base(); -// d->textColor = colorGroup().text(); +// d->baseColor = tqcolorGroup().base(); +// d->textColor = tqcolorGroup().text(); // d->altColor = KGlobalSettings::alternateBackgroundColor(); -// d->grayColor = QColor(200,200,200); - d->diagonalGrayPattern = QBrush(d->appearance.borderColor, Qt::BDiagPattern); +// d->grayColor = TQColor(200,200,200); + d->diagonalGrayPattern = TQBrush(d->appearance.borderColor, TQt::BDiagPattern); setLineWidth(1); horizontalScrollBar()->installEventFilter(this); @@ -219,13 +219,13 @@ KexiTableView::KexiTableView(KexiTableViewData* data, QWidget* parent, const cha //context menu m_popupMenu = new KPopupMenu(this, "contextMenu"); #if 0 //moved to mainwindow's actions - d->menu_id_addRecord = m_popupMenu->insertItem(i18n("Add Record"), this, SLOT(addRecord()), Qt::CTRL+Qt::Key_Insert); + d->menu_id_addRecord = m_popupMenu->insertItem(i18n("Add Record"), this, TQT_SLOT(addRecord()), TQt::CTRL+TQt::Key_Insert); d->menu_id_removeRecord = m_popupMenu->insertItem( kapp->iconLoader()->loadIcon("button_cancel", KIcon::Small), - i18n("Remove Record"), this, SLOT(removeRecord()), Qt::CTRL+Qt::Key_Delete); + i18n("Remove Record"), this, TQT_SLOT(removeRecord()), TQt::CTRL+TQt::Key_Delete); #endif -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN d->rowHeight = fontMetrics().lineSpacing() + 4; #else d->rowHeight = fontMetrics().lineSpacing() + 1; @@ -234,27 +234,27 @@ KexiTableView::KexiTableView(KexiTableViewData* data, QWidget* parent, const cha if(d->rowHeight < 17) d->rowHeight = 17; - d->pUpdateTimer = new QTimer(this); + d->pUpdateTimer = new TQTimer(this); // setMargins(14, fontMetrics().height() + 4, 0, 0); // Create headers m_horizontalHeader = new KexiTableViewHeader(this, "topHeader"); - m_horizontalHeader->setSelectionBackgroundColor( palette().active().highlight() ); + m_horizontalHeader->setSelectionBackgroundColor( tqpalette().active().highlight() ); m_horizontalHeader->setOrientation(Qt::Horizontal); m_horizontalHeader->setTracking(false); m_horizontalHeader->setMovingEnabled(false); - connect(m_horizontalHeader, SIGNAL(sizeChange(int,int,int)), this, SLOT(slotTopHeaderSizeChange(int,int,int))); + connect(m_horizontalHeader, TQT_SIGNAL(sizeChange(int,int,int)), this, TQT_SLOT(slotTopHeaderSizeChange(int,int,int))); m_verticalHeader = new KexiRecordMarker(this, "rm"); - m_verticalHeader->setSelectionBackgroundColor( palette().active().highlight() ); + m_verticalHeader->setSelectionBackgroundColor( tqpalette().active().highlight() ); m_verticalHeader->setCellHeight(d->rowHeight); // m_verticalHeader->setFixedWidth(d->rowHeight); m_verticalHeader->setCurrentRow(-1); setMargins( - QMIN(m_horizontalHeader->sizeHint().height(), d->rowHeight), - m_horizontalHeader->sizeHint().height(), 0, 0); + TQMIN(m_horizontalHeader->tqsizeHint().height(), d->rowHeight), + m_horizontalHeader->tqsizeHint().height(), 0, 0); setupNavigator(); @@ -267,8 +267,8 @@ KexiTableView::KexiTableView(KexiTableViewData* data, QWidget* parent, const cha setData( data ); #if 0//(js) doesn't work! - d->scrollTimer = new QTimer(this); - connect(d->scrollTimer, SIGNAL(timeout()), this, SLOT(slotAutoScroll())); + d->scrollTimer = new TQTimer(this); + connect(d->scrollTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotAutoScroll())); #endif // setBackgroundAltering(true); @@ -278,17 +278,17 @@ KexiTableView::KexiTableView(KexiTableViewData* data, QWidget* parent, const cha viewport()->setAcceptDrops(true); // Connect header, table and scrollbars - connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), m_horizontalHeader, SLOT(setOffset(int))); - connect(verticalScrollBar(), SIGNAL(valueChanged(int)), m_verticalHeader, SLOT(setOffset(int))); - connect(m_horizontalHeader, SIGNAL(sizeChange(int, int, int)), this, SLOT(slotColumnWidthChanged(int, int, int))); - connect(m_horizontalHeader, SIGNAL(sectionHandleDoubleClicked(int)), this, SLOT(slotSectionHandleDoubleClicked(int))); - connect(m_horizontalHeader, SIGNAL(clicked(int)), this, SLOT(sortColumnInternal(int))); + connect(horizontalScrollBar(), TQT_SIGNAL(valueChanged(int)), m_horizontalHeader, TQT_SLOT(setOffset(int))); + connect(verticalScrollBar(), TQT_SIGNAL(valueChanged(int)), m_verticalHeader, TQT_SLOT(setOffset(int))); + connect(m_horizontalHeader, TQT_SIGNAL(sizeChange(int, int, int)), this, TQT_SLOT(slotColumnWidthChanged(int, int, int))); + connect(m_horizontalHeader, TQT_SIGNAL(sectionHandleDoubleClicked(int)), this, TQT_SLOT(slotSectionHandleDoubleClicked(int))); + connect(m_horizontalHeader, TQT_SIGNAL(clicked(int)), this, TQT_SLOT(sortColumnInternal(int))); - connect(d->pUpdateTimer, SIGNAL(timeout()), this, SLOT(slotUpdate())); + connect(d->pUpdateTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotUpdate())); // horizontalScrollBar()->show(); updateScrollBars(); -// resize(sizeHint()); +// resize(tqsizeHint()); // updateContents(); // setMinimumHeight(horizontalScrollBar()->height() + d->rowHeight + topMargin()); @@ -333,7 +333,7 @@ void KexiTableView::setupNavigator() m_navPanel = new KexiRecordNavigator(this, leftMargin(), "navPanel"); m_navPanel->setRecordHandler(this); - m_navPanel->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Preferred); + m_navPanel->tqsetSizePolicy(TQSizePolicy::Minimum,TQSizePolicy::Preferred); } void KexiTableView::initDataContents() @@ -345,8 +345,8 @@ void KexiTableView::initDataContents() m_navPanel->showEditingIndicator(false); } -void KexiTableView::addHeaderColumn(const QString& caption, const QString& description, - const QIconSet& icon, int width) +void KexiTableView::addHeaderColumn(const TQString& caption, const TQString& description, + const TQIconSet& icon, int width) { const int nr = m_horizontalHeader->count(); if (icon.isNull()) @@ -360,33 +360,33 @@ void KexiTableView::addHeaderColumn(const QString& caption, const QString& descr void KexiTableView::updateWidgetContentsSize() { - QSize s(tableSize()); + TQSize s(tableSize()); resizeContents(s.width(), s.height()); } -void KexiTableView::slotRowsDeleted( const QValueList<int> &rows ) +void KexiTableView::slotRowsDeleted( const TQValueList<int> &rows ) { - viewport()->repaint(); + viewport()->tqrepaint(); updateWidgetContentsSize(); - setCursorPosition(QMAX(0, (int)m_curRow - (int)rows.count()), -1, true); + setCursorPosition(TQMAX(0, (int)m_curRow - (int)rows.count()), -1, true); } -/*void KexiTableView::addDropFilter(const QString &filter) +/*void KexiTableView::addDropFilter(const TQString &filter) { d->dropFilters.append(filter); viewport()->setAcceptDrops(true); }*/ -void KexiTableView::setFont( const QFont &font ) +void KexiTableView::setFont( const TQFont &font ) { - QScrollView::setFont(font); + TQScrollView::setFont(font); updateFonts(true); } -void KexiTableView::updateFonts(bool repaint) +void KexiTableView::updateFonts(bool tqrepaint) { -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN d->rowHeight = fontMetrics().lineSpacing() + 4; #else d->rowHeight = fontMetrics().lineSpacing() + 1; @@ -399,15 +399,15 @@ void KexiTableView::updateFonts(bool repaint) // if(d->rowHeight < 22) // d->rowHeight = 22; setMargins( - QMIN(m_horizontalHeader->sizeHint().height(), d->rowHeight), - m_horizontalHeader->sizeHint().height(), 0, 0); + TQMIN(m_horizontalHeader->tqsizeHint().height(), d->rowHeight), + m_horizontalHeader->tqsizeHint().height(), 0, 0); // setMargins(14, d->rowHeight, 0, 0); m_verticalHeader->setCellHeight(d->rowHeight); KexiDisplayUtils::initDisplayForAutonumberSign(d->autonumberSignDisplayParameters, this); KexiDisplayUtils::initDisplayForDefaultValue(d->defaultValueDisplayParameters, this); - if (repaint) + if (tqrepaint) updateContents(); } @@ -425,7 +425,7 @@ void KexiTableView::updateAllVisibleRowsBelow(int row) clipper()->width(), clipper()->height() - (rowPos(row) - contentsY()) ); } -void KexiTableView::clearColumnsInternal(bool /*repaint*/) +void KexiTableView::clearColumnsInternal(bool /*tqrepaint*/) { while(m_horizontalHeader->count()>0) m_horizontalHeader->removeLabel(0); @@ -434,7 +434,7 @@ void KexiTableView::clearColumnsInternal(bool /*repaint*/) void KexiTableView::slotUpdate() { // kdDebug(44021) << " KexiTableView::slotUpdate() -- " << endl; -// QSize s(tableSize()); +// TQSize s(tableSize()); // viewport()->setUpdatesEnabled(false); /// resizeContents(s.width(), s.height()); // viewport()->setUpdatesEnabled(true); @@ -457,7 +457,7 @@ int KexiTableView::currentLocalSortingOrder() const { if (m_horizontalHeader->sortIndicatorSection()==-1) return 0; - return (m_horizontalHeader->sortIndicatorOrder() == Qt::Ascending) ? 1 : -1; + return (m_horizontalHeader->sortIndicatorOrder() == TQt::Ascending) ? 1 : -1; } void KexiTableView::setLocalSortingOrder(int col, int order) @@ -465,7 +465,7 @@ void KexiTableView::setLocalSortingOrder(int col, int order) if (order == 0) col = -1; if (col>=0) - m_horizontalHeader->setSortIndicator(col, (order==1) ? Qt::Ascending : Qt::Descending); + m_horizontalHeader->setSortIndicator(col, (order==1) ? TQt::Ascending : TQt::Descending); } int KexiTableView::currentLocalSortColumn() const @@ -488,37 +488,37 @@ void KexiTableView::updateGUIAfterSorting() // d->pUpdateTimer->start(1,true); } -QSizePolicy KexiTableView::sizePolicy() const +TQSizePolicy KexiTableView::sizePolicy() const { // this widget is expandable - return QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + return TQSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding); } -QSize KexiTableView::sizeHint() const +TQSize KexiTableView::tqsizeHint() const { - const QSize &ts = tableSize(); - int w = QMAX( ts.width() + leftMargin()+ verticalScrollBar()->sizeHint().width() + 2*2, + const TQSize &ts = tableSize(); + int w = TQMAX( ts.width() + leftMargin()+ verticalScrollBar()->tqsizeHint().width() + 2*2, (m_navPanel->isVisible() ? m_navPanel->width() : 0) ); - int h = QMAX( ts.height()+topMargin()+horizontalScrollBar()->sizeHint().height(), - minimumSizeHint().height() ); - w = QMIN( w, qApp->desktop()->width()*3/4 ); //stretch - h = QMIN( h, qApp->desktop()->height()*3/4 ); //stretch - -// kexidbg << "KexiTableView::sizeHint()= " <<w <<", " <<h << endl; - - return QSize(w, h); - /*QSize( - QMAX( ts.width() + leftMargin() + 2*2, (m_navPanel ? m_navPanel->width() : 0) ), - //+ QMIN(m_verticalHeader->width(),d->rowHeight) + margin()*2, - QMAX( ts.height()+topMargin()+horizontalScrollBar()->sizeHint().height(), - minimumSizeHint().height() ) + int h = TQMAX( ts.height()+topMargin()+horizontalScrollBar()->tqsizeHint().height(), + tqminimumSizeHint().height() ); + w = TQMIN( w, tqApp->desktop()->width()*3/4 ); //stretch + h = TQMIN( h, tqApp->desktop()->height()*3/4 ); //stretch + +// kexidbg << "KexiTableView::tqsizeHint()= " <<w <<", " <<h << endl; + + return TQSize(w, h); + /*TQSize( + TQMAX( ts.width() + leftMargin() + 2*2, (m_navPanel ? m_navPanel->width() : 0) ), + //+ TQMIN(m_verticalHeader->width(),d->rowHeight) + margin()*2, + TQMAX( ts.height()+topMargin()+horizontalScrollBar()->tqsizeHint().height(), + tqminimumSizeHint().height() ) );*/ -// QMAX(ts.height() + topMargin(), minimumSizeHint().height()) ); +// TQMAX(ts.height() + topMargin(), tqminimumSizeHint().height()) ); } -QSize KexiTableView::minimumSizeHint() const +TQSize KexiTableView::tqminimumSizeHint() const { - return QSize( + return TQSize( leftMargin() + ((columns()>0)?columnWidth(0):KEXI_DEFAULT_DATA_COLUMN_WIDTH) + 2*2, d->rowHeight*5/2 + topMargin() + (m_navPanel && m_navPanel->isVisible() ? m_navPanel->height() : 0) ); @@ -527,7 +527,7 @@ QSize KexiTableView::minimumSizeHint() const void KexiTableView::createBuffer(int width, int height) { if(!d->pBufferPm) - d->pBufferPm = new QPixmap(width, height); + d->pBufferPm = new TQPixmap(width, height); else if(d->pBufferPm->width() < width || d->pBufferPm->height() < height) d->pBufferPm->resize(width, height); @@ -536,7 +536,7 @@ void KexiTableView::createBuffer(int width, int height) //internal inline void KexiTableView::paintRow(KexiTableItem *item, - QPainter *pb, int r, int rowp, int cx, int cy, + TQPainter *pb, int r, int rowp, int cx, int cy, int colfirst, int collast, int maxwc) { if (!item) @@ -579,7 +579,7 @@ inline void KexiTableView::paintRow(KexiTableItem *item, // Translate painter and draw the cell pb->saveWorldMatrix(); pb->translate(translx, transly); - paintCell( pb, item, c, r, QRect(colp, rowp, colw, d->rowHeight)); + paintCell( pb, item, c, r, TQRect(colp, rowp, colw, d->rowHeight)); pb->restoreWorldMatrix(); } @@ -594,14 +594,14 @@ inline void KexiTableView::paintRow(KexiTableItem *item, if (y_line>=0) { RasterOp op = pb->rasterOp(); pb->setRasterOp(XorROP); - pb->setPen( QPen(Qt::white, 3) ); + pb->setPen( TQPen(TQt::white, 3) ); pb->drawLine(0, y_line, maxwc, y_line); pb->setRasterOp(op); } } } -void KexiTableView::drawContents( QPainter *p, int cx, int cy, int cw, int ch) +void KexiTableView::drawContents( TQPainter *p, int cx, int cy, int cw, int ch) { if (d->disableDrawContents) return; @@ -613,8 +613,8 @@ void KexiTableView::drawContents( QPainter *p, int cx, int cy, int cw, int ch) bool plus1row = false; //true if we should show 'inserting' row at the end bool paintOnlyInsertRow = false; -/* kdDebug(44021) << QString(" KexiTableView::drawContents(cx:%1 cy:%2 cw:%3 ch:%4)") - .arg(cx).arg(cy).arg(cw).arg(ch) << endl;*/ +/* kdDebug(44021) << TQString(" KexiTableView::drawContents(cx:%1 cy:%2 cw:%3 ch:%4)") + .tqarg(cx).tqarg(cy).tqarg(cw).tqarg(ch) << endl;*/ if (rowlast == -1) { rowlast = rows() - 1; @@ -657,10 +657,10 @@ void KexiTableView::drawContents( QPainter *p, int cx, int cy, int cw, int ch) createBuffer(cw, ch); if(d->pBufferPm->isNull()) return; - QPainter *pb = new QPainter(d->pBufferPm, this); -// pb->fillRect(0, 0, cw, ch, colorGroup().base()); + TQPainter *pb = new TQPainter(d->pBufferPm, this); +// pb->fillRect(0, 0, cw, ch, tqcolorGroup().base()); -// int maxwc = QMIN(cw, (columnPos(d->numCols - 1) + columnWidth(d->numCols - 1))); +// int maxwc = TQMIN(cw, (columnPos(d->numCols - 1) + columnWidth(d->numCols - 1))); int maxwc = columnPos(columns() - 1) + columnWidth(columns() - 1); // kdDebug(44021) << "KexiTableView::drawContents(): maxwc: " << maxwc << endl; @@ -673,7 +673,7 @@ void KexiTableView::drawContents( QPainter *p, int cx, int cy, int cw, int ch) rowp = rowPos(r); // 'insert' row's position } else { - QPtrListIterator<KexiTableItem> it = m_data->iterator(); + TQPtrListIterator<KexiTableItem> it = m_data->iterator(); it += rowfirst;//move to 1st row rowp = rowPos(rowfirst); // row position for (r = rowfirst;r <= rowlast; r++, ++it, rowp+=d->rowHeight) { @@ -693,7 +693,7 @@ void KexiTableView::drawContents( QPainter *p, int cx, int cy, int cw, int ch) paintEmptyArea(p, cx, cy, cw, ch); } -bool KexiTableView::isDefaultValueDisplayed(KexiTableItem *item, int col, QVariant* value) +bool KexiTableView::isDefaultValueDisplayed(KexiTableItem *item, int col, TQVariant* value) { const bool cursorAtInsertRowOrEditingNewRow = (item == m_insertItem || (m_newRowEditing && m_currentItem == item)); KexiTableViewColumn *tvcol; @@ -709,7 +709,7 @@ bool KexiTableView::isDefaultValueDisplayed(KexiTableItem *item, int col, QVaria return false; } -void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row, const QRect &cr, bool print) +void KexiTableView::paintCell(TQPainter* p, KexiTableItem *item, int col, int row, const TQRect &cr, bool print) { p->save(); Q_UNUSED(print); @@ -718,12 +718,12 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row int x2 = w - 1; int y2 = h - 1; -/* if (0==qstrcmp("KexiComboBoxPopup",parentWidget()->className())) { - kexidbg << parentWidget()->className() << " >>>>>> KexiTableView::paintCell(col=" << col <<"row="<<row<<") w="<<w<<endl; +/* if (0==qstrcmp("KexiComboBoxPopup",tqparentWidget()->className())) { + kexidbg << tqparentWidget()->className() << " >>>>>> KexiTableView::paintCell(col=" << col <<"row="<<row<<") w="<<w<<endl; }*/ // Draw our lines - QPen pen(p->pen()); + TQPen pen(p->pen()); if (d->appearance.gridEnabled) { p->setPen(d->appearance.borderColor); @@ -746,12 +746,12 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row int x = edit ? edit->leftMargin() : 0; int y_offset=0; - int align = Qt::SingleLine | Qt::AlignVCenter; - QString txt; //text to draw + int align = TQt::SingleLine | TQt::AlignVCenter; + TQString txt; //text to draw KexiTableViewColumn *tvcol = m_data->column(col); - QVariant cellValue; + TQVariant cellValue; if (col < (int)item->count()) { if (m_currentItem == item) { if (m_editor && row == m_curRow && col == m_curCol @@ -790,44 +790,44 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row && m_curRow /*d->highlightedRow*/ >= 0 && row != m_curRow; //d->highlightedRow; // setup default pen - QPen defaultPen; + TQPen defaultPen; const bool usesSelectedTextColor = edit && edit->usesSelectedTextColor(); if (defaultValueDisplayed) { if (col == m_curCol && row == m_curRow && usesSelectedTextColor) - defaultPen = d->defaultValueDisplayParameters.selectedTextColor; + defaultPen = TQPen(d->defaultValueDisplayParameters.selectedTextColor); else - defaultPen = d->defaultValueDisplayParameters.textColor; + defaultPen = TQPen(d->defaultValueDisplayParameters.textColor); } else if (d->appearance.fullRowSelection && (row == d->highlightedRow || (row == m_curRow && d->highlightedRow==-1)) && usesSelectedTextColor ) { - defaultPen = d->appearance.rowHighlightingTextColor; //special case: highlighted row + defaultPen = TQPen(d->appearance.rowHighlightingTextColor); //special case: highlighted row } else if (d->appearance.fullRowSelection && row == m_curRow && usesSelectedTextColor) { - defaultPen = d->appearance.textColor; //special case for full row selection + defaultPen = TQPen(d->appearance.textColor); //special case for full row selection } else if (m_currentItem == item && col == m_curCol && !columnReadOnly && !dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted && usesSelectedTextColor) { - defaultPen = colorGroup().highlightedText(); //selected text + defaultPen = TQPen(tqcolorGroup().highlightedText()); //selected text } else if (d->appearance.rowHighlightingEnabled && row == m_curRow && !dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted && usesSelectedTextColor) { - defaultPen = d->appearance.rowHighlightingTextColor; + defaultPen = TQPen(d->appearance.rowHighlightingTextColor); } else if (d->appearance.rowMouseOverHighlightingEnabled && row == d->highlightedRow && !dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted && usesSelectedTextColor) { - defaultPen = d->appearance.rowMouseOverHighlightingTextColor; + defaultPen = TQPen(d->appearance.rowMouseOverHighlightingTextColor); } else - defaultPen = d->appearance.textColor; + defaultPen = TQPen(d->appearance.textColor); if (edit) { if (defaultValueDisplayed) @@ -849,7 +849,7 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row if (m_currentItem == item && (col == m_curCol || d->appearance.fullRowSelection)) { if (edit && ((d->appearance.rowHighlightingEnabled && !d->appearance.fullRowSelection) || (row == m_curRow && d->highlightedRow==-1 && d->appearance.fullRowSelection))) //!dontPaintNonpersistentSelectionBecauseDifferentRowHasBeenHighlighted) edit->paintSelectionBackground( p, isEnabled(), txt, align, x, y_offset, w, h, - isEnabled() ? colorGroup().highlight() : QColor(200,200,200),//d->grayColor, + isEnabled() ? tqcolorGroup().highlight() : TQColor(200,200,200),//d->grayColor, p->fontMetrics(), columnReadOnly, d->appearance.fullRowSelection ); } @@ -867,7 +867,7 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row p->setPen(d->appearance.textColor); } else { - QPen gray_pen(p->pen()); + TQPen gray_pen(p->pen()); gray_pen.setColor(d->appearance.borderColor); p->setPen(gray_pen); } @@ -887,7 +887,7 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row // autonumber = true; // if (autonumber) { KexiDisplayUtils::paintAutonumberSign(d->autonumberSignDisplayParameters, p, - x, y_offset, w - x - x - ((align & Qt::AlignLeft)?2:0), h, align); + x, y_offset, w - x - x - ((align & TQt::AlignLeft)?2:0), h, align); // } } } @@ -897,81 +897,81 @@ void KexiTableView::paintCell(QPainter* p, KexiTableItem *item, int col, int row if (defaultValueDisplayed) p->setFont( d->defaultValueDisplayParameters.font ); p->setPen( defaultPen ); - p->drawText(x, y_offset, w - (x + x)- ((align & Qt::AlignLeft)?2:0)/*right space*/, h, + p->drawText(x, y_offset, w - (x + x)- ((align & TQt::AlignLeft)?2:0)/*right space*/, h, align, txt); } p->restore(); } -QPoint KexiTableView::contentsToViewport2( const QPoint &p ) +TQPoint KexiTableView::contentsToViewport2( const TQPoint &p ) { - return QPoint( p.x() - contentsX(), p.y() - contentsY() ); + return TQPoint( p.x() - contentsX(), p.y() - contentsY() ); } void KexiTableView::contentsToViewport2( int x, int y, int& vx, int& vy ) { - const QPoint v = contentsToViewport2( QPoint( x, y ) ); + const TQPoint v = contentsToViewport2( TQPoint( x, y ) ); vx = v.x(); vy = v.y(); } -QPoint KexiTableView::viewportToContents2( const QPoint& vp ) +TQPoint KexiTableView::viewportToContents2( const TQPoint& vp ) { - return QPoint( vp.x() + contentsX(), + return TQPoint( vp.x() + contentsX(), vp.y() + contentsY() ); } -void KexiTableView::paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch ) +void KexiTableView::paintEmptyArea( TQPainter *p, int cx, int cy, int cw, int ch ) { -// qDebug("%s: paintEmptyArea(x:%d y:%d w:%d h:%d)", (const char*)parentWidget()->caption(),cx,cy,cw,ch); +// qDebug("%s: paintEmptyArea(x:%d y:%d w:%d h:%d)", (const char*)tqparentWidget()->caption(),cx,cy,cw,ch); // Regions work with shorts, so avoid an overflow and adjust the // table size to the visible size - QSize ts( tableSize() ); -// ts.setWidth( QMIN( ts.width(), visibleWidth() ) ); -// ts.setHeight( QMIN( ts.height() - (m_navPanel ? m_navPanel->height() : 0), visibleHeight()) ); -/* kdDebug(44021) << QString(" (cx:%1 cy:%2 cw:%3 ch:%4)") - .arg(cx).arg(cy).arg(cw).arg(ch) << endl; - kdDebug(44021) << QString(" (w:%3 h:%4)") - .arg(ts.width()).arg(ts.height()) << endl;*/ + TQSize ts( tableSize() ); +// ts.setWidth( TQMIN( ts.width(), visibleWidth() ) ); +// ts.setHeight( TQMIN( ts.height() - (m_navPanel ? m_navPanel->height() : 0), visibleHeight()) ); +/* kdDebug(44021) << TQString(" (cx:%1 cy:%2 cw:%3 ch:%4)") + .tqarg(cx).tqarg(cy).tqarg(cw).tqarg(ch) << endl; + kdDebug(44021) << TQString(" (w:%3 h:%4)") + .tqarg(ts.width()).tqarg(ts.height()) << endl;*/ // Region of the rect we should draw, calculated in viewport // coordinates, as a region can't handle bigger coordinates contentsToViewport2( cx, cy, cx, cy ); - QRegion reg( QRect( cx, cy, cw, ch ) ); + TQRegion reg( TQRect( cx, cy, cw, ch ) ); //kexidbg << "---cy-- " << contentsY() << endl; // Subtract the table from it -// reg = reg.subtract( QRect( QPoint( 0, 0 ), ts-QSize(0,m_navPanel->isVisible() ? m_navPanel->height() : 0) ) ); - reg = reg.subtract( QRect( QPoint( 0, 0 ), ts - -QSize(0,QMAX((m_navPanel ? m_navPanel->height() : 0), horizontalScrollBar()->sizeHint().height()) - - (horizontalScrollBar()->isVisible() ? horizontalScrollBar()->sizeHint().height()/2 : 0) +// reg = reg.subtract( TQRect( TQPoint( 0, 0 ), ts-TQSize(0,m_navPanel->isVisible() ? m_navPanel->height() : 0) ) ); + reg = reg.subtract( TQRect( TQPoint( 0, 0 ), ts + -TQSize(0,TQMAX((m_navPanel ? m_navPanel->height() : 0), horizontalScrollBar()->tqsizeHint().height()) + - (horizontalScrollBar()->isVisible() ? horizontalScrollBar()->tqsizeHint().height()/2 : 0) + (horizontalScrollBar()->isVisible() ? 0 : d->internal_bottomMargin -// horizontalScrollBar()->sizeHint().height()/2 +// horizontalScrollBar()->tqsizeHint().height()/2 ) -//- /*d->bottomMargin */ horizontalScrollBar()->sizeHint().height()*3/2 +//- /*d->bottomMargin */ horizontalScrollBar()->tqsizeHint().height()*3/2 + contentsY() -// - (verticalScrollBar()->isVisible() ? horizontalScrollBar()->sizeHint().height()/2 : 0) +// - (verticalScrollBar()->isVisible() ? horizontalScrollBar()->tqsizeHint().height()/2 : 0) ) ) ); -// reg = reg.subtract( QRect( QPoint( 0, 0 ), ts ) ); +// reg = reg.subtract( TQRect( TQPoint( 0, 0 ), ts ) ); // And draw the rectangles (transformed inc contents coordinates as needed) - QMemArray<QRect> r = reg.rects(); + TQMemArray<TQRect> r = reg.tqrects(); for ( int i = 0; i < (int)r.count(); i++ ) { - QRect rect( viewportToContents2(r[i].topLeft()), r[i].size() ); -/* kdDebug(44021) << QString("- pEA: p->fillRect(x:%1 y:%2 w:%3 h:%4)") - .arg(rect.x()).arg(rect.y()) - .arg(rect.width()).arg(rect.height()) << endl;*/ -// p->fillRect( QRect(viewportToContents2(r[i].topLeft()),r[i].size()), d->emptyAreaColor ); + TQRect rect( viewportToContents2(r[i].topLeft()), r[i].size() ); +/* kdDebug(44021) << TQString("- pEA: p->fillRect(x:%1 y:%2 w:%3 h:%4)") + .tqarg(rect.x()).tqarg(rect.y()) + .tqarg(rect.width()).tqarg(rect.height()) << endl;*/ +// p->fillRect( TQRect(viewportToContents2(r[i].topLeft()),r[i].size()), d->emptyAreaColor ); p->fillRect( rect, d->appearance.emptyAreaColor ); -// p->fillRect( QRect(viewportToContents2(r[i].topLeft()),r[i].size()), viewport()->backgroundBrush() ); +// p->fillRect( TQRect(viewportToContents2(r[i].topLeft()),r[i].size()), viewport()->backgroundBrush() ); } } -void KexiTableView::contentsMouseDoubleClickEvent(QMouseEvent *e) +void KexiTableView::contentsMouseDoubleClickEvent(TQMouseEvent *e) { // kdDebug(44021) << "KexiTableView::contentsMouseDoubleClickEvent()" << endl; m_contentsMousePressEvent_dblClick = true; @@ -987,7 +987,7 @@ void KexiTableView::contentsMouseDoubleClickEvent(QMouseEvent *e) } else { startEditCurrentCell(); - // createEditor(m_curRow, m_curCol, QString::null); + // createEditor(m_curRow, m_curCol, TQString()); } } @@ -995,22 +995,22 @@ void KexiTableView::contentsMouseDoubleClickEvent(QMouseEvent *e) } } -void KexiTableView::contentsMousePressEvent( QMouseEvent* e ) +void KexiTableView::contentsMousePressEvent( TQMouseEvent* e ) { // kdDebug(44021) << "KexiTableView::contentsMousePressEvent() ??" << endl; setFocus(); if(m_data->count()==0 && !isInsertingEnabled()) { - QScrollView::contentsMousePressEvent( e ); + TQScrollView::contentsMousePressEvent( e ); return; } if (columnAt(e->pos().x())==-1) { //outside a colums - QScrollView::contentsMousePressEvent( e ); + TQScrollView::contentsMousePressEvent( e ); return; } // d->contentsMousePressEvent_ev = *e; // d->contentsMousePressEvent_enabled = true; -// QTimer::singleShot(2000, this, SLOT( contentsMousePressEvent_Internal() )); +// TQTimer::singleShot(2000, this, TQT_SLOT( contentsMousePressEvent_Internal() )); // d->contentsMousePressEvent_timer.start(100,true); // if (!d->contentsMousePressEvent_enabled) @@ -1022,7 +1022,7 @@ void KexiTableView::contentsMousePressEvent( QMouseEvent* e ) return; } -// kdDebug(44021)<<"void KexiTableView::contentsMousePressEvent( QMouseEvent* e ) by now the current items should be set, if not -> error + crash"<<endl; +// kdDebug(44021)<<"void KexiTableView::contentsMousePressEvent( TQMouseEvent* e ) by now the current items should be set, if not -> error + crash"<<endl; if(e->button() == Qt::RightButton) { showContextMenu(e->globalPos()); @@ -1032,19 +1032,19 @@ void KexiTableView::contentsMousePressEvent( QMouseEvent* e ) if(columnType(m_curCol) == KexiDB::Field::Boolean && columnEditable(m_curCol)) { //only accept clicking on the [x] rect (copied from KexiBoolTableEdit::setupContents()) - int s = QMAX(d->rowHeight - 5, 12); - s = QMIN( d->rowHeight-3, s ); - s = QMIN( columnWidth(m_curCol)-3, s ); //avoid too large box - const QRect r( columnPos(m_curCol) + QMAX( columnWidth(m_curCol)/2 - s/2, 0 ), rowPos(m_curRow) +d->rowHeight/2 - s/2 /*- 1*/, s, s); + int s = TQMAX(d->rowHeight - 5, 12); + s = TQMIN( d->rowHeight-3, s ); + s = TQMIN( columnWidth(m_curCol)-3, s ); //avoid too large box + const TQRect r( columnPos(m_curCol) + TQMAX( columnWidth(m_curCol)/2 - s/2, 0 ), rowPos(m_curRow) +d->rowHeight/2 - s/2 /*- 1*/, s, s); //kexidbg << r << endl; - if (r.contains(e->pos())) { + if (r.tqcontains(e->pos())) { // kexidbg << "e->x:" << e->x() << " e->y:" << e->y() << " " << rowPos(m_curRow) << // " " << columnPos(m_curCol) << endl; boolToggled(); } } #if 0 //js: TODO - else if(columnType(m_curCol) == QVariant::StringList && columnEditable(m_curCol)) + else if(columnType(m_curCol) == TQVariant::StringList && columnEditable(m_curCol)) { createEditor(m_curRow, m_curCol); } @@ -1053,7 +1053,7 @@ void KexiTableView::contentsMousePressEvent( QMouseEvent* e ) //ScrollView::contentsMousePressEvent( e ); } -void KexiTableView::contentsMouseReleaseEvent( QMouseEvent* e ) +void KexiTableView::contentsMouseReleaseEvent( TQMouseEvent* e ) { // kdDebug(44021) << "KexiTableView::contentsMousePressEvent() ??" << endl; if(m_data->count()==0 && !isInsertingEnabled()) @@ -1068,12 +1068,12 @@ void KexiTableView::contentsMouseReleaseEvent( QMouseEvent* e ) if (!m_currentItem || col==-1 || row==-1 || col!=m_curCol || row!=m_curRow)//outside a current cell return; - QScrollView::contentsMouseReleaseEvent( e ); + TQScrollView::contentsMouseReleaseEvent( e ); emit itemMouseReleased(m_currentItem, m_curRow, m_curCol); } -bool KexiTableView::handleContentsMousePressOrRelease(QMouseEvent* e, bool release) +bool KexiTableView::handleContentsMousePressOrRelease(TQMouseEvent* e, bool release) { // remember old focus cell int oldRow = m_curRow; @@ -1088,9 +1088,9 @@ bool KexiTableView::handleContentsMousePressOrRelease(QMouseEvent* e, bool relea newrow = rowAt(e->pos().y() - d->rowHeight); if (newrow==-1 && m_data->count()>0) { if (release) - QScrollView::contentsMouseReleaseEvent( e ); + TQScrollView::contentsMouseReleaseEvent( e ); else - QScrollView::contentsMousePressEvent( e ); + TQScrollView::contentsMousePressEvent( e ); return false; } newrow++; @@ -1105,9 +1105,9 @@ bool KexiTableView::handleContentsMousePressOrRelease(QMouseEvent* e, bool relea else { if (rowAt(e->pos().y())==-1 || columnAt(e->pos().x())==-1) { if (release) - QScrollView::contentsMouseReleaseEvent( e ); + TQScrollView::contentsMouseReleaseEvent( e ); else - QScrollView::contentsMousePressEvent( e ); + TQScrollView::contentsMousePressEvent( e ); return false; //clicked outside a grid } // get new focus cell @@ -1121,13 +1121,13 @@ bool KexiTableView::handleContentsMousePressOrRelease(QMouseEvent* e, bool relea return true; } -void KexiTableView::showContextMenu(const QPoint& _pos) +void KexiTableView::showContextMenu(const TQPoint& _pos) { if (!d->contextMenuEnabled || m_popupMenu->count()<1) return; - QPoint pos(_pos); - if (pos==QPoint(-1,-1)) { - pos = viewport()->mapToGlobal( QPoint( columnPos(m_curCol), rowPos(m_curRow) + d->rowHeight ) ); + TQPoint pos(_pos); + if (pos==TQPoint(-1,-1)) { + pos = viewport()->mapToGlobal( TQPoint( columnPos(m_curCol), rowPos(m_curRow) + d->rowHeight ) ); } //show own context menu if configured // if (updateContextMenu()) { @@ -1140,7 +1140,7 @@ void KexiTableView::showContextMenu(const QPoint& _pos) }*/ } -void KexiTableView::contentsMouseMoveEvent( QMouseEvent *e ) +void KexiTableView::contentsMouseMoveEvent( TQMouseEvent *e ) { int row; const int col = columnAt(e->x()); @@ -1159,7 +1159,7 @@ void KexiTableView::contentsMouseMoveEvent( QMouseEvent *e ) d->highlightedRow = row; updateRow(oldRow); updateRow(d->highlightedRow); - //currently selected (not necessary highlighted) row needs to be repainted + //currently selected (not necessary highlighted) row needs to be tqrepainted updateRow(m_curRow); m_verticalHeader->setHighlightedRow(d->highlightedRow); } @@ -1202,11 +1202,11 @@ void KexiTableView::contentsMouseMoveEvent( QMouseEvent *e ) contentsMousePressEvent(e); } #endif - QScrollView::contentsMouseMoveEvent(e); + TQScrollView::contentsMouseMoveEvent(e); } #if 0//(js) doesn't work! -void KexiTableView::contentsMouseReleaseEvent(QMouseEvent *) +void KexiTableView::contentsMouseReleaseEvent(TQMouseEvent *) { if(d->needAutoScroll) { @@ -1215,13 +1215,13 @@ void KexiTableView::contentsMouseReleaseEvent(QMouseEvent *) } #endif -static bool overrideEditorShortcutNeeded(QKeyEvent *e) +static bool overrideEditorShortcutNeeded(TQKeyEvent *e) { //perhaps more to come... - return e->key() == Qt::Key_Delete && e->state()==Qt::ControlButton; + return e->key() == TQt::Key_Delete && e->state()==TQt::ControlButton; } -bool KexiTableView::shortCutPressed( QKeyEvent *e, const QCString &action_name ) +bool KexiTableView::shortCutPressed( TQKeyEvent *e, const TQCString &action_name ) { const int k = e->key(); KAction *action = m_sharedActions[action_name]; @@ -1240,20 +1240,20 @@ bool KexiTableView::shortCutPressed( QKeyEvent *e, const QCString &action_name ) //check default shortcut (when user app has no action shortcuts defined // but we want these shortcuts to still work) if (action_name=="data_save_row") - return (k == Qt::Key_Return || k == Qt::Key_Enter) && e->state()==Qt::ShiftButton; + return (k == TQt::Key_Return || k == TQt::Key_Enter) && e->state()==TQt::ShiftButton; if (action_name=="edit_delete_row") - return k == Qt::Key_Delete && e->state()==Qt::ControlButton; + return k == TQt::Key_Delete && e->state()==TQt::ControlButton; if (action_name=="edit_delete") - return k == Qt::Key_Delete && e->state()==Qt::NoButton; + return k == TQt::Key_Delete && e->state()==Qt::NoButton; if (action_name=="edit_edititem") - return k == Qt::Key_F2 && e->state()==Qt::NoButton; + return k == TQt::Key_F2 && e->state()==Qt::NoButton; if (action_name=="edit_insert_empty_row") - return k == Qt::Key_Insert && e->state()==(Qt::ShiftButton | Qt::ControlButton); + return k == TQt::Key_Insert && e->state()==(TQt::ShiftButton | TQt::ControlButton); return false; } -void KexiTableView::keyPressEvent(QKeyEvent* e) +void KexiTableView::keyPressEvent(TQKeyEvent* e) { if (!hasData()) return; @@ -1261,10 +1261,10 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) const int k = e->key(); const bool ro = isReadOnly(); - QWidget *w = focusWidget(); + TQWidget *w = tqfocusWidget(); // if (!w || w!=viewport() && w!=this && (!m_editor || w!=m_editor->view() && w!=m_editor)) { // if (!w || w!=viewport() && w!=this && (!m_editor || w!=m_editor->view())) { - if (!w || w!=viewport() && w!=this && (!m_editor || !KexiUtils::hasParent(dynamic_cast<QObject*>(m_editor), w))) { + if (!w || TQT_BASE_OBJECT(w)!=TQT_BASE_OBJECT(viewport()) && TQT_TQOBJECT(w)!=TQT_TQOBJECT(this) && (!m_editor || !KexiUtils::hasParent(TQT_TQOBJECT(dynamic_cast<TQT_BASE_OBJECT_NAME*>(m_editor)), TQT_TQOBJECT(w)))) { //don't process stranger's events e->ignore(); return; @@ -1286,11 +1286,11 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) } if(m_editor) {// if a cell is edited, do some special stuff - if (k == Qt::Key_Escape) { + if (k == TQt::Key_Escape) { cancelEditor(); e->accept(); return; - } else if (k == Qt::Key_Return || k == Qt::Key_Enter) { + } else if (k == TQt::Key_Return || k == TQt::Key_Enter) { if (columnType(m_curCol) == KexiDB::Field::Boolean) { boolToggled(); } @@ -1309,7 +1309,7 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) } } - if(k == Qt::Key_Return || k == Qt::Key_Enter) + if(k == TQt::Key_Return || k == TQt::Key_Enter) { emit itemReturnPressed(m_currentItem, m_curRow, m_curCol); } @@ -1317,7 +1317,7 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) int curRow = m_curRow; int curCol = m_curCol; - const bool nobtn = e->state()==NoButton; + const bool nobtn = e->state()==Qt::NoButton; bool printable = false; //check shared shortcuts @@ -1338,8 +1338,8 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) } } -/* case Qt::Key_Delete: - if (e->state()==Qt::ControlButton) {//remove current row +/* case TQt::Key_Delete: + if (e->state()==TQt::ControlButton) {//remove current row deleteCurrentRow(); } else if (nobtn) {//remove contents of the current cell @@ -1348,18 +1348,18 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) break;*/ // bool _return; - if (k == Qt::Key_Shift || k == Qt::Key_Alt || k == Qt::Key_Control || k == Qt::Key_Meta) { + if (k == TQt::Key_Shift || k == TQt::Key_Alt || k == TQt::Key_Control || k == TQt::Key_Meta) { e->ignore(); } else if (KexiDataAwareObjectInterface::handleKeyPress(e, curRow, curCol, d->appearance.fullRowSelection)) { if (e->isAccepted()) return; } - else if (k == Qt::Key_Backspace && nobtn) { + else if (k == TQt::Key_Backspace && nobtn) { if (!ro && columnType(curCol) != KexiDB::Field::Boolean && columnEditable(curCol)) - createEditor(curRow, curCol, QString::null, true); + createEditor(curRow, curCol, TQString(), true); } - else if (k == Qt::Key_Space) { + else if (k == TQt::Key_Space) { if (nobtn && !ro && columnEditable(curCol)) { if (columnType(curCol) == KexiDB::Field::Boolean) { boolToggled(); @@ -1368,7 +1368,7 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) printable = true; //just space key } } - else if (k == Qt::Key_Escape) { + else if (k == TQt::Key_Escape) { if (nobtn && m_rowEditing) { cancelRowEdit(); return; @@ -1376,8 +1376,8 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) } else { //others: - if (nobtn && (k==Qt::Key_Tab || k==Qt::Key_Right)) { -//! \todo add option for stopping at 1st column for Qt::Key_left + if (nobtn && (k==TQt::Key_Tab || k==TQt::Key_Right)) { +//! \todo add option for stopping at 1st column for TQt::Key_left //tab if (acceptEditor()) { if (curCol == (columns() - 1)) { @@ -1390,10 +1390,10 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) curCol++; } } - else if ((e->state()==Qt::ShiftButton && k==Qt::Key_Tab) - || (nobtn && k==Qt::Key_Backtab) - || (e->state()==Qt::ShiftButton && k==Qt::Key_Backtab) - || (nobtn && k==Qt::Key_Left) + else if ((e->state()==TQt::ShiftButton && k==TQt::Key_Tab) + || (nobtn && k==TQt::Key_Backtab) + || (e->state()==TQt::ShiftButton && k==TQt::Key_Backtab) + || (nobtn && k==TQt::Key_Left) ) { //! \todo add option for stopping at last column //backward tab @@ -1408,7 +1408,7 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) curCol--; } } - else if (nobtn && k==d->contextMenuKey) { //Qt::Key_Menu: + else if (nobtn && k==d->contextMenuKey) { //TQt::Key_Menu: showContextMenu(); } else { @@ -1418,16 +1418,16 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) e->accept(); return; } - else if ( nobtn && (k==Qt::Key_Enter || k==Qt::Key_Return || shortCutPressed(e, "edit_edititem")) ) { + else if ( nobtn && (k==TQt::Key_Enter || k==TQt::Key_Return || shortCutPressed(e, "edit_edititem")) ) { //this condition is moved after handleKeyPress() to allow to everride enter key as well startEditOrToggleValue(); } else { kexidbg << "KexiTableView::KeyPressEvent(): default" << endl; if (e->text().isEmpty() || !e->text().isEmpty() && !e->text()[0].isPrint() ) { - kdDebug(44021) << "NOT PRINTABLE: 0x0" << QString("%1").arg(k,0,16) <<endl; + kdDebug(44021) << "NOT PRINTABLE: 0x0" << TQString("%1").tqarg(k,0,16) <<endl; // e->ignore(); - QScrollView::keyPressEvent(e); + TQScrollView::keyPressEvent(e); return; } printable = true; @@ -1437,7 +1437,7 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) //finally: we've printable char: if (printable && !ro) { KexiTableViewColumn *tvcol = m_data->column(curCol); - if (tvcol->acceptsFirstChar(e->text()[0])) { + if (tvcol->acceptsFirstChar(TQString(e->text())[0])) { kdDebug(44021) << "KexiTableView::KeyPressEvent(): ev pressed: acceptsFirstChar()==true" << endl; // if (e->text()[0].isPrint()) createEditor(curRow, curCol, e->text(), true); @@ -1450,7 +1450,7 @@ void KexiTableView::keyPressEvent(QKeyEvent* e) m_vScrollBarValueChanged_enabled=false; - // if focus cell changes, repaint + // if focus cell changes, tqrepaint setCursorPosition(curRow, curCol); m_vScrollBarValueChanged_enabled=true; @@ -1495,9 +1495,9 @@ KexiDataItemInterface *KexiTableView::editor( int col, bool ignoreMissingEditor if (m_data->cursor() && m_data->cursor()->query()) editor->createInternalEditor(*m_data->cursor()->query()); - connect(editor,SIGNAL(editRequested()),this,SLOT(slotEditRequested())); - connect(editor,SIGNAL(cancelRequested()),this,SLOT(cancelEditor())); - connect(editor,SIGNAL(acceptRequested()),this,SLOT(acceptEditor())); + connect(editor,TQT_SIGNAL(editRequested()),this,TQT_SLOT(slotEditRequested())); + connect(editor,TQT_SIGNAL(cancelRequested()),this,TQT_SLOT(cancelEditor())); + connect(editor,TQT_SIGNAL(acceptRequested()),this,TQT_SLOT(acceptEditor())); editor->resize(columnWidth(col)-1, rowHeight()-1); editor->installEventFilter(this); @@ -1518,7 +1518,7 @@ void KexiTableView::editorShowFocus( int /*row*/, int col ) }*/ if (edit) { kexidbg<< "KexiTableView::editorShowFocus() : IN" << endl; - QRect rect = cellGeometry( m_curRow, m_curCol ); + TQRect rect = cellGeometry( m_curRow, m_curCol ); // rect.moveBy( -contentsX(), -contentsY() ); edit->showFocus( rect, isReadOnly() || m_data->column(col)->isReadOnly() ); } @@ -1534,7 +1534,7 @@ void KexiTableView::reloadData() { updateContents(); } -void KexiTableView::createEditor(int row, int col, const QString& addText, bool removeOld) +void KexiTableView::createEditor(int row, int col, const TQString& addText, bool removeOld) { kdDebug(44021) << "KexiTableView::createEditor('"<<addText<<"',"<<removeOld<<")"<<endl; if (isReadOnly()) { @@ -1569,7 +1569,7 @@ void KexiTableView::createEditor(int row, int col, const QString& addText, bool //refr. current and next row updateContents(columnPos(0), rowPos(row), viewport()->width(), d->rowHeight*2); // updateContents(columnPos(0), rowPos(row+1), viewport()->width(), d->rowHeight); -//js: warning this breaks behaviour (cursor is skipping, etc.): qApp->processEvents(500); +//js: warning this breaks behaviour (cursor is skipping, etc.): tqApp->processEvents(500); ensureVisible(columnPos(m_curCol), rowPos(row+1)+d->rowHeight-1, columnWidth(m_curCol), d->rowHeight); m_verticalHeader->setOffset(contentsY()); @@ -1598,13 +1598,13 @@ void KexiTableView::createEditor(int row, int col, const QString& addText, bool } } -void KexiTableView::focusInEvent(QFocusEvent* e) +void KexiTableView::focusInEvent(TQFocusEvent* e) { Q_UNUSED(e); updateCell(m_curRow, m_curCol); } -void KexiTableView::focusOutEvent(QFocusEvent* e) +void KexiTableView::focusOutEvent(TQFocusEvent* e) { KexiDataAwareObjectInterface::focusOutEvent(e); } @@ -1614,12 +1614,12 @@ bool KexiTableView::focusNextPrevChild(bool /*next*/) return false; //special Tab/BackTab meaning /* if (m_editor) return true; - return QScrollView::focusNextPrevChild(next);*/ + return TQScrollView::focusNextPrevChild(next);*/ } -void KexiTableView::resizeEvent(QResizeEvent *e) +void KexiTableView::resizeEvent(TQResizeEvent *e) { - QScrollView::resizeEvent(e); + TQScrollView::resizeEvent(e); //updateGeometries(); if (m_navPanel) @@ -1630,34 +1630,34 @@ void KexiTableView::resizeEvent(QResizeEvent *e) slotUpdate(); triggerUpdate(); } -// d->pTopHeader->repaint(); +// d->pTopHeader->tqrepaint(); /* m_navPanel->setGeometry( frameWidth(), viewport()->height() +d->pTopHeader->height() - -(horizontalScrollBar()->isVisible() ? 0 : horizontalScrollBar()->sizeHint().height()) + -(horizontalScrollBar()->isVisible() ? 0 : horizontalScrollBar()->tqsizeHint().height()) +frameWidth(), - m_navPanel->sizeHint().width(), // - verticalScrollBar()->sizeHint().width() - horizontalScrollBar()->sizeHint().width(), - horizontalScrollBar()->sizeHint().height() + m_navPanel->tqsizeHint().width(), // - verticalScrollBar()->tqsizeHint().width() - horizontalScrollBar()->tqsizeHint().width(), + horizontalScrollBar()->tqsizeHint().height() );*/ // updateContents(); // m_navPanel->setGeometry(1,horizontalScrollBar()->pos().y(), // m_navPanel->width(), horizontalScrollBar()->height()); // updateContents(0,0,2000,2000);//js -// erase(); repaint(); +// erase(); tqrepaint(); } -void KexiTableView::viewportResizeEvent( QResizeEvent *e ) +void KexiTableView::viewportResizeEvent( TQResizeEvent *e ) { - QScrollView::viewportResizeEvent( e ); + TQScrollView::viewportResizeEvent( e ); updateGeometries(); -// erase(); repaint(); +// erase(); tqrepaint(); } -void KexiTableView::showEvent(QShowEvent *e) +void KexiTableView::showEvent(TQShowEvent *e) { - QScrollView::showEvent(e); + TQScrollView::showEvent(e); if (!d->maximizeColumnsWidthOnShow.isEmpty()) { maximizeColumnsWidth(d->maximizeColumnsWidthOnShow); d->maximizeColumnsWidthOnShow.clear(); @@ -1670,29 +1670,29 @@ void KexiTableView::showEvent(QShowEvent *e) } else { //just update size - QSize s(tableSize()); -// QRect r(cellGeometry(rows() - 1 + (isInsertingEnabled()?1:0), columns() - 1 )); + TQSize s(tableSize()); +// TQRect r(cellGeometry(rows() - 1 + (isInsertingEnabled()?1:0), columns() - 1 )); // resizeContents(r.right() + 1, r.bottom() + 1); resizeContents(s.width(),s.height()); } updateGeometries(); //now we can ensure cell's visibility ( if there was such a call before show() ) - if (d->ensureCellVisibleOnShow!=QPoint(-1,-1)) { + if (d->ensureCellVisibleOnShow!=TQPoint(-1,-1)) { ensureCellVisible( d->ensureCellVisibleOnShow.x(), d->ensureCellVisibleOnShow.y() ); - d->ensureCellVisibleOnShow = QPoint(-1,-1); //reset the flag + d->ensureCellVisibleOnShow = TQPoint(-1,-1); //reset the flag } if (m_navPanel) m_navPanel->updateGeometry(leftMargin()); // updateNavPanelGeometry(); } -void KexiTableView::contentsDragMoveEvent(QDragMoveEvent *e) +void KexiTableView::contentsDragMoveEvent(TQDragMoveEvent *e) { if (!hasData()) return; if (m_dropsAtRowEnabled) { - QPoint p = e->pos(); + TQPoint p = e->pos(); int row = rowAt(p.y()); KexiTableItem *item = 0; // if (row==(rows()-1) && (p.y() % d->rowHeight) > (d->rowHeight*2/3) ) { @@ -1721,7 +1721,7 @@ void KexiTableView::contentsDragMoveEvent(QDragMoveEvent *e) } else e->acceptAction(false); -/* QStringList::ConstIterator it, end( d->dropFilters.constEnd() ); +/* TQStringList::ConstIterator it, end( d->dropFilters.constEnd() ); for( it = d->dropFilters.constBegin(); it != end; it++) { if(e->provides((*it).latin1())) @@ -1733,7 +1733,7 @@ void KexiTableView::contentsDragMoveEvent(QDragMoveEvent *e) // e->acceptAction(false); } -void KexiTableView::contentsDropEvent(QDropEvent *e) +void KexiTableView::contentsDropEvent(TQDropEvent *e) { if (!hasData()) return; @@ -1744,7 +1744,7 @@ void KexiTableView::contentsDropEvent(QDropEvent *e) m_dragIndicatorLine = -1; updateRow(row2update); } - QPoint p = e->pos(); + TQPoint p = e->pos(); int row = rowAt(p.y()); if ((p.y() % d->rowHeight) > (d->rowHeight*2/3) ) { row++; @@ -1761,7 +1761,7 @@ void KexiTableView::contentsDropEvent(QDropEvent *e) } } -void KexiTableView::viewportDragLeaveEvent( QDragLeaveEvent *e ) +void KexiTableView::viewportDragLeaveEvent( TQDragLeaveEvent *e ) { Q_UNUSED(e); if (!hasData()) @@ -1780,7 +1780,7 @@ void KexiTableView::updateCell(int row, int col) { // kdDebug(44021) << "updateCell("<<row<<", "<<col<<")"<<endl; updateContents(cellGeometry(row, col)); -/* QRect r = cellGeometry(row, col); +/* TQRect r = cellGeometry(row, col); r.setHeight(r.height()+6); r.setTop(r.top()-3); updateContents();*/ @@ -1799,30 +1799,30 @@ void KexiTableView::updateRow(int row) //int leftcol = d->pTopHeader->sectionAt( d->pTopHeader->offset() ); //kexidbg << contentsX() << " " << contentsY() << endl; - //kexidbg << QRect( columnPos( leftcol ), rowPos(row), clipper()->width(), rowHeight() ) << endl; - // updateContents( QRect( columnPos( leftcol ), rowPos(row), clipper()->width(), rowHeight() ) ); //columnPos(rightcol)+columnWidth(rightcol), rowHeight() ) ); - updateContents( QRect( contentsX(), rowPos(row), clipper()->width(), rowHeight() ) ); //columnPos(rightcol)+columnWidth(rightcol), rowHeight() ) ); + //kexidbg << TQRect( columnPos( leftcol ), rowPos(row), clipper()->width(), rowHeight() ) << endl; + // updateContents( TQRect( columnPos( leftcol ), rowPos(row), clipper()->width(), rowHeight() ) ); //columnPos(rightcol)+columnWidth(rightcol), rowHeight() ) ); + updateContents( TQRect( contentsX(), rowPos(row), clipper()->width(), rowHeight() ) ); //columnPos(rightcol)+columnWidth(rightcol), rowHeight() ) ); } void KexiTableView::slotColumnWidthChanged( int, int, int ) { - QSize s(tableSize()); + TQSize s(tableSize()); int w = contentsWidth(); viewport()->setUpdatesEnabled(false); resizeContents( s.width(), s.height() ); viewport()->setUpdatesEnabled(true); if (contentsWidth() < w) { updateContents(contentsX(), 0, viewport()->width(), contentsHeight()); -// repaintContents( s.width(), 0, w - s.width() + 1, contentsHeight(), true ); +// tqrepaintContents( s.width(), 0, w - s.width() + 1, contentsHeight(), true ); } else { // updateContents( columnPos(col), 0, contentsWidth(), contentsHeight() ); updateContents(contentsX(), 0, viewport()->width(), contentsHeight()); - // viewport()->repaint(); + // viewport()->tqrepaint(); } // updateContents(0, 0, d->pBufferPm->width(), d->pBufferPm->height()); - QWidget *editorWidget = dynamic_cast<QWidget*>(m_editor); + TQWidget *editorWidget = dynamic_cast<TQWidget*>(m_editor); if (editorWidget) { editorWidget->resize(columnWidth(m_curCol)-1, rowHeight()-1); @@ -1844,7 +1844,7 @@ void KexiTableView::slotSectionHandleDoubleClicked( int section ) void KexiTableView::updateGeometries() { - QSize ts = tableSize(); + TQSize ts = tableSize(); if (m_horizontalHeader->offset() && ts.width() < (m_horizontalHeader->offset() + m_horizontalHeader->width())) horizontalScrollBar()->setValue(ts.width() - m_horizontalHeader->width()); @@ -1871,7 +1871,7 @@ int KexiTableView::columnPos(int col) const if (!hasData()) return 0; //if this column is hidden, find first column before that is visible - int c = QMIN(col, (int)m_data->columnsCount()-1), vcID = 0; + int c = TQMIN(col, (int)m_data->columnsCount()-1), vcID = 0; while (c>=0 && (vcID=m_data->visibleColumnID( c ))==-1) c--; if (c<0) @@ -1912,67 +1912,67 @@ int KexiTableView::rowAt(int pos, bool ignoreEnd) const return pos; } -QRect KexiTableView::cellGeometry(int row, int col) const +TQRect KexiTableView::cellGeometry(int row, int col) const { - return QRect(columnPos(col), rowPos(row), + return TQRect(columnPos(col), rowPos(row), columnWidth(col), rowHeight()); } -QSize KexiTableView::tableSize() const +TQSize KexiTableView::tableSize() const { if ((rows()+ (isInsertingEnabled()?1:0) ) > 0 && columns() > 0) { /* kexidbg << "tableSize()= " << columnPos( columns() - 1 ) + columnWidth( columns() - 1 ) << ", " << rowPos( rows()-1+(isInsertingEnabled()?1:0)) + d->rowHeight -// + QMAX(m_navPanel ? m_navPanel->height() : 0, horizontalScrollBar()->sizeHint().height()) - + (m_navPanel->isVisible() ? QMAX( m_navPanel->height(), horizontalScrollBar()->sizeHint().height() ) :0 ) +// + TQMAX(m_navPanel ? m_navPanel->height() : 0, horizontalScrollBar()->tqsizeHint().height()) + + (m_navPanel->isVisible() ? TQMAX( m_navPanel->height(), horizontalScrollBar()->tqsizeHint().height() ) :0 ) + margin() << endl; */ // kexidbg<< m_navPanel->isVisible() <<" "<<m_navPanel->height()<<" " -// <<horizontalScrollBar()->sizeHint().height()<<" "<<rowPos( rows()-1+(isInsertingEnabled()?1:0))<<endl; +// <<horizontalScrollBar()->tqsizeHint().height()<<" "<<rowPos( rows()-1+(isInsertingEnabled()?1:0))<<endl; - //int xx = horizontalScrollBar()->sizeHint().height()/2; + //int xx = horizontalScrollBar()->tqsizeHint().height()/2; - QSize s( + TQSize s( columnPos( columns() - 1 ) + columnWidth( columns() - 1 ), -// + verticalScrollBar()->sizeHint().width(), +// + verticalScrollBar()->tqsizeHint().width(), rowPos( rows()-1+(isInsertingEnabled()?1:0) ) + d->rowHeight - + (horizontalScrollBar()->isVisible() ? 0 : horizontalScrollBar()->sizeHint().height()) + + (horizontalScrollBar()->isVisible() ? 0 : horizontalScrollBar()->tqsizeHint().height()) + d->internal_bottomMargin -// horizontalScrollBar()->sizeHint().height()/2 -// - /*d->bottomMargin */ horizontalScrollBar()->sizeHint().height()*3/2 +// horizontalScrollBar()->tqsizeHint().height()/2 +// - /*d->bottomMargin */ horizontalScrollBar()->tqsizeHint().height()*3/2 // + ( (m_navPanel && m_navPanel->isVisible() && verticalScrollBar()->isVisible() // && !horizontalScrollBar()->isVisible()) - // ? horizontalScrollBar()->sizeHint().height() : 0) + // ? horizontalScrollBar()->tqsizeHint().height() : 0) -// + QMAX( (m_navPanel && m_navPanel->isVisible()) ? m_navPanel->height() : 0, -// horizontalScrollBar()->isVisible() ? horizontalScrollBar()->sizeHint().height() : 0) +// + TQMAX( (m_navPanel && m_navPanel->isVisible()) ? m_navPanel->height() : 0, +// horizontalScrollBar()->isVisible() ? horizontalScrollBar()->tqsizeHint().height() : 0) // + (m_navPanel->isVisible() -// ? QMAX( m_navPanel->height(), horizontalScrollBar()->sizeHint().height() ) :0 ) +// ? TQMAX( m_navPanel->height(), horizontalScrollBar()->tqsizeHint().height() ) :0 ) -// - (horizontalScrollBar()->isVisible() ? horizontalScrollBar()->sizeHint().height() :0 ) +// - (horizontalScrollBar()->isVisible() ? horizontalScrollBar()->tqsizeHint().height() :0 ) + margin() //-2*d->rowHeight ); // kexidbg << rows()-1 <<" "<< (isInsertingEnabled()?1:0) <<" "<< (m_rowEditing?1:0) << " " << s << endl; return s; -// +horizontalScrollBar()->sizeHint().height() + margin() ); +// +horizontalScrollBar()->tqsizeHint().height() + margin() ); } - return QSize(0,0); + return TQSize(0,0); } void KexiTableView::ensureCellVisible(int row, int col/*=-1*/) { if (!isVisible()) { //the table is invisible: we can't ensure visibility now - d->ensureCellVisibleOnShow = QPoint(row,col); + d->ensureCellVisibleOnShow = TQPoint(row,col); return; } //quite clever: ensure the cell is visible: - QRect r( columnPos(col==-1 ? m_curCol : col), rowPos(row) +(d->appearance.fullRowSelection?1:0), + TQRect r( columnPos(col==-1 ? m_curCol : col), rowPos(row) +(d->appearance.fullRowSelection?1:0), columnWidth(col==-1 ? m_curCol : col), rowHeight()); /* if (m_navPanel && horizontalScrollBar()->isHidden() && row == rows()-1) { @@ -1988,7 +1988,7 @@ void KexiTableView::ensureCellVisible(int row, int col/*=-1*/) r.setBottom(r.bottom()+m_navPanel->height()); } - QPoint pcenter = r.center(); + TQPoint pcenter = r.center(); ensureVisible(pcenter.x(), pcenter.y(), r.width()/2, r.height()/2); // updateContents(); // updateNavPanelGeometry(); @@ -2007,13 +2007,13 @@ void KexiTableView::updateAfterAcceptRowEdit() m_navPanel->showEditingIndicator(false); } -bool KexiTableView::getVisibleLookupValue(QVariant& cellValue, KexiTableEdit *edit, +bool KexiTableView::getVisibleLookupValue(TQVariant& cellValue, KexiTableEdit *edit, KexiTableItem *item, KexiTableViewColumn *tvcol) const { if (edit->columnInfo() && edit->columnInfo()->indexForVisibleLookupValue()!=-1 && edit->columnInfo()->indexForVisibleLookupValue() < (int)item->count()) { - const QVariant *visibleFieldValue = 0; + const TQVariant *visibleFieldValue = 0; if (m_currentItem == item && m_data->rowEditBuffer()) { visibleFieldValue = m_data->rowEditBuffer()->at( *tvcol->visibleLookupColumnInfo, false/*!useDefaultValueIfPossible*/ ); @@ -2040,7 +2040,7 @@ void KexiTableView::removeEditor() void KexiTableView::slotRowRepaintRequested(KexiTableItem& item) { - updateRow( m_data->findRef(&item) ); + updateRow( m_data->tqfindRef(&item) ); } //(js) unused @@ -2081,15 +2081,15 @@ KexiTableView::print(KPrinter &/*printer*/) int bottomMargin = 0; kdDebug(44021) << "KexiTableView::print: bottom = " << bottomMargin << endl; - QPainter p(&printer); + TQPainter p(&printer); KexiTableItem *i; int width = leftMargin; for(int col=0; col < columns(); col++) { - p.fillRect(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight, QBrush(Qt::gray)); + p.fillRect(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight, TQBrush(TQt::gray)); p.drawRect(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight); - p.drawText(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight, Qt::AlignLeft | Qt::AlignVCenter, + p.drawText(width, topMargin - d->rowHeight, columnWidth(col), d->rowHeight, TQt::AlignLeft | TQt::AlignVCenter, m_horizontalHeader->label(col)); width = width + columnWidth(col); } @@ -2107,7 +2107,7 @@ KexiTableView::print(KPrinter &/*printer*/) kdDebug(44021) << "KexiTableView::print: col = " << col << " x = " << xOffset << endl; p.saveWorldMatrix(); p.translate(xOffset, yOffset); - paintCell(&p, i, col, QRect(0, 0, columnWidth(col) + 1, d->rowHeight), true); + paintCell(&p, i, col, TQRect(0, 0, columnWidth(col) + 1, d->rowHeight), true); p.restoreWorldMatrix(); // p.drawRect(xOffset, yOffset, columnWidth(col), d->rowHeight); xOffset = xOffset + columnWidth(col); @@ -2136,7 +2136,7 @@ KexiTableView::print(KPrinter &/*printer*/) } #endif -QString KexiTableView::columnCaption(int colNum) const +TQString KexiTableView::columnCaption(int colNum) const { return m_horizontalHeader->label(colNum); } @@ -2167,14 +2167,14 @@ void KexiTableView::adjustColumnWidthToContents(int colNum) if (indexOfVisibleColumn < 0) return; - QPtrListIterator<KexiTableItem> it = m_data->iterator(); + TQPtrListIterator<KexiTableItem> it = m_data->iterator(); if (it.current() && it.current()->count()<=(uint)indexOfVisibleColumn) return; KexiCellEditorFactoryItem *item = KexiCellEditorFactory::item( columnType(indexOfVisibleColumn) ); if (!item) return; - QFontMetrics fm(fontMetrics()); + TQFontMetrics fm(fontMetrics()); int maxw = horizontalHeaderVisible() ? fm.width( m_horizontalHeader->label( colNum/* not indexOfVisibleColumn*/ ) ) : 0; if (maxw == 0 && m_data->isEmpty()) @@ -2186,7 +2186,7 @@ void KexiTableView::adjustColumnWidthToContents(int colNum) if (ed) { for (it = m_data->iterator(); it.current(); ++it) { const int wfw = ed->widthForValue( it.current()->at( indexOfVisibleColumn ), fm ); - maxw = QMAX( maxw, wfw ); + maxw = TQMAX( maxw, wfw ); } const bool focused = currentColumn() == colNum; maxw += (fm.width(" ") + ed->leftMargin() + ed->rightMargin(focused)); @@ -2207,7 +2207,7 @@ void KexiTableView::setColumnWidth(int colNum, int width) slotTopHeaderSizeChange( colNum, oldWidth, m_horizontalHeader->sectionSize( colNum ) ); } -void KexiTableView::maximizeColumnsWidth( const QValueList<int> &columnList ) +void KexiTableView::maximizeColumnsWidth( const TQValueList<int> &columnList ) { if (!isVisible()) { d->maximizeColumnsWidthOnShow += columnList; @@ -2216,11 +2216,11 @@ void KexiTableView::maximizeColumnsWidth( const QValueList<int> &columnList ) if (width() <= m_horizontalHeader->headerWidth()) return; //sort the list and make it unique - QValueList<int> cl, sortedList = columnList; + TQValueList<int> cl, sortedList = columnList; qHeapSort(sortedList); int i=-999; - QValueList<int>::ConstIterator it, end( sortedList.constEnd() ); + TQValueList<int>::ConstIterator it, end( sortedList.constEnd() ); for ( it = sortedList.constBegin(); it != end; ++it) { if (i != (*it)) { cl += (*it); @@ -2271,13 +2271,13 @@ void KexiTableView::setVerticalHeaderVisible(bool set) int left_width; if (set) { m_verticalHeader->show(); - left_width = QMIN(m_horizontalHeader->sizeHint().height(), d->rowHeight); + left_width = TQMIN(m_horizontalHeader->tqsizeHint().height(), d->rowHeight); } else { m_verticalHeader->hide(); left_width = 0; } - setMargins( left_width, horizontalHeaderVisible() ? m_horizontalHeader->sizeHint().height() : 0, 0, 0); + setMargins( left_width, horizontalHeaderVisible() ? m_horizontalHeader->tqsizeHint().height() : 0, 0, 0); } bool KexiTableView::horizontalHeaderVisible() const @@ -2291,7 +2291,7 @@ void KexiTableView::setHorizontalHeaderVisible(bool set) d->horizontalHeaderVisible = set; //needed because isVisible() is not always accurate if (set) { m_horizontalHeader->show(); - top_height = m_horizontalHeader->sizeHint().height(); + top_height = m_horizontalHeader->tqsizeHint().height(); } else { m_horizontalHeader->hide(); @@ -2308,7 +2308,7 @@ void KexiTableView::triggerUpdate() // d->pUpdateTimer->start(200, true); } -void KexiTableView::setHBarGeometry( QScrollBar & hbar, int x, int y, int w, int h ) +void KexiTableView::setHBarGeometry( TQScrollBar & hbar, int x, int y, int w, int h ) { /*todo*/ kdDebug(44021)<<"KexiTableView::setHBarGeometry"<<endl; @@ -2329,7 +2329,7 @@ void KexiTableView::setSpreadSheetMode() setAppearance( a ); } -int KexiTableView::validRowNumber(const QString& text) +int KexiTableView::validRowNumber(const TQString& text) { bool ok=true; int r = text.toInt(&ok); @@ -2376,11 +2376,11 @@ void KexiTableView::copySelection() { if (m_currentItem && m_curCol!=-1) { KexiTableEdit *edit = tableEditorWidget( m_curCol ); - QVariant defaultValue; + TQVariant defaultValue; const bool defaultValueDisplayed = isDefaultValueDisplayed(m_currentItem, m_curCol, &defaultValue); if (edit) { - QVariant visibleValue; + TQVariant visibleValue; getVisibleLookupValue(visibleValue, edit, m_currentItem, m_data->column(m_curCol)); edit->handleCopyAction( defaultValueDisplayed ? defaultValue : m_currentItem->at( m_curCol ), @@ -2405,14 +2405,14 @@ void KexiTableView::paste() edit->handleAction("edit_paste"); } -bool KexiTableView::eventFilter( QObject *o, QEvent *e ) +bool KexiTableView::eventFilter( TQObject *o, TQEvent *e ) { //don't allow to stole key my events by others: // kexidbg << "spontaneous " << e->spontaneous() << " type=" << e->type() << endl; - if (e->type()==QEvent::KeyPress) { - if (e->spontaneous() /*|| e->type()==QEvent::AccelOverride*/) { - QKeyEvent *ke = static_cast<QKeyEvent*>(e); + if (e->type()==TQEvent::KeyPress) { + if (e->spontaneous() /*|| e->type()==TQEvent::AccelOverride*/) { + TQKeyEvent *ke = TQT_TQKEYEVENT(e); const int k = ke->key(); int s = ke->state(); //cell editor's events: @@ -2422,12 +2422,12 @@ bool KexiTableView::eventFilter( QObject *o, QEvent *e ) ke->accept(); return true; } - else if (m_editor && (o==dynamic_cast<QObject*>(m_editor) || o==m_editor->widget())) { - if ( (k==Qt::Key_Tab && (s==Qt::NoButton || s==Qt::ShiftButton)) + else if (m_editor && (o==dynamic_cast<TQT_BASE_OBJECT_NAME*>(m_editor) || TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(m_editor->widget()))) { + if ( (k==TQt::Key_Tab && (s==Qt::NoButton || s==TQt::ShiftButton)) || (overrideEditorShortcutNeeded(ke)) - || (k==Qt::Key_Enter || k==Qt::Key_Return || k==Qt::Key_Up || k==Qt::Key_Down) - || (k==Qt::Key_Left && m_editor->cursorAtStart()) - || (k==Qt::Key_Right && m_editor->cursorAtEnd()) + || (k==TQt::Key_Enter || k==TQt::Key_Return || k==TQt::Key_Up || k==TQt::Key_Down) + || (k==TQt::Key_Left && m_editor->cursorAtStart()) + || (k==TQt::Key_Right && m_editor->cursorAtEnd()) ) { //try to steal the key press from editor or it's internal widget... @@ -2437,12 +2437,12 @@ bool KexiTableView::eventFilter( QObject *o, QEvent *e ) } } /* - else if (e->type()==QEvent::KeyPress && (o==this || (m_editor && o==m_editor->widget()))){//|| o==viewport()) + else if (e->type()==TQEvent::KeyPress && (o==this || (m_editor && o==m_editor->widget()))){//|| o==viewport()) keyPressEvent(ke); if (ke->isAccepted()) return true; }*/ -/*todo else if ((k==Qt::Key_Tab || k==(Qt::SHIFT|Qt::Key_Tab)) && o==d->navRowNumber) { +/*todo else if ((k==TQt::Key_Tab || k==(TQt::SHIFT|TQt::Key_Tab)) && o==d->navRowNumber) { //tab key focuses tv ke->accept(); setFocus(); @@ -2450,14 +2450,14 @@ bool KexiTableView::eventFilter( QObject *o, QEvent *e ) }*/ } } - else if (o==horizontalScrollBar()) { - if ((e->type()==QEvent::Show && !horizontalScrollBar()->isVisible()) - || (e->type()==QEvent::Hide && horizontalScrollBar()->isVisible())) { + else if (TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(horizontalScrollBar())) { + if ((e->type()==TQEvent::Show && !horizontalScrollBar()->isVisible()) + || (e->type()==TQEvent::Hide && horizontalScrollBar()->isVisible())) { updateWidgetContentsSize(); } } - else if (e->type()==QEvent::Leave) { - if (o==viewport() && d->appearance.rowMouseOverHighlightingEnabled + else if (e->type()==TQEvent::Leave) { + if (TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(viewport()) && d->appearance.rowMouseOverHighlightingEnabled && d->appearance.persistentSelections) { if (d->highlightedRow!=-1) { @@ -2474,22 +2474,22 @@ bool KexiTableView::eventFilter( QObject *o, QEvent *e ) } } } - d->recentCellWithToolTip = QPoint(-1,-1); + d->recentCellWithToolTip = TQPoint(-1,-1); } -/* else if (e->type()==QEvent::FocusOut && o->inherits("QWidget")) { +/* else if (e->type()==TQEvent::FocusOut && o->inherits(TQWIDGET_OBJECT_NAME_STRING)) { //hp==true if currently focused widget is a child of this table view - const bool hp = KexiUtils::hasParent( static_cast<QWidget*>(o), focusWidget()); - if (!hp && KexiUtils::hasParent( this, static_cast<QWidget*>(o))) { + const bool hp = KexiUtils::hasParent( static_cast<TQWidget*>(o), tqfocusWidget()); + if (!hp && KexiUtils::hasParent( this, static_cast<TQWidget*>(o))) { //accept row editing if focus is moved to foreign widget - //(not a child, like eg. editor) from one of our table view's children + //(not a child, like eg. editor) from one of our table view's tqchildren //or from table view itself if (!acceptRowEdit()) { - static_cast<QWidget*>(o)->setFocus(); + static_cast<TQWidget*>(o)->setFocus(); return true; } } }*/ - return QScrollView::eventFilter(o,e); + return TQScrollView::eventFilter(o,e); } void KexiTableView::slotTopHeaderSizeChange( @@ -2503,14 +2503,14 @@ void KexiTableView::setBottomMarginInternal(int pixels) d->internal_bottomMargin = pixels; } -void KexiTableView::paletteChange( const QPalette &oldPalette ) +void KexiTableView::paletteChange( const TQPalette &oldPalette ) { Q_UNUSED(oldPalette); //update: if (m_verticalHeader) - m_verticalHeader->setSelectionBackgroundColor( palette().active().highlight() ); + m_verticalHeader->setSelectionBackgroundColor( tqpalette().active().highlight() ); if (m_horizontalHeader) - m_horizontalHeader->setSelectionBackgroundColor( palette().active().highlight() ); + m_horizontalHeader->setSelectionBackgroundColor( tqpalette().active().highlight() ); } const KexiTableView::Appearance& KexiTableView::appearance() const @@ -2531,8 +2531,8 @@ void KexiTableView::setAppearance(const Appearance& a) m_verticalHeader->setCellHeight(d->rowHeight); if (m_horizontalHeader) { setMargins( - QMIN(m_horizontalHeader->sizeHint().height(), d->rowHeight), - m_horizontalHeader->sizeHint().height(), 0, 0); + TQMIN(m_horizontalHeader->tqsizeHint().height(), d->rowHeight), + m_horizontalHeader->tqsizeHint().height(), 0, 0); } // } if (a.rowHighlightingEnabled) @@ -2561,8 +2561,8 @@ int KexiTableView::highlightedRow() const void KexiTableView::setHighlightedRow(int row) { if (row!=-1) { - row = QMIN(rows() - 1 + (isInsertingEnabled()?1:0), row); - row = QMAX(0, row); + row = TQMIN(rows() - 1 + (isInsertingEnabled()?1:0), row); + row = TQMAX(0, row); ensureCellVisible(row, -1); } const int previouslyHighlightedRow = d->highlightedRow; @@ -2581,7 +2581,7 @@ void KexiTableView::setHighlightedRow(int row) if (m_curRow>=0 && (previouslyHighlightedRow==-1 || previouslyHighlightedRow==m_curRow) && d->highlightedRow!=m_curRow && !d->appearance.persistentSelections) { - //currently selected row needs to be repainted + //currently selected row needs to be tqrepainted updateRow(m_curRow); } } |