diff options
Diffstat (limited to 'kexi/widget/tableview/kexicomboboxtableedit.cpp')
-rw-r--r-- | kexi/widget/tableview/kexicomboboxtableedit.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/kexi/widget/tableview/kexicomboboxtableedit.cpp b/kexi/widget/tableview/kexicomboboxtableedit.cpp index 75815a8a..ba61e305 100644 --- a/kexi/widget/tableview/kexicomboboxtableedit.cpp +++ b/kexi/widget/tableview/kexicomboboxtableedit.cpp @@ -18,12 +18,12 @@ * Boston, MA 02110-1301, USA. */ -#include <qlayout.h> -#include <qstyle.h> -#include <qwindowsstyle.h> -#include <qpainter.h> -#include <qapplication.h> -#include <qclipboard.h> +#include <tqlayout.h> +#include <tqstyle.h> +#include <tqwindowsstyle.h> +#include <tqpainter.h> +#include <tqapplication.h> +#include <tqclipboard.h> #include "kexicomboboxtableedit.h" #include <widget/utils/kexicomboboxdropdownbutton.h> @@ -54,41 +54,41 @@ public: KPushButton *button; KexiComboBoxPopup *popup; int currentEditorWidth; - QSize totalSize; + TQSize totalSize; KexiTableViewColumn* visibleTableViewColumn; KexiTableEdit* internalEditor; }; //====================================================== -KexiComboBoxTableEdit::KexiComboBoxTableEdit(KexiTableViewColumn &column, QWidget *parent) - : KexiInputTableEdit(column, parent) +KexiComboBoxTableEdit::KexiComboBoxTableEdit(KexiTableViewColumn &column, TQWidget *tqparent) + : KexiInputTableEdit(column, tqparent) , KexiComboBoxBase() , d(new Private()) { setName("KexiComboBoxTableEdit"); m_setVisibleValueOnSetValueInternal = true; - d->button = new KexiComboBoxDropDownButton( parentWidget() /*usually a viewport*/ ); + d->button = new KexiComboBoxDropDownButton( tqparentWidget() /*usually a viewport*/ ); d->button->hide(); - d->button->setFocusPolicy( NoFocus ); - connect(d->button, SIGNAL(clicked()), this, SLOT(slotButtonClicked())); + d->button->setFocusPolicy( TQ_NoFocus ); + connect(d->button, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotButtonClicked())); - connect(m_lineedit, SIGNAL(textChanged(const QString&)), this, SLOT(slotLineEditTextChanged(const QString&))); + connect(m_lineedit, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotLineEditTextChanged(const TQString&))); // m_lineedit = new KLineEdit(this, "lineedit"); // m_lineedit->setFrame(false); -// m_lineedit->setFrameStyle( QFrame::Plain | QFrame::Box ); +// m_lineedit->setFrameStyle( TQFrame::Plain | TQFrame::Box ); // m_lineedit->setLineWidth( 1 ); // if (f.isNumericType()) { -// m_lineedit->setAlignment(AlignRight); +// m_lineedit->tqsetAlignment(AlignRight); // } // setView( m_lineedit ); -// layout->addWidget(m_view); +// tqlayout->addWidget(m_view); // m_combo->setEditable( true ); // m_combo->clear(); // m_combo->insertStringList(f.enumHints()); -// QStringList::ConstIterator it, end( f.enumHints().constEnd() ); +// TQStringList::ConstIterator it, end( f.enumHints().constEnd() ); // for ( it = f.enumHints().constBegin(); it != end; ++it) { // if(!hints.at(i).isEmpty()) // m_combo->insertItem(hints.at(i)); @@ -138,7 +138,7 @@ void KexiComboBoxTableEdit::setPopup(KexiComboBoxPopup *popup) d->popup = popup; } -void KexiComboBoxTableEdit::showFocus( const QRect& r, bool readOnly ) +void KexiComboBoxTableEdit::showFocus( const TQRect& r, bool readOnly ) { // d->button->move( pos().x()+ width(), pos().y() ); updateFocus( r ); @@ -151,13 +151,13 @@ void KexiComboBoxTableEdit::showFocus( const QRect& r, bool readOnly ) void KexiComboBoxTableEdit::resize(int w, int h) { - d->totalSize = QSize(w,h); + d->totalSize = TQSize(w,h); if (!column()->isReadOnly()) { d->button->resize( h, h ); - QWidget::resize(w - d->button->width(), h); + TQWidget::resize(w - d->button->width(), h); } m_rightMarginWhenFocused = m_rightMargin + (column()->isReadOnly() ? 0 : d->button->width()); - QRect r( pos().x(), pos().y(), w+1, h+1 ); + TQRect r( pos().x(), pos().y(), w+1, h+1 ); if (m_scrollView) r.moveBy(m_scrollView->contentsX(), m_scrollView->contentsY()); updateFocus( r ); @@ -167,7 +167,7 @@ void KexiComboBoxTableEdit::resize(int w, int h) } // internal -void KexiComboBoxTableEdit::updateFocus( const QRect& r ) +void KexiComboBoxTableEdit::updateFocus( const TQRect& r ) { if (!column()->isReadOnly()) { if (d->button->width() > r.width()) @@ -182,14 +182,14 @@ void KexiComboBoxTableEdit::hideFocus() d->button->hide(); } -QVariant KexiComboBoxTableEdit::visibleValue() +TQVariant KexiComboBoxTableEdit::visibleValue() { return KexiComboBoxBase::visibleValue(); /* KexiDB::LookupFieldSchema *lookupFieldSchema = this->lookupFieldSchema(); if (!popup() || !lookupFieldSchema) - return QVariant(); + return TQVariant(); KexiTableItem *it = popup()->tableView()->selectedItem(); - return it ? it->at( lookupFieldSchema->visibleColumn() ) : QVariant();*/ + return it ? it->at( lookupFieldSchema->visibleColumn() ) : TQVariant();*/ } void KexiComboBoxTableEdit::clear() @@ -206,7 +206,7 @@ bool KexiComboBoxTableEdit::valueChanged() return res == true; } -void KexiComboBoxTableEdit::paintFocusBorders( QPainter *p, QVariant &, int x, int y, int w, int h ) +void KexiComboBoxTableEdit::paintFocusBorders( TQPainter *p, TQVariant &, int x, int y, int w, int h ) { // d->currentEditorWidth = w; if (!column()->isReadOnly()) { @@ -216,8 +216,8 @@ void KexiComboBoxTableEdit::paintFocusBorders( QPainter *p, QVariant &, int x, i p->drawRect(x, y, w, h); } -void KexiComboBoxTableEdit::setupContents( QPainter *p, bool focused, const QVariant& val, - QString &txt, int &align, int &x, int &y_offset, int &w, int &h ) +void KexiComboBoxTableEdit::setupContents( TQPainter *p, bool focused, const TQVariant& val, + TQString &txt, int &align, int &x, int &y_offset, int &w, int &h ) { if (d->internalEditor) { d->internalEditor->setupContents( p, focused, val, txt, align, x, y_offset, w, h ); @@ -295,18 +295,18 @@ void KexiComboBoxTableEdit::show() } } -bool KexiComboBoxTableEdit::handleKeyPress( QKeyEvent *ke, bool editorActive ) +bool KexiComboBoxTableEdit::handleKeyPress( TQKeyEvent *ke, bool editorActive ) { const int k = ke->key(); - if ((ke->state()==NoButton && k==Qt::Key_F4) - || (ke->state()==AltButton && k==Qt::Key_Down)) + if ((ke->state()==Qt::NoButton && k==TQt::Key_F4) + || (ke->state()==AltButton && k==TQt::Key_Down)) { //show popup slotButtonClicked(); return true; } else if (editorActive) { - const bool enterPressed = k==Qt::Key_Enter || k==Qt::Key_Return; + const bool enterPressed = k==TQt::Key_Enter || k==TQt::Key_Return; if (enterPressed && m_internalEditorValueChanged) { createPopup(false); selectItemForEnteredValueInLookupTable( m_userEnteredValue ); @@ -319,52 +319,52 @@ bool KexiComboBoxTableEdit::handleKeyPress( QKeyEvent *ke, bool editorActive ) return false; } -void KexiComboBoxTableEdit::slotLineEditTextChanged(const QString& s) +void KexiComboBoxTableEdit::slotLineEditTextChanged(const TQString& s) { slotInternalEditorValueChanged(s); } -int KexiComboBoxTableEdit::widthForValue( QVariant &val, const QFontMetrics &fm ) +int KexiComboBoxTableEdit::widthForValue( TQVariant &val, const TQFontMetrics &fm ) { KexiTableViewData *relData = column() ? column()->relatedData() : 0; if (lookupFieldSchema() || relData) { // in 'lookupFieldSchema' or or 'related table data' model // we're assuming val is already the text, not the index //! @todo ok? - return QMAX(KEXITV_MINIMUM_COLUMN_WIDTH, fm.width(val.toString())); + return TQMAX(KEXITV_MINIMUM_COLUMN_WIDTH, fm.width(val.toString())); } //use 'enum hints' model - QValueVector<QString> hints = field()->enumHints(); + TQValueVector<TQString> hints = field()->enumHints(); bool ok; int idx = val.toInt(&ok); if (!ok || idx < 0 || idx > int(hints.size()-1)) return KEXITV_MINIMUM_COLUMN_WIDTH; - QString txt = hints.at( idx, &ok ); + TQString txt = hints.at( idx, &ok ); if (!ok) return KEXITV_MINIMUM_COLUMN_WIDTH; return fm.width( txt ); } -bool KexiComboBoxTableEdit::eventFilter( QObject *o, QEvent *e ) +bool KexiComboBoxTableEdit::eventFilter( TQObject *o, TQEvent *e ) { - if (!column()->isReadOnly() && e->type()==QEvent::MouseButtonPress && m_scrollView) { - QPoint gp = static_cast<QMouseEvent*>(e)->globalPos() - + QPoint(m_scrollView->childX(d->button), m_scrollView->childY(d->button)); - QRect r(d->button->mapToGlobal(d->button->geometry().topLeft()), - d->button->mapToGlobal(d->button->geometry().bottomRight())); - if (o==popup() && popup()->isVisible() && r.contains( gp )) { + if (!column()->isReadOnly() && e->type()==TQEvent::MouseButtonPress && m_scrollView) { + TQPoint gp = TQT_TQMOUSEEVENT(e)->globalPos() + + TQPoint(m_scrollView->childX(d->button), m_scrollView->childY(d->button)); + TQRect r(d->button->mapToGlobal(d->button->tqgeometry().topLeft()), + d->button->mapToGlobal(d->button->tqgeometry().bottomRight())); + if (TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(popup()) && popup()->isVisible() && r.tqcontains( gp )) { m_mouseBtnPressedWhenPopupVisible = true; } } return false; } -QSize KexiComboBoxTableEdit::totalSize() const +TQSize KexiComboBoxTableEdit::totalSize() const { return d->totalSize; } -QWidget *KexiComboBoxTableEdit::internalEditor() const +TQWidget *KexiComboBoxTableEdit::internalEditor() const { return m_lineedit; } @@ -394,37 +394,37 @@ void KexiComboBoxTableEdit::selectAll() m_lineedit->selectAll(); } -void KexiComboBoxTableEdit::setValueInInternalEditor(const QVariant& value) +void KexiComboBoxTableEdit::setValueInInternalEditor(const TQVariant& value) { m_lineedit->setText(value.toString()); } -QVariant KexiComboBoxTableEdit::valueFromInternalEditor() +TQVariant KexiComboBoxTableEdit::valueFromInternalEditor() { return m_lineedit->text(); } -QPoint KexiComboBoxTableEdit::mapFromParentToGlobal(const QPoint& pos) const +TQPoint KexiComboBoxTableEdit::mapFromParentToGlobal(const TQPoint& pos) const { KexiTableView *tv = dynamic_cast<KexiTableView*>(m_scrollView); if (!tv) - return QPoint(-1,-1); + return TQPoint(-1,-1); return tv->viewport()->mapToGlobal(pos); } int KexiComboBoxTableEdit::popupWidthHint() const { - return m_lineedit->width() + m_leftMargin + m_rightMarginWhenFocused; //QMAX(popup()->width(), d->currentEditorWidth); + return m_lineedit->width() + m_leftMargin + m_rightMarginWhenFocused; //TQMAX(popup()->width(), d->currentEditorWidth); } -void KexiComboBoxTableEdit::handleCopyAction(const QVariant& value, const QVariant& visibleValue) +void KexiComboBoxTableEdit::handleCopyAction(const TQVariant& value, const TQVariant& visibleValue) { Q_UNUSED(value); //! @todo does not work with BLOBs! - qApp->clipboard()->setText( visibleValue.toString() ); + tqApp->clipboard()->setText( visibleValue.toString() ); } -void KexiComboBoxTableEdit::handleAction(const QString& actionName) +void KexiComboBoxTableEdit::handleAction(const TQString& actionName) { const bool alreadyVisible = m_lineedit->isVisible(); @@ -434,7 +434,7 @@ void KexiComboBoxTableEdit::handleAction(const QString& actionName) m_lineedit->clear(); } //! @todo does not work with BLOBs! - setValueInInternalEditor( qApp->clipboard()->text() ); + setValueInInternalEditor( tqApp->tqclipboard()->text() ); } else KexiInputTableEdit::handleAction(actionName); |