diff options
Diffstat (limited to 'kexi/widget/tableview/kexiinputtableedit.cpp')
-rw-r--r-- | kexi/widget/tableview/kexiinputtableedit.cpp | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/kexi/widget/tableview/kexiinputtableedit.cpp b/kexi/widget/tableview/kexiinputtableedit.cpp index 9af5c627..26a3ed7f 100644 --- a/kexi/widget/tableview/kexiinputtableedit.cpp +++ b/kexi/widget/tableview/kexiinputtableedit.cpp @@ -20,14 +20,14 @@ #include "kexiinputtableedit.h" -#include <qregexp.h> -#include <qevent.h> -#include <qlayout.h> -#include <qtimer.h> -#include <qpainter.h> -#include <qapplication.h> -#include <qclipboard.h> -#include <qtooltip.h> +#include <tqregexp.h> +#include <tqevent.h> +#include <tqlayout.h> +#include <tqtimer.h> +#include <tqpainter.h> +#include <tqapplication.h> +#include <tqclipboard.h> +#include <tqtooltip.h> #include <kglobal.h> #include <klocale.h> @@ -43,12 +43,12 @@ class MyLineEdit : public KLineEdit { public: - MyLineEdit(QWidget *parent, const char *name) : KLineEdit(parent,name) + MyLineEdit(TQWidget *tqparent, const char *name) : KLineEdit(tqparent,name) {} protected: - virtual void drawFrame ( QPainter * p ) { - p->setPen( QPen( colorGroup().text() ) ); - QRect r = rect(); + virtual void drawFrame ( TQPainter * p ) { + p->setPen( TQPen( tqcolorGroup().text() ) ); + TQRect r = rect(); p->moveTo( r.topLeft() ); p->lineTo( r.topRight() ); p->lineTo( r.bottomRight() ); @@ -60,8 +60,8 @@ class MyLineEdit : public KLineEdit //====================================================== -KexiInputTableEdit::KexiInputTableEdit(KexiTableViewColumn &column, QWidget *parent) - : KexiTableEdit(column, parent) +KexiInputTableEdit::KexiInputTableEdit(KexiTableViewColumn &column, TQWidget *tqparent) + : KexiTableEdit(column, tqparent) { setName("KexiInputTableEdit"); // m_type = f.type(); //copied because the rest of code uses m_type @@ -91,7 +91,7 @@ void KexiInputTableEdit::init() if (!align_right) { //create layer for internal editor - QHBoxLayout *lyr = new QHBoxLayout(this); + TQHBoxLayout *lyr = new TQHBoxLayout(this); lyr->addSpacing(4); lyr->setAutoAdd(true); } @@ -100,29 +100,29 @@ void KexiInputTableEdit::init() m_lineedit = new MyLineEdit(this, "KexiInputTableEdit-KLineEdit"); setViewWidget(m_lineedit); if (align_right) - m_lineedit->setAlignment(AlignRight); + m_lineedit->tqsetAlignment(AlignRight); // m_cview->setFrame(false); -// m_cview->setFrameStyle( QFrame::Plain | QFrame::Box ); +// m_cview->setFrameStyle( TQFrame::Plain | TQFrame::Box ); // m_cview->setLineWidth( 1 ); m_calculatedCell = false; #if 0 //js TODO - connect(m_cview->completionBox(), SIGNAL(activated(const QString &)), - this, SLOT(completed(const QString &))); - connect(m_cview->completionBox(), SIGNAL(highlighted(const QString &)), - this, SLOT(completed(const QString &))); + connect(m_cview->completionBox(), TQT_SIGNAL(activated(const TQString &)), + this, TQT_SLOT(completed(const TQString &))); + connect(m_cview->completionBox(), TQT_SIGNAL(highlighted(const TQString &)), + this, TQT_SLOT(completed(const TQString &))); m_cview->completionBox()->setTabHandling(true); #endif } -void KexiInputTableEdit::setValueInternal(const QVariant& add, bool removeOld) +void KexiInputTableEdit::setValueInternal(const TQVariant& add, bool removeOld) { - QString text( m_textFormatter.valueToText(removeOld ? QVariant() : m_origValue, add.toString()) ); + TQString text( m_textFormatter.valueToText(removeOld ? TQVariant() : m_origValue, add.toString()) ); if (text.isEmpty()) { if (m_origValue.toString().isEmpty()) { //we have to set NULL initial value: - m_lineedit->setText(QString::null); + m_lineedit->setText(TQString()); } } else { @@ -138,7 +138,7 @@ void KexiInputTableEdit::setValueInternal(const QVariant& add, bool removeOld) #endif if (!m_lineedit->validator()) { - QValidator *validator = new KexiDB::FieldValidator( + TQValidator *validator = new KexiDB::FieldValidator( *field(), m_lineedit, "KexiInputTableEdit-validator"); m_lineedit->setValidator( validator ); } @@ -146,28 +146,28 @@ void KexiInputTableEdit::setValueInternal(const QVariant& add, bool removeOld) #if 0 //moved to KexiTextFormatter -QString KexiInputTableEdit::valueToText(KexiDB::Field* field, const QVariant& value, const QString& add) +TQString KexiInputTableEdit::valueToText(KexiDB::Field* field, const TQVariant& value, const TQString& add) { - QString text; //result + TQString text; //result if (field->isFPNumericType()) { //! @todo precision! //! @todo support 'g' format - text = QString::number(value.toDouble(), 'f', - QMAX(field->visibleDecimalPlaces(), 10)); //<-- 10 is quite good maximum for fractional digits + text = TQString::number(value.toDouble(), 'f', + TQMAX(field->visibleDecimalPlaces(), 10)); //<-- 10 is quite good maximum for fractional digits //! @todo add command line settings? if (value.toDouble() == 0.0) { text = add.isEmpty() ? "0" : add; //eat 0 } else { //! @todo (js): get decimal places settings here... - QStringList sl = QStringList::split(".", text); + TQStringList sl = TQStringList::split(".", text); if (text.isEmpty()) { //nothing } else if (sl.count()==2) { // kdDebug() << "sl.count()=="<<sl.count()<< " " <<sl[0] << " | " << sl[1] << endl; - const QString sl1 = sl[1]; + const TQString sl1 = sl[1]; int pos = sl1.length()-1; if (pos>=1) { for (;pos>=0 && sl1[pos]=='0';pos--) @@ -183,7 +183,7 @@ QString KexiInputTableEdit::valueToText(KexiDB::Field* field, const QVariant& va } /*moved to KexiDB::FieldValidator if (setValidator && !m_lineedit->validator()) { - QValidator *validator = new KDoubleValidator(m_lineedit); + TQValidator *validator = new KDoubleValidator(m_lineedit); m_lineedit->setValidator( validator ); }*/ } @@ -199,7 +199,7 @@ QString KexiInputTableEdit::valueToText(KexiDB::Field* field, const QVariant& va /*moved to KexiDB::FieldValidator //! @todo implement ranges here! if (setValidator && !m_lineedit->validator()) { - QValidator *validator; + TQValidator *validator; if (KexiDB::Field::BigInteger == field()->type()) { //! @todo use field->isUnsigned() for KexiUtils::ULongLongValidator validator = new KexiUtils::LongLongValidator(m_lineedit); @@ -219,10 +219,10 @@ QString KexiInputTableEdit::valueToText(KexiDB::Field* field, const QVariant& va } #endif -void KexiInputTableEdit::paintEvent ( QPaintEvent * /*e*/ ) +void KexiInputTableEdit::paintEvent ( TQPaintEvent * /*e*/ ) { - QPainter p(this); - p.setPen( QPen( colorGroup().text() ) ); + TQPainter p(this); + p.setPen( TQPen( tqcolorGroup().text() ) ); p.drawRect( rect() ); } @@ -239,8 +239,8 @@ kdDebug() << "KexiInputTableEdit::setRestrictedCompletion()" << endl; m_cview->useGlobalKeyBindings(); - QStringList newC; - QStringList::ConstIterator it, end( m_comp.constEnd() ); + TQStringList newC; + TQStringList::ConstIterator it, end( m_comp.constEnd() ); for( it = m_comp.constBegin(); it != end; ++it) { if((*it).startsWith(m_cview->text())) @@ -251,7 +251,7 @@ kdDebug() << "KexiInputTableEdit::setRestrictedCompletion()" << endl; } void -KexiInputTableEdit::completed(const QString &s) +KexiInputTableEdit::completed(const TQString &s) { // kdDebug() << "KexiInputTableEdit::completed(): " << s << endl; m_lineedit->setText(s); @@ -274,39 +274,39 @@ bool KexiInputTableEdit::valueIsEmpty() return !m_lineedit->text().isNull() && m_lineedit->text().isEmpty(); } -QVariant KexiInputTableEdit::value() +TQVariant KexiInputTableEdit::value() { if (field()->isFPNumericType()) {//==KexiDB::Field::Double || m_type==KexiDB::Field::Float) { //! js @todo PRESERVE PRECISION! - QString txt = m_lineedit->text(); + TQString txt = m_lineedit->text(); if (m_decsym!=".") - txt = txt.replace(m_decsym,".");//convert back + txt = txt.tqreplace(m_decsym,".");//convert back bool ok; const double result = txt.toDouble(&ok); - return ok ? QVariant(result) : QVariant(); + return ok ? TQVariant(result) : TQVariant(); } else if (field()->isIntegerType()) { //! @todo check constraints bool ok; if (KexiDB::Field::BigInteger == field()->type()) { if (field()->isUnsigned()) { - const Q_ULLONG result = m_lineedit->text().toULongLong(&ok); - return ok ? QVariant(result) : QVariant(); + const TQ_ULLONG result = m_lineedit->text().toULongLong(&ok); + return ok ? TQVariant(result) : TQVariant(); } else { - const Q_LLONG result = m_lineedit->text().toLongLong(&ok); - return ok ? QVariant(result) : QVariant(); + const TQ_LLONG result = m_lineedit->text().toLongLong(&ok); + return ok ? TQVariant(result) : TQVariant(); } } if (KexiDB::Field::Integer == field()->type()) { if (field()->isUnsigned()) { const uint result = m_lineedit->text().toUInt(&ok); - return ok ? QVariant(result) : QVariant(); + return ok ? TQVariant(result) : TQVariant(); } } //default: signed int const int result = m_lineedit->text().toInt(&ok); - return ok ? QVariant(result) : QVariant(); + return ok ? TQVariant(result) : TQVariant(); } //default: text return m_lineedit->text(); @@ -328,21 +328,21 @@ bool KexiInputTableEdit::cursorAtEnd() return m_lineedit->cursorPosition()==(int)m_lineedit->text().length(); } -QSize KexiInputTableEdit::totalSize() +TQSize KexiInputTableEdit::totalSize() { if (!m_lineedit) return size(); return m_lineedit->size(); } -void KexiInputTableEdit::handleCopyAction(const QVariant& value, const QVariant& visibleValue) +void KexiInputTableEdit::handleCopyAction(const TQVariant& value, const TQVariant& visibleValue) { Q_UNUSED(visibleValue); //! @todo handle rich text? - qApp->clipboard()->setText( m_textFormatter.valueToText(value, QString::null) ); + tqApp->clipboard()->setText( m_textFormatter.valueToText(value, TQString()) ); } -void KexiInputTableEdit::handleAction(const QString& actionName) +void KexiInputTableEdit::handleAction(const TQString& actionName) { const bool alreadyVisible = m_lineedit->isVisible(); @@ -363,12 +363,12 @@ void KexiInputTableEdit::handleAction(const QString& actionName) } } -bool KexiInputTableEdit::showToolTipIfNeeded(const QVariant& value, const QRect& rect, - const QFontMetrics& fm, bool focused) +bool KexiInputTableEdit::showToolTipIfNeeded(const TQVariant& value, const TQRect& rect, + const TQFontMetrics& fm, bool focused) { - QString text( value.type()==QVariant::String ? value.toString() - : m_textFormatter.valueToText(value, QString::null) ); - QRect internalRect(rect); + TQString text( value.type()==TQVariant::String ? value.toString() + : m_textFormatter.valueToText(value, TQString()) ); + TQRect internalRect(rect); internalRect.setLeft(rect.x()+leftMargin()); internalRect.setWidth(internalRect.width()-rightMargin(focused)-2*3); kexidbg << rect << " " << internalRect << " " << fm.width(text) << endl; |