diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/plugins/forms/widgets/kexidbautofield.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/plugins/forms/widgets/kexidbautofield.cpp')
-rw-r--r-- | kexi/plugins/forms/widgets/kexidbautofield.cpp | 298 |
1 files changed, 149 insertions, 149 deletions
diff --git a/kexi/plugins/forms/widgets/kexidbautofield.cpp b/kexi/plugins/forms/widgets/kexidbautofield.cpp index 36fbdb1a..4926a334 100644 --- a/kexi/plugins/forms/widgets/kexidbautofield.cpp +++ b/kexi/plugins/forms/widgets/kexidbautofield.cpp @@ -21,11 +21,11 @@ #include "kexidbautofield.h" -#include <qlabel.h> -#include <qlayout.h> -#include <qpainter.h> -#include <qmetaobject.h> -#include <qapplication.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqpainter.h> +#include <tqmetaobject.h> +#include <tqapplication.h> #include <kdebug.h> #include <klocale.h> @@ -57,13 +57,13 @@ class KexiDBAutoField::Private //!< of widgetTypeForFieldType() if widgetTypeForFieldType is Auto WidgetType widgetType_property; //!< provides widget type or Auto LabelPosition lblPosition; - QBoxLayout *layout; - QLabel *label; - QString caption; + TQBoxLayout *tqlayout; + TQLabel *label; + TQString caption; KexiDB::Field::Type fieldTypeInternal; - QString fieldCaptionInternal; - QColor baseColor; //!< needed because for unbound mode editor==0 - QColor textColor; //!< needed because for unbound mode editor==0 + TQString fieldCaptionInternal; + TQColor baseColor; //!< needed because for unbound mode editor==0 + TQColor textColor; //!< needed because for unbound mode editor==0 bool autoCaption : 1; bool focusPolicyChanged : 1; bool designMode : 1; @@ -71,9 +71,9 @@ class KexiDBAutoField::Private //------------------------------------- -KexiDBAutoField::KexiDBAutoField(const QString &text, WidgetType type, LabelPosition pos, - QWidget *parent, const char *name, bool designMode) - : QWidget(parent, name) +KexiDBAutoField::KexiDBAutoField(const TQString &text, WidgetType type, LabelPosition pos, + TQWidget *tqparent, const char *name, bool designMode) + : TQWidget(tqparent, name) , KexiFormDataItemInterface() , KFormDesigner::DesignTimeDynamicChildWidgetHandler() , d( new Private() ) @@ -82,14 +82,14 @@ KexiDBAutoField::KexiDBAutoField(const QString &text, WidgetType type, LabelPosi init(text, type, pos); } -KexiDBAutoField::KexiDBAutoField(QWidget *parent, const char *name, bool designMode, LabelPosition pos) - : QWidget(parent, name) +KexiDBAutoField::KexiDBAutoField(TQWidget *tqparent, const char *name, bool designMode, LabelPosition pos) + : TQWidget(tqparent, name) , KexiFormDataItemInterface() , KFormDesigner::DesignTimeDynamicChildWidgetHandler() , d( new Private() ) { d->designMode = designMode; - init(QString::null/*i18n("Auto Field")*/, Auto, pos); + init(TQString()/*i18n("Auto Field")*/, Auto, pos); } KexiDBAutoField::~KexiDBAutoField() @@ -101,14 +101,14 @@ KexiDBAutoField::~KexiDBAutoField() } void -KexiDBAutoField::init(const QString &text, WidgetType type, LabelPosition pos) +KexiDBAutoField::init(const TQString &text, WidgetType type, LabelPosition pos) { d->fieldTypeInternal = KexiDB::Field::InvalidType; - d->layout = 0; + d->tqlayout = 0; m_subwidget = 0; - d->label = new QLabel(text, this); + d->label = new TQLabel(text, this); d->label->installEventFilter( this ); - //QFontMetrics fm( font() ); + //TQFontMetrics fm( font() ); //d->label->setFixedWidth( fm.width("This is a test string length") ); d->autoCaption = true; d->focusPolicyChanged = false; @@ -116,8 +116,8 @@ KexiDBAutoField::init(const QString &text, WidgetType type, LabelPosition pos) d->widgetType_property = (type==Auto ? Text : type); //to force "differ" to be true in setWidgetType() setLabelPosition(pos); setWidgetType(type); - d->baseColor = palette().active().base(); - d->textColor = palette().active().text(); + d->baseColor = tqpalette().active().base(); + d->textColor = tqpalette().active().text(); } void @@ -142,10 +142,10 @@ void KexiDBAutoField::createEditor() { if(m_subwidget) { - delete (QWidget *)m_subwidget; + delete (TQWidget *)m_subwidget; } - QWidget *newSubwidget; + TQWidget *newSubwidget; switch( d->widgetType ) { case Text: case Double: //! @todo setup validator @@ -153,19 +153,19 @@ KexiDBAutoField::createEditor() case Date: case Time: case DateTime: - newSubwidget = new KexiDBLineEdit( this, QCString("KexiDBAutoField_KexiDBLineEdit:")+name() ); + newSubwidget = new KexiDBLineEdit( this, TQCString("KexiDBAutoField_KexiDBLineEdit:")+name() ); break; case MultiLineText: - newSubwidget = new KexiDBTextEdit( this, QCString("KexiDBAutoField_KexiDBTextEdit:")+name() ); + newSubwidget = new KexiDBTextEdit( this, TQCString("KexiDBAutoField_KexiDBTextEdit:")+name() ); break; case Boolean: - newSubwidget = new KexiDBCheckBox(dataSource(), this, QCString("KexiDBAutoField_KexiDBCheckBox:")+name()); + newSubwidget = new KexiDBCheckBox(dataSource(), this, TQCString("KexiDBAutoField_KexiDBCheckBox:")+name()); break; case Image: - newSubwidget = new KexiDBImageBox(d->designMode, this, QCString("KexiDBAutoField_KexiDBImageBox:")+name()); + newSubwidget = new KexiDBImageBox(d->designMode, this, TQCString("KexiDBAutoField_KexiDBImageBox:")+name()); break; case ComboBox: - newSubwidget = new KexiDBComboBox(this, QCString("KexiDBAutoField_KexiDBComboBox:")+name(), d->designMode); + newSubwidget = new KexiDBComboBox(this, TQCString("KexiDBAutoField_KexiDBComboBox:")+name(), d->designMode); break; default: newSubwidget = 0; @@ -176,7 +176,7 @@ KexiDBAutoField::createEditor() setSubwidget( newSubwidget ); //this will also allow to declare subproperties, see KFormDesigner::WidgetWithSubpropertiesInterface if(newSubwidget) { - newSubwidget->setName( QCString("KexiDBAutoField_") + newSubwidget->className() ); + newSubwidget->setName( TQCString("KexiDBAutoField_") + newSubwidget->className() ); dynamic_cast<KexiDataItemInterface*>(newSubwidget)->setParentDataItemInterface(this); dynamic_cast<KexiFormDataItemInterface*>(newSubwidget) ->setColumnInfo(columnInfo()); //needed at least by KexiDBImageBox @@ -190,11 +190,11 @@ KexiDBAutoField::createEditor() newSubwidget->setFocusPolicy(focusPolicy()); } else {//if focusPolicy is not changed at top level, inherit it from editor - QWidget::setFocusPolicy(newSubwidget->focusPolicy()); + TQWidget::setFocusPolicy(newSubwidget->focusPolicy()); } setFocusProxy(newSubwidget); //ok? - if (parentWidget()) - newSubwidget->setPalette( qApp->palette() ); + if (tqparentWidget()) + newSubwidget->setPalette( tqApp->palette() ); copyPropertiesToEditor(); // KFormDesigner::installRecursiveEventFilter(newSubwidget, this); } @@ -207,12 +207,12 @@ void KexiDBAutoField::copyPropertiesToEditor() if (m_subwidget) { // kdDebug() << "KexiDBAutoField::copyPropertiesToEditor(): base col: " << d->baseColor.name() << // "; text col: " << d->textColor.name() << endl; - QPalette p( m_subwidget->palette() ); - p.setColor( QPalette::Active, QColorGroup::Base, d->baseColor ); + TQPalette p( m_subwidget->palette() ); + p.setColor( TQPalette::Active, TQColorGroup::Base, d->baseColor ); if(d->widgetType == Boolean) - p.setColor( QPalette::Active, QColorGroup::Foreground, d->textColor ); + p.setColor( TQPalette::Active, TQColorGroup::Foreground, d->textColor ); else - p.setColor( QPalette::Active, QColorGroup::Text, d->textColor ); + p.setColor( TQPalette::Active, TQColorGroup::Text, d->textColor ); m_subwidget->setPalette(p); //m_subwidget->setPaletteBackgroundColor( d->baseColor ); } @@ -222,30 +222,30 @@ void KexiDBAutoField::setLabelPosition(LabelPosition position) { d->lblPosition = position; - if(d->layout) { - QBoxLayout *lyr = d->layout; - d->layout = 0; + if(d->tqlayout) { + TQBoxLayout *lyr = d->tqlayout; + d->tqlayout = 0; delete lyr; } if(m_subwidget) m_subwidget->show(); - //! \todo support right-to-left layout where positions are inverted + //! \todo support right-to-left tqlayout where positions are inverted if (position==Top || position==Left) { - int align = d->label->alignment(); + int align = d->label->tqalignment(); if(position == Top) { - d->layout = (QBoxLayout*) new QVBoxLayout(this); + d->tqlayout = (TQBoxLayout*) new TQVBoxLayout(this); align |= AlignVertical_Mask; align ^= AlignVertical_Mask; align |= AlignTop; } else { - d->layout = (QBoxLayout*) new QHBoxLayout(this); + d->tqlayout = (TQBoxLayout*) new TQHBoxLayout(this); align |= AlignVertical_Mask; align ^= AlignVertical_Mask; align |= AlignVCenter; } - d->label->setAlignment(align); + d->label->tqsetAlignment(align); if(d->widgetType == Boolean || (d->widgetType == Auto && fieldTypeInternal() == KexiDB::Field::InvalidType && !d->designMode)) { @@ -254,55 +254,55 @@ KexiDBAutoField::setLabelPosition(LabelPosition position) else { d->label->show(); } - d->layout->addWidget(d->label, 0, position == Top ? int(Qt::AlignLeft) : 0); + d->tqlayout->addWidget(d->label, 0, position == Top ? int(TQt::AlignLeft) : 0); if(position == Left && d->widgetType != Boolean) - d->layout->addSpacing(KexiDBAutoField_SPACING); - d->layout->addWidget(m_subwidget, 1); - KexiSubwidgetInterface *subwidgetInterface = dynamic_cast<KexiSubwidgetInterface*>((QWidget*)m_subwidget); + d->tqlayout->addSpacing(KexiDBAutoField_SPACING); + d->tqlayout->addWidget(m_subwidget, 1); + KexiSubwidgetInterface *subwidgetInterface = dynamic_cast<KexiSubwidgetInterface*>((TQWidget*)m_subwidget); if (subwidgetInterface) { if (subwidgetInterface->appendStretchRequired(this)) - d->layout->addStretch(0); + d->tqlayout->addStretch(0); if (subwidgetInterface->subwidgetStretchRequired(this)) { - QSizePolicy sizePolicy( m_subwidget->sizePolicy() ); + TQSizePolicy sizePolicy( m_subwidget->tqsizePolicy() ); if(position == Left) { - sizePolicy.setHorData( QSizePolicy::Minimum ); - d->label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + sizePolicy.setHorData( TQSizePolicy::Minimum ); + d->label->tqsetSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Preferred); } else { - sizePolicy.setVerData( QSizePolicy::Minimum ); - d->label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + sizePolicy.setVerData( TQSizePolicy::Minimum ); + d->label->tqsetSizePolicy(TQSizePolicy::Preferred, TQSizePolicy::Fixed); } - m_subwidget->setSizePolicy(sizePolicy); + m_subwidget->tqsetSizePolicy(sizePolicy); } } // if(m_subwidget) - // m_subwidget->setSizePolicy(...); + // m_subwidget->tqsetSizePolicy(...); } else { - d->layout = (QBoxLayout*) new QHBoxLayout(this); + d->tqlayout = (TQBoxLayout*) new TQHBoxLayout(this); d->label->hide(); - d->layout->addWidget(m_subwidget); + d->tqlayout->addWidget(m_subwidget); } - //a hack to force layout to be refreshed (any better idea for this?) - resize(size()+QSize(1,0)); - resize(size()-QSize(1,0)); - if (dynamic_cast<KexiDBAutoField*>((QWidget*)m_subwidget)) { + //a hack to force tqlayout to be refreshed (any better idea for this?) + resize(size()+TQSize(1,0)); + resize(size()-TQSize(1,0)); + if (dynamic_cast<KexiDBAutoField*>((TQWidget*)m_subwidget)) { //needed for KexiDBComboBox - dynamic_cast<KexiDBAutoField*>((QWidget*)m_subwidget)->setLabelPosition(position); + dynamic_cast<KexiDBAutoField*>((TQWidget*)m_subwidget)->setLabelPosition(position); } } void -KexiDBAutoField::setInvalidState( const QString &text ) +KexiDBAutoField::setInvalidState( const TQString &text ) { - // Widget with an invalid dataSource is just a QLabel + // Widget with an invalid dataSource is just a TQLabel if (d->designMode) return; d->widgetType = Auto; createEditor(); - setFocusPolicy(QWidget::NoFocus); + setFocusPolicy(TQ_NoFocus); if (m_subwidget) - m_subwidget->setFocusPolicy(QWidget::NoFocus); + m_subwidget->setFocusPolicy(TQ_NoFocus); //! @todo or set this to editor's text? d->label->setText( text ); } @@ -310,7 +310,7 @@ KexiDBAutoField::setInvalidState( const QString &text ) bool KexiDBAutoField::isReadOnly() const { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) return iface->isReadOnly(); else @@ -320,33 +320,33 @@ KexiDBAutoField::isReadOnly() const void KexiDBAutoField::setReadOnly( bool readOnly ) { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) iface->setReadOnly(readOnly); } void -KexiDBAutoField::setValueInternal(const QVariant& add, bool removeOld) +KexiDBAutoField::setValueInternal(const TQVariant& add, bool removeOld) { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) iface->setValue(m_origValue, add, removeOld); // iface->setValueInternal(add, removeOld); } -QVariant +TQVariant KexiDBAutoField::value() { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) return iface->value(); - return QVariant(); + return TQVariant(); } bool KexiDBAutoField::valueIsNull() { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) return iface->valueIsNull(); return true; @@ -355,7 +355,7 @@ KexiDBAutoField::valueIsNull() bool KexiDBAutoField::valueIsEmpty() { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) return iface->valueIsEmpty(); return true; @@ -364,7 +364,7 @@ KexiDBAutoField::valueIsEmpty() bool KexiDBAutoField::valueIsValid() { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) return iface->valueIsValid(); return true; @@ -373,7 +373,7 @@ KexiDBAutoField::valueIsValid() bool KexiDBAutoField::valueChanged() { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); kexipluginsdbg << m_origValue << endl; if(iface) return iface->valueChanged(); @@ -384,7 +384,7 @@ void KexiDBAutoField::installListener(KexiDataItemChangesListener* listener) { KexiFormDataItemInterface::installListener(listener); - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) iface->installListener(listener); } @@ -399,7 +399,7 @@ KexiDBAutoField::LabelPosition KexiDBAutoField::labelPosition() const return d->lblPosition; } -QString KexiDBAutoField::caption() const +TQString KexiDBAutoField::caption() const { return d->caption; } @@ -409,12 +409,12 @@ bool KexiDBAutoField::hasAutoCaption() const return d->autoCaption; } -QWidget* KexiDBAutoField::editor() const +TQWidget* KexiDBAutoField::editor() const { return m_subwidget; } -QLabel* KexiDBAutoField::label() const +TQLabel* KexiDBAutoField::label() const { return d->label; } @@ -424,7 +424,7 @@ int KexiDBAutoField::fieldTypeInternal() const return d->fieldTypeInternal; } -QString KexiDBAutoField::fieldCaptionInternal() const +TQString KexiDBAutoField::fieldCaptionInternal() const { return d->fieldCaptionInternal; } @@ -432,7 +432,7 @@ QString KexiDBAutoField::fieldCaptionInternal() const bool KexiDBAutoField::cursorAtStart() { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) return iface->cursorAtStart(); return false; @@ -441,7 +441,7 @@ KexiDBAutoField::cursorAtStart() bool KexiDBAutoField::cursorAtEnd() { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) return iface->cursorAtEnd(); return false; @@ -450,7 +450,7 @@ KexiDBAutoField::cursorAtEnd() void KexiDBAutoField::clear() { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) iface->clear(); } @@ -480,11 +480,11 @@ KexiDBAutoField::setFieldTypeInternal(int kexiDBFieldType) } void -KexiDBAutoField::setFieldCaptionInternal(const QString& text) +KexiDBAutoField::setFieldCaptionInternal(const TQString& text) { d->fieldCaptionInternal = text; //change text only if autocaption is set and no columnInfo is available - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if((!iface || !iface->columnInfo()) && d->autoCaption) { changeText(d->fieldCaptionInternal); } @@ -522,7 +522,7 @@ KexiDBAutoField::setColumnInfoInternal(KexiDB::QueryColumnInfo* cinfo, KexiDB::Q // update label's text changeText((cinfo && d->autoCaption) ? cinfo->captionOrAliasOrName() : d->caption); - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) iface->setColumnInfo(visibleColumnInfo); } @@ -564,15 +564,15 @@ KexiDBAutoField::widgetTypeForFieldType(KexiDB::Field::Type type) } void -KexiDBAutoField::changeText(const QString &text, bool beautify) +KexiDBAutoField::changeText(const TQString &text, bool beautify) { - QString realText; + TQString realText; bool unbound = false; if (d->autoCaption && (d->widgetType==Auto || dataSource().isEmpty())) { if (d->designMode) - realText = QString::fromLatin1(name())+" "+i18n("Unbound Auto Field", "(unbound)"); + realText = TQString::tqfromLatin1(name())+" "+i18n("Unbound Auto Field", "(unbound)"); else - realText = QString::null; + realText = TQString(); unbound = true; } else { @@ -584,7 +584,7 @@ KexiDBAutoField::changeText(const QString &text, bool beautify) realText = text[0].upper() + text.mid(1); if (d->widgetType!=Boolean) { //! @todo ":" suffix looks weird for checkbox; remove this condition when [x] is displayed _after_ label -//! @todo support right-to-left layout where position of ":" is inverted +//! @todo support right-to-left tqlayout where position of ":" is inverted realText += ": "; } } @@ -594,12 +594,12 @@ KexiDBAutoField::changeText(const QString &text, bool beautify) } if (unbound) - d->label->setAlignment( Qt::AlignCenter | Qt::WordBreak ); + d->label->tqsetAlignment( TQt::AlignCenter | TQt::WordBreak ); else - d->label->setAlignment( Qt::AlignCenter ); -// QWidget* widgetToAlterForegroundColor; + d->label->tqsetAlignment( TQt::AlignCenter ); +// TQWidget* widgetToAlterForegroundColor; if(d->widgetType == Boolean) { - static_cast<QCheckBox*>((QWidget*)m_subwidget)->setText(realText); + static_cast<TQCheckBox*>((TQWidget*)m_subwidget)->setText(realText); // widgetToAlterForegroundColor = m_subwidget; } else { @@ -617,7 +617,7 @@ KexiDBAutoField::changeText(const QString &text, bool beautify) } void -KexiDBAutoField::setCaption(const QString &caption) +KexiDBAutoField::setCaption(const TQString &caption) { d->caption = caption; if(!d->autoCaption && !caption.isEmpty()) @@ -629,7 +629,7 @@ KexiDBAutoField::setAutoCaption(bool autoCaption) { d->autoCaption = autoCaption; if(d->autoCaption) { - //d->caption = QString::null; + //d->caption = TQString(); if(columnInfo()) { changeText(columnInfo()->captionOrAliasOrName()); } @@ -642,35 +642,35 @@ KexiDBAutoField::setAutoCaption(bool autoCaption) } void -KexiDBAutoField::setDataSource( const QString &ds ) { +KexiDBAutoField::setDataSource( const TQString &ds ) { KexiFormDataItemInterface::setDataSource(ds); if (ds.isEmpty()) { setColumnInfo(0); } } -QSize -KexiDBAutoField::sizeHint() const +TQSize +KexiDBAutoField::tqsizeHint() const { if (d->lblPosition == NoLabel) - return m_subwidget ? m_subwidget->sizeHint() : QWidget::sizeHint(); + return m_subwidget ? m_subwidget->tqsizeHint() : TQWidget::tqsizeHint(); - QSize s1(0,0); + TQSize s1(0,0); if (m_subwidget) - s1 = m_subwidget->sizeHint(); - QSize s2(d->label->sizeHint()); + s1 = m_subwidget->tqsizeHint(); + TQSize s2(d->label->tqsizeHint()); if (d->lblPosition == Top) - return QSize(QMAX(s1.width(), s2.width()), s1.height()+KexiDBAutoField_SPACING+s2.height()); + return TQSize(TQMAX(s1.width(), s2.width()), s1.height()+KexiDBAutoField_SPACING+s2.height()); //left - return QSize(s1.width()+KexiDBAutoField_SPACING+s2.width(), QMAX(s1.height(), s2.height())); + return TQSize(s1.width()+KexiDBAutoField_SPACING+s2.width(), TQMAX(s1.height(), s2.height())); } void -KexiDBAutoField::setFocusPolicy( FocusPolicy policy ) +KexiDBAutoField::setFocusPolicy( TQ_FocusPolicy policy ) { d->focusPolicyChanged = true; - QWidget::setFocusPolicy(policy); + TQWidget::setFocusPolicy(policy); d->label->setFocusPolicy(policy); if (m_subwidget) m_subwidget->setFocusPolicy(policy); @@ -682,31 +682,31 @@ KexiDBAutoField::updateInformationAboutUnboundField() if ( (d->autoCaption && (dataSource().isEmpty() || dataSourceMimeType().isEmpty())) || (!d->autoCaption && d->caption.isEmpty()) ) { - d->label->setText( QString::fromLatin1(name())+" "+i18n("Unbound Auto Field", " (unbound)") ); + d->label->setText( TQString::tqfromLatin1(name())+" "+i18n("Unbound Auto Field", " (unbound)") ); } // else -// d->label->setText( QString::fromLatin1(name())+" "+i18n(" (unbound)") ); +// d->label->setText( TQString::tqfromLatin1(name())+" "+i18n(" (unbound)") ); } /*void -KexiDBAutoField::paintEvent( QPaintEvent* pe ) +KexiDBAutoField::paintEvent( TQPaintEvent* pe ) { - QWidget::paintEvent( pe ); + TQWidget::paintEvent( pe ); if ( (d->autoCaption && (dataSource().isEmpty() || dataSourceMimeType().isEmpty())) || (!d->autoCaption && d->caption.isEmpty()) ) { - QPainter p(this); + TQPainter p(this); p.setPen( d->label->paletteForegroundColor() ); p.setClipRect(pe->rect()); p.setFont(d->label->font()); - p.drawText(rect(), Qt::AlignLeft | Qt::WordBreak, - QString::fromLatin1(name())+" "+i18n(" (unbound)")); + p.drawText(rect(), TQt::AlignLeft | TQt::WordBreak, + TQString::tqfromLatin1(name())+" "+i18n(" (unbound)")); } }*/ void -KexiDBAutoField::paletteChange( const QPalette& oldPal ) +KexiDBAutoField::paletteChange( const TQPalette& oldPal ) { Q_UNUSED(oldPal); d->label->setPalette( palette() ); @@ -714,35 +714,35 @@ KexiDBAutoField::paletteChange( const QPalette& oldPal ) void KexiDBAutoField::unsetPalette() { - QWidget::unsetPalette(); + TQWidget::unsetPalette(); } // ===== methods below are just proxies for the internal editor or label ===== -const QColor & KexiDBAutoField::paletteForegroundColor() const +const TQColor & KexiDBAutoField::paletteForegroundColor() const { return d->textColor; } -void KexiDBAutoField::setPaletteForegroundColor( const QColor & color ) +void KexiDBAutoField::setPaletteForegroundColor( const TQColor & color ) { d->textColor = color; copyPropertiesToEditor(); } -const QColor & KexiDBAutoField::paletteBackgroundColor() const +const TQColor & KexiDBAutoField::paletteBackgroundColor() const { return d->baseColor; } -void KexiDBAutoField::setPaletteBackgroundColor( const QColor & color ) +void KexiDBAutoField::setPaletteBackgroundColor( const TQColor & color ) { d->baseColor = color; copyPropertiesToEditor(); } -const QColor & KexiDBAutoField::foregroundLabelColor() const +const TQColor & KexiDBAutoField::foregroundLabelColor() const { if(d->widgetType == Boolean) return paletteForegroundColor(); @@ -750,17 +750,17 @@ const QColor & KexiDBAutoField::foregroundLabelColor() const return d->label->paletteForegroundColor(); } -void KexiDBAutoField::setForegroundLabelColor( const QColor & color ) +void KexiDBAutoField::setForegroundLabelColor( const TQColor & color ) { if(d->widgetType == Boolean) setPaletteForegroundColor(color); else { d->label->setPaletteForegroundColor(color); - QWidget::setPaletteForegroundColor(color); + TQWidget::setPaletteForegroundColor(color); } } -const QColor & KexiDBAutoField::backgroundLabelColor() const +const TQColor & KexiDBAutoField::backgroundLabelColor() const { if(d->widgetType == Boolean) return paletteBackgroundColor(); @@ -768,76 +768,76 @@ const QColor & KexiDBAutoField::backgroundLabelColor() const return d->label->paletteBackgroundColor(); } -void KexiDBAutoField::setBackgroundLabelColor( const QColor & color ) +void KexiDBAutoField::setBackgroundLabelColor( const TQColor & color ) { if(d->widgetType == Boolean) setPaletteBackgroundColor(color); else { d->label->setPaletteBackgroundColor(color); - QWidget::setPaletteBackgroundColor(color); + TQWidget::setPaletteBackgroundColor(color); } // if (m_subwidget) -// m_subwidget->setPalette( qApp->palette() ); +// m_subwidget->setPalette( tqApp->palette() ); } -QVariant KexiDBAutoField::property( const char * name ) const +TQVariant KexiDBAutoField::property( const char * name ) const { bool ok; - QVariant val = KFormDesigner::WidgetWithSubpropertiesInterface::subproperty(name, ok); + TQVariant val = KFormDesigner::WidgetWithSubpropertiesInterface::subproperty(name, ok); if (ok) return val; - return QWidget::property(name); + return TQWidget::property(name); } -bool KexiDBAutoField::setProperty( const char * name, const QVariant & value ) +bool KexiDBAutoField::setProperty( const char * name, const TQVariant & value ) { bool ok = KFormDesigner::WidgetWithSubpropertiesInterface::setSubproperty(name, value); if (ok) return true; - return QWidget::setProperty(name, value); + return TQWidget::setProperty(name, value); } -bool KexiDBAutoField::eventFilter( QObject *o, QEvent *e ) +bool KexiDBAutoField::eventFilter( TQObject *o, TQEvent *e ) { - if (o==d->label && d->label->buddy() && e->type()==QEvent::MouseButtonRelease) { + if (TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(d->label) && d->label->buddy() && e->type()==TQEvent::MouseButtonRelease) { //focus label's buddy when user clicked the label d->label->buddy()->setFocus(); } - return QWidget::eventFilter(o, e); + return TQWidget::eventFilter(o, e); } -void KexiDBAutoField::setDisplayDefaultValue(QWidget* widget, bool displayDefaultValue) +void KexiDBAutoField::setDisplayDefaultValue(TQWidget* widget, bool displayDefaultValue) { KexiFormDataItemInterface::setDisplayDefaultValue(widget, displayDefaultValue); - if (dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget)) - dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget)->setDisplayDefaultValue(m_subwidget, displayDefaultValue); + if (dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget)) + dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget)->setDisplayDefaultValue(m_subwidget, displayDefaultValue); } void KexiDBAutoField::moveCursorToEnd() { - KexiDataItemInterface *iface = dynamic_cast<KexiDataItemInterface*>((QWidget*)m_subwidget); + KexiDataItemInterface *iface = dynamic_cast<KexiDataItemInterface*>((TQWidget*)m_subwidget); if (iface) iface->moveCursorToEnd(); } void KexiDBAutoField::moveCursorToStart() { - KexiDataItemInterface *iface = dynamic_cast<KexiDataItemInterface*>((QWidget*)m_subwidget); + KexiDataItemInterface *iface = dynamic_cast<KexiDataItemInterface*>((TQWidget*)m_subwidget); if (iface) iface->moveCursorToStart(); } void KexiDBAutoField::selectAll() { - KexiDataItemInterface *iface = dynamic_cast<KexiDataItemInterface*>((QWidget*)m_subwidget); + KexiDataItemInterface *iface = dynamic_cast<KexiDataItemInterface*>((TQWidget*)m_subwidget); if (iface) iface->selectAll(); } -bool KexiDBAutoField::keyPressed(QKeyEvent *ke) +bool KexiDBAutoField::keyPressed(TQKeyEvent *ke) { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if (iface && iface->keyPressed(ke)) return true; return false; |