diff options
Diffstat (limited to 'kexi/plugins/forms/widgets')
35 files changed, 1449 insertions, 1433 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; diff --git a/kexi/plugins/forms/widgets/kexidbautofield.h b/kexi/plugins/forms/widgets/kexidbautofield.h index 981a0519..f13e701e 100644 --- a/kexi/plugins/forms/widgets/kexidbautofield.h +++ b/kexi/plugins/forms/widgets/kexidbautofield.h @@ -22,39 +22,40 @@ #ifndef KEXIDBAUTOFIELD_H #define KEXIDBAUTOFIELD_H -#include <qwidget.h> +#include <tqwidget.h> #include <kexidb/field.h> #include <formeditor/container.h> #include <formeditor/widgetwithsubpropertiesinterface.h> #include "kexiformdataiteminterface.h" -class QBoxLayout; -class QLabel; +class TQBoxLayout; +class TQLabel; //! Universal "Auto Field" widget for Kexi forms /*! It acts as a container for most data-aware widgets. */ class KEXIFORMUTILS_EXPORT KexiDBAutoField : - public QWidget, + public TQWidget, public KexiFormDataItemInterface, public KFormDesigner::DesignTimeDynamicChildWidgetHandler, public KFormDesigner::WidgetWithSubpropertiesInterface { Q_OBJECT -//'caption' is uncovered now Q_PROPERTY(QString labelCaption READ caption WRITE setCaption DESIGNABLE true) - Q_OVERRIDE(QString caption READ caption WRITE setCaption DESIGNABLE true) - Q_OVERRIDE(QColor paletteForegroundColor READ paletteForegroundColor WRITE setPaletteForegroundColor DESIGNABLE true RESET unsetPalette) - Q_OVERRIDE(QColor paletteBackgroundColor READ paletteBackgroundColor WRITE setPaletteBackgroundColor DESIGNABLE true RESET unsetPalette) - Q_PROPERTY(QColor foregroundLabelColor READ foregroundLabelColor WRITE setForegroundLabelColor DESIGNABLE true RESET unsetPalette) - Q_PROPERTY(QColor backgroundLabelColor READ backgroundLabelColor WRITE setBackgroundLabelColor DESIGNABLE true RESET unsetPalette) - Q_PROPERTY(bool autoCaption READ hasAutoCaption WRITE setAutoCaption DESIGNABLE true) - Q_PROPERTY(QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) - Q_PROPERTY(QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) - Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) - Q_PROPERTY(LabelPosition labelPosition READ labelPosition WRITE setLabelPosition DESIGNABLE true) - Q_PROPERTY(WidgetType widgetType READ widgetType WRITE setWidgetType DESIGNABLE true) + TQ_OBJECT +//'caption' is uncovered now TQ_PROPERTY(TQString labelCaption READ caption WRITE setCaption DESIGNABLE true) + TQ_OVERRIDE(TQString caption READ caption WRITE setCaption DESIGNABLE true) + TQ_OVERRIDE(TQColor paletteForegroundColor READ paletteForegroundColor WRITE setPaletteForegroundColor DESIGNABLE true RESET unsetPalette) + TQ_OVERRIDE(TQColor paletteBackgroundColor READ paletteBackgroundColor WRITE setPaletteBackgroundColor DESIGNABLE true RESET unsetPalette) + TQ_PROPERTY(TQColor foregroundLabelColor READ foregroundLabelColor WRITE setForegroundLabelColor DESIGNABLE true RESET unsetPalette) + TQ_PROPERTY(TQColor backgroundLabelColor READ backgroundLabelColor WRITE setBackgroundLabelColor DESIGNABLE true RESET unsetPalette) + TQ_PROPERTY(bool autoCaption READ hasAutoCaption WRITE setAutoCaption DESIGNABLE true) + TQ_PROPERTY(TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) + TQ_PROPERTY(TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) + TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) + TQ_PROPERTY(LabelPosition labelPosition READ labelPosition WRITE setLabelPosition DESIGNABLE true) + TQ_PROPERTY(WidgetType widgetType READ widgetType WRITE setWidgetType DESIGNABLE true) /*internal, for design time only*/ - Q_PROPERTY(int fieldTypeInternal READ fieldTypeInternal WRITE setFieldTypeInternal DESIGNABLE true STORED false) - Q_PROPERTY(QString fieldCaptionInternal READ fieldCaptionInternal WRITE setFieldCaptionInternal DESIGNABLE true STORED false) + TQ_PROPERTY(int fieldTypeInternal READ fieldTypeInternal WRITE setFieldTypeInternal DESIGNABLE true STORED false) + TQ_PROPERTY(TQString fieldCaptionInternal READ fieldCaptionInternal WRITE setFieldCaptionInternal DESIGNABLE true STORED false) Q_ENUMS( WidgetType LabelPosition ) public: @@ -62,24 +63,24 @@ class KEXIFORMUTILS_EXPORT KexiDBAutoField : MultiLineText, ComboBox, Image }; enum LabelPosition { Left = 300, Top, NoLabel }; - KexiDBAutoField(const QString &text, WidgetType type, LabelPosition pos, - QWidget *parent = 0, const char *name = 0, bool designMode = true); - KexiDBAutoField(QWidget *parent = 0, const char *name = 0, bool designMode = true, + KexiDBAutoField(const TQString &text, WidgetType type, LabelPosition pos, + TQWidget *tqparent = 0, const char *name = 0, bool designMode = true); + KexiDBAutoField(TQWidget *tqparent = 0, const char *name = 0, bool designMode = true, LabelPosition pos = Left); virtual ~KexiDBAutoField(); - inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); } - inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } - virtual void setDataSource( const QString &ds ); - virtual void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } + inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); } + inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } + virtual void setDataSource( const TQString &ds ); + virtual void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } virtual void setColumnInfo(KexiDB::QueryColumnInfo* cinfo); - virtual void setInvalidState(const QString& text); + virtual void setInvalidState(const TQString& text); virtual bool isReadOnly() const; virtual void setReadOnly( bool readOnly ); - virtual QVariant value(); + virtual TQVariant value(); virtual bool valueIsNull(); virtual bool valueIsEmpty(); virtual bool valueIsValid(); @@ -95,8 +96,8 @@ class KEXIFORMUTILS_EXPORT KexiDBAutoField : LabelPosition labelPosition() const; virtual void setLabelPosition(LabelPosition position); - QString caption() const; - void setCaption(const QString &caption); + TQString caption() const; + void setCaption(const TQString &caption); bool hasAutoCaption() const; void setAutoCaption(bool autoCaption); @@ -105,10 +106,10 @@ class KEXIFORMUTILS_EXPORT KexiDBAutoField : is displayed in a special way. Used by KexiFormDataProvider::fillDataItems(). \a widget is equal to 'this'. Reimplemented after KexiFormDataItemInterface. */ - virtual void setDisplayDefaultValue(QWidget* widget, bool displayDefaultValue); + virtual void setDisplayDefaultValue(TQWidget* widget, bool displayDefaultValue); - QWidget* editor() const; - QLabel* label() const; + TQWidget* editor() const; + TQLabel* label() const; virtual bool cursorAtStart(); virtual bool cursorAtEnd(); @@ -123,56 +124,56 @@ class KEXIFORMUTILS_EXPORT KexiDBAutoField : /*! On design time it is not possible to pass a reference to KexiDB::Field object so we're just providing field caption. Only used when widget type is Auto. @internal */ - void setFieldCaptionInternal(const QString& text); + void setFieldCaptionInternal(const TQString& text); /*! @internal */ int fieldTypeInternal() const; /*! @internal */ - QString fieldCaptionInternal() const; + TQString fieldCaptionInternal() const; - virtual QSize sizeHint() const; - virtual void setFocusPolicy ( FocusPolicy policy ); + virtual TQSize tqsizeHint() const; + virtual void setFocusPolicy ( TQ_FocusPolicy policy ); //! Reimplemented to return internal editor's color. - const QColor & paletteForegroundColor() const; + const TQColor & paletteForegroundColor() const; //! Reimplemented to set internal editor's color. - void setPaletteForegroundColor( const QColor & color ); + void setPaletteForegroundColor( const TQColor & color ); //! Reimplemented to return internal editor's color. - const QColor & paletteBackgroundColor() const; + const TQColor & paletteBackgroundColor() const; //! Reimplemented to set internal editor's color. - virtual void setPaletteBackgroundColor( const QColor & color ); + virtual void setPaletteBackgroundColor( const TQColor & color ); //! \return label's foreground color - const QColor & foregroundLabelColor() const; + const TQColor & foregroundLabelColor() const; //! Sets label's foreground color - virtual void setForegroundLabelColor( const QColor & color ); + virtual void setForegroundLabelColor( const TQColor & color ); //! \return label's background color - const QColor & backgroundLabelColor() const; + const TQColor & backgroundLabelColor() const; //! Sets label's background color - virtual void setBackgroundLabelColor( const QColor & color ); + virtual void setBackgroundLabelColor( const TQColor & color ); //! Reimplemented to accept subproperties. @see KFormDesigner::WidgetWithSubpropertiesInterface - virtual QVariant property( const char * name ) const; + virtual TQVariant property( const char * name ) const; //! Reimplemented to accept subproperties. @see KFormDesigner::WidgetWithSubpropertiesInterface - virtual bool setProperty( const char * name, const QVariant & value ); + virtual bool setProperty( const char * name, const TQVariant & value ); /*! Called by the top-level form on key press event to consume widget-specific shortcuts. */ - virtual bool keyPressed(QKeyEvent *ke); + virtual bool keyPressed(TQKeyEvent *ke); public slots: virtual void unsetPalette(); protected slots: // void slotValueChanged(); - virtual void paletteChange( const QPalette& oldPal ); + virtual void paletteChange( const TQPalette& oldPal ); //! Implemented for KexiDataItemInterface virtual void moveCursorToEnd(); @@ -184,17 +185,17 @@ class KEXIFORMUTILS_EXPORT KexiDBAutoField : virtual void selectAll(); protected: - virtual void setValueInternal(const QVariant&add, bool removeOld); - void init(const QString &text, WidgetType type, LabelPosition pos); + virtual void setValueInternal(const TQVariant&add, bool removeOld); + void init(const TQString &text, WidgetType type, LabelPosition pos); virtual void createEditor(); - void changeText(const QString &text, bool beautify = true); -// virtual void paintEvent( QPaintEvent* pe ); + void changeText(const TQString &text, bool beautify = true); +// virtual void paintEvent( TQPaintEvent* pe ); void updateInformationAboutUnboundField(); //! internal editor can be created too late, so certain properties should be copied void copyPropertiesToEditor(); - virtual bool eventFilter( QObject *o, QEvent *e ); + virtual bool eventFilter( TQObject *o, TQEvent *e ); //! Used by @ref setLabelPositionInternal(LabelPosition) void setLabelPositionInternal(LabelPosition position, bool noLabel); diff --git a/kexi/plugins/forms/widgets/kexidbcheckbox.cpp b/kexi/plugins/forms/widgets/kexidbcheckbox.cpp index 6b63851a..c704a985 100644 --- a/kexi/plugins/forms/widgets/kexidbcheckbox.cpp +++ b/kexi/plugins/forms/widgets/kexidbcheckbox.cpp @@ -23,29 +23,29 @@ #include <kexiutils/utils.h> #include <kexidb/queryschema.h> -KexiDBCheckBox::KexiDBCheckBox(const QString &text, QWidget *parent, const char *name) - : QCheckBox(text, parent, name), KexiFormDataItemInterface() +KexiDBCheckBox::KexiDBCheckBox(const TQString &text, TQWidget *tqparent, const char *name) + : TQCheckBox(text, tqparent, name), KexiFormDataItemInterface() , m_invalidState(false) , m_tristateChanged(false) , m_tristate(TristateDefault) { - setFocusPolicy(QWidget::StrongFocus); + setFocusPolicy(TQ_StrongFocus); updateTristate(); - connect(this, SIGNAL(stateChanged(int)), this, SLOT(slotStateChanged(int))); + connect(this, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(slotStateChanged(int))); } KexiDBCheckBox::~KexiDBCheckBox() { } -void KexiDBCheckBox::setInvalidState( const QString& displayText ) +void KexiDBCheckBox::setInvalidState( const TQString& displayText ) { setEnabled(false); setState(NoChange); m_invalidState = true; //! @todo move this to KexiDataItemInterface::setInvalidStateInternal() ? - if (focusPolicy() & TabFocus) - setFocusPolicy(QWidget::ClickFocus); + if (focusPolicy() & TQ_TabFocus) + setFocusPolicy(TQ_ClickFocus); setText(displayText); } @@ -54,7 +54,7 @@ KexiDBCheckBox::setEnabled(bool enabled) { if(enabled && m_invalidState) return; - QCheckBox::setEnabled(enabled); + TQCheckBox::setEnabled(enabled); } void @@ -63,7 +63,7 @@ KexiDBCheckBox::setReadOnly(bool readOnly) setEnabled(!readOnly); } -void KexiDBCheckBox::setValueInternal(const QVariant &add, bool removeOld) +void KexiDBCheckBox::setValueInternal(const TQVariant &add, bool removeOld) { Q_UNUSED(add); Q_UNUSED(removeOld); @@ -73,12 +73,12 @@ void KexiDBCheckBox::setValueInternal(const QVariant &add, bool removeOld) setState( m_origValue.toBool() ? On : Off ); } -QVariant +TQVariant KexiDBCheckBox::value() { if (state()==NoChange) - return QVariant(); - return QVariant(state()==On, 1); + return TQVariant(); + return TQVariant(state()==On, 1); } void KexiDBCheckBox::slotStateChanged(int ) @@ -101,7 +101,7 @@ bool KexiDBCheckBox::isReadOnly() const return !isEnabled(); } -QWidget* +TQWidget* KexiDBCheckBox::widget() { return this; @@ -146,29 +146,29 @@ void KexiDBCheckBox::updateTristate() { if (m_tristate == TristateDefault) { //! @todo the data source may be defined as NOT NULL... thus disallowing NULL state - QCheckBox::setTristate( !dataSource().isEmpty() ); + TQCheckBox::setTristate( !dataSource().isEmpty() ); } else { - QCheckBox::setTristate( m_tristate == TristateOn ); + TQCheckBox::setTristate( m_tristate == TristateOn ); } } -void KexiDBCheckBox::setDataSource(const QString &ds) +void KexiDBCheckBox::setDataSource(const TQString &ds) { KexiFormDataItemInterface::setDataSource(ds); updateTristate(); } -void KexiDBCheckBox::setDisplayDefaultValue(QWidget *widget, bool displayDefaultValue) +void KexiDBCheckBox::setDisplayDefaultValue(TQWidget *widget, bool displayDefaultValue) { KexiFormDataItemInterface::setDisplayDefaultValue(widget, displayDefaultValue); // initialize display parameters for default / entered value KexiDisplayUtils::DisplayParameters * const params = displayDefaultValue ? m_displayParametersForDefaultValue : m_displayParametersForEnteredValue; // setFont(params->font); - QPalette pal(palette()); -// pal.setColor(QPalette::Active, QColorGroup::Text, params->textColor); - pal.setColor(QPalette::Active, QColorGroup::Foreground, params->textColor); + TQPalette pal(palette()); +// pal.setColor(TQPalette::Active, TQColorGroup::Text, params->textColor); + pal.setColor(TQPalette::Active, TQColorGroup::Foreground, params->textColor); setPalette(pal); } diff --git a/kexi/plugins/forms/widgets/kexidbcheckbox.h b/kexi/plugins/forms/widgets/kexidbcheckbox.h index d4a68bf3..8a65f33a 100644 --- a/kexi/plugins/forms/widgets/kexidbcheckbox.h +++ b/kexi/plugins/forms/widgets/kexidbcheckbox.h @@ -22,25 +22,26 @@ #define KexiDBCheckBox_H #include "kexiformdataiteminterface.h" -#include <qcheckbox.h> +#include <tqcheckbox.h> //! @short A db-aware check box -class KEXIFORMUTILS_EXPORT KexiDBCheckBox : public QCheckBox, public KexiFormDataItemInterface +class KEXIFORMUTILS_EXPORT KexiDBCheckBox : public TQCheckBox, public KexiFormDataItemInterface { Q_OBJECT - Q_PROPERTY(QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) - Q_PROPERTY(QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) - Q_OVERRIDE( Tristate tristate READ isTristate WRITE setTristate ) + TQ_OBJECT + TQ_PROPERTY(TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) + TQ_PROPERTY(TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) + TQ_OVERRIDE( Tristate tristate READ isTristate WRITE setTristate ) Q_ENUMS( Tristate ) public: - KexiDBCheckBox(const QString &text, QWidget *parent, const char *name=0); + KexiDBCheckBox(const TQString &text, TQWidget *tqparent, const char *name=0); virtual ~KexiDBCheckBox(); - inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); } - inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } - virtual QVariant value(); - virtual void setInvalidState( const QString& displayText ); + inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); } + inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } + virtual TQVariant value(); + virtual void setInvalidState( const TQString& displayText ); //! \return true if editor's value is null (not empty) //! Used for checking if a given constraint within table of form is met. @@ -56,7 +57,7 @@ class KEXIFORMUTILS_EXPORT KexiDBCheckBox : public QCheckBox, public KexiFormDat virtual bool isReadOnly() const; /*! \return the view widget of this item, e.g. line edit widget. */ - virtual QWidget* widget(); + virtual TQWidget* widget(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); @@ -70,24 +71,24 @@ class KEXIFORMUTILS_EXPORT KexiDBCheckBox : public QCheckBox, public KexiFormDat Tristate isTristate() const; /*! Reimplemented after KexiFormDataItemInterface. */ - virtual void setDisplayDefaultValue(QWidget* widget, bool displayDefaultValue); + virtual void setDisplayDefaultValue(TQWidget* widget, bool displayDefaultValue); public slots: - void setDataSource(const QString &ds); - inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } + void setDataSource(const TQString &ds); + inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } void slotStateChanged(int state); //! This implementation just disables read only widget virtual void setReadOnly( bool readOnly ); protected: - virtual void setValueInternal(const QVariant& add, bool removeOld); + virtual void setValueInternal(const TQVariant& add, bool removeOld); //! \return true in isTristate() == TristateDefault and the widget has bound data source //! or if isTristate() == TristateOn, else false is returned. bool isTristateInternal() const; - //! Updates tristate in QCheckBox itself according to m_tristate. + //! Updates tristate in TQCheckBox itself according to m_tristate. void updateTristate(); private: diff --git a/kexi/plugins/forms/widgets/kexidbcombobox.cpp b/kexi/plugins/forms/widgets/kexidbcombobox.cpp index 19366a15..a908c2fd 100644 --- a/kexi/plugins/forms/widgets/kexidbcombobox.cpp +++ b/kexi/plugins/forms/widgets/kexidbcombobox.cpp @@ -25,12 +25,12 @@ #include <kdebug.h> #include <kapplication.h> -#include <qmetaobject.h> -#include <qpainter.h> -#include <qstyle.h> -#include <qdrawutil.h> -#include <qptrdict.h> -#include <qcursor.h> +#include <tqmetaobject.h> +#include <tqpainter.h> +#include <tqstyle.h> +#include <tqdrawutil.h> +#include <tqptrdict.h> +#include <tqcursor.h> #include <kexidb/queryschema.h> #include <widget/tableview/kexicomboboxpopup.h> @@ -58,11 +58,11 @@ class KexiDBComboBox::Private } KexiComboBoxPopup *popup; - KComboBox *paintedCombo; //!< fake combo used only to pass it as 'this' for QStyle (because styles use <static_cast>) - QSize sizeHint; //!< A cache for KexiDBComboBox::sizeHint(), + KComboBox *paintedCombo; //!< fake combo used only to pass it as 'this' for TQStyle (because styles use <static_cast>) + TQSize tqsizeHint; //!< A cache for KexiDBComboBox::tqsizeHint(), //!< rebuilt by KexiDBComboBox::fontChange() and KexiDBComboBox::styleChange() KexiDB::QueryColumnInfo* visibleColumnInfo; - QPtrDict<char> *subWidgetsWithDisabledEvents; //! used to collect subwidget and its children (if isEditable is false) + TQPtrDict<char> *subWidgetsWithDisabledEvents; //! used to collect subwidget and its tqchildren (if isEditable is false) bool isEditable : 1; //!< true is the combo box is editable bool buttonPressed : 1; bool mouseOver : 1; @@ -72,13 +72,13 @@ class KexiDBComboBox::Private //------------------------------------- -KexiDBComboBox::KexiDBComboBox(QWidget *parent, const char *name, bool designMode) - : KexiDBAutoField(parent, name, designMode, NoLabel) +KexiDBComboBox::KexiDBComboBox(TQWidget *tqparent, const char *name, bool designMode) + : KexiDBAutoField(tqparent, name, designMode, NoLabel) , KexiComboBoxBase() , d(new Private()) { setMouseTracking(true); - setFocusPolicy(WheelFocus); + setFocusPolicy(TQ_WheelFocus); installEventFilter(this); d->designMode = designMode; d->paintedCombo = new KComboBox(this); @@ -121,58 +121,58 @@ bool KexiDBComboBox::isEditable() const return d->isEditable; } -void KexiDBComboBox::paintEvent( QPaintEvent * ) +void KexiDBComboBox::paintEvent( TQPaintEvent * ) { - QPainter p( this ); - QColorGroup cg( palette().active() ); + TQPainter p( this ); + TQColorGroup cg( tqpalette().active() ); // if ( hasFocus() ) -// cg.setColor(QColorGroup::Base, cg.highlight()); +// cg.setColor(TQColorGroup::Base, cg.highlight()); // else - cg.setColor(QColorGroup::Base, paletteBackgroundColor()); //update base color using (reimplemented) bg color + cg.setColor(TQColorGroup::Base, paletteBackgroundColor()); //update base color using (reimplemented) bg color p.setPen(cg.text()); - QStyle::SFlags flags = QStyle::Style_Default; + TQStyle::SFlags flags = TQStyle::Style_Default; if (isEnabled()) - flags |= QStyle::Style_Enabled; + flags |= TQStyle::Style_Enabled; if (hasFocus()) - flags |= QStyle::Style_HasFocus; + flags |= TQStyle::Style_HasFocus; if (d->mouseOver) - flags |= QStyle::Style_MouseOver; + flags |= TQStyle::Style_MouseOver; if ( width() < 5 || height() < 5 ) { - qDrawShadePanel( &p, rect(), cg, FALSE, 2, &cg.brush( QColorGroup::Button ) ); + qDrawShadePanel( &p, rect(), cg, FALSE, 2, &cg.brush( TQColorGroup::Button ) ); return; } -//! @todo support reverse layout -//bool reverse = QApplication::reverseLayout(); - style().drawComplexControl( QStyle::CC_ComboBox, &p, d->paintedCombo /*this*/, rect(), cg, - flags, (uint)QStyle::SC_All, - (d->buttonPressed ? QStyle::SC_ComboBoxArrow : QStyle::SC_None ) +//! @todo support reverse tqlayout +//bool reverse = TQApplication::reverseLayout(); + tqstyle().tqdrawComplexControl( TQStyle::CC_ComboBox, &p, d->paintedCombo /*this*/, rect(), cg, + flags, (uint)TQStyle::SC_All, + (d->buttonPressed ? TQStyle::SC_ComboBoxArrow : TQStyle::SC_None ) ); if (d->isEditable) { //if editable, editor paints itself, nothing to do } else { //not editable: we need to paint the current item - QRect editorGeometry( this->editorGeometry() ); + TQRect editorGeometry( this->editorGeometry() ); if ( hasFocus() ) { - if (0==qstrcmp(style().name(), "windows")) //a hack - p.fillRect( editorGeometry, cg.brush( QColorGroup::Highlight ) ); - QRect r( QStyle::visualRect( style().subRect( QStyle::SR_ComboBoxFocusRect, d->paintedCombo ), this ) ); - r = QRect(r.left()-1, r.top()-1, r.width()+2, r.height()+2); //enlare by 1 pixel each side to avoid covering by the subwidget - style().drawPrimitive( QStyle::PE_FocusRect, &p, - r, cg, flags | QStyle::Style_FocusAtBorder, QStyleOption(cg.highlight())); + if (0==qstrcmp(tqstyle().name(), "windows")) //a hack + p.fillRect( editorGeometry, cg.brush( TQColorGroup::Highlight ) ); + TQRect r( TQStyle::tqvisualRect( tqstyle().subRect( TQStyle::SR_ComboBoxFocusRect, d->paintedCombo ), this ) ); + r = TQRect(r.left()-1, r.top()-1, r.width()+2, r.height()+2); //enlare by 1 pixel each side to avoid covering by the subwidget + tqstyle().tqdrawPrimitive( TQStyle::PE_FocusRect, &p, + r, cg, flags | TQStyle::Style_FocusAtBorder, TQStyleOption(cg.highlight())); } //todo } } -QRect KexiDBComboBox::editorGeometry() const +TQRect KexiDBComboBox::editorGeometry() const { - QRect r( QStyle::visualRect( - style().querySubControlMetrics(QStyle::CC_ComboBox, d->paintedCombo, - QStyle::SC_ComboBoxEditField), d->paintedCombo ) ); + TQRect r( TQStyle::tqvisualRect( + tqstyle().querySubControlMetrics(TQStyle::CC_ComboBox, d->paintedCombo, + TQStyle::SC_ComboBoxEditField), d->paintedCombo ) ); //if ((height()-r.bottom())<6) // r.setBottom(height()-6); @@ -185,20 +185,20 @@ void KexiDBComboBox::createEditor() if (m_subwidget) { m_subwidget->setGeometry( editorGeometry() ); if (!d->isEditable) { - m_subwidget->setCursor(QCursor(Qt::ArrowCursor)); // widgets like listedit have IbeamCursor, we don't want that -//! @todo Qt4: set transparent background, for now we're setting button color - QPalette subwidgetPalette( m_subwidget->palette() ); - subwidgetPalette.setColor(QPalette::Active, QColorGroup::Base, - subwidgetPalette.color(QPalette::Active, QColorGroup::Button)); + m_subwidget->setCursor(TQCursor(TQt::ArrowCursor)); // widgets like listedit have IbeamCursor, we don't want that +//! @todo TQt4: set transparent background, for now we're setting button color + TQPalette subwidgetPalette( m_subwidget->palette() ); + subwidgetPalette.setColor(TQPalette::Active, TQColorGroup::Base, + subwidgetPalette.color(TQPalette::Active, TQColorGroup::Button)); m_subwidget->setPalette( subwidgetPalette ); if (d->subWidgetsWithDisabledEvents) d->subWidgetsWithDisabledEvents->clear(); else - d->subWidgetsWithDisabledEvents = new QPtrDict<char>(); + d->subWidgetsWithDisabledEvents = new TQPtrDict<char>(); d->subWidgetsWithDisabledEvents->insert(m_subwidget, (char*)1); m_subwidget->installEventFilter(this); - QObjectList *l = m_subwidget->queryList( "QWidget" ); - for ( QObjectListIt it( *l ); it.current(); ++it ) { + TQObjectList *l = m_subwidget->queryList( TQWIDGET_OBJECT_NAME_STRING ); + for ( TQObjectListIt it( *l ); it.current(); ++it ) { d->subWidgetsWithDisabledEvents->insert(it.current(), (char*)1); it.current()->installEventFilter(this); } @@ -211,34 +211,34 @@ void KexiDBComboBox::createEditor() void KexiDBComboBox::setLabelPosition(LabelPosition position) { if(m_subwidget) { - if (-1 != m_subwidget->metaObject()->findProperty("frameShape", true)) - m_subwidget->setProperty("frameShape", QVariant((int)QFrame::NoFrame)); + if (-1 != m_subwidget->tqmetaObject()->tqfindProperty("frameShape", true)) + m_subwidget->setProperty("frameShape", TQVariant((int)TQFrame::NoFrame)); m_subwidget->setGeometry( editorGeometry() ); } -// KexiSubwidgetInterface *subwidgetInterface = dynamic_cast<KexiSubwidgetInterface*>((QWidget*)m_subwidget); +// KexiSubwidgetInterface *subwidgetInterface = dynamic_cast<KexiSubwidgetInterface*>((TQWidget*)m_subwidget); // update size policy // if (subwidgetInterface && subwidgetInterface->subwidgetStretchRequired(this)) { - QSizePolicy sizePolicy( this->sizePolicy() ); + TQSizePolicy sizePolicy( this->tqsizePolicy() ); if(position == Left) - sizePolicy.setHorData( QSizePolicy::Minimum ); + sizePolicy.setHorData( TQSizePolicy::Minimum ); else - sizePolicy.setVerData( QSizePolicy::Minimum ); - //m_subwidget->setSizePolicy(sizePolicy); - setSizePolicy(sizePolicy); + sizePolicy.setVerData( TQSizePolicy::Minimum ); + //m_subwidget->tqsetSizePolicy(sizePolicy); + tqsetSizePolicy(sizePolicy); //} // } } -QRect KexiDBComboBox::buttonGeometry() const +TQRect KexiDBComboBox::buttonGeometry() const { - QRect arrowRect( - style().querySubControlMetrics( QStyle::CC_ComboBox, d->paintedCombo, QStyle::SC_ComboBoxArrow) ); - arrowRect = QStyle::visualRect(arrowRect, d->paintedCombo); - arrowRect.setHeight( QMAX( height() - (2 * arrowRect.y()), arrowRect.height() ) ); // a fix for Motif style + TQRect arrowRect( + tqstyle().querySubControlMetrics( TQStyle::CC_ComboBox, d->paintedCombo, TQStyle::SC_ComboBoxArrow) ); + arrowRect = TQStyle::tqvisualRect(arrowRect, d->paintedCombo); + arrowRect.setHeight( TQMAX( height() - (2 * arrowRect.y()), arrowRect.height() ) ); // a fix for Motif style return arrowRect; } -bool KexiDBComboBox::handleMousePressEvent(QMouseEvent *e) +bool KexiDBComboBox::handleMousePressEvent(TQMouseEvent *e) { if ( e->button() != Qt::LeftButton || d->designMode ) return true; @@ -247,19 +247,19 @@ bool KexiDBComboBox::handleMousePressEvent(QMouseEvent *e) return; }*/ - if ( /*count() &&*/ ( !isEditable() || buttonGeometry().contains( e->pos() ) ) ) { + if ( /*count() &&*/ ( !isEditable() || buttonGeometry().tqcontains( e->pos() ) ) ) { d->buttonPressed = false; /* if ( d->usingListBox() ) { listBox()->blockSignals( TRUE ); - qApp->sendEvent( listBox(), e ); // trigger the listbox's autoscroll + tqApp->sendEvent( listBox(), e ); // trigger the listbox's autoscroll listBox()->setCurrentItem(d->current); listBox()->blockSignals( FALSE ); popup(); - if ( arrowRect.contains( e->pos() ) ) { + if ( arrowRect.tqcontains( e->pos() ) ) { d->arrowPressed = TRUE; d->arrowDown = TRUE; - repaint( FALSE ); + tqrepaint( FALSE ); } } else {*/ showPopup(); @@ -268,12 +268,12 @@ bool KexiDBComboBox::handleMousePressEvent(QMouseEvent *e) return false; } -bool KexiDBComboBox::handleKeyPressEvent(QKeyEvent *ke) +bool KexiDBComboBox::handleKeyPressEvent(TQKeyEvent *ke) { const int k = ke->key(); - const bool dropDown = (ke->state() == Qt::NoButton && ((k==Qt::Key_F2 && !d->isEditable) || k==Qt::Key_F4)) - || (ke->state() == Qt::AltButton && k==Qt::Key_Down); - const bool escPressed = ke->state() == Qt::NoButton && k==Qt::Key_Escape; + const bool dropDown = (ke->state() == Qt::NoButton && ((k==TQt::Key_F2 && !d->isEditable) || k==TQt::Key_F4)) + || (ke->state() == TQt::AltButton && k==TQt::Key_Down); + const bool escPressed = ke->state() == Qt::NoButton && k==TQt::Key_Escape; const bool popupVisible = popup() && popup()->isVisible(); if ((dropDown || escPressed) && popupVisible) { popup()->hide(); @@ -285,7 +285,7 @@ bool KexiDBComboBox::handleKeyPressEvent(QKeyEvent *ke) return true; } else if (popupVisible) { - 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*/) { acceptPopupSelection(); return true; @@ -296,91 +296,91 @@ bool KexiDBComboBox::handleKeyPressEvent(QKeyEvent *ke) return false; } -bool KexiDBComboBox::keyPressed(QKeyEvent *ke) +bool KexiDBComboBox::keyPressed(TQKeyEvent *ke) { if (KexiDBAutoField::keyPressed(ke)) return true; const int k = ke->key(); const bool popupVisible = popup() && popup()->isVisible(); - const bool escPressed = ke->state() == Qt::NoButton && k==Qt::Key_Escape; + const bool escPressed = ke->state() == Qt::NoButton && k==TQt::Key_Escape; if (escPressed && popupVisible) { popup()->hide(); return true; } - if (ke->state() == Qt::NoButton && (k==Qt::Key_PageDown || k==Qt::Key_PageUp) && popupVisible) + if (ke->state() == Qt::NoButton && (k==TQt::Key_PageDown || k==TQt::Key_PageUp) && popupVisible) return true; return false; } -void KexiDBComboBox::mousePressEvent( QMouseEvent *e ) +void KexiDBComboBox::mousePressEvent( TQMouseEvent *e ) { if (handleMousePressEvent(e)) return; -// QTimer::singleShot( 200, this, SLOT(internalClickTimeout())); +// TQTimer::singleShot( 200, this, TQT_SLOT(internalClickTimeout())); // d->shortClick = TRUE; // } KexiDBAutoField::mousePressEvent( e ); } -void KexiDBComboBox::mouseDoubleClickEvent( QMouseEvent *e ) +void KexiDBComboBox::mouseDoubleClickEvent( TQMouseEvent *e ) { mousePressEvent( e ); } -bool KexiDBComboBox::eventFilter( QObject *o, QEvent *e ) +bool KexiDBComboBox::eventFilter( TQObject *o, TQEvent *e ) { - if (o==this) { - if (e->type()==QEvent::Resize) { + if (TQT_BASE_OBJECT(o)==TQT_BASE_OBJECT(this)) { + if (e->type()==TQEvent::Resize) { d->paintedCombo->resize(size()); if (m_subwidget) m_subwidget->setGeometry( editorGeometry() ); } - else if (e->type()==QEvent::Enter) { + else if (e->type()==TQEvent::Enter) { if (!d->isEditable - || /*over button if editable combo*/buttonGeometry().contains( static_cast<QMouseEvent*>(e)->pos() )) + || /*over button if editable combo*/buttonGeometry().tqcontains( TQT_TQMOUSEEVENT(e)->pos() )) { d->mouseOver = true; update(); } } - else if (e->type()==QEvent::MouseMove) { + else if (e->type()==TQEvent::MouseMove) { if (d->isEditable) { - const bool overButton = buttonGeometry().contains( static_cast<QMouseEvent*>(e)->pos() ); + const bool overButton = buttonGeometry().tqcontains( TQT_TQMOUSEEVENT(e)->pos() ); if (overButton != d->mouseOver) { d->mouseOver = overButton; update(); } } } - else if (e->type()==QEvent::Leave) { + else if (e->type()==TQEvent::Leave) { d->mouseOver = false; update(); } - else if (e->type()==QEvent::KeyPress) { + else if (e->type()==TQEvent::KeyPress) { // handle F2/F4 - if (handleKeyPressEvent(static_cast<QKeyEvent*>(e))) + if (handleKeyPressEvent(TQT_TQKEYEVENT(e))) return true; } - else if (e->type()==QEvent::FocusOut) { + else if (e->type()==TQEvent::FocusOut) { if (popup() && popup()->isVisible()) { popup()->hide(); undoChanges(); } } } - else if (!d->isEditable && d->subWidgetsWithDisabledEvents && d->subWidgetsWithDisabledEvents->find(o)) { - if (e->type()==QEvent::MouseButtonPress) { + else if (!d->isEditable && d->subWidgetsWithDisabledEvents && d->subWidgetsWithDisabledEvents->tqfind(o)) { + if (e->type()==TQEvent::MouseButtonPress) { // clicking the subwidget should mean the same as clicking the combo box (i.e. show the popup) - if (handleMousePressEvent(static_cast<QMouseEvent*>(e))) + if (handleMousePressEvent(TQT_TQMOUSEEVENT(e))) return true; } - else if (e->type()==QEvent::KeyPress) { - if (handleKeyPressEvent(static_cast<QKeyEvent*>(e))) + else if (e->type()==TQEvent::KeyPress) { + if (handleKeyPressEvent(TQT_TQKEYEVENT(e))) return true; } - return e->type()!=QEvent::Paint; + return e->type()!=TQEvent::Paint; } return KexiDBAutoField::eventFilter( o, e ); } @@ -391,15 +391,15 @@ bool KexiDBComboBox::subwidgetStretchRequired(KexiDBAutoField* autoField) const return true; } -void KexiDBComboBox::setPaletteBackgroundColor( const QColor & color ) +void KexiDBComboBox::setPaletteBackgroundColor( const TQColor & color ) { KexiDBAutoField::setPaletteBackgroundColor(color); - QPalette pal(palette()); - QColorGroup cg(pal.active()); - pal.setColor(QColorGroup::Base, red); - pal.setColor(QColorGroup::Background, red); + TQPalette pal(palette()); + TQColorGroup cg(pal.active()); + pal.setColor(TQColorGroup::Base, red); + pal.setColor(TQColorGroup::Background, red); pal.setActive(cg); - QWidget::setPalette(pal); + TQWidget::setPalette(pal); update(); } @@ -439,7 +439,7 @@ void KexiDBComboBox::selectAllInInternalEditor() selectAll(); } -void KexiDBComboBox::setValueInternal(const QVariant& add, bool removeOld) +void KexiDBComboBox::setValueInternal(const TQVariant& add, bool removeOld) { //// use KexiDBAutoField instead of KexiComboBoxBase::setValueInternal //// expects existing popup(), but we want to have delayed creation @@ -448,38 +448,38 @@ void KexiDBComboBox::setValueInternal(const QVariant& add, bool removeOld) KexiComboBoxBase::setValueInternal(add, removeOld); } -void KexiDBComboBox::setVisibleValueInternal(const QVariant& value) +void KexiDBComboBox::setVisibleValueInternal(const TQVariant& value) { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) - iface->setValue(value, QVariant(), false /*!removeOld*/); + iface->setValue(value, TQVariant(), false /*!removeOld*/); } -QVariant KexiDBComboBox::visibleValue() +TQVariant KexiDBComboBox::visibleValue() { return KexiComboBoxBase::visibleValue(); } -void KexiDBComboBox::setValueInInternalEditor(const QVariant& value) +void KexiDBComboBox::setValueInInternalEditor(const TQVariant& value) { if (!m_setValueInInternalEditor_enabled) return; - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if(iface) - iface->setValue(value, QVariant(), false/*!removeOld*/); + iface->setValue(value, TQVariant(), false/*!removeOld*/); } -QVariant KexiDBComboBox::valueFromInternalEditor() +TQVariant KexiDBComboBox::valueFromInternalEditor() { return KexiDBAutoField::value(); } -QPoint KexiDBComboBox::mapFromParentToGlobal(const QPoint& pos) const +TQPoint KexiDBComboBox::mapFromParentToGlobal(const TQPoint& pos) const { // const KexiFormScrollView* view = KexiUtils::findParentConst<const KexiFormScrollView>(this, "KexiFormScrollView"); - if (!parentWidget()) - return QPoint(-1,-1); - return parentWidget()->mapToGlobal(pos); + if (!tqparentWidget()) + return TQPoint(-1,-1); + return tqparentWidget()->mapToGlobal(pos); // return view->viewport()->mapToGlobal(pos); } @@ -488,31 +488,31 @@ int KexiDBComboBox::popupWidthHint() const return width(); //popup() ? popup()->width() : 0; } -void KexiDBComboBox::fontChange( const QFont & oldFont ) +void KexiDBComboBox::fontChange( const TQFont & oldFont ) { - d->sizeHint = QSize(); //force rebuild the cache + d->tqsizeHint = TQSize(); //force rebuild the cache KexiDBAutoField::fontChange(oldFont); } -void KexiDBComboBox::styleChange( QStyle& oldStyle ) +void KexiDBComboBox::styleChange( TQStyle& oldStyle ) { KexiDBAutoField::styleChange( oldStyle ); - d->sizeHint = QSize(); //force rebuild the cache + d->tqsizeHint = TQSize(); //force rebuild the cache if (m_subwidget) m_subwidget->setGeometry( editorGeometry() ); } -QSize KexiDBComboBox::sizeHint() const +TQSize KexiDBComboBox::tqsizeHint() const { - if ( isVisible() && d->sizeHint.isValid() ) - return d->sizeHint; + if ( isVisible() && d->tqsizeHint.isValid() ) + return d->tqsizeHint; - const int maxWidth = 7 * fontMetrics().width(QChar('x')) + 18; - const int maxHeight = QMAX( fontMetrics().lineSpacing(), 14 ) + 2; - d->sizeHint = (style().sizeFromContents(QStyle::CT_ComboBox, d->paintedCombo, - QSize(maxWidth, maxHeight)).expandedTo(QApplication::globalStrut())); + const int maxWidth = 7 * fontMetrics().width(TQChar('x')) + 18; + const int maxHeight = TQMAX( fontMetrics().lineSpacing(), 14 ) + 2; + d->tqsizeHint = (tqstyle().tqsizeFromContents(TQStyle::CT_ComboBox, d->paintedCombo, + TQSize(maxWidth, maxHeight)).expandedTo(TQApplication::globalStrut())); - return d->sizeHint; + return d->tqsizeHint; } void KexiDBComboBox::editRequested() @@ -534,7 +534,7 @@ void KexiDBComboBox::slotRowAccepted(KexiTableItem *item, int row) void KexiDBComboBox::beforeSignalValueChanged() { if (d->dataEnteredByHand) { - KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)m_subwidget); + KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((TQWidget*)m_subwidget); if (iface) { slotInternalEditorValueChanged( iface->value() ); } diff --git a/kexi/plugins/forms/widgets/kexidbcombobox.h b/kexi/plugins/forms/widgets/kexidbcombobox.h index 5208d37d..2639b1f9 100644 --- a/kexi/plugins/forms/widgets/kexidbcombobox.h +++ b/kexi/plugins/forms/widgets/kexidbcombobox.h @@ -35,15 +35,16 @@ class KEXIFORMUTILS_EXPORT KexiDBComboBox : public KexiDBAutoField, public KexiComboBoxBase { Q_OBJECT - Q_PROPERTY( bool editable READ isEditable WRITE setEditable ) + TQ_OBJECT + TQ_PROPERTY( bool editable READ isEditable WRITE setEditable ) //properties from KexiDBAutoField that should not be visible: - Q_OVERRIDE(QColor paletteBackgroundColor READ paletteBackgroundColor WRITE setPaletteBackgroundColor DESIGNABLE true RESET unsetPalette) - Q_OVERRIDE(QColor foregroundLabelColor DESIGNABLE false) - Q_OVERRIDE(QColor backgroundLabelColor DESIGNABLE false) - Q_OVERRIDE(bool autoCaption DESIGNABLE false) + TQ_OVERRIDE(TQColor paletteBackgroundColor READ paletteBackgroundColor WRITE setPaletteBackgroundColor DESIGNABLE true RESET unsetPalette) + TQ_OVERRIDE(TQColor foregroundLabelColor DESIGNABLE false) + TQ_OVERRIDE(TQColor backgroundLabelColor DESIGNABLE false) + TQ_OVERRIDE(bool autoCaption DESIGNABLE false) public: - KexiDBComboBox(QWidget *parent, const char *name=0, bool designMode = true); + KexiDBComboBox(TQWidget *tqparent, const char *name=0, bool designMode = true); virtual ~KexiDBComboBox(); //! Implemented for KexiComboBoxBase: form has no 'related data' model (only the full database model) @@ -53,21 +54,21 @@ class KEXIFORMUTILS_EXPORT KexiDBComboBox : virtual KexiDB::Field *field() const { return KexiDBAutoField::field(); } //! Implemented for KexiComboBoxBase - virtual QVariant origValue() const { return m_origValue; } + virtual TQVariant origValue() const { return m_origValue; } void setEditable(bool set); bool isEditable() const; virtual void setLabelPosition(LabelPosition position); - virtual QVariant value() { return KexiComboBoxBase::value(); } + virtual TQVariant value() { return KexiComboBoxBase::value(); } - virtual QVariant visibleValue(); + virtual TQVariant visibleValue(); //! Reimpemented because to avoid taking value from the internal editor (index is taken from the popup instead) virtual bool valueChanged(); - virtual QSize sizeHint() const; + virtual TQSize tqsizeHint() const; //! Reimplemented after KexiDBAutoField: jsut sets \a cinfo without initializing a subwidget. //! Initialization is performed by \ref setVisibleColumnInfo(). @@ -81,10 +82,10 @@ class KEXIFORMUTILS_EXPORT KexiDBComboBox : Reimplemented. */ virtual KexiDB::QueryColumnInfo* visibleColumnInfo() const; - const QColor & paletteBackgroundColor() const { return KexiDBAutoField::paletteBackgroundColor(); } + const TQColor & paletteBackgroundColor() const { return KexiDBAutoField::paletteBackgroundColor(); } //! Reimplemented to also set 'this' widget's background color, not only subwidget's. - virtual void setPaletteBackgroundColor( const QColor & color ); + virtual void setPaletteBackgroundColor( const TQColor & color ); /*! Undoes changes made to this item - just resets the widget to original value. Reimplemented after KexiFormDataItemInterface to also revert the visible value @@ -96,37 +97,37 @@ class KEXIFORMUTILS_EXPORT KexiDBComboBox : void slotItemSelected(KexiTableItem* item) { KexiComboBoxBase::slotItemSelected(item); } protected slots: - void slotInternalEditorValueChanged(const QVariant& v) + void slotInternalEditorValueChanged(const TQVariant& v) { KexiComboBoxBase::slotInternalEditorValueChanged(v); } protected: - QRect buttonGeometry() const; + TQRect buttonGeometry() const; - virtual void paintEvent( QPaintEvent * ); + virtual void paintEvent( TQPaintEvent * ); - virtual void mousePressEvent( QMouseEvent *e ); + virtual void mousePressEvent( TQMouseEvent *e ); - void mouseDoubleClickEvent( QMouseEvent *e ); + void mouseDoubleClickEvent( TQMouseEvent *e ); - virtual bool eventFilter( QObject *o, QEvent *e ); + virtual bool eventFilter( TQObject *o, TQEvent *e ); - //! \return internal editor's geometry - QRect editorGeometry() const; + //! \return internal editor's tqgeometry + TQRect editorGeometry() const; //! Creates editor. Reimplemented, because if the combo box is not editable, //! editor should not be created. virtual void createEditor(); /*! Reimplemented */ - virtual void styleChange( QStyle& oldStyle ); + virtual void styleChange( TQStyle& oldStyle ); /*! Reimplemented */ - virtual void fontChange( const QFont & oldFont ); + virtual void fontChange( const TQFont & oldFont ); virtual bool subwidgetStretchRequired(KexiDBAutoField* autoField) const; //! Implemented for KexiComboBoxBase - virtual QWidget *internalEditor() const { return /*WidgetWithSubpropertiesInterface*/m_subwidget; } + virtual TQWidget *internalEditor() const { return /*WidgetWithSubpropertiesInterface*/m_subwidget; } //! Implemented for KexiComboBoxBase. Does nothing if the widget is not editable. virtual void moveCursorToEndInInternalEditor(); @@ -135,10 +136,10 @@ class KEXIFORMUTILS_EXPORT KexiDBComboBox : virtual void selectAllInInternalEditor(); //! Implemented for KexiComboBoxBase - virtual void setValueInInternalEditor(const QVariant& value); + virtual void setValueInInternalEditor(const TQVariant& value); //! Implemented for KexiComboBoxBase - virtual QVariant valueFromInternalEditor(); + virtual TQVariant valueFromInternalEditor(); //! Implemented for KexiComboBoxBase virtual void editRequested(); @@ -146,21 +147,21 @@ class KEXIFORMUTILS_EXPORT KexiDBComboBox : //! Implemented for KexiComboBoxBase virtual void acceptRequested(); - //! Implement this to return a position \a pos mapped from parent (e.g. viewport) - //! to global coordinates. QPoint(-1, -1) should be returned if this cannot be computed. - virtual QPoint mapFromParentToGlobal(const QPoint& pos) const; + //! Implement this to return a position \a pos mapped from tqparent (e.g. viewport) + //! to global coordinates. TQPoint(-1, -1) should be returned if this cannot be computed. + virtual TQPoint mapFromParentToGlobal(const TQPoint& pos) const; //! Implement this to return a hint for popup width. virtual int popupWidthHint() const; - virtual void setValueInternal(const QVariant& add, bool removeOld); + virtual void setValueInternal(const TQVariant& add, bool removeOld); //! Implemented to handle visible value instead of index - virtual void setVisibleValueInternal(const QVariant& value); + virtual void setVisibleValueInternal(const TQVariant& value); - bool handleMousePressEvent(QMouseEvent *e); + bool handleMousePressEvent(TQMouseEvent *e); - bool handleKeyPressEvent(QKeyEvent *ke); + bool handleKeyPressEvent(TQKeyEvent *ke); //! Implemented for KexiDataItemInterface virtual void beforeSignalValueChanged(); @@ -172,7 +173,7 @@ class KEXIFORMUTILS_EXPORT KexiDBComboBox : Used for Key_Escape to if the popup is visible, so the key press won't be consumed to perform "cancel editing". Also used for grabbing page down/up keys. */ - virtual bool keyPressed(QKeyEvent *ke); + virtual bool keyPressed(TQKeyEvent *ke); class Private; Private * const d; diff --git a/kexi/plugins/forms/widgets/kexidbdateedit.cpp b/kexi/plugins/forms/widgets/kexidbdateedit.cpp index 32584fce..9638f93a 100644 --- a/kexi/plugins/forms/widgets/kexidbdateedit.cpp +++ b/kexi/plugins/forms/widgets/kexidbdateedit.cpp @@ -19,8 +19,8 @@ */ #include "kexidbdateedit.h" -#include <qlayout.h> -#include <qtoolbutton.h> +#include <tqlayout.h> +#include <tqtoolbutton.h> #include <kpopupmenu.h> #include <kdatepicker.h> #include <kdatetbl.h> @@ -28,45 +28,45 @@ #include <kexiutils/utils.h> #include <kexidb/queryschema.h> -KexiDBDateEdit::KexiDBDateEdit(const QDate &date, QWidget *parent, const char *name) - : QWidget(parent, name), KexiFormDataItemInterface() +KexiDBDateEdit::KexiDBDateEdit(const TQDate &date, TQWidget *tqparent, const char *name) + : TQWidget(tqparent, name), KexiFormDataItemInterface() { m_invalidState = false; m_cleared = false; m_readOnly = false; - m_edit = new QDateEdit(date, this); + m_edit = new TQDateEdit(date, this); m_edit->setAutoAdvance(true); - m_edit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); - connect( m_edit, SIGNAL(valueChanged(const QDate&)), this, SLOT(slotValueChanged(const QDate&)) ); - connect( m_edit, SIGNAL(valueChanged(const QDate&)), this, SIGNAL(dateChanged(const QDate&)) ); + m_edit->tqsetSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding); + connect( m_edit, TQT_SIGNAL(valueChanged(const TQDate&)), this, TQT_SLOT(slotValueChanged(const TQDate&)) ); + connect( m_edit, TQT_SIGNAL(valueChanged(const TQDate&)), this, TQT_SIGNAL(dateChanged(const TQDate&)) ); - QToolButton* btn = new QToolButton(this); + TQToolButton* btn = new TQToolButton(this); btn->setText("..."); - btn->setFixedWidth( QFontMetrics(btn->font()).width(" ... ") ); + btn->setFixedWidth( TQFontMetrics(btn->font()).width(" ... ") ); btn->setPopupDelay(1); //1 ms -#ifdef QDateTimeEditor_HACK - m_dte_date = KexiUtils::findFirstChild<QDateTimeEditor>(m_edit, "QDateTimeEditor"); +#ifdef TQDateTimeEditor_HACK + m_dte_date = KexiUtils::findFirstChild<TQDateTimeEditor>(m_edit, "TQDateTimeEditor"); #else m_dte_date = 0; #endif m_datePickerPopupMenu = new KPopupMenu(0, "date_popup"); - connect(m_datePickerPopupMenu, SIGNAL(aboutToShow()), this, SLOT(slotShowDatePicker())); - m_datePicker = new KDatePicker(m_datePickerPopupMenu, QDate::currentDate(), 0); + connect(m_datePickerPopupMenu, TQT_SIGNAL(aboutToShow()), this, TQT_SLOT(slotShowDatePicker())); + m_datePicker = new KDatePicker(m_datePickerPopupMenu, TQDate::tqcurrentDate(), 0); KDateTable *dt = KexiUtils::findFirstChild<KDateTable>(m_datePicker, "KDateTable"); if (dt) - connect(dt, SIGNAL(tableClicked()), this, SLOT(acceptDate())); + connect(dt, TQT_SIGNAL(tableClicked()), this, TQT_SLOT(acceptDate())); m_datePicker->setCloseButton(true); m_datePicker->installEventFilter(this); m_datePickerPopupMenu->insertItem(m_datePicker); btn->setPopup(m_datePickerPopupMenu); - QHBoxLayout* layout = new QHBoxLayout(this); - layout->addWidget(m_edit, 1); - layout->addWidget(btn, 0); + TQHBoxLayout* tqlayout = new TQHBoxLayout(this); + tqlayout->addWidget(m_edit, 1); + tqlayout->addWidget(btn, 0); setFocusProxy(m_edit); } @@ -75,14 +75,14 @@ KexiDBDateEdit::~KexiDBDateEdit() { } -void KexiDBDateEdit::setInvalidState( const QString& ) +void KexiDBDateEdit::setInvalidState( const TQString& ) { setEnabled(false); setReadOnly(true); m_invalidState = true; //! @todo move this to KexiDataItemInterface::setInvalidStateInternal() ? if (focusPolicy() & TabFocus) - setFocusPolicy(QWidget::ClickFocus); + setFocusPolicy(TQ_ClickFocus); } void @@ -91,18 +91,18 @@ KexiDBDateEdit::setEnabled(bool enabled) // prevent the user from reenabling the widget when it is in invalid state if(enabled && m_invalidState) return; - QWidget::setEnabled(enabled); + TQWidget::setEnabled(enabled); } -void KexiDBDateEdit::setValueInternal(const QVariant &add, bool removeOld) +void KexiDBDateEdit::setValueInternal(const TQVariant &add, bool removeOld) { int setNumberOnFocus = -1; - QDate d; - QString addString(add.toString()); + TQDate d; + TQString addString(add.toString()); if (removeOld) { if (!addString.isEmpty() && addString[0].latin1()>='0' && addString[0].latin1() <='9') { setNumberOnFocus = addString[0].latin1()-'0'; - d = QDate(setNumberOnFocus*1000, 1, 1); + d = TQDate(setNumberOnFocus*1000, 1, 1); } } else @@ -111,10 +111,10 @@ void KexiDBDateEdit::setValueInternal(const QVariant &add, bool removeOld) m_edit->setDate(d); } -QVariant +TQVariant KexiDBDateEdit::value() { - return QVariant(m_edit->date()); + return TQVariant(m_edit->date()); } bool KexiDBDateEdit::valueIsNull() @@ -139,7 +139,7 @@ void KexiDBDateEdit::setReadOnly(bool set) m_readOnly = set; } -QWidget* +TQWidget* KexiDBDateEdit::widget() { return this; @@ -147,7 +147,7 @@ KexiDBDateEdit::widget() bool KexiDBDateEdit::cursorAtStart() { -#ifdef QDateTimeEditor_HACK +#ifdef TQDateTimeEditor_HACK return m_dte_date && m_edit->hasFocus() && m_dte_date->focusSection()==0; #else return false; @@ -156,7 +156,7 @@ bool KexiDBDateEdit::cursorAtStart() bool KexiDBDateEdit::cursorAtEnd() { -#ifdef QDateTimeEditor_HACK +#ifdef TQDateTimeEditor_HACK return m_dte_date && m_edit->hasFocus() && m_dte_date->focusSection()==int(m_dte_date->sectionCount()-1); #else @@ -166,12 +166,12 @@ bool KexiDBDateEdit::cursorAtEnd() void KexiDBDateEdit::clear() { - m_edit->setDate(QDate()); + m_edit->setDate(TQDate()); m_cleared = true; } void -KexiDBDateEdit::slotValueChanged(const QDate&) +KexiDBDateEdit::slotValueChanged(const TQDate&) { m_cleared = false; } @@ -179,7 +179,7 @@ KexiDBDateEdit::slotValueChanged(const QDate&) void KexiDBDateEdit::slotShowDatePicker() { - QDate date = m_edit->date(); + TQDate date = m_edit->date(); m_datePicker->setDate(date); m_datePicker->setFocus(); @@ -195,24 +195,24 @@ KexiDBDateEdit::acceptDate() } bool -KexiDBDateEdit::eventFilter(QObject *o, QEvent *e) +KexiDBDateEdit::eventFilter(TQObject *o, TQEvent *e) { if (o != m_datePicker) return false; switch (e->type()) { - case QEvent::Hide: + case TQEvent::Hide: m_datePickerPopupMenu->hide(); break; - case QEvent::KeyPress: - case QEvent::KeyRelease: { - QKeyEvent *ke = (QKeyEvent *)e; - if (ke->key()==Qt::Key_Enter || ke->key()==Qt::Key_Return) { + case TQEvent::KeyPress: + case TQEvent::KeyRelease: { + TQKeyEvent *ke = (TQKeyEvent *)e; + if (ke->key()==TQt::Key_Enter || ke->key()==TQt::Key_Return) { //accepting picker acceptDate(); return true; } - else if (ke->key()==Qt::Key_Escape) { + else if (ke->key()==TQt::Key_Escape) { //canceling picker m_datePickerPopupMenu->hide(); return true; diff --git a/kexi/plugins/forms/widgets/kexidbdateedit.h b/kexi/plugins/forms/widgets/kexidbdateedit.h index 2ad693a8..b611590e 100644 --- a/kexi/plugins/forms/widgets/kexidbdateedit.h +++ b/kexi/plugins/forms/widgets/kexidbdateedit.h @@ -22,37 +22,38 @@ #define KexiDBDateEdit_H #include "kexiformdataiteminterface.h" -#include <qdatetimeedit.h> +#include <tqdatetimeedit.h> class KPopupMenu; class KDatePicker; -class QDateTimeEditor; +class TQDateTimeEditor; //! @short A db-aware date editor -class KEXIFORMUTILS_EXPORT KexiDBDateEdit : public QWidget, public KexiFormDataItemInterface +class KEXIFORMUTILS_EXPORT KexiDBDateEdit : public TQWidget, public KexiFormDataItemInterface { Q_OBJECT - Q_PROPERTY(QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) - Q_PROPERTY(QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) - // properties copied from QDateEdit + TQ_OBJECT + TQ_PROPERTY(TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) + TQ_PROPERTY(TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) + // properties copied from TQDateEdit Q_ENUMS( Order ) - Q_PROPERTY( Order order READ order WRITE setOrder DESIGNABLE true) - Q_PROPERTY( QDate date READ date WRITE setDate DESIGNABLE true) - Q_PROPERTY( bool autoAdvance READ autoAdvance WRITE setAutoAdvance DESIGNABLE true) - Q_PROPERTY( QDate maxValue READ maxValue WRITE setMaxValue DESIGNABLE true) - Q_PROPERTY( QDate minValue READ minValue WRITE setMinValue DESIGNABLE true) - Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true ) + TQ_PROPERTY( Order order READ order WRITE setOrder DESIGNABLE true) + TQ_PROPERTY( TQDate date READ date WRITE setDate DESIGNABLE true) + TQ_PROPERTY( bool autoAdvance READ autoAdvance WRITE setAutoAdvance DESIGNABLE true) + TQ_PROPERTY( TQDate maxValue READ maxValue WRITE setMaxValue DESIGNABLE true) + TQ_PROPERTY( TQDate minValue READ minValue WRITE setMinValue DESIGNABLE true) + TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true ) public: - enum Order { DMY = QDateEdit::DMY, MDY = QDateEdit::MDY, YMD = QDateEdit::YMD, YDM = QDateEdit::YDM }; + enum Order { DMY = TQDateEdit::DMY, MDY = TQDateEdit::MDY, YMD = TQDateEdit::YMD, YDM = TQDateEdit::YDM }; - KexiDBDateEdit(const QDate &date, QWidget *parent, const char *name=0); + KexiDBDateEdit(const TQDate &date, TQWidget *tqparent, const char *name=0); virtual ~KexiDBDateEdit(); - inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); } - inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } - virtual QVariant value(); - virtual void setInvalidState( const QString& displayText ); + inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); } + inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } + virtual TQVariant value(); + virtual void setInvalidState( const TQString& displayText ); //! \return true if editor's value is null (not empty) //! Used for checking if a given constraint within table of form is met. @@ -68,7 +69,7 @@ class KEXIFORMUTILS_EXPORT KexiDBDateEdit : public QWidget, public KexiFormDataI virtual bool isReadOnly() const; /*! \return the view widget of this item, e.g. line edit widget. */ - virtual QWidget* widget(); + virtual TQWidget* widget(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); @@ -77,39 +78,39 @@ class KEXIFORMUTILS_EXPORT KexiDBDateEdit : public QWidget, public KexiFormDataI virtual void setEnabled(bool enabled); // property functions - inline QDate date() const { return m_edit->date(); } - inline void setOrder(Order order) { m_edit->setOrder( (QDateEdit::Order) order); } + inline TQDate date() const { return m_edit->date(); } + inline void setOrder(Order order) { m_edit->setOrder( (TQDateEdit::Order) order); } inline Order order() const { return (Order)m_edit->order(); } inline void setAutoAdvance( bool advance ) { m_edit->setAutoAdvance(advance); } inline bool autoAdvance() const { return m_edit->autoAdvance(); } - inline void setMinValue(const QDate& d) { m_edit->setMinValue(d); } - inline QDate minValue() const { return m_edit->minValue(); } - inline void setMaxValue(const QDate& d) { m_edit->setMaxValue(d); } - inline QDate maxValue() const { return m_edit->maxValue(); } + inline void setMinValue(const TQDate& d) { m_edit->setMinValue(d); } + inline TQDate minValue() const { return m_edit->minValue(); } + inline void setMaxValue(const TQDate& d) { m_edit->setMaxValue(d); } + inline TQDate maxValue() const { return m_edit->maxValue(); } signals: - void dateChanged(const QDate &date); + void dateChanged(const TQDate &date); public slots: - inline void setDataSource(const QString &ds) { KexiFormDataItemInterface::setDataSource(ds); } - inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } - inline void setDate(const QDate& date) { m_edit->setDate(date); } + inline void setDataSource(const TQString &ds) { KexiFormDataItemInterface::setDataSource(ds); } + inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } + inline void setDate(const TQDate& date) { m_edit->setDate(date); } virtual void setReadOnly(bool set); protected slots: - void slotValueChanged(const QDate&); + void slotValueChanged(const TQDate&); void slotShowDatePicker(); void acceptDate(); protected: - virtual void setValueInternal(const QVariant& add, bool removeOld); - virtual bool eventFilter(QObject *o, QEvent *e); + virtual void setValueInternal(const TQVariant& add, bool removeOld); + virtual bool eventFilter(TQObject *o, TQEvent *e); private: KDatePicker *m_datePicker; - QDateEdit *m_edit; + TQDateEdit *m_edit; KPopupMenu *m_datePickerPopupMenu; - QDateTimeEditor *m_dte_date; + TQDateTimeEditor *m_dte_date; bool m_invalidState : 1; bool m_cleared : 1; bool m_readOnly : 1; diff --git a/kexi/plugins/forms/widgets/kexidbdatetimeedit.cpp b/kexi/plugins/forms/widgets/kexidbdatetimeedit.cpp index faaeca66..e99e4651 100644 --- a/kexi/plugins/forms/widgets/kexidbdatetimeedit.cpp +++ b/kexi/plugins/forms/widgets/kexidbdatetimeedit.cpp @@ -20,62 +20,62 @@ #include "kexidbdatetimeedit.h" -#include <qtoolbutton.h> -#include <qlayout.h> +#include <tqtoolbutton.h> +#include <tqlayout.h> #include <kpopupmenu.h> #include <kdatepicker.h> #include <kdatetbl.h> #include <kexiutils/utils.h> -KexiDBDateTimeEdit::KexiDBDateTimeEdit(const QDateTime &datetime, QWidget *parent, const char *name) - : QWidget(parent, name), KexiFormDataItemInterface() +KexiDBDateTimeEdit::KexiDBDateTimeEdit(const TQDateTime &datetime, TQWidget *tqparent, const char *name) + : TQWidget(tqparent, name), KexiFormDataItemInterface() { m_invalidState = false; m_cleared = false; m_readOnly = false; - m_dateEdit = new QDateEdit(datetime.date(), this); + m_dateEdit = new TQDateEdit(datetime.date(), this); m_dateEdit->setAutoAdvance(true); - m_dateEdit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); -// m_dateEdit->setFixedWidth( QFontMetrics(m_dateEdit->font()).width("8888-88-88___") ); - connect(m_dateEdit, SIGNAL(valueChanged(const QDate&)), this, SLOT(slotValueChanged())); - connect(m_dateEdit, SIGNAL(valueChanged(const QDate&)), this, SIGNAL(dateTimeChanged())); + m_dateEdit->tqsetSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding); +// m_dateEdit->setFixedWidth( TQFontMetrics(m_dateEdit->font()).width("8888-88-88___") ); + connect(m_dateEdit, TQT_SIGNAL(valueChanged(const TQDate&)), this, TQT_SLOT(slotValueChanged())); + connect(m_dateEdit, TQT_SIGNAL(valueChanged(const TQDate&)), this, TQT_SIGNAL(dateTimeChanged())); - QToolButton* btn = new QToolButton(this); + TQToolButton* btn = new TQToolButton(this); btn->setText("..."); - btn->setFixedWidth( QFontMetrics(btn->font()).width(" ... ") ); + btn->setFixedWidth( TQFontMetrics(btn->font()).width(" ... ") ); btn->setPopupDelay(1); //1 ms - m_timeEdit = new QTimeEdit(datetime.time(), this);; + m_timeEdit = new TQTimeEdit(datetime.time(), this);; m_timeEdit->setAutoAdvance(true); - m_timeEdit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); - connect(m_timeEdit, SIGNAL(valueChanged(const QTime&)), this, SLOT(slotValueChanged())); - connect(m_timeEdit, SIGNAL(valueChanged(const QTime&)), this, SIGNAL(dateTimeChanged())); + m_timeEdit->tqsetSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::MinimumExpanding); + connect(m_timeEdit, TQT_SIGNAL(valueChanged(const TQTime&)), this, TQT_SLOT(slotValueChanged())); + connect(m_timeEdit, TQT_SIGNAL(valueChanged(const TQTime&)), this, TQT_SIGNAL(dateTimeChanged())); -#ifdef QDateTimeEditor_HACK - m_dte_date = KexiUtils::findFirstChild<QDateTimeEditor>(m_dateEdit, "QDateTimeEditor"); - m_dte_time = KexiUtils::findFirstChild<QDateTimeEditor>(m_timeEdit, "QDateTimeEditor"); +#ifdef TQDateTimeEditor_HACK + m_dte_date = KexiUtils::findFirstChild<TQDateTimeEditor>(m_dateEdit, "TQDateTimeEditor"); + m_dte_time = KexiUtils::findFirstChild<TQDateTimeEditor>(m_timeEdit, "TQDateTimeEditor"); #else m_dte_date = 0; #endif m_datePickerPopupMenu = new KPopupMenu(0, "date_popup"); - connect(m_datePickerPopupMenu, SIGNAL(aboutToShow()), this, SLOT(slotShowDatePicker())); - m_datePicker = new KDatePicker(m_datePickerPopupMenu, QDate::currentDate(), 0); + connect(m_datePickerPopupMenu, TQT_SIGNAL(aboutToShow()), this, TQT_SLOT(slotShowDatePicker())); + m_datePicker = new KDatePicker(m_datePickerPopupMenu, TQDate::tqcurrentDate(), 0); KDateTable *dt = KexiUtils::findFirstChild<KDateTable>(m_datePicker, "KDateTable"); if (dt) - connect(dt, SIGNAL(tableClicked()), this, SLOT(acceptDate())); + connect(dt, TQT_SIGNAL(tableClicked()), this, TQT_SLOT(acceptDate())); m_datePicker->setCloseButton(true); m_datePicker->installEventFilter(this); m_datePickerPopupMenu->insertItem(m_datePicker); btn->setPopup(m_datePickerPopupMenu); - QHBoxLayout* layout = new QHBoxLayout(this); - layout->addWidget(m_dateEdit, 0); - layout->addWidget(btn, 0); - layout->addWidget(m_timeEdit, 0); - //layout->addStretch(1); + TQHBoxLayout* tqlayout = new TQHBoxLayout(this); + tqlayout->addWidget(m_dateEdit, 0); + tqlayout->addWidget(btn, 0); + tqlayout->addWidget(m_timeEdit, 0); + //tqlayout->addStretch(1); setFocusProxy(m_dateEdit); } @@ -84,14 +84,14 @@ KexiDBDateTimeEdit::~KexiDBDateTimeEdit() { } -void KexiDBDateTimeEdit::setInvalidState(const QString & /*! @todo paint this text: text*/) +void KexiDBDateTimeEdit::setInvalidState(const TQString & /*! @todo paint this text: text*/) { setEnabled(false); setReadOnly(true); m_invalidState = true; //! @todo move this to KexiDataItemInterface::setInvalidStateInternal() ? if (focusPolicy() & TabFocus) - setFocusPolicy(QWidget::ClickFocus); + setFocusPolicy(TQ_ClickFocus); } void @@ -100,19 +100,19 @@ KexiDBDateTimeEdit::setEnabled(bool enabled) // prevent the user from reenabling the widget when it is in invalid state if(enabled && m_invalidState) return; - QWidget::setEnabled(enabled); + TQWidget::setEnabled(enabled); } -void KexiDBDateTimeEdit::setValueInternal(const QVariant &, bool ) +void KexiDBDateTimeEdit::setValueInternal(const TQVariant &, bool ) { m_dateEdit->setDate(m_origValue.toDate()); m_timeEdit->setTime(m_origValue.toTime()); } -QVariant +TQVariant KexiDBDateTimeEdit::value() { - return QDateTime(m_dateEdit->date(), m_timeEdit->time()); + return TQDateTime(m_dateEdit->date(), m_timeEdit->time()); } bool KexiDBDateTimeEdit::valueIsNull() @@ -138,7 +138,7 @@ void KexiDBDateTimeEdit::setReadOnly(bool set) m_readOnly = set; } -QWidget* +TQWidget* KexiDBDateTimeEdit::widget() { return m_dateEdit; @@ -146,7 +146,7 @@ KexiDBDateTimeEdit::widget() bool KexiDBDateTimeEdit::cursorAtStart() { -#ifdef QDateTimeEditor_HACK +#ifdef TQDateTimeEditor_HACK return m_dte_date && m_dateEdit->hasFocus() && m_dte_date->focusSection()==0; #else return false; @@ -155,7 +155,7 @@ bool KexiDBDateTimeEdit::cursorAtStart() bool KexiDBDateTimeEdit::cursorAtEnd() { -#ifdef QDateTimeEditor_HACK +#ifdef TQDateTimeEditor_HACK return m_dte_time && m_timeEdit->hasFocus() && m_dte_time->focusSection()==int(m_dte_time->sectionCount()-1); #else @@ -165,8 +165,8 @@ bool KexiDBDateTimeEdit::cursorAtEnd() void KexiDBDateTimeEdit::clear() { - m_dateEdit->setDate(QDate()); - m_timeEdit->setTime(QTime()); + m_dateEdit->setDate(TQDate()); + m_timeEdit->setTime(TQTime()); m_cleared = true; } @@ -179,7 +179,7 @@ KexiDBDateTimeEdit::slotValueChanged() void KexiDBDateTimeEdit::slotShowDatePicker() { - QDate date = m_dateEdit->date(); + TQDate date = m_dateEdit->date(); m_datePicker->setDate(date); m_datePicker->setFocus(); @@ -195,24 +195,24 @@ KexiDBDateTimeEdit::acceptDate() } bool -KexiDBDateTimeEdit::eventFilter(QObject *o, QEvent *e) +KexiDBDateTimeEdit::eventFilter(TQObject *o, TQEvent *e) { if (o != m_datePicker) return false; switch (e->type()) { - case QEvent::Hide: + case TQEvent::Hide: m_datePickerPopupMenu->hide(); break; - case QEvent::KeyPress: - case QEvent::KeyRelease: { - QKeyEvent *ke = (QKeyEvent *)e; - if (ke->key()==Qt::Key_Enter || ke->key()==Qt::Key_Return) { + case TQEvent::KeyPress: + case TQEvent::KeyRelease: { + TQKeyEvent *ke = (TQKeyEvent *)e; + if (ke->key()==TQt::Key_Enter || ke->key()==TQt::Key_Return) { //accepting picker acceptDate(); return true; } - else if (ke->key()==Qt::Key_Escape) { + else if (ke->key()==TQt::Key_Escape) { //canceling picker m_datePickerPopupMenu->hide(); return true; @@ -227,14 +227,14 @@ KexiDBDateTimeEdit::eventFilter(QObject *o, QEvent *e) return false; } -QDateTime +TQDateTime KexiDBDateTimeEdit::dateTime() const { - return QDateTime(m_dateEdit->date(), m_timeEdit->time()); + return TQDateTime(m_dateEdit->date(), m_timeEdit->time()); } void -KexiDBDateTimeEdit::setDateTime(const QDateTime &dt) +KexiDBDateTimeEdit::setDateTime(const TQDateTime &dt) { m_dateEdit->setDate(dt.date()); m_timeEdit->setTime(dt.time()); diff --git a/kexi/plugins/forms/widgets/kexidbdatetimeedit.h b/kexi/plugins/forms/widgets/kexidbdatetimeedit.h index 1f185b16..b5bbaec0 100644 --- a/kexi/plugins/forms/widgets/kexidbdatetimeedit.h +++ b/kexi/plugins/forms/widgets/kexidbdatetimeedit.h @@ -22,32 +22,33 @@ #define KexiDBDateTimeEdit_H #include "kexiformdataiteminterface.h" -#include <qdatetimeedit.h> +#include <tqdatetimeedit.h> class KDatePicker; -class QDateTimeEditor; +class TQDateTimeEditor; class KPopupMenu; //! @short A db-aware datetime editor -class KEXIFORMUTILS_EXPORT KexiDBDateTimeEdit : public QWidget, public KexiFormDataItemInterface +class KEXIFORMUTILS_EXPORT KexiDBDateTimeEdit : public TQWidget, public KexiFormDataItemInterface { Q_OBJECT - Q_PROPERTY(QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) - Q_PROPERTY(QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) - // properties copied from QDateTimeEdit - Q_PROPERTY( QDateTime dateTime READ dateTime WRITE setDateTime ) - Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true ) + TQ_OBJECT + TQ_PROPERTY(TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) + TQ_PROPERTY(TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) + // properties copied from TQDateTimeEdit + TQ_PROPERTY( TQDateTime dateTime READ dateTime WRITE setDateTime ) + TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true ) public: enum Order { DMY, MDY, YMD, YDM }; - KexiDBDateTimeEdit(const QDateTime &datetime, QWidget *parent, const char *name=0); + KexiDBDateTimeEdit(const TQDateTime &datetime, TQWidget *tqparent, const char *name=0); virtual ~KexiDBDateTimeEdit(); - inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); } - inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } - virtual QVariant value(); - virtual void setInvalidState( const QString& displayText ); + inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); } + inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } + virtual TQVariant value(); + virtual void setInvalidState( const TQString& displayText ); //! \return true if editor's value is null (not empty) //! Used for checking if a given constraint within table of form is met. @@ -63,7 +64,7 @@ class KEXIFORMUTILS_EXPORT KexiDBDateTimeEdit : public QWidget, public KexiFormD virtual bool isReadOnly() const; /*! \return the view widget of this item, e.g. line edit widget. */ - virtual QWidget* widget(); + virtual TQWidget* widget(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); @@ -72,20 +73,20 @@ class KEXIFORMUTILS_EXPORT KexiDBDateTimeEdit : public QWidget, public KexiFormD virtual void setEnabled(bool enabled); // property functions - QDateTime dateTime() const; + TQDateTime dateTime() const; signals: void dateTimeChanged(); public slots: - inline void setDataSource(const QString &ds) { KexiFormDataItemInterface::setDataSource(ds); } - inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } - void setDateTime(const QDateTime &dt); + inline void setDataSource(const TQString &ds) { KexiFormDataItemInterface::setDataSource(ds); } + inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } + void setDateTime(const TQDateTime &dt); virtual void setReadOnly(bool set); protected: - virtual void setValueInternal(const QVariant& add, bool removeOld); - virtual bool eventFilter(QObject *o, QEvent *e); + virtual void setValueInternal(const TQVariant& add, bool removeOld); + virtual bool eventFilter(TQObject *o, TQEvent *e); protected slots: void slotValueChanged(); @@ -94,9 +95,9 @@ class KEXIFORMUTILS_EXPORT KexiDBDateTimeEdit : public QWidget, public KexiFormD private: KDatePicker *m_datePicker; - QDateEdit* m_dateEdit; - QTimeEdit* m_timeEdit; - QDateTimeEditor *m_dte_date, *m_dte_time; + TQDateEdit* m_dateEdit; + TQTimeEdit* m_timeEdit; + TQDateTimeEditor *m_dte_date, *m_dte_time; KPopupMenu *m_datePickerPopupMenu; bool m_invalidState : 1; bool m_cleared : 1; diff --git a/kexi/plugins/forms/widgets/kexidbdoublespinbox.cpp b/kexi/plugins/forms/widgets/kexidbdoublespinbox.cpp index 67a2c1a6..c0eb17d3 100644 --- a/kexi/plugins/forms/widgets/kexidbdoublespinbox.cpp +++ b/kexi/plugins/forms/widgets/kexidbdoublespinbox.cpp @@ -20,26 +20,26 @@ #include "kexidbdoublespinbox.h" -#include <qlineedit.h> +#include <tqlineedit.h> -KexiDBDoubleSpinBox::KexiDBDoubleSpinBox(QWidget *parent, const char *name) - : KDoubleSpinBox(parent, name) , KexiFormDataItemInterface() +KexiDBDoubleSpinBox::KexiDBDoubleSpinBox(TQWidget *tqparent, const char *name) + : KDoubleSpinBox(tqparent, name) , KexiFormDataItemInterface() { - connect(this, SIGNAL(valueChanged(double)), this, SLOT(slotValueChanged())); + connect(this, TQT_SIGNAL(valueChanged(double)), this, TQT_SLOT(slotValueChanged())); } KexiDBDoubleSpinBox::~KexiDBDoubleSpinBox() { } -void KexiDBDoubleSpinBox::setInvalidState( const QString& displayText ) +void KexiDBDoubleSpinBox::setInvalidState( const TQString& displayText ) { m_invalidState = true; setEnabled(false); setReadOnly(true); //! @todo move this to KexiDataItemInterface::setInvalidStateInternal() ? if (focusPolicy() & TabFocus) - setFocusPolicy(QWidget::ClickFocus); + setFocusPolicy(TQ_ClickFocus); setSpecialValueText(displayText); KDoubleSpinBox::setValue(minValue()); } @@ -53,12 +53,12 @@ KexiDBDoubleSpinBox::setEnabled(bool enabled) KDoubleSpinBox::setEnabled(enabled); } -void KexiDBDoubleSpinBox::setValueInternal(const QVariant&, bool ) +void KexiDBDoubleSpinBox::setValueInternal(const TQVariant&, bool ) { KDoubleSpinBox::setValue(m_origValue.toDouble()); } -QVariant +TQVariant KexiDBDoubleSpinBox::value() { return KDoubleSpinBox::value(); @@ -89,7 +89,7 @@ void KexiDBDoubleSpinBox::setReadOnly(bool set) editor()->setReadOnly(set); } -QWidget* +TQWidget* KexiDBDoubleSpinBox::widget() { return this; diff --git a/kexi/plugins/forms/widgets/kexidbdoublespinbox.h b/kexi/plugins/forms/widgets/kexidbdoublespinbox.h index c6bc627d..1445980c 100644 --- a/kexi/plugins/forms/widgets/kexidbdoublespinbox.h +++ b/kexi/plugins/forms/widgets/kexidbdoublespinbox.h @@ -22,25 +22,26 @@ #define KexiDBDoubleSpinBox_H #include "kexiformdataiteminterface.h" -#include <qwidget.h> +#include <tqwidget.h> #include <knuminput.h> //! @short A db-aware int spin box class KEXIFORMUTILS_EXPORT KexiDBDoubleSpinBox : public KDoubleSpinBox, public KexiFormDataItemInterface { Q_OBJECT - Q_PROPERTY(QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) - Q_PROPERTY(QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) - Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true ) + TQ_OBJECT + TQ_PROPERTY(TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) + TQ_PROPERTY(TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) + TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true ) public: - KexiDBDoubleSpinBox(QWidget *parent, const char *name=0); + KexiDBDoubleSpinBox(TQWidget *tqparent, const char *name=0); virtual ~KexiDBDoubleSpinBox(); - inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); } - inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } - virtual QVariant value(); - virtual void setInvalidState( const QString& displayText ); + inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); } + inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } + virtual TQVariant value(); + virtual void setInvalidState( const TQString& displayText ); //! \return true if editor's value is null (not empty) //! Used for checking if a given constraint within table of form is met. @@ -56,7 +57,7 @@ class KEXIFORMUTILS_EXPORT KexiDBDoubleSpinBox : public KDoubleSpinBox, public K virtual bool isReadOnly() const; /*! \return the view widget of this item, e.g. line edit widget. */ - virtual QWidget* widget(); + virtual TQWidget* widget(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); @@ -64,13 +65,13 @@ class KEXIFORMUTILS_EXPORT KexiDBDoubleSpinBox : public KDoubleSpinBox, public K public slots: virtual void setEnabled(bool enabled); - inline void setDataSource(const QString &ds) { KexiFormDataItemInterface::setDataSource(ds); } - inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } + inline void setDataSource(const TQString &ds) { KexiFormDataItemInterface::setDataSource(ds); } + inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } void slotValueChanged(); virtual void setReadOnly(bool set); protected: - virtual void setValueInternal(const QVariant& add, bool removeOld); + virtual void setValueInternal(const TQVariant& add, bool removeOld); private: bool m_invalidState : 1; diff --git a/kexi/plugins/forms/widgets/kexidbform.cpp b/kexi/plugins/forms/widgets/kexidbform.cpp index cff12c7c..12210430 100644 --- a/kexi/plugins/forms/widgets/kexidbform.cpp +++ b/kexi/plugins/forms/widgets/kexidbform.cpp @@ -19,11 +19,11 @@ * Boston, MA 02110-1301, USA. */ -#include <qobjectlist.h> -#include <qpainter.h> -#include <qcursor.h> -#include <qapplication.h> -#include <qfocusdata.h> +#include <tqobjectlist.h> +#include <tqpainter.h> +#include <tqcursor.h> +#include <tqapplication.h> +#include <tqfocusdata.h> #include <kdebug.h> @@ -55,7 +55,7 @@ class KexiDBForm::Private } //! \return index of data-aware widget \a widget - int indexOfDataAwareWidget(QWidget *widget) const + int indexOfDataAwareWidget(TQWidget *widget) const { if (!dynamic_cast<KexiDataItemInterface*>(widget)) return -1; @@ -65,8 +65,8 @@ class KexiDBForm::Private //! \return index of data item \a item, or -1 if not found int indexOfDataItem( KexiDataItemInterface* item ) const { - QMapConstIterator<KexiDataItemInterface*, uint> indicesForDataAwareWidgetsIt( - indicesForDataAwareWidgets.find(item)); + TQMapConstIterator<KexiDataItemInterface*, uint> indicesForDataAwareWidgetsIt( + indicesForDataAwareWidgets.tqfind(item)); if (indicesForDataAwareWidgetsIt == indicesForDataAwareWidgets.constEnd()) return -1; kexipluginsdbg << "KexiDBForm: column # for item: " @@ -75,7 +75,7 @@ class KexiDBForm::Private } //! Sets orderedFocusWidgetsIterator member to a position pointing to \a widget - void setOrderedFocusWidgetsIteratorTo( QWidget *widget ) + void setOrderedFocusWidgetsIteratorTo( TQWidget *widget ) { if (orderedFocusWidgetsIterator.current() == widget) return; @@ -86,23 +86,23 @@ class KexiDBForm::Private KexiDataAwareObjectInterface* dataAwareObject; //! ordered list of focusable widgets (can be both data-widgets or buttons, etc.) - QPtrList<QWidget> orderedFocusWidgets; + TQPtrList<TQWidget> orderedFocusWidgets; //! ordered list of data-aware widgets - QPtrList<QWidget> orderedDataAwareWidgets; - QMap<KexiDataItemInterface*, uint> indicesForDataAwareWidgets; //!< a subset of orderedFocusWidgets mapped to indices - QPtrListIterator<QWidget> orderedFocusWidgetsIterator; - QPixmap buffer; //!< stores grabbed entire form's area for redraw - QRect prev_rect; //!< previously selected rectangle -// QGuardedPtr<QWidget> widgetFocusedBeforePopup; + TQPtrList<TQWidget> orderedDataAwareWidgets; + TQMap<KexiDataItemInterface*, uint> indicesForDataAwareWidgets; //!< a subset of orderedFocusWidgets mapped to indices + TQPtrListIterator<TQWidget> orderedFocusWidgetsIterator; + TQPixmap buffer; //!< stores grabbed entire form's area for redraw + TQRect prev_rect; //!< previously selected rectangle +// TQGuardedPtr<TQWidget> widgetFocusedBeforePopup; bool autoTabStops : 1; bool popupFocused : 1; //!< used in KexiDBForm::eventFilter() }; //======================== -KexiDBForm::KexiDBForm(QWidget *parent, KexiDataAwareObjectInterface* dataAwareObject, +KexiDBForm::KexiDBForm(TQWidget *tqparent, KexiDataAwareObjectInterface* dataAwareObject, const char *name/*, KexiDB::Connection *conn*/) - : KexiDBFormBase(parent, name) + : KexiDBFormBase(tqparent, name) , KexiFormDataItemInterface() , d(new Private()) { @@ -113,7 +113,7 @@ KexiDBForm::KexiDBForm(QWidget *parent, KexiDataAwareObjectInterface* dataAwareO m_hasFocusableWidget = false; kexipluginsdbg << "KexiDBForm::KexiDBForm(): " << endl; - setCursor(QCursor(Qt::ArrowCursor)); //to avoid keeping Size cursor when moving from form's boundaries + setCursor(TQCursor(TQt::ArrowCursor)); //to avoid keeping Size cursor when moving from form's boundaries setAcceptDrops( true ); } @@ -125,48 +125,48 @@ KexiDBForm::~KexiDBForm() KexiDataAwareObjectInterface* KexiDBForm::dataAwareObject() const { return d->dataAwareObject; } -//repaint all children widgets -static void repaintAll(QWidget *w) +//tqrepaint all tqchildren widgets +static void tqrepaintAll(TQWidget *w) { - QObjectList *list = w->queryList("QWidget"); - QObjectListIt it(*list); - for (QObject *obj; (obj=it.current()); ++it ) { - static_cast<QWidget*>(obj)->repaint(); + TQObjectList *list = w->queryList(TQWIDGET_OBJECT_NAME_STRING); + TQObjectListIt it(*list); + for (TQObject *obj; (obj=it.current()); ++it ) { + TQT_TQWIDGET(obj)->tqrepaint(); } delete list; } void -KexiDBForm::drawRect(const QRect& r, int type) +KexiDBForm::drawRect(const TQRect& r, int type) { - QValueList<QRect> l; + TQValueList<TQRect> l; l.append(r); drawRects(l, type); } void -KexiDBForm::drawRects(const QValueList<QRect> &list, int type) +KexiDBForm::drawRects(const TQValueList<TQRect> &list, int type) { - QPainter p; - p.begin(this, true); + TQPainter p; + p.tqbegin(TQT_TQPAINTDEVICE(this), true); bool unclipped = testWFlags( WPaintUnclipped ); setWFlags( WPaintUnclipped ); if (d->prev_rect.isValid()) { //redraw prev. selection's rectangle - p.drawPixmap( QPoint(d->prev_rect.x()-2, d->prev_rect.y()-2), d->buffer, - QRect(d->prev_rect.x()-2, d->prev_rect.y()-2, d->prev_rect.width()+4, d->prev_rect.height()+4)); + p.drawPixmap( TQPoint(d->prev_rect.x()-2, d->prev_rect.y()-2), d->buffer, + TQRect(d->prev_rect.x()-2, d->prev_rect.y()-2, d->prev_rect.width()+4, d->prev_rect.height()+4)); } - p.setBrush(QBrush::NoBrush); + p.setBrush(TQBrush::NoBrush); if(type == 1) // selection rect - p.setPen(QPen(white, 1, Qt::DotLine)); + p.setPen(TQPen(white, 1, TQt::DotLine)); else if(type == 2) // insert rect - p.setPen(QPen(white, 2)); + p.setPen(TQPen(white, 2)); p.setRasterOp(XorROP); - d->prev_rect = QRect(); - QValueList<QRect>::ConstIterator endIt = list.constEnd(); - for(QValueList<QRect>::ConstIterator it = list.constBegin(); it != endIt; ++it) { + d->prev_rect = TQRect(); + TQValueList<TQRect>::ConstIterator endIt = list.constEnd(); + for(TQValueList<TQRect>::ConstIterator it = list.constBegin(); it != endIt; ++it) { p.drawRect(*it); if (d->prev_rect.isValid()) d->prev_rect = d->prev_rect.unite(*it); @@ -182,59 +182,59 @@ KexiDBForm::drawRects(const QValueList<QRect> &list, int type) void KexiDBForm::initBuffer() { - repaintAll(this); + tqrepaintAll(this); d->buffer.resize( width(), height() ); - d->buffer = QPixmap::grabWindow( winId() ); - d->prev_rect = QRect(); + d->buffer = TQPixmap::grabWindow( winId() ); + d->prev_rect = TQRect(); } void KexiDBForm::clearForm() { - QPainter p; - p.begin(this, true); + TQPainter p; + p.tqbegin(TQT_TQPAINTDEVICE(this), true); bool unclipped = testWFlags( WPaintUnclipped ); setWFlags( WPaintUnclipped ); //redraw entire form surface - p.drawPixmap( QPoint(0,0), d->buffer, QRect(0,0,d->buffer.width(), d->buffer.height()) ); + p.drawPixmap( TQPoint(0,0), d->buffer, TQRect(0,0,d->buffer.width(), d->buffer.height()) ); if (!unclipped) clearWFlags( WPaintUnclipped ); p.end(); - repaintAll(this); + tqrepaintAll(this); } void -KexiDBForm::highlightWidgets(QWidget *from, QWidget *to)//, const QPoint &point) +KexiDBForm::highlightWidgets(TQWidget *from, TQWidget *to)//, const TQPoint &point) { - QPoint fromPoint, toPoint; - if(from && from->parentWidget() && (from != this)) - fromPoint = from->parentWidget()->mapTo(this, from->pos()); - if(to && to->parentWidget() && (to != this)) - toPoint = to->parentWidget()->mapTo(this, to->pos()); - - QPainter p; - p.begin(this, true); + TQPoint fromPoint, toPoint; + if(from && from->tqparentWidget() && (from != this)) + fromPoint = from->tqparentWidget()->mapTo(this, from->pos()); + if(to && to->tqparentWidget() && (to != this)) + toPoint = to->tqparentWidget()->mapTo(this, to->pos()); + + TQPainter p; + p.tqbegin(TQT_TQPAINTDEVICE(this), true); bool unclipped = testWFlags( WPaintUnclipped ); setWFlags( WPaintUnclipped ); if (d->prev_rect.isValid()) { //redraw prev. selection's rectangle - p.drawPixmap( QPoint(d->prev_rect.x(), d->prev_rect.y()), d->buffer, - QRect(d->prev_rect.x(), d->prev_rect.y(), d->prev_rect.width(), d->prev_rect.height())); + p.drawPixmap( TQPoint(d->prev_rect.x(), d->prev_rect.y()), d->buffer, + TQRect(d->prev_rect.x(), d->prev_rect.y(), d->prev_rect.width(), d->prev_rect.height())); } - p.setPen( QPen(Qt::red, 2) ); + p.setPen( TQPen(TQt::red, 2) ); if(to) { - QPixmap pix1 = QPixmap::grabWidget(from); - QPixmap pix2 = QPixmap::grabWidget(to); + TQPixmap pix1 = TQPixmap::grabWidget(from); + TQPixmap pix2 = TQPixmap::grabWidget(to); if((from != this) && (to != this)) - p.drawLine( from->parentWidget()->mapTo(this, from->geometry().center()), to->parentWidget()->mapTo(this, to->geometry().center()) ); + p.drawLine( from->tqparentWidget()->mapTo(this, from->tqgeometry().center()), to->tqparentWidget()->mapTo(this, to->tqgeometry().center()) ); p.drawPixmap(fromPoint.x(), fromPoint.y(), pix1); p.drawPixmap(toPoint.x(), toPoint.y(), pix2); @@ -251,7 +251,7 @@ KexiDBForm::highlightWidgets(QWidget *from, QWidget *to)//, const QPoint &point) p.drawRoundRect(fromPoint.x(), fromPoint.y(), from->width(), from->height(), 5, 5); if((to == this) || (from == this)) - d->prev_rect = QRect(0, 0, d->buffer.width(), d->buffer.height()); + d->prev_rect = TQRect(0, 0, d->buffer.width(), d->buffer.height()); else if(to) { d->prev_rect.setX( (fromPoint.x() < toPoint.x()) ? (fromPoint.x() - 5) : (toPoint.x() - 5) ); @@ -260,21 +260,21 @@ KexiDBForm::highlightWidgets(QWidget *from, QWidget *to)//, const QPoint &point) d->prev_rect.setBottom( (fromPoint.y() < toPoint.y()) ? (toPoint.y() + to->height() + 10) : (fromPoint.y() + from->height() + 10) ) ; } else - d->prev_rect = QRect(fromPoint.x()- 5, fromPoint.y() -5, from->width() + 10, from->height() + 10); + d->prev_rect = TQRect(fromPoint.x()- 5, fromPoint.y() -5, from->width() + 10, from->height() + 10); if (!unclipped) clearWFlags( WPaintUnclipped ); p.end(); } -QSize -KexiDBForm::sizeHint() const +TQSize +KexiDBForm::tqsizeHint() const { //todo: find better size (user configured?) - return QSize(400,300); + return TQSize(400,300); } -void KexiDBForm::setInvalidState( const QString& displayText ) +void KexiDBForm::setInvalidState( const TQString& displayText ) { Q_UNUSED( displayText ); @@ -291,40 +291,40 @@ void KexiDBForm::setAutoTabStops(bool set) d->autoTabStops = set; } -QPtrList<QWidget>* KexiDBForm::orderedFocusWidgets() const +TQPtrList<TQWidget>* KexiDBForm::orderedFocusWidgets() const { return &d->orderedFocusWidgets; } -QPtrList<QWidget>* KexiDBForm::orderedDataAwareWidgets() const +TQPtrList<TQWidget>* KexiDBForm::orderedDataAwareWidgets() const { return &d->orderedDataAwareWidgets; } void KexiDBForm::updateTabStopsOrder(KFormDesigner::Form* form) { - QWidget *fromWidget = 0; - //QWidget *topLevelWidget = form->widget()->topLevelWidget(); + TQWidget *fromWidget = 0; + //TQWidget *tqtopLevelWidget = form->widget()->tqtopLevelWidget(); //js form->updateTabStopsOrder(); //certain widgets can have now updated focusPolicy properties, fix this uint numberOfDataAwareWidgets = 0; // if (d->orderedFocusWidgets.isEmpty()) { //generate a new list for (KFormDesigner::ObjectTreeListIterator it(form->tabStopsIterator()); it.current(); ++it) { - if (it.current()->widget()->focusPolicy() & QWidget::TabFocus) { + if (it.current()->widget()->focusPolicy() & TQ_TabFocus) { //this widget has tab focus: it.current()->widget()->installEventFilter(this); - //also filter events for data-aware children of this widget (i.e. KexiDBAutoField's editors) - QObjectList *children = it.current()->widget()->queryList("QWidget"); - for (QObjectListIt childrenIt(*children); childrenIt.current(); ++childrenIt) { - // if (dynamic_cast<KexiFormDataItemInterface*>(childrenIt.current())) { + //also filter events for data-aware tqchildren of this widget (i.e. KexiDBAutoField's editors) + TQObjectList *tqchildren = it.current()->widget()->queryList(TQWIDGET_OBJECT_NAME_STRING); + for (TQObjectListIt tqchildrenIt(*tqchildren); tqchildrenIt.current(); ++tqchildrenIt) { + // if (dynamic_cast<KexiFormDataItemInterface*>(tqchildrenIt.current())) { kexipluginsdbg << "KexiDBForm::updateTabStopsOrder(): also adding '" - << childrenIt.current()->className() << " " << childrenIt.current()->name() + << tqchildrenIt.current()->className() << " " << tqchildrenIt.current()->name() << "' child to filtered widgets" << endl; - //it.current()->widget()->installEventFilter(static_cast<QWidget*>(childrenIt.current())); - childrenIt.current()->installEventFilter(this); + //it.current()->widget()->installEventFilter(TQT_TQWIDGET(tqchildrenIt.current())); + tqchildrenIt.current()->installEventFilter(this); // } } - delete children; + delete tqchildren; if (fromWidget) { kexipluginsdbg << "KexiDBForm::updateTabStopsOrder() tab order: " << fromWidget->name() << " -> " << it.current()->widget()->name() << endl; @@ -342,7 +342,7 @@ void KexiDBForm::updateTabStopsOrder(KFormDesigner::Form* form) // /*! @todo d->indicesForDataAwareWidgets SHOULDNT BE UPDATED HERE BECAUSE // THERE CAN BE ALSO NON-TABSTOP DATA WIDGETS! // */ - d->indicesForDataAwareWidgets.replace( + d->indicesForDataAwareWidgets.tqreplace( dataItem, numberOfDataAwareWidgets ); numberOfDataAwareWidgets++; @@ -353,7 +353,7 @@ void KexiDBForm::updateTabStopsOrder(KFormDesigner::Form* form) // } /* else { //restore ordering - for (QPtrListIterator<QWidget> it(d->orderedFocusWidgets); it.current(); ++it) { + for (TQPtrListIterator<TQWidget> it(d->orderedFocusWidgets); it.current(); ++it) { if (fromWidget) { kdDebug() << "KexiDBForm::updateTabStopsOrder() tab order: " << fromWidget->name() << " -> " << it.current()->name() << endl; @@ -361,14 +361,14 @@ void KexiDBForm::updateTabStopsOrder(KFormDesigner::Form* form) } fromWidget = it.current(); } -// SET_FOCUS_USING_REASON(focusWidget(), QFocusEvent::Tab); +// SET_FOCUS_USING_REASON(tqfocusWidget(), TQFocusEvent::Tab); }*/ } void KexiDBForm::updateTabStopsOrder() { - for (QPtrListIterator<QWidget> it( d->orderedFocusWidgets ); it.current();) { - if (! (it.current()->focusPolicy() & QWidget::TabFocus)) + for (TQPtrListIterator<TQWidget> it( d->orderedFocusWidgets ); it.current();) { + if (! (it.current()->focusPolicy() & TQ_TabFocus)) d->orderedFocusWidgets.remove( it.current() ); else ++it; @@ -377,7 +377,7 @@ void KexiDBForm::updateTabStopsOrder() void KexiDBForm::updateReadOnlyFlags() { - for (QPtrListIterator<QWidget> it(d->orderedDataAwareWidgets); it.current(); ++it) { + for (TQPtrListIterator<TQWidget> it(d->orderedDataAwareWidgets); it.current(); ++it) { KexiFormDataItemInterface* dataItem = dynamic_cast<KexiFormDataItemInterface*>( it.current() ); if (dataItem && !dataItem->dataSource().isEmpty()) { if (dataAwareObject()->isReadOnly()) { @@ -387,27 +387,27 @@ void KexiDBForm::updateReadOnlyFlags() } } -bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) +bool KexiDBForm::eventFilter( TQObject * watched, TQEvent * e ) { //kexipluginsdbg << e->type() << endl; - if (e->type()==QEvent::Resize && watched == this) + if (e->type()==TQEvent::Resize && TQT_BASE_OBJECT(watched) == TQT_BASE_OBJECT(this)) kexipluginsdbg << "RESIZE" << endl; - if (e->type()==QEvent::KeyPress) { + if (e->type()==TQEvent::KeyPress) { if (preview()) { - QKeyEvent *ke = static_cast<QKeyEvent*>(e); + TQKeyEvent *ke = TQT_TQKEYEVENT(e); const int key = ke->key(); - bool tab = ke->state() == Qt::NoButton && key == Qt::Key_Tab; - bool backtab = ((ke->state() == Qt::NoButton || ke->state() == Qt::ShiftButton) && key == Qt::Key_Backtab) - || (ke->state() == Qt::ShiftButton && key == Qt::Key_Tab); - QObject *o = watched; //focusWidget(); - QWidget* realWidget = dynamic_cast<QWidget*>(o); //will beused below (for tab/backtab handling) + bool tab = ke->state() == Qt::NoButton && key == TQt::Key_Tab; + bool backtab = ((ke->state() == Qt::NoButton || ke->state() == TQt::ShiftButton) && key == TQt::Key_Backtab) + || (ke->state() == TQt::ShiftButton && key == TQt::Key_Tab); + TQObject *o = watched; //tqfocusWidget(); + TQWidget* realWidget = dynamic_cast<TQWidget*>(o); //will beused below (for tab/backtab handling) if (!tab && !backtab) { //for buttons, left/up and right/down keys act like tab/backtab (see qbutton.cpp) - if (realWidget->inherits("QButton")) { - if (ke->state() == Qt::NoButton && (key == Qt::Key_Right || key == Qt::Key_Down)) + if (realWidget->inherits(TQBUTTON_OBJECT_NAME_STRING)) { + if (ke->state() == Qt::NoButton && (key == TQt::Key_Right || key == TQt::Key_Down)) tab = true; - else if (ke->state() == Qt::NoButton && (key == Qt::Key_Left || key == Qt::Key_Up)) + else if (ke->state() == Qt::NoButton && (key == TQt::Key_Left || key == TQt::Key_Up)) backtab = true; } } @@ -415,21 +415,21 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) if (!tab && !backtab) { // allow the editor widget to grab the key press event while (true) { - if (!o || o == dynamic_cast<QObject*>(d->dataAwareObject)) + if (!o || o == dynamic_cast<TQObject*>(d->dataAwareObject)) break; if (dynamic_cast<KexiFormDataItemInterface*>(o)) { - realWidget = dynamic_cast<QWidget*>(o); //will be used below + realWidget = dynamic_cast<TQWidget*>(o); //will be used below if (realWidget == this) //we have encountered 'this' form surface, give up return false; KexiFormDataItemInterface* dataItemIface = dynamic_cast<KexiFormDataItemInterface*>(o); while (dataItemIface) { if (dataItemIface->keyPressed(ke)) return false; - dataItemIface = dynamic_cast<KexiFormDataItemInterface*>(dataItemIface->parentInterface()); //try in parent, e.g. in combobox + dataItemIface = dynamic_cast<KexiFormDataItemInterface*>(dataItemIface->tqparentInterface()); //try in tqparent, e.g. in combobox } break; } - o = o->parent(); + o = o->tqparent(); } // try to handle global shortcuts at the KexiDataAwareObjectInterface // level (e.g. for "next record" action) @@ -437,15 +437,15 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) int curCol = d->dataAwareObject->currentColumn(); bool moveToFirstField; //if true, we'll move focus to the first field (in tab order) bool moveToLastField; //if true, we'll move focus to the first field (in tab order) - if (! (ke->state() == Qt::NoButton && (key == Qt::Key_Home - || key == Qt::Key_End || key == Qt::Key_Down || key == Qt::Key_Up)) + if (! (ke->state() == Qt::NoButton && (key == TQt::Key_Home + || key == TQt::Key_End || key == TQt::Key_Down || key == TQt::Key_Up)) /* ^^ home/end/down/up are already handled by widgets */ && d->dataAwareObject->handleKeyPress( ke, curRow, curCol, false/*!fullRowSelection*/, &moveToFirstField, &moveToLastField)) { if (ke->isAccepted()) return true; - QWidget* widgetToFocus; + TQWidget* widgetToFocus; if (moveToFirstField) { widgetToFocus = d->orderedFocusWidgets.first(); //? curCol = d->indexOfDataAwareWidget( widgetToFocus ); @@ -467,14 +467,14 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) ke->accept(); return true; } - if (key == Qt::Key_Delete && ke->state()==Qt::ControlButton) { + if (key == TQt::Key_Delete && ke->state()==TQt::ControlButton) { //! @todo remove hardcoded shortcuts: can be reconfigured... d->dataAwareObject->deleteCurrentRow(); return true; } } // handle Esc key - if (ke->state() == Qt::NoButton && key == Qt::Key_Escape) { + if (ke->state() == Qt::NoButton && key == TQt::Key_Escape) { //cancel field editing/row editing if possible if (d->dataAwareObject->cancelEditor()) return true; @@ -482,29 +482,29 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) return true; return false; // canceling not needed - pass the event to the active widget } - // jstaniek: Fix for Qt bug (handling e.g. Alt+2, Ctrl+2 keys on every platform) + // jstaniek: Fix for TQt bug (handling e.g. Alt+2, Ctrl+2 keys on every platform) // It's important because we're using alt+2 short cut by default // Damn! I've reported this to Trolltech in November 2004 - still not fixed. - if (ke->isAccepted() && (ke->state() & Qt::AltButton) && ke->text()>="0" && ke->text()<="9") + if (ke->isAccepted() && (ke->state() & TQt::AltButton) && ke->text()>="0" && ke->text()<="9") return true; if (tab || backtab) { //the watched widget can be a subwidget of a real widget, e.g. a drop down button of image box: find it while (!KexiFormPart::library()->widgetInfoForClassName(realWidget->className())) - realWidget = realWidget->parentWidget(); + realWidget = realWidget->tqparentWidget(); if (!realWidget) return true; //ignore //the watched widget can be a subwidget of a real widget, e.g. autofield: find it - //QWidget* realWidget = static_cast<QWidget*>(watched); - while (dynamic_cast<KexiDataItemInterface*>(realWidget) && dynamic_cast<KexiDataItemInterface*>(realWidget)->parentInterface()) - realWidget = dynamic_cast<QWidget*>( dynamic_cast<KexiDataItemInterface*>(realWidget)->parentInterface() ); + //TQWidget* realWidget = TQT_TQWIDGET(watched); + while (dynamic_cast<KexiDataItemInterface*>(realWidget) && dynamic_cast<KexiDataItemInterface*>(realWidget)->tqparentInterface()) + realWidget = dynamic_cast<TQWidget*>( dynamic_cast<KexiDataItemInterface*>(realWidget)->tqparentInterface() ); d->setOrderedFocusWidgetsIteratorTo( realWidget ); kexipluginsdbg << realWidget->name() << endl; // find next/prev widget to focus - QWidget *widgetToUnfocus = realWidget; - QWidget *widgetToFocus = 0; + TQWidget *widgetToUnfocus = realWidget; + TQWidget *widgetToFocus = 0; bool wasAtFirstWidget = false; //used to protect against infinite loop while (true) { if (tab) { @@ -533,11 +533,11 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) widgetToFocus = d->orderedFocusWidgetsIterator.current(); - QObject *pageFor_widgetToFocus = 0; + TQObject *pageFor_widgetToFocus = 0; KFormDesigner::TabWidget *tabWidgetFor_widgetToFocus = KFormDesigner::findParent<KFormDesigner::TabWidget>( widgetToFocus, "KFormDesigner::TabWidget", pageFor_widgetToFocus); - if (tabWidgetFor_widgetToFocus && tabWidgetFor_widgetToFocus->currentPage()!=pageFor_widgetToFocus) { + if (tabWidgetFor_widgetToFocus && TQT_BASE_OBJECT(tabWidgetFor_widgetToFocus->currentPage())!=TQT_BASE_OBJECT(pageFor_widgetToFocus)) { realWidget = widgetToFocus; continue; //the new widget to focus is placed on invisible tab page: move to next widget } @@ -545,21 +545,21 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) }//while //set focus, but don't use just setFocus() because certain widgets - //behaves differently (e.g. QLineEdit calls selectAll()) when - //focus event's reason is QFocusEvent::Tab + //behaves differently (e.g. TQLineEdit calls selectAll()) when + //focus event's reason is TQFocusEvent::Tab if (widgetToFocus->focusProxy()) - widgetToFocus = widgetToFocus->focusProxy(); + widgetToFocus = TQT_TQWIDGET(widgetToFocus->focusProxy()); if (widgetToFocus && d->dataAwareObject->acceptEditor()) { if (tab) { //try to accept this will validate the current input (if any) - KexiUtils::unsetFocusWithReason(widgetToUnfocus, QFocusEvent::Tab); - KexiUtils::setFocusWithReason(widgetToFocus, QFocusEvent::Tab); + KexiUtils::unsetFocusWithReason(widgetToUnfocus, TQFocusEvent::Tab); + KexiUtils::setFocusWithReason(widgetToFocus, TQFocusEvent::Tab); kexipluginsdbg << "focusing " << widgetToFocus->name() << endl; } else {//backtab - KexiUtils::unsetFocusWithReason(widgetToUnfocus, QFocusEvent::Backtab); + KexiUtils::unsetFocusWithReason(widgetToUnfocus, TQFocusEvent::Backtab); //set focus, see above note - KexiUtils::setFocusWithReason(d->orderedFocusWidgetsIterator.current(), QFocusEvent::Backtab); + KexiUtils::setFocusWithReason(d->orderedFocusWidgetsIterator.current(), TQFocusEvent::Backtab); kexipluginsdbg << "focusing " << d->orderedFocusWidgetsIterator.current()->name() << endl; } } @@ -567,9 +567,9 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) } } } - else if (e->type()==QEvent::FocusIn) { + else if (e->type()==TQEvent::FocusIn) { bool focusDataWidget = preview(); - if (static_cast<QFocusEvent*>(e)->reason()==QFocusEvent::Popup) { + if (TQT_TQFOCUSEVENT(e)->reason()==TQFocusEvent::Popup) { kdDebug() << "->>> focus IN, popup" <<endl; focusDataWidget = !d->popupFocused; d->popupFocused = false; @@ -582,10 +582,10 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) if (focusDataWidget) { kexipluginsdbg << "KexiDBForm: FocusIn: " << watched->className() << " " << watched->name() << endl; if (d->dataAwareObject) { - QWidget *dataItem = dynamic_cast<QWidget*>(watched); + TQWidget *dataItem = dynamic_cast<TQWidget*>(watched); while (dataItem) { while (dataItem && !dynamic_cast<KexiDataItemInterface*>(dataItem)) - dataItem = dataItem->parentWidget(); + dataItem = dataItem->tqparentWidget(); if (!dataItem) break; kexipluginsdbg << "KexiDBForm: FocusIn: FOUND " << dataItem->className() << " " << dataItem->name() << endl; @@ -600,23 +600,23 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) break; } else - dataItem = dataItem->parentWidget(); + dataItem = dataItem->tqparentWidget(); dataItem->update(); } } } } - else if (e->type()==QEvent::FocusOut) { - if (static_cast<QFocusEvent*>(e)->reason()==QFocusEvent::Popup) { - //d->widgetFocusedBeforePopup = (QWidget*)watched; + else if (e->type()==TQEvent::FocusOut) { + if (TQT_TQFOCUSEVENT(e)->reason()==TQFocusEvent::Popup) { + //d->widgetFocusedBeforePopup = (TQWidget*)watched; d->popupFocused = true; } else d->popupFocused = false; // d->widgetFocusedBeforePopup = 0; -// kdDebug() << "e->type()==QEvent::FocusOut " << watched->className() << " " <<watched->name() << endl; -// UNSET_FOCUS_USING_REASON(watched, static_cast<QFocusEvent*>(e)->reason()); +// kdDebug() << "e->type()==TQEvent::FocusOut " << watched->className() << " " <<watched->name() << endl; +// UNSET_FOCUS_USING_REASON(watched, TQT_TQFOCUSEVENT(e)->reason()); } return KexiDBFormBase::eventFilter(watched, e); } @@ -645,7 +645,7 @@ void KexiDBForm::setReadOnly( bool readOnly ) d->dataAwareObject->setReadOnly( readOnly ); //??? } -QWidget* KexiDBForm::widget() +TQWidget* KexiDBForm::widget() { return this; } @@ -670,19 +670,19 @@ bool KexiDBForm::preview() const { ? dynamic_cast<KexiScrollView*>(d->dataAwareObject)->preview() : false; } -void KexiDBForm::dragMoveEvent( QDragMoveEvent *e ) +void KexiDBForm::dragMoveEvent( TQDragMoveEvent *e ) { KexiDBFormBase::dragMoveEvent( e ); emit handleDragMoveEvent(e); } -void KexiDBForm::dropEvent( QDropEvent *e ) +void KexiDBForm::dropEvent( TQDropEvent *e ) { KexiDBFormBase::dropEvent( e ); emit handleDropEvent(e); } -void KexiDBForm::setCursor( const QCursor & cursor ) +void KexiDBForm::setCursor( const TQCursor & cursor ) { //js: empty, to avoid fscking problems with random cursors! //! @todo? @@ -691,11 +691,11 @@ void KexiDBForm::setCursor( const QCursor & cursor ) KexiDBFormBase::setCursor(cursor); } -//! @todo: Qt4? XORed resize rectangles instead of black widgets +//! @todo: TQt4? XORed resize rectangles instead of black widgets /* -void KexiDBForm::paintEvent( QPaintEvent *e ) +void KexiDBForm::paintEvent( TQPaintEvent *e ) { - QPainter p; + TQPainter p; p.begin(this, true); bool unclipped = testWFlags( WPaintUnclipped ); setWFlags( WPaintUnclipped ); diff --git a/kexi/plugins/forms/widgets/kexidbform.h b/kexi/plugins/forms/widgets/kexidbform.h index 81a71bba..cbfdc8ee 100644 --- a/kexi/plugins/forms/widgets/kexidbform.h +++ b/kexi/plugins/forms/widgets/kexidbform.h @@ -21,7 +21,7 @@ #ifndef KEXIDBFORM_H #define KEXIDBFORM_H -#include <qpixmap.h> +#include <tqpixmap.h> #include <formeditor/form.h> #include "../kexiformdataiteminterface.h" @@ -30,7 +30,7 @@ #include <kexigradientwidget.h> # define KexiDBFormBase KexiGradientWidget #else -# define KexiDBFormBase QWidget +# define KexiDBFormBase TQWidget #endif class KexiDataAwareObjectInterface; @@ -43,88 +43,89 @@ class KEXIFORMUTILS_EXPORT KexiDBForm : public KexiFormDataItemInterface { Q_OBJECT - Q_PROPERTY(QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) - Q_PROPERTY(QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) - Q_PROPERTY(bool autoTabStops READ autoTabStops WRITE setAutoTabStops DESIGNABLE true) + TQ_OBJECT + TQ_PROPERTY(TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) + TQ_PROPERTY(TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) + TQ_PROPERTY(bool autoTabStops READ autoTabStops WRITE setAutoTabStops DESIGNABLE true) //original "size" property is not designable, so here's a custom (not storable) replacement - Q_PROPERTY( QSize sizeInternal READ sizeInternal WRITE resizeInternal DESIGNABLE true STORED false ) + TQ_PROPERTY( TQSize sizeInternal READ sizeInternal WRITE resizeInternal DESIGNABLE true STORED false ) public: - KexiDBForm(QWidget *parent, KexiDataAwareObjectInterface* dataAwareObject, const char *name="kexi_dbform"); + KexiDBForm(TQWidget *tqparent, KexiDataAwareObjectInterface* dataAwareObject, const char *name="kexi_dbform"); virtual ~KexiDBForm(); KexiDataAwareObjectInterface* dataAwareObject() const; - inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); } - inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } + inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); } + inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } //! no effect - QVariant value() { return QVariant(); } + TQVariant value() { return TQVariant(); } - virtual void setInvalidState( const QString& displayText ); + virtual void setInvalidState( const TQString& displayText ); - virtual void drawRect(const QRect& r, int type); - virtual void drawRects(const QValueList<QRect> &list, int type); + virtual void drawRect(const TQRect& r, int type); + virtual void drawRects(const TQValueList<TQRect> &list, int type); virtual void initBuffer(); virtual void clearForm(); - virtual void highlightWidgets(QWidget *from, QWidget *to/*, const QPoint &p*/); + virtual void highlightWidgets(TQWidget *from, TQWidget *to/*, const TQPoint &p*/); - virtual QSize sizeHint() const; + virtual TQSize tqsizeHint() const; bool autoTabStops() const; - QPtrList<QWidget>* orderedFocusWidgets() const; + TQPtrList<TQWidget>* orderedFocusWidgets() const; - QPtrList<QWidget>* orderedDataAwareWidgets() const; + TQPtrList<TQWidget>* orderedDataAwareWidgets() const; void updateTabStopsOrder(KFormDesigner::Form* form); void updateTabStopsOrder(); - virtual bool eventFilter ( QObject * watched, QEvent * e ); + virtual bool eventFilter ( TQObject * watched, TQEvent * e ); virtual bool valueIsNull(); virtual bool valueIsEmpty(); virtual bool isReadOnly() const; - virtual QWidget* widget(); + virtual TQWidget* widget(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); virtual void clear(); bool preview() const; - virtual void setCursor( const QCursor & cursor ); + virtual void setCursor( const TQCursor & cursor ); public slots: void setAutoTabStops(bool set); - inline void setDataSource(const QString &ds) { KexiFormDataItemInterface::setDataSource(ds); } - inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } + inline void setDataSource(const TQString &ds) { KexiFormDataItemInterface::setDataSource(ds); } + inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } //! This implementation just disables read only widget virtual void setReadOnly( bool readOnly ); //! @internal for sizeInternal property - QSize sizeInternal() const { return KexiDBFormBase::size(); } + TQSize sizeInternal() const { return KexiDBFormBase::size(); } //! @internal for sizeInternal property - void resizeInternal(const QSize& s) { KexiDBFormBase::resize(s); } + void resizeInternal(const TQSize& s) { KexiDBFormBase::resize(s); } signals: - void handleDragMoveEvent(QDragMoveEvent *e); - void handleDropEvent(QDropEvent *e); + void handleDragMoveEvent(TQDragMoveEvent *e); + void handleDropEvent(TQDropEvent *e); protected: //! no effect - virtual void setValueInternal(const QVariant&, bool) {} + virtual void setValueInternal(const TQVariant&, bool) {} //! Used to emit handleDragMoveEvent() signal needed to control dragging over the container's surface - virtual void dragMoveEvent( QDragMoveEvent *e ); + virtual void dragMoveEvent( TQDragMoveEvent *e ); //! Used to emit handleDropEvent() signal needed to control dropping on the container's surface - virtual void dropEvent( QDropEvent *e ); + virtual void dropEvent( TQDropEvent *e ); //! called from KexiFormScrollView::initDataContents() void updateReadOnlyFlags(); -// virtual void paintEvent( QPaintEvent * ); +// virtual void paintEvent( TQPaintEvent * ); //! Points to a currently edited data item. //! It is cleared when the focus is moved to other diff --git a/kexi/plugins/forms/widgets/kexidbimagebox.cpp b/kexi/plugins/forms/widgets/kexidbimagebox.cpp index 82e70086..5f2f20e3 100644 --- a/kexi/plugins/forms/widgets/kexidbimagebox.cpp +++ b/kexi/plugins/forms/widgets/kexidbimagebox.cpp @@ -20,15 +20,15 @@ #include "kexidbimagebox.h" -#include <qapplication.h> -#include <qpixmap.h> -#include <qstyle.h> -#include <qclipboard.h> -#include <qtooltip.h> -#include <qimage.h> -#include <qbuffer.h> -#include <qfiledialog.h> -#include <qpainter.h> +#include <tqapplication.h> +#include <tqpixmap.h> +#include <tqstyle.h> +#include <tqclipboard.h> +#include <tqtooltip.h> +#include <tqimage.h> +#include <tqbuffer.h> +#include <tqfiledialog.h> +#include <tqpainter.h> #include <kdebug.h> #include <kpopupmenu.h> @@ -51,7 +51,7 @@ #include <kexidb/queryschema.h> #include <formeditor/widgetlibrary.h> -#ifdef Q_WS_WIN +#ifdef TQ_WS_WIN #include <win32_utils.h> #include <krecentdirs.h> #endif @@ -59,15 +59,15 @@ #include "kexidbutils.h" #include "../kexiformpart.h" -static KStaticDeleter<QPixmap> KexiDBImageBox_pmDeleter; -static QPixmap* KexiDBImageBox_pm = 0; -static KStaticDeleter<QPixmap> KexiDBImageBox_pmSmallDeleter; -static QPixmap* KexiDBImageBox_pmSmall = 0; +static KStaticDeleter<TQPixmap> KexiDBImageBox_pmDeleter; +static TQPixmap* KexiDBImageBox_pm = 0; +static KStaticDeleter<TQPixmap> KexiDBImageBox_pmSmallDeleter; +static TQPixmap* KexiDBImageBox_pmSmall = 0; -KexiDBImageBox::KexiDBImageBox( bool designMode, QWidget *parent, const char *name ) - : KexiFrame( parent, name, Qt::WNoAutoErase ) +KexiDBImageBox::KexiDBImageBox( bool designMode, TQWidget *tqparent, const char *name ) + : KexiFrame( tqparent, name, TQt::WNoAutoErase ) , KexiFormDataItemInterface() - , m_alignment(Qt::AlignAuto|Qt::AlignTop) + , m_tqalignment(TQt::AlignAuto|TQt::AlignTop) , m_designMode(designMode) , m_readOnly(false) , m_scaledContents(false) @@ -80,7 +80,7 @@ KexiDBImageBox::KexiDBImageBox( bool designMode, QWidget *parent, const char *na , m_insideSetPalette(false) { installEventFilter(this); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + tqsetSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Preferred); //setup popup menu m_popupMenu = new KexiImageContextMenu(this); @@ -91,47 +91,47 @@ KexiDBImageBox::KexiDBImageBox( bool designMode, QWidget *parent, const char *na } else { m_chooser = new KexiDropDownButton(this); - m_chooser->setFocusPolicy(StrongFocus); + m_chooser->setFocusPolicy(TQ_StrongFocus); m_chooser->setPopup(m_popupMenu); setFocusProxy(m_chooser); m_chooser->installEventFilter(this); -// m_chooser->setPalette(qApp->palette()); +// m_chooser->setPalette(tqApp->palette()); // hlyr->addWidget(m_chooser); } - setBackgroundMode(Qt::NoBackground); - setFrameShape(QFrame::Box); - setFrameShadow(QFrame::Plain); - setFrameColor(Qt::black); + setBackgroundMode(TQt::NoBackground); + setFrameShape(TQFrame::Box); + setFrameShadow(TQFrame::Plain); + setFrameColor(TQt::black); m_paletteBackgroundColorChanged = false; //set this here, not before - connect(m_popupMenu, SIGNAL(updateActionsAvailabilityRequested(bool&, bool&)), - this, SLOT(slotUpdateActionsAvailabilityRequested(bool&, bool&))); - connect(m_popupMenu, SIGNAL(insertFromFileRequested(const KURL&)), - this, SLOT(handleInsertFromFileAction(const KURL&))); - connect(m_popupMenu, SIGNAL(saveAsRequested(const QString&)), - this, SLOT(handleSaveAsAction(const QString&))); - connect(m_popupMenu, SIGNAL(cutRequested()), - this, SLOT(handleCutAction())); - connect(m_popupMenu, SIGNAL(copyRequested()), - this, SLOT(handleCopyAction())); - connect(m_popupMenu, SIGNAL(pasteRequested()), - this, SLOT(handlePasteAction())); - connect(m_popupMenu, SIGNAL(clearRequested()), - this, SLOT(clear())); - connect(m_popupMenu, SIGNAL(showPropertiesRequested()), - this, SLOT(handleShowPropertiesAction())); - -// connect(m_popupMenu, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHidePopupMenu())); + connect(m_popupMenu, TQT_SIGNAL(updateActionsAvailabilityRequested(bool&, bool&)), + this, TQT_SLOT(slotUpdateActionsAvailabilityRequested(bool&, bool&))); + connect(m_popupMenu, TQT_SIGNAL(insertFromFileRequested(const KURL&)), + this, TQT_SLOT(handleInsertFromFileAction(const KURL&))); + connect(m_popupMenu, TQT_SIGNAL(saveAsRequested(const TQString&)), + this, TQT_SLOT(handleSaveAsAction(const TQString&))); + connect(m_popupMenu, TQT_SIGNAL(cutRequested()), + this, TQT_SLOT(handleCutAction())); + connect(m_popupMenu, TQT_SIGNAL(copyRequested()), + this, TQT_SLOT(handleCopyAction())); + connect(m_popupMenu, TQT_SIGNAL(pasteRequested()), + this, TQT_SLOT(handlePasteAction())); + connect(m_popupMenu, TQT_SIGNAL(clearRequested()), + this, TQT_SLOT(clear())); + connect(m_popupMenu, TQT_SIGNAL(showPropertiesRequested()), + this, TQT_SLOT(handleShowPropertiesAction())); + +// connect(m_popupMenu, TQT_SIGNAL(aboutToHide()), this, TQT_SLOT(slotAboutToHidePopupMenu())); // if (m_chooser) { //we couldn't use m_chooser->setPopup() because of drawing problems -// connect(m_chooser, SIGNAL(pressed()), this, SLOT(slotChooserPressed())); -// connect(m_chooser, SIGNAL(released()), this, SLOT(slotChooserReleased())); -// connect(m_chooser, SIGNAL(toggled(bool)), this, SLOT(slotToggled(bool))); +// connect(m_chooser, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotChooserPressed())); +// connect(m_chooser, TQT_SIGNAL(released()), this, TQT_SLOT(slotChooserReleased())); +// connect(m_chooser, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotToggled(bool))); // } - setDataSource( QString::null ); //to initialize popup menu and actions availability + setDataSource( TQString() ); //to initialize popup menu and actions availability } KexiDBImageBox::~KexiDBImageBox() @@ -143,29 +143,29 @@ KexiImageContextMenu* KexiDBImageBox::contextMenu() const return m_popupMenu; } -QVariant KexiDBImageBox::value() +TQVariant KexiDBImageBox::value() { if (dataSource().isEmpty()) { //not db-aware - return QVariant(); + return TQVariant(); } //db-aware mode return m_value; //todo - //return QVariant(); //todo + //return TQVariant(); //todo } -void KexiDBImageBox::setValueInternal( const QVariant& add, bool removeOld, bool loadPixmap ) +void KexiDBImageBox::setValueInternal( const TQVariant& add, bool removeOld, bool loadPixmap ) { if (isReadOnly()) return; m_popupMenu->hide(); if (removeOld) m_value = add.toByteArray(); - else //do not add "m_origValue" to "add" as this is QByteArray + else //do not add "m_origValue" to "add" as this is TQByteArray m_value = m_origValue.toByteArray(); bool ok = !m_value.isEmpty(); if (ok) { - ///unused (m_valueMimeType is not available unless the px is inserted) QString type( KImageIO::typeForMime(m_valueMimeType) ); + ///unused (m_valueMimeType is not available unless the px is inserted) TQString type( KImageIO::typeForMime(m_valueMimeType) ); ///ok = KImageIO::canRead( type ); ok = loadPixmap ? m_pixmap.loadFromData(m_value) : true; //, type.latin1()); if (!ok) { @@ -173,22 +173,22 @@ void KexiDBImageBox::setValueInternal( const QVariant& add, bool removeOld, bool } } if (!ok) { - m_valueMimeType = QString::null; - m_pixmap = QPixmap(); + m_valueMimeType = TQString(); + m_pixmap = TQPixmap(); } - repaint(); + tqrepaint(); } -void KexiDBImageBox::setInvalidState( const QString& displayText ) +void KexiDBImageBox::setInvalidState( const TQString& displayText ) { Q_UNUSED( displayText ); -// m_pixmapLabel->setPixmap(QPixmap()); +// m_pixmapLabel->setPixmap(TQPixmap()); if (!dataSource().isEmpty()) { - m_value = QByteArray(); + m_value = TQByteArray(); } -// m_pixmap = QPixmap(); -// m_originalFileName = QString::null; +// m_pixmap = TQPixmap(); +// m_originalFileName = TQString(); //! @todo m_pixmapLabel->setText( displayText ); @@ -218,7 +218,7 @@ void KexiDBImageBox::setReadOnly(bool set) m_readOnly = set; } -QPixmap KexiDBImageBox::pixmap() const +TQPixmap KexiDBImageBox::pixmap() const { if (dataSource().isEmpty()) { //not db-aware @@ -242,7 +242,7 @@ void KexiDBImageBox::setPixmapId(uint id) if (m_insideSetData) //avoid recursion return; setData(KexiBLOBBuffer::self()->objectForId( id, /*unstored*/false )); - repaint(); + tqrepaint(); } uint KexiDBImageBox::storedPixmapId() const @@ -257,7 +257,7 @@ uint KexiDBImageBox::storedPixmapId() const void KexiDBImageBox::setStoredPixmapId(uint id) { setData(KexiBLOBBuffer::self()->objectForId( id, /*stored*/true )); - repaint(); + tqrepaint(); } bool KexiDBImageBox::hasScaledContents() const @@ -266,27 +266,27 @@ bool KexiDBImageBox::hasScaledContents() const // return m_pixmapLabel->hasScaledContents(); } -/*void KexiDBImageBox::setPixmap(const QByteArray& pixmap) +/*void KexiDBImageBox::setPixmap(const TQByteArray& pixmap) { setValueInternal(pixmap, true); -// setBackgroundMode(pixmap.isNull() ? Qt::NoBackground : Qt::PaletteBackground); +// setBackgroundMode(pixmap.isNull() ? TQt::NoBackground : TQt::PaletteBackground); }*/ void KexiDBImageBox::setScaledContents(bool set) { //todo m_pixmapLabel->setScaledContents(set); m_scaledContents = set; - repaint(); + tqrepaint(); } void KexiDBImageBox::setKeepAspectRatio(bool set) { m_keepAspectRatio = set; if (m_scaledContents) - repaint(); + tqrepaint(); } -QWidget* KexiDBImageBox::widget() +TQWidget* KexiDBImageBox::widget() { //! @todo // return m_pixmapLabel; @@ -303,7 +303,7 @@ bool KexiDBImageBox::cursorAtEnd() return true; } -QByteArray KexiDBImageBox::data() const +TQByteArray KexiDBImageBox::data() const { if (dataSource().isEmpty()) { //static mode @@ -331,19 +331,19 @@ void KexiDBImageBox::handleInsertFromFileAction(const KURL& url) if (!h) return; setData(h); - repaint(); + tqrepaint(); } else { //db-aware - QString fileName( url.isLocalFile() ? url.path() : url.prettyURL() ); + TQString fileName( url.isLocalFile() ? url.path() : url.prettyURL() ); //! @todo download the file if remote, then set fileName properly - QFile f(fileName); + TQFile f(fileName); if (!f.open(IO_ReadOnly)) { //! @todo err msg return; } - QByteArray ba = f.readAll(); + TQByteArray ba = f.readAll(); if (f.status()!=IO_Ok) { //! @todo err msg f.close(); @@ -359,7 +359,7 @@ void KexiDBImageBox::handleInsertFromFileAction(const KURL& url) } } -void KexiDBImageBox::handleAboutToSaveAsAction(QString& origFilename, QString& fileExtension, bool& dataIsEmpty) +void KexiDBImageBox::handleAboutToSaveAsAction(TQString& origFilename, TQString& fileExtension, bool& dataIsEmpty) { if (data().isEmpty()) { kdWarning() << "KexiDBImageBox::handleAboutToSaveAs(): no pixmap!" << endl; @@ -369,15 +369,15 @@ void KexiDBImageBox::handleAboutToSaveAsAction(QString& origFilename, QString& f if (dataSource().isEmpty()) { //for static images filename and mimetype can be available origFilename = m_data.originalFileName(); if (!origFilename.isEmpty()) - origFilename = QString("/") + origFilename; + origFilename = TQString("/") + origFilename; if (!m_data.mimeType().isEmpty()) fileExtension = KImageIO::typeForMime(m_data.mimeType()).lower(); } } -void KexiDBImageBox::handleSaveAsAction(const QString& fileName) +void KexiDBImageBox::handleSaveAsAction(const TQString& fileName) { - QFile f(fileName); + TQFile f(fileName); if (!f.open(IO_WriteOnly)) { //! @todo err msg return; @@ -401,14 +401,14 @@ void KexiDBImageBox::handleCutAction() void KexiDBImageBox::handleCopyAction() { - qApp->clipboard()->setPixmap(pixmap(), QClipboard::Clipboard); + tqApp->tqclipboard()->setPixmap(pixmap(), TQClipboard::Clipboard); } void KexiDBImageBox::handlePasteAction() { if (isReadOnly() || (!m_designMode && !hasFocus())) return; - QPixmap pm( qApp->clipboard()->pixmap(QClipboard::Clipboard) ); + TQPixmap pm( tqApp->tqclipboard()->pixmap(TQClipboard::Clipboard) ); // if (!pm.isNull()) // setValueInternal(pm, true); if (dataSource().isEmpty()) { @@ -418,18 +418,18 @@ void KexiDBImageBox::handlePasteAction() else { //db-aware mode m_pixmap = pm; - QByteArray ba; - QBuffer buffer( ba ); + TQByteArray ba; + TQBuffer buffer( ba ); buffer.open( IO_WriteOnly ); if (m_pixmap.save( &buffer, "PNG" )) {// write pixmap into ba in PNG format setValueInternal( ba, true, false/* !loadPixmap */ ); } else { - setValueInternal( QByteArray(), true ); + setValueInternal( TQByteArray(), true ); } } - repaint(); + tqrepaint(); if (!dataSource().isEmpty()) { // emit pixmapChanged(); signalValueChanged(); @@ -446,16 +446,16 @@ void KexiDBImageBox::clear() if (isReadOnly()) return; //db-aware mode - setValueInternal(QByteArray(), true); - //m_pixmap = QPixmap(); + setValueInternal(TQByteArray(), true); + //m_pixmap = TQPixmap(); } -// m_originalFileName = QString::null; +// m_originalFileName = TQString(); //! @todo emit signal for setting "dirty" flag within the design -// m_pixmap = QPixmap(); //will be loaded on demand - repaint(); +// m_pixmap = TQPixmap(); //will be loaded on demand + tqrepaint(); if (!dataSource().isEmpty()) { // emit pixmapChanged();//valueChanged(data()); signalValueChanged(); @@ -492,7 +492,7 @@ void KexiDBImageBox::slotAboutToHidePopupMenu() } }*/ -void KexiDBImageBox::contextMenuEvent( QContextMenuEvent * e ) +void KexiDBImageBox::contextMenuEvent( TQContextMenuEvent * e ) { if (popupMenuAvailable()) m_popupMenu->exec( e->globalPos(), -1 ); @@ -519,20 +519,20 @@ void KexiDBImageBox::slotToggled(bool on) return; } m_chooser->disableMousePress = false; - QRect screen = qApp->desktop()->availableGeometry( m_chooser ); - QPoint p; - if ( QApplication::reverseLayout() ) { - if ( (mapToGlobal( m_chooser->rect().bottomLeft() ).y() + m_popupMenu->sizeHint().height()) <= screen.height() ) + TQRect screen = tqApp->desktop()->availableGeometry( m_chooser ); + TQPoint p; + if ( TQApplication::reverseLayout() ) { + if ( (mapToGlobal( m_chooser->rect().bottomLeft() ).y() + m_popupMenu->tqsizeHint().height()) <= screen.height() ) p = m_chooser->mapToGlobal( m_chooser->rect().bottomRight() ); else - p = m_chooser->mapToGlobal( m_chooser->rect().topRight() - QPoint( 0, m_popupMenu->sizeHint().height() ) ); - p.rx() -= m_popupMenu->sizeHint().width(); + p = m_chooser->mapToGlobal( m_chooser->rect().topRight() - TQPoint( 0, m_popupMenu->tqsizeHint().height() ) ); + p.rx() -= m_popupMenu->tqsizeHint().width(); } else { - if ( (m_chooser->mapToGlobal( m_chooser->rect().bottomLeft() ).y() + m_popupMenu->sizeHint().height()) <= screen.height() ) + if ( (m_chooser->mapToGlobal( m_chooser->rect().bottomLeft() ).y() + m_popupMenu->tqsizeHint().height()) <= screen.height() ) p = m_chooser->mapToGlobal( m_chooser->rect().bottomLeft() ); else - p = m_chooser->mapToGlobal( m_chooser->rect().topLeft() - QPoint( 0, m_popupMenu->sizeHint().height() ) ); + p = m_chooser->mapToGlobal( m_chooser->rect().topLeft() - TQPoint( 0, m_popupMenu->tqsizeHint().height() ) ); } if (!m_popupMenu->isVisible() && on) { m_popupMenu->exec( p, -1 ); @@ -546,7 +546,7 @@ void KexiDBImageBox::updateActionStrings() if (!m_popupMenu) return; if (m_designMode) { -/* QString titleString( i18n("Image Box") ); +/* TQString titleString( i18n("Image Box") ); if (!dataSource().isEmpty()) titleString.prepend(dataSource() + " : "); m_popupMenu->changeTitle(m_popupMenu->idAt(0), m_popupMenu->titlePixmap(m_popupMenu->idAt(0)), titleString);*/ @@ -561,19 +561,19 @@ void KexiDBImageBox::updateActionStrings() if (m_chooser) { if (popupMenuAvailable() && dataSource().isEmpty()) { //this may work in the future (see @todo below) - QToolTip::add(m_chooser, i18n("Click to show actions for this image box")); + TQToolTip::add(m_chooser, i18n("Click to show actions for this image box")); } else { - QString beautifiedImageBoxName; + TQString beautifiedImageBoxName; if (m_designMode) { beautifiedImageBoxName = dataSource(); } else { - beautifiedImageBoxName = columnInfo() ? columnInfo()->captionOrAliasOrName() : QString::null; + beautifiedImageBoxName = columnInfo() ? columnInfo()->captionOrAliasOrName() : TQString(); /*! @todo look at makeFirstCharacterUpperCaseInCaptions setting [bool] (see doc/dev/settings.txt) */ beautifiedImageBoxName = beautifiedImageBoxName[0].upper() + beautifiedImageBoxName.mid(1); } - QToolTip::add(m_chooser, i18n("Click to show actions for \"%1\" image box").arg(beautifiedImageBoxName)); + TQToolTip::add(m_chooser, i18n("Click to show actions for \"%1\" image box").tqarg(beautifiedImageBoxName)); } } } @@ -586,7 +586,7 @@ bool KexiDBImageBox::popupMenuAvailable() return !dataSource().isEmpty(); } -void KexiDBImageBox::setDataSource( const QString &ds ) +void KexiDBImageBox::setDataSource( const TQString &ds ) { KexiFormDataItemInterface::setDataSource( ds ); setData(KexiBLOBBuffer::Handle()); @@ -608,96 +608,96 @@ void KexiDBImageBox::setDataSource( const QString &ds ) if (!m_lineWidthChanged) { KexiFrame::setLineWidth( ds.isEmpty() ? 0 : 1 ); } - if (!m_paletteBackgroundColorChanged && parentWidget()) { + if (!m_paletteBackgroundColorChanged && tqparentWidget()) { KexiFrame::setPaletteBackgroundColor( - dataSource().isEmpty() ? parentWidget()->paletteBackgroundColor() : palette().active().base() ); + dataSource().isEmpty() ? tqparentWidget()->paletteBackgroundColor() : tqpalette().active().base() ); } } -QSize KexiDBImageBox::sizeHint() const +TQSize KexiDBImageBox::tqsizeHint() const { if (pixmap().isNull()) - return QSize(80, 80); + return TQSize(80, 80); return pixmap().size(); } int KexiDBImageBox::realLineWidth() const { - if (frameShape()==QFrame::Box && (frameShadow()==QFrame::Sunken || frameShadow()==QFrame::Raised)) + if (frameShape()==TQFrame::Box && (frameShadow()==TQFrame::Sunken || frameShadow()==TQFrame::Raised)) return 2 * lineWidth(); else return lineWidth(); } -void KexiDBImageBox::paintEvent( QPaintEvent *pe ) +void KexiDBImageBox::paintEvent( TQPaintEvent *pe ) { if (!m_paintEventEnabled) return; - QPainter p(this); + TQPainter p(this); p.setClipRect(pe->rect()); const int m = realLineWidth() + margin(); - QColor bg(eraseColor()); + TQColor bg(eraseColor()); if (m_designMode && pixmap().isNull()) { - QPixmap pm(size()-QSize(m, m)); - QPainter p2; - p2.begin(&pm, this); + TQPixmap pm(size()-TQSize(m, m)); + TQPainter p2; + p2.tqbegin(TQT_TQPAINTDEVICE(&pm), this); p2.fillRect(0,0,width(),height(), bg); updatePixmap(); - QPixmap *imagBoxPm; + TQPixmap *imagBoxPm; const bool tooLarge = (height()-m-m) <= KexiDBImageBox_pm->height(); if (tooLarge || (width()-m-m) <= KexiDBImageBox_pm->width()) imagBoxPm = KexiDBImageBox_pmSmall; else imagBoxPm = KexiDBImageBox_pm; - QImage img(imagBoxPm->convertToImage()); + TQImage img(imagBoxPm->convertToImage()); img = KImageEffect::flatten(img, bg.dark(150), - qGray( bg.rgb() ) <= 20 ? QColor(Qt::gray).dark(150) : bg.light(105)); + tqGray( bg.rgb() ) <= 20 ? TQColor(TQt::gray).dark(150) : bg.light(105)); - QPixmap converted; + TQPixmap converted; converted.convertFromImage(img); // if (tooLarge) // p2.drawPixmap(2, 2, converted); // else p2.drawPixmap(2, height()-m-m-imagBoxPm->height()-2, converted); - QFont f(qApp->font()); + TQFont f(tqApp->font()); p2.setFont(f); p2.setPen( KexiUtils::contrastColor( bg ) ); - p2.drawText(pm.rect(), Qt::AlignCenter, + p2.drawText(pm.rect(), TQt::AlignCenter, dataSource().isEmpty() - ? QString::fromLatin1(name())+"\n"+i18n("Unbound Image Box", "(unbound)") //i18n("No Image") + ? TQString::tqfromLatin1(name())+"\n"+i18n("Unbound Image Box", "(unbound)") //i18n("No Image") : dataSource()); p2.end(); bitBlt(this, m, m, &pm); } else { - QSize internalSize(size()); + TQSize internalSize(size()); if (m_chooser && m_dropDownButtonVisible && !dataSource().isEmpty()) internalSize.setWidth( internalSize.width() - m_chooser->width() ); //clearing needed here because we may need to draw a pixmap with transparency p.fillRect(0,0,width(),height(), bg); - KexiUtils::drawPixmap( p, m, QRect(QPoint(0,0), internalSize), pixmap(), m_alignment, + KexiUtils::drawPixmap( p, m, TQRect(TQPoint(0,0), internalSize), pixmap(), m_tqalignment, m_scaledContents, m_keepAspectRatio ); } KexiFrame::drawFrame( &p ); // if the widget is focused, draw focus indicator rect _if_ there is no chooser button if (!m_designMode && !dataSource().isEmpty() && hasFocus() && (!m_chooser || !m_chooser->isVisible())) { - style().drawPrimitive( - QStyle::PE_FocusRect, &p, style().subRect(QStyle::SR_PushButtonContents, this), - palette().active() ); + tqstyle().tqdrawPrimitive( + TQStyle::PE_FocusRect, &p, tqstyle().subRect(TQStyle::SR_PushButtonContents, this), + tqpalette().active() ); } } -/* virtual void KexiDBImageBox::paletteChange ( const QPalette & oldPalette ) +/* virtual void KexiDBImageBox::paletteChange ( const TQPalette & oldPalette ) { - QFrame::paletteChange(oldPalette); + TQFrame::paletteChange(oldPalette); if (oldPalette.active().background()!=palette().active().background()) { delete KexiDBImageBox_pm; KexiDBImageBox_pm = 0; - repaint(); + tqrepaint(); } }*/ @@ -707,19 +707,19 @@ void KexiDBImageBox::updatePixmap() return; if (!KexiDBImageBox_pm) { - QString fname( locate("data", QString("kexi/pics/imagebox.png")) ); - KexiDBImageBox_pmDeleter.setObject( KexiDBImageBox_pm, new QPixmap(fname, "PNG") ); - QImage img(KexiDBImageBox_pm->convertToImage()); + TQString fname( locate("data", TQString("kexi/pics/imagebox.png")) ); + KexiDBImageBox_pmDeleter.setObject( KexiDBImageBox_pm, new TQPixmap(fname, "PNG") ); + TQImage img(KexiDBImageBox_pm->convertToImage()); KexiDBImageBox_pmSmallDeleter.setObject( KexiDBImageBox_pmSmall, - new QPixmap( img.smoothScale(img.width()/2, img.height()/2, QImage::ScaleMin) ) ); + new TQPixmap( img.smoothScale(img.width()/2, img.height()/2, TQ_ScaleMin) ) ); } } -void KexiDBImageBox::setAlignment(int alignment) +void KexiDBImageBox::tqsetAlignment(int tqalignment) { - m_alignment = alignment; + m_tqalignment = tqalignment; if (!m_scaledContents || m_keepAspectRatio) - repaint(); + tqrepaint(); } void KexiDBImageBox::setData(const KexiBLOBBuffer::Handle& handle) @@ -733,23 +733,23 @@ void KexiDBImageBox::setData(const KexiBLOBBuffer::Handle& handle) update(); } -void KexiDBImageBox::resizeEvent( QResizeEvent * e ) +void KexiDBImageBox::resizeEvent( TQResizeEvent * e ) { KexiFrame::resizeEvent(e); if (m_chooser) { - QSize s( m_chooser->sizeHint() ); - QSize margin( realLineWidth(), realLineWidth() ); + TQSize s( m_chooser->tqsizeHint() ); + TQSize margin( realLineWidth(), realLineWidth() ); s.setHeight( height() - 2*margin.height() ); s = s.boundedTo( size()-2*margin ); m_chooser->resize( s ); - m_chooser->move( QRect(QPoint(0,0), e->size() - m_chooser->size() - margin + QSize(1,1)).bottomRight() ); + m_chooser->move( TQRect(TQPoint(0,0), e->size() - m_chooser->size() - margin + TQSize(1,1)).bottomRight() ); } } /* -bool KexiDBImageBox::setProperty( const char * name, const QVariant & value ) +bool KexiDBImageBox::setProperty( const char * name, const TQVariant & value ) { - const bool ret = QLabel::setProperty(name, value); + const bool ret = TQLabel::setProperty(name, value); if (p_shadowEnabled) { if (0==qstrcmp("indent", name) || 0==qstrcmp("font", name) || 0==qstrcmp("margin", name) || 0==qstrcmp("frameShadow", name) || 0==qstrcmp("frameShape", name) @@ -770,16 +770,16 @@ void KexiDBImageBox::setColumnInfo(KexiDB::QueryColumnInfo* cinfo) updateActionStrings(); } -bool KexiDBImageBox::keyPressed(QKeyEvent *ke) +bool KexiDBImageBox::keyPressed(TQKeyEvent *ke) { // Esc key should close the popup - if (ke->state() == Qt::NoButton && ke->key() == Qt::Key_Escape) { + if (ke->state() == Qt::NoButton && ke->key() == TQt::Key_Escape) { if (m_popupMenu->isVisible()) { m_setFocusOnButtonAfterClosingPopup = true; return true; } } -// else if (ke->state() == Qt::ControlButton && KStdAccel::shortcut(KStdAccel::Copy).keyCodeQt() == (ke->key()|Qt::CTRL)) { +// else if (ke->state() == TQt::ControlButton && KStdAccel::shortcut(KStdAccel::Copy).keyCodeTQt() == (ke->key()|TQt::CTRL)) { // } return false; } @@ -790,7 +790,7 @@ void KexiDBImageBox::setLineWidth( int width ) KexiFrame::setLineWidth(width); } -void KexiDBImageBox::setPalette( const QPalette &pal ) +void KexiDBImageBox::setPalette( const TQPalette &pal ) { KexiFrame::setPalette(pal); if (m_insideSetPalette) @@ -801,13 +801,13 @@ void KexiDBImageBox::setPalette( const QPalette &pal ) m_insideSetPalette = false; } -void KexiDBImageBox::setPaletteBackgroundColor( const QColor & color ) +void KexiDBImageBox::setPaletteBackgroundColor( const TQColor & color ) { - kexipluginsdbg << "KexiDBImageBox::setPaletteBackgroundColor(): " << color.name() << endl; + kexipluginsdbg << "KexiDBImageBox::setPaletteBackgroundColor(): " << TQString(color.name()) << endl; m_paletteBackgroundColorChanged = true; KexiFrame::setPaletteBackgroundColor(color); if (m_chooser) - m_chooser->setPalette( qApp->palette() ); + m_chooser->setPalette( tqApp->palette() ); } bool KexiDBImageBox::dropDownButtonVisible() const @@ -835,33 +835,33 @@ bool KexiDBImageBox::subwidgetStretchRequired(KexiDBAutoField* autoField) const return true; } -bool KexiDBImageBox::eventFilter( QObject * watched, QEvent * e ) +bool KexiDBImageBox::eventFilter( TQObject * watched, TQEvent * e ) { - if (watched==this || watched==m_chooser) { //we're watching chooser as well because it's a focus proxy even if invisible - if (e->type()==QEvent::FocusIn || e->type()==QEvent::FocusOut || e->type()==QEvent::MouseButtonPress) { - update(); //to repaint focus rect + if (TQT_BASE_OBJECT(watched)==TQT_BASE_OBJECT(this) || TQT_BASE_OBJECT(watched)==TQT_BASE_OBJECT(m_chooser)) { //we're watching chooser as well because it's a focus proxy even if invisible + if (e->type()==TQEvent::FocusIn || e->type()==TQEvent::FocusOut || e->type()==TQEvent::MouseButtonPress) { + update(); //to tqrepaint focus rect } } // hide popup menu as soon as it loses focus - if (watched==m_popupMenu && e->type()==QEvent::FocusOut) { + if (TQT_BASE_OBJECT(watched)==TQT_BASE_OBJECT(m_popupMenu) && e->type()==TQEvent::FocusOut) { m_popupMenu->hide(); } return KexiFrame::eventFilter(watched, e); } -QWidget::FocusPolicy KexiDBImageBox::focusPolicy() const +TQ_FocusPolicy KexiDBImageBox::focusPolicy() const { if (dataSource().isEmpty()) - return NoFocus; + return TQ_NoFocus; return m_focusPolicyInternal; } -QWidget::FocusPolicy KexiDBImageBox::focusPolicyInternal() const +TQ_FocusPolicy KexiDBImageBox::focusPolicyInternal() const { return m_focusPolicyInternal; } -void KexiDBImageBox::setFocusPolicy( FocusPolicy policy ) +void KexiDBImageBox::setFocusPolicy( TQ_FocusPolicy policy ) { m_focusPolicyInternal = policy; KexiFrame::setFocusPolicy( focusPolicy() ); //set modified policy diff --git a/kexi/plugins/forms/widgets/kexidbimagebox.h b/kexi/plugins/forms/widgets/kexidbimagebox.h index 3ad2f710..85b54cd5 100644 --- a/kexi/plugins/forms/widgets/kexidbimagebox.h +++ b/kexi/plugins/forms/widgets/kexidbimagebox.h @@ -38,46 +38,47 @@ class KEXIFORMUTILS_EXPORT KexiDBImageBox : public KexiSubwidgetInterface { Q_OBJECT - Q_PROPERTY( QString dataSource READ dataSource WRITE setDataSource ) - Q_PROPERTY( QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType ) - Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) -// Q_PROPERTY( QPixmap pixmap READ pixmap WRITE setPixmap ) -// Q_PROPERTY( QByteArray pixmapData READ pixmapData WRITE setPixmapData ) - Q_PROPERTY( uint pixmapId READ pixmapId WRITE setPixmapId DESIGNABLE true STORED false ) - Q_PROPERTY( uint storedPixmapId READ storedPixmapId WRITE setStoredPixmapId DESIGNABLE false STORED true ) - Q_PROPERTY( bool scaledContents READ hasScaledContents WRITE setScaledContents ) - Q_PROPERTY( bool keepAspectRatio READ keepAspectRatio WRITE setKeepAspectRatio ) - Q_PROPERTY( Alignment alignment READ alignment WRITE setAlignment ) -// Q_PROPERTY( QString originalFileName READ originalFileName WRITE setOriginalFileName DESIGNABLE false ) -// Q_OVERRIDE( FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy ) - Q_PROPERTY( bool dropDownButtonVisible READ dropDownButtonVisible WRITE setDropDownButtonVisible ) - Q_OVERRIDE( int lineWidth READ lineWidth WRITE setLineWidth ) - Q_OVERRIDE( FocusPolicy focusPolicy READ focusPolicyInternal WRITE setFocusPolicy ) + TQ_OBJECT + TQ_PROPERTY( TQString dataSource READ dataSource WRITE setDataSource ) + TQ_PROPERTY( TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType ) + TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) +// TQ_PROPERTY( TQPixmap pixmap READ pixmap WRITE setPixmap ) +// TQ_PROPERTY( TQByteArray pixmapData READ pixmapData WRITE setPixmapData ) + TQ_PROPERTY( uint pixmapId READ pixmapId WRITE setPixmapId DESIGNABLE true STORED false ) + TQ_PROPERTY( uint storedPixmapId READ storedPixmapId WRITE setStoredPixmapId DESIGNABLE false STORED true ) + TQ_PROPERTY( bool scaledContents READ hasScaledContents WRITE setScaledContents ) + TQ_PROPERTY( bool keepAspectRatio READ keepAspectRatio WRITE setKeepAspectRatio ) + TQ_PROPERTY( int tqalignment READ tqalignment WRITE tqsetAlignment ) +// TQ_PROPERTY( TQString originalFileName READ originalFileName WRITE setOriginalFileName DESIGNABLE false ) +// TQ_OVERRIDE( FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy ) + TQ_PROPERTY( bool dropDownButtonVisible READ dropDownButtonVisible WRITE setDropDownButtonVisible ) + TQ_OVERRIDE( int lineWidth READ lineWidth WRITE setLineWidth ) + TQ_OVERRIDE( FocusPolicy focusPolicy READ focusPolicyInternal WRITE setFocusPolicy ) public: - KexiDBImageBox( bool designMode, QWidget *parent, const char *name = 0 ); + KexiDBImageBox( bool designMode, TQWidget *tqparent, const char *name = 0 ); virtual ~KexiDBImageBox(); - inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); } - inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } + inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); } + inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } - virtual QVariant value(); // { return m_value.data(); } + virtual TQVariant value(); // { return m_value.data(); } -// QByteArray pixmapData() const { return m_value.data(); } +// TQByteArray pixmapData() const { return m_value.data(); } - QPixmap pixmap() const; + TQPixmap pixmap() const; uint pixmapId() const; uint storedPixmapId() const; // - virtual void setInvalidState( const QString& displayText ); + virtual void setInvalidState( const TQString& displayText ); virtual bool valueIsNull(); virtual bool valueIsEmpty(); - virtual QWidget* widget(); + virtual TQWidget* widget(); //! always true virtual bool cursorAtStart(); @@ -86,7 +87,7 @@ class KEXIFORMUTILS_EXPORT KexiDBImageBox : virtual bool cursorAtEnd(); // //! used to catch setIndent(), etc. -// virtual bool setProperty ( const char * name, const QVariant & value ); +// virtual bool setProperty ( const char * name, const TQVariant & value ); virtual bool isReadOnly() const; @@ -94,28 +95,28 @@ class KEXIFORMUTILS_EXPORT KexiDBImageBox : // bool designMode() const { return m_designMode; } - int alignment() const { return m_alignment; } + int tqalignment() const { return m_tqalignment; } bool keepAspectRatio() const { return m_keepAspectRatio; } - virtual QSize sizeHint() const; + virtual TQSize tqsizeHint() const; KexiImageContextMenu *contextMenu() const; /*! \return original file name of image loaded from a file. This can be later reused for displaying the image within a collection (to be implemented) or on saving the image data back to file. */ -//todo QString originalFileName() const { return m_value.originalFileName(); } +//todo TQString originalFileName() const { return m_value.originalFileName(); } //! Reimplemented to override behaviour of "lineWidth" property. virtual void setLineWidth( int width ); //! Reimplemented to override behaviour of "paletteBackgroundColor" //! and "paletteForegroundColor" properties. - virtual void setPalette( const QPalette &pal ); + virtual void setPalette( const TQPalette &pal ); //! Reimplemented to override behaviour of "paletteBackgroundColor" property. - virtual void setPaletteBackgroundColor( const QColor & color ); + virtual void setPaletteBackgroundColor( const TQColor & color ); //! \return true id drop down button should be visible (the default). bool dropDownButtonVisible() const; @@ -126,14 +127,14 @@ class KEXIFORMUTILS_EXPORT KexiDBImageBox : /*! Overriden to change the policy behaviour a bit: NoFocus is returned regardless the real focus flag if the data source is empty (see dataSource()). */ - FocusPolicy focusPolicy() const; + TQ_FocusPolicy focusPolicy() const; //! \return the internal focus policy value, i.e. the one unrelated to data source presence. - FocusPolicy focusPolicyInternal() const; + TQ_FocusPolicy focusPolicyInternal() const; /*! Sets the internal focus policy value. "Internal" means that if there is no data source set, real policy becomes NoFocus. */ - virtual void setFocusPolicy( FocusPolicy policy ); + virtual void setFocusPolicy( TQ_FocusPolicy policy ); public slots: void setPixmapId(uint id); @@ -141,23 +142,23 @@ class KEXIFORMUTILS_EXPORT KexiDBImageBox : void setStoredPixmapId(uint id); //! Sets the datasource to \a ds - virtual void setDataSource( const QString &ds ); + virtual void setDataSource( const TQString &ds ); - inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } + inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } virtual void setReadOnly(bool set); //! Sets \a pixmapData data for this widget. If the widget has data source set, //! the pixmap will be also placed inside of the buffer and saved later. -//todo void setPixmapData(const QByteArray& pixmapData) { m_value.setData(pixmapData); } +//todo void setPixmapData(const TQByteArray& pixmapData) { m_value.setData(pixmapData); } /*! Sets original file name of image loaded from a file. @see originalFileName() */ -//todo void setOriginalFileName(const QString& name) { m_value.setOriginalFileName(name); } +//todo void setOriginalFileName(const TQString& name) { m_value.setOriginalFileName(name); } void setScaledContents(bool set); - void setAlignment(int alignment); + void tqsetAlignment(int tqalignment); void setKeepAspectRatio(bool set); @@ -176,7 +177,7 @@ class KEXIFORMUTILS_EXPORT KexiDBImageBox : //! Used for db-aware mode. Emitted when value has been changed. //! Actual value can be obtained using value(). // virtual void pixmapChanged(); -// virtual void valueChanged(const QByteArray& data); +// virtual void valueChanged(const TQByteArray& data); void idChanged(long id); @@ -184,8 +185,8 @@ class KEXIFORMUTILS_EXPORT KexiDBImageBox : void slotUpdateActionsAvailabilityRequested(bool& valueIsNull, bool& valueIsReadOnly); void handleInsertFromFileAction(const KURL& url); - void handleAboutToSaveAsAction(QString& origFilename, QString& fileExtension, bool& dataIsEmpty); - void handleSaveAsAction(const QString& fileName); + void handleAboutToSaveAsAction(TQString& origFilename, TQString& fileExtension, bool& dataIsEmpty); + void handleSaveAsAction(const TQString& fileName); void handleCutAction(); void handleCopyAction(); void handlePasteAction(); @@ -194,22 +195,22 @@ class KEXIFORMUTILS_EXPORT KexiDBImageBox : protected: //! \return data depending on the current mode (db-aware or static) - QByteArray data() const; + TQByteArray data() const; - virtual void contextMenuEvent ( QContextMenuEvent * e ); -// virtual void mousePressEvent( QMouseEvent *e ); + virtual void contextMenuEvent ( TQContextMenuEvent * e ); +// virtual void mousePressEvent( TQMouseEvent *e ); virtual void setColumnInfo(KexiDB::QueryColumnInfo* cinfo); - virtual void paintEvent( QPaintEvent* ); - virtual void resizeEvent( QResizeEvent* e ); - virtual bool eventFilter( QObject * watched, QEvent * e ); + virtual void paintEvent( TQPaintEvent* ); + virtual void resizeEvent( TQResizeEvent* e ); + virtual bool eventFilter( TQObject * watched, TQEvent * e ); //! Sets value \a value for a widget. - virtual void setValueInternal( const QVariant& add, bool removeOld ) { + virtual void setValueInternal( const TQVariant& add, bool removeOld ) { setValueInternal( add, removeOld, true /*loadPixmap*/ ); } //! @internal, added \a loadPixmap option used by paste(). - void setValueInternal( const QVariant& add, bool removeOld, bool loadPixmap ); + void setValueInternal( const TQVariant& add, bool removeOld, bool loadPixmap ); //! Updates i18n'd action strings after datasource change void updateActionStrings(); @@ -223,7 +224,7 @@ class KEXIFORMUTILS_EXPORT KexiDBImageBox : /*! Called by top-level form on key press event. Used for Key_Escape to if the popup is visible, so the key press won't be consumed to perform "cancel editing". */ - virtual bool keyPressed(QKeyEvent *ke); + virtual bool keyPressed(TQKeyEvent *ke); //! \return real line width, i.e. for Boxed sunken or Boxed raised //! frames returns doubled width value. @@ -232,33 +233,33 @@ class KEXIFORMUTILS_EXPORT KexiDBImageBox : //! Implemented for KexiSubwidgetInterface virtual bool subwidgetStretchRequired(KexiDBAutoField* autoField) const; -// virtual void drawContents ( QPainter *p ); +// virtual void drawContents ( TQPainter *p ); -// virtual void fontChange( const QFont& font ); -// virtual void styleChange( QStyle& style ); +// virtual void fontChange( const TQFont& font ); +// virtual void styleChange( TQStyle& style ); // virtual void enabledChange( bool enabled ); -// virtual void paletteChange( const QPalette& pal ); +// virtual void paletteChange( const TQPalette& pal ); // virtual void frameChanged(); -// virtual void showEvent( QShowEvent* e ); +// virtual void showEvent( TQShowEvent* e ); // void updatePixmapLater(); // class ImageLabel; // ImageLabel *m_pixmapLabel; - QPixmap m_pixmap; - QByteArray m_value; //!< for db-aware mode - QString m_valueMimeType; //!< for db-aware mode + TQPixmap m_pixmap; + TQByteArray m_value; //!< for db-aware mode + TQString m_valueMimeType; //!< for db-aware mode // PixmapData m_value; KexiBLOBBuffer::Handle m_data; -// QString m_originalFileName; +// TQString m_originalFileName; KexiDropDownButton *m_chooser; KexiImageContextMenu *m_popupMenu; //moved KActionCollection m_actionCollection; //moved KAction *m_insertFromFileAction, *m_saveAsAction, *m_cutAction, *m_copyAction, *m_pasteAction, // *m_deleteAction, *m_propertiesAction; -// QTimer m_clickTimer; - int m_alignment; - FocusPolicy m_focusPolicyInternal; //!< Used for focusPolicyInternal() +// TQTimer m_clickTimer; + int m_tqalignment; + TQ_FocusPolicy m_focusPolicyInternal; //!< Used for focusPolicyInternal() bool m_designMode : 1; bool m_readOnly : 1; bool m_scaledContents : 1; diff --git a/kexi/plugins/forms/widgets/kexidbintspinbox.cpp b/kexi/plugins/forms/widgets/kexidbintspinbox.cpp index ac923347..7d5ae6ee 100644 --- a/kexi/plugins/forms/widgets/kexidbintspinbox.cpp +++ b/kexi/plugins/forms/widgets/kexidbintspinbox.cpp @@ -20,27 +20,27 @@ #include "kexidbintspinbox.h" -#include <qlineedit.h> +#include <tqlineedit.h> #include <knumvalidator.h> -KexiDBIntSpinBox::KexiDBIntSpinBox(QWidget *parent, const char *name) - : KIntSpinBox(parent, name) , KexiFormDataItemInterface() +KexiDBIntSpinBox::KexiDBIntSpinBox(TQWidget *tqparent, const char *name) + : KIntSpinBox(tqparent, name) , KexiFormDataItemInterface() { - connect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged())); + connect(this, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotValueChanged())); } KexiDBIntSpinBox::~KexiDBIntSpinBox() { } -void KexiDBIntSpinBox::setInvalidState( const QString& displayText ) +void KexiDBIntSpinBox::setInvalidState( const TQString& displayText ) { m_invalidState = true; setEnabled(false); setReadOnly(true); //! @todo move this to KexiDataItemInterface::setInvalidStateInternal() ? if (focusPolicy() & TabFocus) - setFocusPolicy(QWidget::ClickFocus); + setFocusPolicy(TQ_ClickFocus); setSpecialValueText(displayText); KIntSpinBox::setValue(minValue()); } @@ -54,12 +54,12 @@ KexiDBIntSpinBox::setEnabled(bool enabled) KIntSpinBox::setEnabled(enabled); } -void KexiDBIntSpinBox::setValueInternal(const QVariant&, bool) +void KexiDBIntSpinBox::setValueInternal(const TQVariant&, bool) { KIntSpinBox::setValue(m_origValue.toInt()); } -QVariant +TQVariant KexiDBIntSpinBox::value() { return KIntSpinBox::value(); @@ -90,7 +90,7 @@ void KexiDBIntSpinBox::setReadOnly(bool set) editor()->setReadOnly(set); } -QWidget* +TQWidget* KexiDBIntSpinBox::widget() { return this; diff --git a/kexi/plugins/forms/widgets/kexidbintspinbox.h b/kexi/plugins/forms/widgets/kexidbintspinbox.h index cddc614e..9827cd5f 100644 --- a/kexi/plugins/forms/widgets/kexidbintspinbox.h +++ b/kexi/plugins/forms/widgets/kexidbintspinbox.h @@ -22,25 +22,26 @@ #define KexiDBIntSpinBox_H #include "kexiformdataiteminterface.h" -#include <qwidget.h> +#include <tqwidget.h> #include <knuminput.h> //! @short A db-aware int spin box class KEXIFORMUTILS_EXPORT KexiDBIntSpinBox : public KIntSpinBox, public KexiFormDataItemInterface { Q_OBJECT - Q_PROPERTY(QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) - Q_PROPERTY(QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) - Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true ) + TQ_OBJECT + TQ_PROPERTY(TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) + TQ_PROPERTY(TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) + TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true ) public: - KexiDBIntSpinBox(QWidget *parent, const char *name=0); + KexiDBIntSpinBox(TQWidget *tqparent, const char *name=0); virtual ~KexiDBIntSpinBox(); - inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); } - inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } - virtual QVariant value(); - virtual void setInvalidState( const QString& displayText ); + inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); } + inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } + virtual TQVariant value(); + virtual void setInvalidState( const TQString& displayText ); //! \return true if editor's value is null (not empty) //! Used for checking if a given constraint within table of form is met. @@ -56,7 +57,7 @@ class KEXIFORMUTILS_EXPORT KexiDBIntSpinBox : public KIntSpinBox, public KexiFor virtual bool isReadOnly() const; /*! \return the view widget of this item, e.g. line edit widget. */ - virtual QWidget* widget(); + virtual TQWidget* widget(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); @@ -65,13 +66,13 @@ class KEXIFORMUTILS_EXPORT KexiDBIntSpinBox : public KIntSpinBox, public KexiFor virtual void setEnabled(bool enabled); public slots: - inline void setDataSource(const QString &ds) { KexiFormDataItemInterface::setDataSource(ds); } - inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } + inline void setDataSource(const TQString &ds) { KexiFormDataItemInterface::setDataSource(ds); } + inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } void slotValueChanged(); virtual void setReadOnly(bool set); protected: - virtual void setValueInternal(const QVariant& add, bool removeOld); + virtual void setValueInternal(const TQVariant& add, bool removeOld); private: bool m_invalidState : 1; diff --git a/kexi/plugins/forms/widgets/kexidblabel.cpp b/kexi/plugins/forms/widgets/kexidblabel.cpp index e30cc19e..db946141 100644 --- a/kexi/plugins/forms/widgets/kexidblabel.cpp +++ b/kexi/plugins/forms/widgets/kexidblabel.cpp @@ -20,11 +20,11 @@ #include "kexidblabel.h" -#include <qbitmap.h> -#include <qpainter.h> -#include <qdrawutil.h> -#include <qapplication.h> -#include <qtimer.h> +#include <tqbitmap.h> +#include <tqpainter.h> +#include <tqdrawutil.h> +#include <tqapplication.h> +#include <tqtimer.h> #include <kdebug.h> #include <kimageeffect.h> @@ -41,7 +41,7 @@ #define SHADOW_THICKNESS 1 //! @internal -class KexiDBInternalLabel : public QLabel { +class KexiDBInternalLabel : public TQLabel { friend class KexiDBLabel; public: KexiDBInternalLabel( KexiDBLabel* ); @@ -50,23 +50,23 @@ class KexiDBInternalLabel : public QLabel { protected: void updateFrame(); - QImage makeShadow( const QImage& textImage, const QColor &bgColor, const QRect& boundingRect ); - QRect getBounding( const QImage &image, const QRect& startRect ); -// double defaultDecay( QImage& source, int i, int j ); + TQImage makeShadow( const TQImage& textImage, const TQColor &bgColor, const TQRect& boundingRect ); + TQRect getBounding( const TQImage &image, const TQRect& startRect ); +// double defaultDecay( TQImage& source, int i, int j ); KPixmap getShadowPixmap(); - QRect m_shadowRect; + TQRect m_shadowRect; KexiDBLabel *m_parentLabel; }; -KexiDBInternalLabel::KexiDBInternalLabel( KexiDBLabel* parent ) - : QLabel( parent ) - , m_parentLabel(parent) +KexiDBInternalLabel::KexiDBInternalLabel( KexiDBLabel* tqparent ) + : TQLabel( tqparent ) + , m_parentLabel(tqparent) { - int a = alignment() | Qt::WordBreak; - a &= (0xffffff ^ Qt::AlignVertical_Mask); - a |= Qt::AlignTop; - setAlignment( a ); + int a = tqalignment() | TQt::WordBreak; + a &= (0xffffff ^ TQt::AlignVertical_Mask); + a |= TQt::AlignTop; + tqsetAlignment( a ); updateFrame(); } @@ -93,11 +93,11 @@ KexiDBInternalLabel::~KexiDBInternalLabel() * -- * Christian Nitschkowski */ -QImage KexiDBInternalLabel::makeShadow( const QImage& textImage, - const QColor &bgColor, const QRect& boundingRect ) +TQImage KexiDBInternalLabel::makeShadow( const TQImage& textImage, + const TQColor &bgColor, const TQRect& boundingRect ) { - QImage result; - QString origText( text() ); + TQImage result; + TQString origText( text() ); // create a new image for for the shaddow const int w = textImage.width(); @@ -119,7 +119,7 @@ QImage KexiDBInternalLabel::makeShadow( const QImage& textImage, /* * This is the source pixmap */ - QImage img = textImage.convertDepth( 32 ); + TQImage img = textImage.convertDepth( 32 ); /* * Resize the image if necessary @@ -129,10 +129,10 @@ QImage KexiDBInternalLabel::makeShadow( const QImage& textImage, } // result.fill( 0 ); // all black - double realOpacity = SHADOW_OPACITY + QMIN(50.0/double(256.0-qGray(bgColor.rgb())), 50.0); + double realOpacity = SHADOW_OPACITY + TQMIN(50.0/double(256.0-tqGray(bgColor.rgb())), 50.0); //int _h, _s, _v; //.getHsv( &_h, &_s, &_v ); - if (colorGroup().background()==Qt::red)//_s>=250 && _v>=250) //for colors like cyan or red, make the result more white + if (tqcolorGroup().background()==TQt::red)//_s>=250 && _v>=250) //for colors like cyan or red, make the result more white realOpacity += 50.0; result.fill( (int)realOpacity ); result.setAlphaBuffer( true ); @@ -148,26 +148,26 @@ QImage KexiDBInternalLabel::makeShadow( const QImage& textImage, if ( ( i < 1 ) || ( j < 1 ) || ( i > img.width() - 2 ) || ( j > img.height() - 2 ) ) continue; else - alphaShadow = ( qGray( img.pixel( i - 1, j - 1 ) ) * SHADOW_DIAGONAL_FACTOR + - qGray( img.pixel( i - 1, j ) ) * SHADOW_AXIS_FACTOR + - qGray( img.pixel( i - 1, j + 1 ) ) * SHADOW_DIAGONAL_FACTOR + - qGray( img.pixel( i , j - 1 ) ) * SHADOW_AXIS_FACTOR + + alphaShadow = ( tqGray( img.pixel( i - 1, j - 1 ) ) * SHADOW_DIAGONAL_FACTOR + + tqGray( img.pixel( i - 1, j ) ) * SHADOW_AXIS_FACTOR + + tqGray( img.pixel( i - 1, j + 1 ) ) * SHADOW_DIAGONAL_FACTOR + + tqGray( img.pixel( i , j - 1 ) ) * SHADOW_AXIS_FACTOR + 0 + - qGray( img.pixel( i , j + 1 ) ) * SHADOW_AXIS_FACTOR + - qGray( img.pixel( i + 1, j - 1 ) ) * SHADOW_DIAGONAL_FACTOR + - qGray( img.pixel( i + 1, j ) ) * SHADOW_AXIS_FACTOR + - qGray( img.pixel( i + 1, j + 1 ) ) * SHADOW_DIAGONAL_FACTOR ) / SHADOW_FACTOR; + tqGray( img.pixel( i , j + 1 ) ) * SHADOW_AXIS_FACTOR + + tqGray( img.pixel( i + 1, j - 1 ) ) * SHADOW_DIAGONAL_FACTOR + + tqGray( img.pixel( i + 1, j ) ) * SHADOW_AXIS_FACTOR + + tqGray( img.pixel( i + 1, j + 1 ) ) * SHADOW_DIAGONAL_FACTOR ) / SHADOW_FACTOR; // update the shadow's i,j pixel. if (alphaShadow > 0) - result.setPixel( i, j, qRgba( bgRed, bgGreen , bgBlue, + result.setPixel( i, j, tqRgba( bgRed, bgGreen , bgBlue, ( int ) (( alphaShadow > realOpacity ) ? realOpacity : alphaShadow) ) ); } /*caused too much redraw problems if (period && i % period) { - qApp->processEvents(); + tqApp->processEvents(); if (text() != origText) //text has been changed in the meantime: abort - return QImage(); + return TQImage(); }*/ } return result; @@ -177,25 +177,25 @@ KPixmap KexiDBInternalLabel::getShadowPixmap() { /*! * Backup the default color used to draw text. */ - const QColor textColor = colorGroup().foreground(); + const TQColor textColor = tqcolorGroup().foreground(); /*! * Temporary storage for the generated shadow */ KPixmap finalPixmap, tempPixmap; - QImage shadowImage, tempImage; - QPainter painter; + TQImage shadowImage, tempImage; + TQPainter painter; - m_shadowRect = QRect(); + m_shadowRect = TQRect(); tempPixmap.resize( size() ); - tempPixmap.fill( Qt::black ); + tempPixmap.fill( TQt::black ); tempPixmap.setMask( tempPixmap.createHeuristicMask( true ) ); /*! * The textcolor has to be white for creating shadows! */ - setPaletteForegroundColor( Qt::white ); + setPaletteForegroundColor( TQt::white ); /*! Draw the label "as usual" in a pixmap @@ -211,7 +211,7 @@ KPixmap KexiDBInternalLabel::getShadowPixmap() { * This will fit around the unmodified text. */ shadowImage = tempPixmap; - tempPixmap.setMask( QBitmap() ); + tempPixmap.setMask( TQBitmap() ); /*! Get the first bounding rect. @@ -225,14 +225,14 @@ KPixmap KexiDBInternalLabel::getShadowPixmap() { * The new rect has to fit in the pixmap. * I have to admit this isn't really nice code... */ - m_shadowRect.setX( QMAX( m_shadowRect.x() - ( m_shadowRect.width() / 4 ), 0 ) ); - m_shadowRect.setY( QMAX( m_shadowRect.y() - ( m_shadowRect.height() / 4 ), 0 ) ); - m_shadowRect.setBottomRight( QPoint( - QMIN( m_shadowRect.x() + ( m_shadowRect.width() * 3 / 2 ), shadowImage.width() ), - QMIN( m_shadowRect.y() + ( m_shadowRect.height() * 3 / 2 ), shadowImage.height() ) ) ); + m_shadowRect.setX( TQMAX( m_shadowRect.x() - ( m_shadowRect.width() / 4 ), 0 ) ); + m_shadowRect.setY( TQMAX( m_shadowRect.y() - ( m_shadowRect.height() / 4 ), 0 ) ); + m_shadowRect.setBottomRight( TQPoint( + TQMIN( m_shadowRect.x() + ( m_shadowRect.width() * 3 / 2 ), shadowImage.width() ), + TQMIN( m_shadowRect.y() + ( m_shadowRect.height() * 3 / 2 ), shadowImage.height() ) ) ); shadowImage = makeShadow( shadowImage, - qGray( colorGroup().background().rgb() ) < 127 ? Qt::white : Qt::black, + tqGray( tqcolorGroup().background().rgb() ) < 127 ? TQt::white : TQt::black, m_shadowRect ); if (shadowImage.isNull()) return KPixmap(); @@ -249,8 +249,8 @@ KPixmap KexiDBInternalLabel::getShadowPixmap() { painter.begin( &finalPixmap ); painter.fillRect( 0, 0, finalPixmap.width(), finalPixmap.height(), palette().brush( - isEnabled() ? QPalette::Active : QPalette::Disabled, - QColorGroup::Background ) ); + isEnabled() ? TQPalette::Active : TQPalette::Disabled, + TQColorGroup::Background ) ); painter.end(); /*! @@ -276,7 +276,7 @@ KPixmap KexiDBInternalLabel::getShadowPixmap() { to a new image. I tried to copy this to a pixmap directly, but it didn't work correctly. - Maybe a Qt bug? + Maybe a TQt bug? */ tempImage = shadowImage.copy( m_shadowRect ); tempPixmap.convertFromImage( tempImage ); @@ -296,30 +296,30 @@ KPixmap KexiDBInternalLabel::getShadowPixmap() { return finalPixmap; } -QRect KexiDBInternalLabel::getBounding( const QImage &image, const QRect& startRect ) { - QPoint topLeft; - QPoint bottomRight; +TQRect KexiDBInternalLabel::getBounding( const TQImage &image, const TQRect& startRect ) { + TQPoint topLeft; + TQPoint bottomRight; const int startX = startRect.x(); const int startY = startRect.y(); /*! * Ugly beast to get the correct width and height */ - const int width = QMIN( ( startRect.bottomRight().x() > 0 - ? startRect.bottomRight().x() : QCOORD_MAX ), + const int width = TQMIN( ( startRect.bottomRight().x() > 0 + ? startRect.bottomRight().x() : TQCOORD_MAX ), image.width() ); - const int height = QMIN( ( startRect.bottomRight().y() > 0 - ? startRect.bottomRight().y() : QCOORD_MAX ), + const int height = TQMIN( ( startRect.bottomRight().y() > 0 + ? startRect.bottomRight().y() : TQCOORD_MAX ), image.height() ); /*! Assume the first pixel has the color of the background that has to be cut away. - Qt uses the four corner pixels to guess the + TQt uses the four corner pixels to guess the correct color, but in this case the topleft pixel should be enough. */ - QRgb trans = image.pixel( 0, 0 ); + TQRgb trans = image.pixel( 0, 0 ); for ( int y = startY; y < height; y++ ) { for ( int x = startX; x < width; x++ ) { @@ -361,7 +361,7 @@ QRect KexiDBInternalLabel::getBounding( const QImage &image, const QRect& startR } } - return QRect( + return TQRect( topLeft.x(), topLeft.y(), bottomRight.x() - topLeft.x(), @@ -384,10 +384,10 @@ class KexiDBLabel::Private } ~Private() {} KPixmap shadowPixmap; - QPoint shadowPosition; + TQPoint shadowPosition; KexiDBInternalLabel* internalLabel; - QTimer* timer; - QColor frameColor; + TQTimer* timer; + TQColor frameColor; bool pixmapDirty : 1; bool shadowEnabled : 1; bool resizeEvent : 1; @@ -395,8 +395,8 @@ class KexiDBLabel::Private //========================================================= -KexiDBLabel::KexiDBLabel( QWidget *parent, const char *name, WFlags f ) - : QLabel( parent, name, f ) +KexiDBLabel::KexiDBLabel( TQWidget *tqparent, const char *name, WFlags f ) + : TQLabel( tqparent, name, f ) , KexiDBTextWidgetInterface() , KexiFormDataItemInterface() , d( new Private() ) @@ -404,8 +404,8 @@ KexiDBLabel::KexiDBLabel( QWidget *parent, const char *name, WFlags f ) init(); } -KexiDBLabel::KexiDBLabel( const QString& text, QWidget *parent, const char *name, WFlags f ) - : QLabel( parent, name, f ) +KexiDBLabel::KexiDBLabel( const TQString& text, TQWidget *tqparent, const char *name, WFlags f ) + : TQLabel( tqparent, name, f ) , KexiDBTextWidgetInterface() , KexiFormDataItemInterface() , d( new Private() ) @@ -424,16 +424,16 @@ void KexiDBLabel::init() m_hasFocusableWidget = false; d->internalLabel = new KexiDBInternalLabel( this ); d->internalLabel->hide(); - d->frameColor = palette().active().foreground(); + d->frameColor = tqpalette().active().foreground(); - setAlignment( d->internalLabel->alignment() ); + tqsetAlignment( d->internalLabel->tqalignment() ); } void KexiDBLabel::updatePixmapLater() { if (d->resizeEvent) { if (!d->timer) { - d->timer = new QTimer(this, "KexiDBLabelTimer"); - connect(d->timer, SIGNAL(timeout()), this, SLOT(updatePixmap())); + d->timer = new TQTimer(this, "KexiDBLabelTimer"); + connect(d->timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(updatePixmap())); } d->timer->start(100, true); d->resizeEvent = false; @@ -453,20 +453,20 @@ void KexiDBLabel::updatePixmap() { d->internalLabel->setText( text() ); d->internalLabel->setFixedSize( size() ); d->internalLabel->setPalette( palette() ); - d->internalLabel->setAlignment( alignment() ); -// d->shadowPixmap = KPixmap(); //parallel repaints won't hurt us cause incomplete pixmap + d->internalLabel->tqsetAlignment( tqalignment() ); +// d->shadowPixmap = KPixmap(); //parallel tqrepaints won't hurt us cause incomplete pixmap KPixmap shadowPixmap = d->internalLabel->getShadowPixmap(); if (shadowPixmap.isNull()) return; d->shadowPixmap = shadowPixmap; d->shadowPosition = d->internalLabel->m_shadowRect.topLeft(); d->pixmapDirty = false; - repaint(); + tqrepaint(); } -void KexiDBLabel::paintEvent( QPaintEvent* e ) +void KexiDBLabel::paintEvent( TQPaintEvent* e ) { - QPainter p( this ); + TQPainter p( this ); if ( d->shadowEnabled ) { /*! If required, update the pixmap-cache. @@ -482,31 +482,31 @@ void KexiDBLabel::paintEvent( QPaintEvent* e ) the shadow has to be drawn using an offset relative to the widgets border. */ - if ( !d->pixmapDirty && e->rect().contains( d->shadowPosition ) && !d->shadowPixmap.isNull()) { - QRect clipRect = QRect( - QMAX( e->rect().x() - d->shadowPosition.x(), 0 ), - QMAX( e->rect().y() - d->shadowPosition.y(), 0 ), - QMIN( e->rect().width() + d->shadowPosition.x(), d->shadowPixmap.width() ), - QMIN( e->rect().height() + d->shadowPosition.y(), d->shadowPixmap.height() ) ); + if ( !d->pixmapDirty && e->rect().tqcontains( d->shadowPosition ) && !d->shadowPixmap.isNull()) { + TQRect clipRect = TQRect( + TQMAX( e->rect().x() - d->shadowPosition.x(), 0 ), + TQMAX( e->rect().y() - d->shadowPosition.y(), 0 ), + TQMIN( e->rect().width() + d->shadowPosition.x(), d->shadowPixmap.width() ), + TQMIN( e->rect().height() + d->shadowPosition.y(), d->shadowPixmap.height() ) ); p.drawPixmap( d->internalLabel->m_shadowRect.topLeft(), d->shadowPixmap, clipRect ); } } - KexiDBTextWidgetInterface::paint( this, &p, text().isEmpty(), alignment(), false ); - QLabel::paintEvent( e ); + KexiDBTextWidgetInterface::paint( this, &p, text().isEmpty(), tqalignment(), false ); + TQLabel::paintEvent( e ); } -void KexiDBLabel::setValueInternal( const QVariant& add, bool removeOld ) { +void KexiDBLabel::setValueInternal( const TQVariant& add, bool removeOld ) { if (removeOld) setText(add.toString()); else setText( m_origValue.toString() + add.toString() ); } -QVariant KexiDBLabel::value() { +TQVariant KexiDBLabel::value() { return text(); } -void KexiDBLabel::setInvalidState( const QString& displayText ) +void KexiDBLabel::setInvalidState( const TQString& displayText ) { setText( displayText ); } @@ -531,7 +531,7 @@ void KexiDBLabel::setReadOnly( bool readOnly ) Q_UNUSED(readOnly); } -QWidget* KexiDBLabel::widget() +TQWidget* KexiDBLabel::widget() { return this; } @@ -548,12 +548,12 @@ bool KexiDBLabel::cursorAtEnd() void KexiDBLabel::clear() { - setText(QString::null); + setText(TQString()); } -bool KexiDBLabel::setProperty( const char * name, const QVariant & value ) +bool KexiDBLabel::setProperty( const char * name, const TQVariant & value ) { - const bool ret = QLabel::setProperty(name, value); + const bool ret = TQLabel::setProperty(name, value); if (d->shadowEnabled) { if (0==qstrcmp("indent", name) || 0==qstrcmp("font", name) || 0==qstrcmp("margin", name) || 0==qstrcmp("frameShadow", name) || 0==qstrcmp("frameShape", name) @@ -577,45 +577,45 @@ void KexiDBLabel::setShadowEnabled( bool state ) { d->pixmapDirty = true; if (state) d->internalLabel->updateFrame(); - repaint(); + tqrepaint(); } -void KexiDBLabel::resizeEvent( QResizeEvent* e ) { +void KexiDBLabel::resizeEvent( TQResizeEvent* e ) { if (isVisible()) d->resizeEvent = true; d->pixmapDirty = true; - QLabel::resizeEvent( e ); + TQLabel::resizeEvent( e ); } -void KexiDBLabel::fontChange( const QFont& font ) { +void KexiDBLabel::fontChange( const TQFont& font ) { d->pixmapDirty = true; d->internalLabel->setFont( font ); - QLabel::fontChange( font ); + TQLabel::fontChange( font ); } -void KexiDBLabel::styleChange( QStyle& style ) { +void KexiDBLabel::styleChange( TQStyle& style ) { d->pixmapDirty = true; - QLabel::styleChange( style ); + TQLabel::styleChange( style ); } void KexiDBLabel::enabledChange( bool enabled ) { d->pixmapDirty = true; d->internalLabel->setEnabled( enabled ); - QLabel::enabledChange( enabled ); + TQLabel::enabledChange( enabled ); } -void KexiDBLabel::paletteChange( const QPalette& oldPal ) { +void KexiDBLabel::paletteChange( const TQPalette& oldPal ) { Q_UNUSED(oldPal); d->pixmapDirty = true; d->internalLabel->setPalette( palette() ); } -/*const QColor & KexiDBLabel::paletteForegroundColor () const +/*const TQColor & KexiDBLabel::paletteForegroundColor () const { return d->foregroundColor; } -void KexiDBLabel::setPaletteForegroundColor ( const QColor& color ) +void KexiDBLabel::setPaletteForegroundColor ( const TQColor& color ) { d->foregroundColor = color; }*/ @@ -623,20 +623,20 @@ void KexiDBLabel::setPaletteForegroundColor ( const QColor& color ) void KexiDBLabel::frameChanged() { d->pixmapDirty = true; d->internalLabel->updateFrame(); - QFrame::frameChanged(); + TQFrame::frameChanged(); } -void KexiDBLabel::showEvent( QShowEvent* e ) { +void KexiDBLabel::showEvent( TQShowEvent* e ) { d->pixmapDirty = true; - QLabel::showEvent( e ); + TQLabel::showEvent( e ); } -void KexiDBLabel::setText( const QString& text ) { +void KexiDBLabel::setText( const TQString& text ) { d->pixmapDirty = true; - QLabel::setText( text ); + TQLabel::setText( text ); //This is necessary for KexiFormDataItemInterface valueChanged(); - repaint(); + tqrepaint(); } bool KexiDBLabel::shadowEnabled() const @@ -645,6 +645,6 @@ bool KexiDBLabel::shadowEnabled() const } #define ClassName KexiDBLabel -#define SuperClassName QLabel +#define SuperClassName TQLabel #include "kexiframeutils_p.cpp" #include "kexidblabel.moc" diff --git a/kexi/plugins/forms/widgets/kexidblabel.h b/kexi/plugins/forms/widgets/kexidblabel.h index ec4e626a..af396a12 100644 --- a/kexi/plugins/forms/widgets/kexidblabel.h +++ b/kexi/plugins/forms/widgets/kexidblabel.h @@ -21,8 +21,8 @@ #ifndef KEXIDBLABEL_H #define KEXIDBLABEL_H -#include <qimage.h> -#include <qlabel.h> +#include <tqimage.h> +#include <tqlabel.h> #include <kpixmap.h> @@ -30,8 +30,8 @@ #include "../kexidbtextwidgetinterface.h" #include <widget/utils/kexidisplayutils.h> -class QPainter; -class QTimer; +class TQPainter; +class TQTimer; class KexiDBInternalLabel; //! @short An extended, data-aware, read-only text label. @@ -39,29 +39,30 @@ class KexiDBInternalLabel; @author Christian Nitschkowski, Jaroslaw Staniek */ -class KEXIFORMUTILS_EXPORT KexiDBLabel : public QLabel, protected KexiDBTextWidgetInterface, public KexiFormDataItemInterface { +class KEXIFORMUTILS_EXPORT KexiDBLabel : public TQLabel, protected KexiDBTextWidgetInterface, public KexiFormDataItemInterface { Q_OBJECT - Q_PROPERTY( QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true ) - Q_PROPERTY( QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true ) - Q_PROPERTY( bool shadowEnabled READ shadowEnabled WRITE setShadowEnabled DESIGNABLE true ) - Q_OVERRIDE( QPixmap pixmap DESIGNABLE false ) - Q_OVERRIDE( bool scaledContents DESIGNABLE false ) -// Q_OVERRIDE( QColor paletteForegroundColor READ paletteForegroundColor WRITE setPaletteForegroundColor DESIGNABLE true ) - Q_PROPERTY( QColor frameColor READ frameColor WRITE setFrameColor DESIGNABLE true ) + TQ_OBJECT + TQ_PROPERTY( TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true ) + TQ_PROPERTY( TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true ) + TQ_PROPERTY( bool shadowEnabled READ shadowEnabled WRITE setShadowEnabled DESIGNABLE true ) + TQ_OVERRIDE( TQPixmap pixmap DESIGNABLE false ) + TQ_OVERRIDE( bool scaledContents DESIGNABLE false ) +// TQ_OVERRIDE( TQColor paletteForegroundColor READ paletteForegroundColor WRITE setPaletteForegroundColor DESIGNABLE true ) + TQ_PROPERTY( TQColor frameColor READ frameColor WRITE setFrameColor DESIGNABLE true ) public: - KexiDBLabel( QWidget *parent, const char *name = 0, WFlags f = 0 ); - KexiDBLabel( const QString& text, QWidget *parent, const char *name = 0, WFlags f = 0 ); + KexiDBLabel( TQWidget *tqparent, const char *name = 0, WFlags f = 0 ); + KexiDBLabel( const TQString& text, TQWidget *tqparent, const char *name = 0, WFlags f = 0 ); virtual ~KexiDBLabel(); - inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); } - inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } + inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); } + inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } - virtual QVariant value(); + virtual TQVariant value(); bool shadowEnabled() const; - virtual void setInvalidState( const QString& displayText ); + virtual void setInvalidState( const TQString& displayText ); virtual bool valueIsNull(); @@ -70,7 +71,7 @@ class KEXIFORMUTILS_EXPORT KexiDBLabel : public QLabel, protected KexiDBTextWidg //! always true virtual bool isReadOnly() const; - virtual QWidget* widget(); + virtual TQWidget* widget(); //! always false virtual bool cursorAtStart(); @@ -81,29 +82,29 @@ class KEXIFORMUTILS_EXPORT KexiDBLabel : public QLabel, protected KexiDBTextWidg virtual void clear(); //! used to catch setIndent(), etc. - virtual bool setProperty ( const char * name, const QVariant & value ); + virtual bool setProperty ( const char * name, const TQVariant & value ); - virtual const QColor& frameColor() const; + virtual const TQColor& frameColor() const; -// const QColor & paletteForegroundColor() const; +// const TQColor & paletteForegroundColor() const; public slots: //! Sets the datasource to \a ds - inline void setDataSource( const QString &ds ) { KexiFormDataItemInterface::setDataSource( ds ); } + inline void setDataSource( const TQString &ds ) { KexiFormDataItemInterface::setDataSource( ds ); } - inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } + inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } - virtual void setText( const QString& text ); + virtual void setText( const TQString& text ); /*! Enable/Disable the shadow effect. - KexiDBLabel acts just like a normal QLabel when shadow is disabled. */ + KexiDBLabel acts just like a normal TQLabel when shadow is disabled. */ void setShadowEnabled( bool state ); - virtual void setPalette( const QPalette &pal ); + virtual void setPalette( const TQPalette &pal ); - virtual void setFrameColor(const QColor& color); + virtual void setFrameColor(const TQColor& color); -// void setPaletteForegroundColor( const QColor& color ); +// void setPaletteForegroundColor( const TQColor& color ); protected slots: //! empty @@ -113,23 +114,23 @@ class KEXIFORMUTILS_EXPORT KexiDBLabel : public QLabel, protected KexiDBTextWidg protected: void init(); virtual void setColumnInfo(KexiDB::QueryColumnInfo* cinfo); - virtual void paintEvent( QPaintEvent* ); - virtual void resizeEvent( QResizeEvent* e ); + virtual void paintEvent( TQPaintEvent* ); + virtual void resizeEvent( TQResizeEvent* e ); //! Sets value \a value for a widget. - virtual void setValueInternal( const QVariant& add, bool removeOld ); + virtual void setValueInternal( const TQVariant& add, bool removeOld ); - virtual void fontChange( const QFont& font ); - virtual void styleChange( QStyle& style ); + virtual void fontChange( const TQFont& font ); + virtual void styleChange( TQStyle& style ); virtual void enabledChange( bool enabled ); - virtual void paletteChange( const QPalette& oldPal ); + virtual void paletteChange( const TQPalette& oldPal ); virtual void frameChanged(); - virtual void showEvent( QShowEvent* e ); + virtual void showEvent( TQShowEvent* e ); //! Reimplemented to paint using real frame color instead of froeground. //! Also allows to paint more types of frame. - virtual void drawFrame( QPainter * ); + virtual void drawFrame( TQPainter * ); void updatePixmapLater(); diff --git a/kexi/plugins/forms/widgets/kexidblineedit.cpp b/kexi/plugins/forms/widgets/kexidblineedit.cpp index 3897a8cb..0b1709e1 100644 --- a/kexi/plugins/forms/widgets/kexidblineedit.cpp +++ b/kexi/plugins/forms/widgets/kexidblineedit.cpp @@ -25,8 +25,8 @@ #include <knumvalidator.h> #include <kdatetbl.h> -#include <qpopupmenu.h> -#include <qpainter.h> +#include <tqpopupmenu.h> +#include <tqpainter.h> #include <kexiutils/utils.h> #include <kexidb/queryschema.h> @@ -37,37 +37,37 @@ //#define USE_KLineEdit_setReadOnly //! @internal A validator used for read only flag to disable editing -class KexiDBLineEdit_ReadOnlyValidator : public QValidator +class KexiDBLineEdit_ReadOnlyValidator : public TQValidator { public: - KexiDBLineEdit_ReadOnlyValidator( QObject * parent ) - : QValidator(parent) + KexiDBLineEdit_ReadOnlyValidator( TQObject * tqparent ) + : TQValidator(tqparent) { } ~KexiDBLineEdit_ReadOnlyValidator() {} - virtual State validate( QString &, int & ) const { return Invalid; } + virtual State validate( TQString &, int & ) const { return Invalid; } }; //----- -KexiDBLineEdit::KexiDBLineEdit(QWidget *parent, const char *name) - : KLineEdit(parent, name) +KexiDBLineEdit::KexiDBLineEdit(TQWidget *tqparent, const char *name) + : KLineEdit(tqparent, name) , KexiDBTextWidgetInterface() , KexiFormDataItemInterface() //moved , m_dateFormatter(0) //moved , m_timeFormatter(0) - , m_menuExtender(this, this) + , m_menuExtender(TQT_TQOBJECT(this), this) , m_internalReadOnly(false) , m_slotTextChanged_enabled(true) { #ifdef USE_KLineEdit_setReadOnly //! @todo reenable as an app aption - QPalette p(widget->palette()); + TQPalette p(widget->palette()); p.setColor( lighterGrayBackgroundColor(palette()) ); widget->setPalette(p); #endif - connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(slotTextChanged(const QString&))); + connect(this, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotTextChanged(const TQString&))); } KexiDBLineEdit::~KexiDBLineEdit() @@ -76,19 +76,19 @@ KexiDBLineEdit::~KexiDBLineEdit() //moved delete m_timeFormatter; } -void KexiDBLineEdit::setInvalidState( const QString& displayText ) +void KexiDBLineEdit::setInvalidState( const TQString& displayText ) { KLineEdit::setReadOnly(true); //! @todo move this to KexiDataItemInterface::setInvalidStateInternal() ? - if (focusPolicy() & TabFocus) - setFocusPolicy(QWidget::ClickFocus); + if (focusPolicy() & TQ_TabFocus) + setFocusPolicy(TQ_ClickFocus); setText(displayText); } -void KexiDBLineEdit::setValueInternal(const QVariant& add, bool removeOld) +void KexiDBLineEdit::setValueInternal(const TQVariant& add, bool removeOld) { #if 0 //moved to KexiTextFormatter - QVariant value; + TQVariant value; if (removeOld) value = add; else { @@ -106,15 +106,15 @@ void KexiDBLineEdit::setValueInternal(const QVariant& add, bool removeOld) return; } else if (t == KexiDB::Field::Date) { - setText( dateFormatter()->dateToString( value.toString().isEmpty() ? QDate() : value.toDate() ) ); + setText( dateFormatter()->dateToString( value.toString().isEmpty() ? TQDate() : value.toDate() ) ); setCursorPosition(0); //ok? return; } else if (t == KexiDB::Field::Time) { setText( timeFormatter()->timeToString( - //hack to avoid converting null variant to valid QTime(0,0,0) - value.toString().isEmpty() ? value.toTime() : QTime(99,0,0) + //hack to avoid converting null variant to valid TQTime(0,0,0) + value.toString().isEmpty() ? value.toTime() : TQTime(99,0,0) ) ); setCursorPosition(0); //ok? @@ -122,7 +122,7 @@ void KexiDBLineEdit::setValueInternal(const QVariant& add, bool removeOld) } else if (t == KexiDB::Field::DateTime) { if (value.toString().isEmpty() ) { - setText( QString::null ); + setText( TQString() ); } else { setText( @@ -136,18 +136,18 @@ void KexiDBLineEdit::setValueInternal(const QVariant& add, bool removeOld) } #endif m_slotTextChanged_enabled = false; - setText( m_textFormatter.valueToText(removeOld ? QVariant() : m_origValue, add.toString()) ); + setText( m_textFormatter.valueToText(removeOld ? TQVariant() : m_origValue, add.toString()) ); // setText( value.toString() ); setCursorPosition(0); //ok? m_slotTextChanged_enabled = true; } -QVariant KexiDBLineEdit::value() +TQVariant KexiDBLineEdit::value() { return m_textFormatter.textToValue( text() ); #if 0 // moved to KexiTextFormatter if (! m_columnInfo) - return QVariant(); + return TQVariant(); const KexiDB::Field::Type t = m_columnInfo->field->type(); switch (t) { case KexiDB::Field::Text: @@ -163,7 +163,7 @@ QVariant KexiDBLineEdit::value() return text().toLongLong(); case KexiDB::Field::Boolean: //! @todo temporary solution for booleans! - return text() == "1" ? QVariant(true,1) : QVariant(false,0); + return text() == "1" ? TQVariant(true,1) : TQVariant(false,0); case KexiDB::Field::Date: return dateFormatter()->stringToVariant( text() ); case KexiDB::Field::Time: @@ -175,14 +175,14 @@ QVariant KexiDBLineEdit::value() case KexiDB::Field::Double: return text().toDouble(); default: - return QVariant(); + return TQVariant(); } //! @todo more data types! return text(); #endif } -void KexiDBLineEdit::slotTextChanged(const QString&) +void KexiDBLineEdit::slotTextChanged(const TQString&) { if (!m_slotTextChanged_enabled) return; @@ -254,7 +254,7 @@ void KexiDBLineEdit::setReadOnly( bool readOnly ) if (m_internalReadOnly) { m_readWriteValidator = validator(); if (!m_readOnlyValidator) - m_readOnlyValidator = new KexiDBLineEdit_ReadOnlyValidator(this); + m_readOnlyValidator = new KexiDBLineEdit_ReadOnlyValidator(TQT_TQOBJECT(this)); setValidator( m_readOnlyValidator ); } else { @@ -265,15 +265,15 @@ void KexiDBLineEdit::setReadOnly( bool readOnly ) #endif } -QPopupMenu * KexiDBLineEdit::createPopupMenu() +TQPopupMenu * KexiDBLineEdit::createPopupMenu() { - QPopupMenu *contextMenu = KLineEdit::createPopupMenu(); + TQPopupMenu *contextMenu = KLineEdit::createPopupMenu(); m_menuExtender.createTitle(contextMenu); return contextMenu; } -QWidget* KexiDBLineEdit::widget() +TQWidget* KexiDBLineEdit::widget() { return this; } @@ -303,7 +303,7 @@ void KexiDBLineEdit::setColumnInfo(KexiDB::QueryColumnInfo* cinfo) if (!cinfo) return; -//! @todo handle input mask (via QLineEdit::setInputMask()) using a special KexiDB::FieldInputMask class +//! @todo handle input tqmask (via TQLineEdit::setInputMask()) using a special KexiDB::FieldInputMask class setValidator( new KexiDB::FieldValidator(*cinfo->field, this) ); #if 0 // moved to KexiTextFormatter @@ -321,7 +321,7 @@ void KexiDBLineEdit::setColumnInfo(KexiDB::QueryColumnInfo* cinfo) dateTimeInputMask( *dateFormatter(), *timeFormatter() ) ); } #endif - const QString inputMask( m_textFormatter.inputMask() ); + const TQString inputMask( m_textFormatter.inputMask() ); if (!inputMask.isEmpty()) setInputMask( inputMask ); @@ -329,26 +329,26 @@ void KexiDBLineEdit::setColumnInfo(KexiDB::QueryColumnInfo* cinfo) } /*todo -void KexiDBLineEdit::paint( QPainter *p ) +void KexiDBLineEdit::paint( TQPainter *p ) { - KexiDBTextWidgetInterface::paint( this, &p, text().isEmpty(), alignment(), hasFocus() ); + KexiDBTextWidgetInterface::paint( this, &p, text().isEmpty(), tqalignment(), hasFocus() ); }*/ -void KexiDBLineEdit::paintEvent ( QPaintEvent *pe ) +void KexiDBLineEdit::paintEvent ( TQPaintEvent *pe ) { KLineEdit::paintEvent( pe ); - QPainter p(this); - KexiDBTextWidgetInterface::paint( this, &p, text().isEmpty(), alignment(), hasFocus() ); + TQPainter p(this); + KexiDBTextWidgetInterface::paint( this, &p, text().isEmpty(), tqalignment(), hasFocus() ); } -bool KexiDBLineEdit::event( QEvent * e ) +bool KexiDBLineEdit::event( TQEvent * e ) { const bool ret = KLineEdit::event( e ); KexiDBTextWidgetInterface::event(e, this, text().isEmpty()); - if (e->type()==QEvent::FocusOut) { - QFocusEvent *fe = static_cast<QFocusEvent *>(e); -// if (fe->reason()!=QFocusEvent::ActiveWindow && fe->reason()!=QFocusEvent::Popup) { - if (fe->reason()==QFocusEvent::Tab || fe->reason()==QFocusEvent::Backtab) { + if (e->type()==TQEvent::FocusOut) { + TQFocusEvent *fe = TQT_TQFOCUSEVENT(e); +// if (fe->reason()!=TQFocusEvent::ActiveWindow && fe->reason()!=TQFocusEvent::Popup) { + if (fe->reason()==TQFocusEvent::Tab || fe->reason()==TQFocusEvent::Backtab) { //display aligned to left after loosing the focus (only if this is tab/backtab event) //! @todo add option to set cursor at the beginning setCursorPosition(0); //ok? @@ -362,7 +362,7 @@ bool KexiDBLineEdit::appendStretchRequired(KexiDBAutoField* autoField) const return KexiDBAutoField::Top == autoField->labelPosition(); } -void KexiDBLineEdit::handleAction(const QString& actionName) +void KexiDBLineEdit::handleAction(const TQString& actionName) { if (actionName=="edit_copy") { copy(); @@ -376,15 +376,15 @@ void KexiDBLineEdit::handleAction(const QString& actionName) //! @todo ? } -void KexiDBLineEdit::setDisplayDefaultValue(QWidget *widget, bool displayDefaultValue) +void KexiDBLineEdit::setDisplayDefaultValue(TQWidget *widget, bool displayDefaultValue) { KexiFormDataItemInterface::setDisplayDefaultValue(widget, displayDefaultValue); // initialize display parameters for default / entered value KexiDisplayUtils::DisplayParameters * const params = displayDefaultValue ? m_displayParametersForDefaultValue : m_displayParametersForEnteredValue; setFont(params->font); - QPalette pal(palette()); - pal.setColor(QPalette::Active, QColorGroup::Text, params->textColor); + TQPalette pal(palette()); + pal.setColor(TQPalette::Active, TQColorGroup::Text, params->textColor); setPalette(pal); } @@ -408,7 +408,7 @@ void KexiDBLineEdit::selectAll() KLineEdit::selectAll(); } -bool KexiDBLineEdit::keyPressed(QKeyEvent *ke) +bool KexiDBLineEdit::keyPressed(TQKeyEvent *ke) { Q_UNUSED(ke); return false; diff --git a/kexi/plugins/forms/widgets/kexidblineedit.h b/kexi/plugins/forms/widgets/kexidblineedit.h index 5f0262b2..4457a8d0 100644 --- a/kexi/plugins/forms/widgets/kexidblineedit.h +++ b/kexi/plugins/forms/widgets/kexidblineedit.h @@ -22,7 +22,7 @@ #define KexiDBLineEdit_H #include <klineedit.h> -#include <qvalidator.h> +#include <tqvalidator.h> #include "kexiformdataiteminterface.h" #include "kexidbtextwidgetinterface.h" @@ -34,11 +34,11 @@ class KexiDBWidgetContextMenuExtender; /*! @internal Utility: alter background color to be a blended color of the background and base (usually lighter gray). Used for read-only mode. */ -void setLighterGrayBackgroundColor(QWidget* widget); +void setLighterGrayBackgroundColor(TQWidget* widget); //! @short Line edit widget for Kexi forms /*! Handles many data types. User input is validated by using validators - and/or input masks. + and/or input tqmasks. */ class KEXIFORMUTILS_EXPORT KexiDBLineEdit : public KLineEdit, @@ -47,18 +47,19 @@ class KEXIFORMUTILS_EXPORT KexiDBLineEdit : public KexiSubwidgetInterface { Q_OBJECT - Q_PROPERTY(QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) - Q_PROPERTY(QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) - Q_OVERRIDE(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true) + TQ_OBJECT + TQ_PROPERTY(TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) + TQ_PROPERTY(TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) + TQ_OVERRIDE(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true) public: - KexiDBLineEdit(QWidget *parent, const char *name=0); + KexiDBLineEdit(TQWidget *tqparent, const char *name=0); virtual ~KexiDBLineEdit(); - inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); } - inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } - virtual QVariant value(); - virtual void setInvalidState( const QString& displayText ); + inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); } + inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } + virtual TQVariant value(); + virtual void setInvalidState( const TQString& displayText ); //! \return true if editor's value is null (not empty) //! Used for checking if a given constraint within table of form is met. @@ -80,10 +81,10 @@ class KEXIFORMUTILS_EXPORT KexiDBLineEdit : is displayed in a special way. Used by KexiFormDataProvider::fillDataItems(). \a widget is equal to 'this'. Reimplemented after KexiFormDataItemInterface. */ - virtual void setDisplayDefaultValue(QWidget* widget, bool displayDefaultValue); + virtual void setDisplayDefaultValue(TQWidget* widget, bool displayDefaultValue); /*! \return the view widget of this item, e.g. line edit widget. */ - virtual QWidget* widget(); + virtual TQWidget* widget(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); @@ -94,14 +95,14 @@ class KEXIFORMUTILS_EXPORT KexiDBLineEdit : /*! Handles action having standard name \a actionName. Action could be: "edit_copy", "edit_paste", etc. Reimplemented after KexiDataItemChangesListener. */ - virtual void handleAction(const QString& actionName); + virtual void handleAction(const TQString& actionName); /*! Called by top-level form on key press event to consume widget-specific shortcuts. */ - virtual bool keyPressed(QKeyEvent *ke); + virtual bool keyPressed(TQKeyEvent *ke); public slots: - inline void setDataSource(const QString &ds) { KexiFormDataItemInterface::setDataSource(ds); } - inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } + inline void setDataSource(const TQString &ds) { KexiFormDataItemInterface::setDataSource(ds); } + inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } virtual void setReadOnly( bool readOnly ); //! Reimplemented, so "undo" means the same as "cancelEditor" action @@ -117,12 +118,12 @@ class KEXIFORMUTILS_EXPORT KexiDBLineEdit : virtual void selectAll(); protected slots: - void slotTextChanged(const QString&); + void slotTextChanged(const TQString&); protected: - virtual void paintEvent ( QPaintEvent * ); - virtual void setValueInternal(const QVariant& add, bool removeOld); - virtual bool event ( QEvent * ); + virtual void paintEvent ( TQPaintEvent * ); + virtual void setValueInternal(const TQVariant& add, bool removeOld); + virtual bool event ( TQEvent * ); #if 0 //moved to KexiTextFormatter @@ -135,7 +136,7 @@ class KEXIFORMUTILS_EXPORT KexiDBLineEdit : } #endif - virtual QPopupMenu * createPopupMenu(); + virtual TQPopupMenu * createPopupMenu(); //! Implemented for KexiSubwidgetInterface virtual bool appendStretchRequired(KexiDBAutoField* autoField) const; @@ -151,10 +152,10 @@ class KEXIFORMUTILS_EXPORT KexiDBLineEdit : KexiTextFormatter m_textFormatter; //! Used for read only flag to disable editing - QGuardedPtr<const QValidator> m_readOnlyValidator; + TQGuardedPtr<const TQValidator> m_readOnlyValidator; //! Used to remember the previous validator used forf r/w mode, after setting the read only flag - QGuardedPtr<const QValidator> m_readWriteValidator; + TQGuardedPtr<const TQValidator> m_readWriteValidator; //! Used for extending context menu KexiDBWidgetContextMenuExtender m_menuExtender; diff --git a/kexi/plugins/forms/widgets/kexidbsubform.cpp b/kexi/plugins/forms/widgets/kexidbsubform.cpp index 8d1971a9..8cb4f795 100644 --- a/kexi/plugins/forms/widgets/kexidbsubform.cpp +++ b/kexi/plugins/forms/widgets/kexidbsubform.cpp @@ -29,38 +29,38 @@ #include <formeditor/container.h> #include <formeditor/formmanager.h> -KexiDBSubForm::KexiDBSubForm(KFormDesigner::Form *parentForm, QWidget *parent, const char *name) -: QScrollView(parent, name), m_parentForm(parentForm), m_form(0), m_widget(0) +KexiDBSubForm::KexiDBSubForm(KFormDesigner::Form *tqparentForm, TQWidget *tqparent, const char *name) +: TQScrollView(tqparent, name), m_parentForm(tqparentForm), m_form(0), m_widget(0) { - setFrameStyle(QFrame::WinPanel | QFrame::Sunken); - viewport()->setPaletteBackgroundColor(colorGroup().mid()); + setFrameStyle(TQFrame::WinPanel | TQFrame::Sunken); + viewport()->setPaletteBackgroundColor(tqcolorGroup().mid()); } /* void -KexiDBSubForm::paintEvent(QPaintEvent *ev) +KexiDBSubForm::paintEvent(TQPaintEvent *ev) { - QScrollView::paintEvent(ev); - QPainter p; + TQScrollView::paintEvent(ev); + TQPainter p; setWFlags(WPaintUnclipped); - QString txt("Subform"); - QFont f = font(); + TQString txt("Subform"); + TQFont f = font(); f.setPointSize(f.pointSize() * 3); - QFontMetrics fm(f); + TQFontMetrics fm(f); const int txtw = fm.width(txt), txth = fm.height(); p.begin(this, true); p.setPen(black); p.setFont(f); - p.drawText(width()/2, height()/2, txt, Qt::AlignCenter|Qt::AlignVCenter); + p.drawText(width()/2, height()/2, txt, TQt::AlignCenter|TQt::AlignVCenter); p.end(); clearWFlags( WPaintUnclipped ); } */ void -KexiDBSubForm::setFormName(const QString &name) +KexiDBSubForm::setFormName(const TQString &name) { if(m_formName==name) return; @@ -74,12 +74,12 @@ KexiDBSubForm::setFormName(const QString &name) return; } - QWidget *pw = parentWidget(); + TQWidget *pw = tqparentWidget(); KexiFormView *view = 0; - QStringList list; + TQStringList list; while(pw) { if(pw->isA("KexiDBSubForm")) { - if(list.contains(pw->name())) { + if(list.tqcontains(pw->name())) { //! @todo error message return; // Be sure to don't run into a endless-loop cause of recursive subforms. } @@ -87,18 +87,18 @@ KexiDBSubForm::setFormName(const QString &name) } else if(! view && pw->isA("KexiFormView")) view = static_cast<KexiFormView*>(pw); // we need a KexiFormView* - pw = pw->parentWidget(); + pw = pw->tqparentWidget(); } - if (!view || !view->parentDialog() || !view->parentDialog()->mainWin() - || !view->parentDialog()->mainWin()->project()->dbConnection()) + if (!view || !view->tqparentDialog() || !view->tqparentDialog()->mainWin() + || !view->tqparentDialog()->mainWin()->project()->dbConnection()) return; - KexiDB::Connection *conn = view->parentDialog()->mainWin()->project()->dbConnection(); + KexiDB::Connection *conn = view->tqparentDialog()->mainWin()->project()->dbConnection(); // we check if there is a form with this name int id = KexiDB::idForObjectName(*conn, name, KexiPart::FormObjectType); - if((id == 0) || (id == view->parentDialog()->id())) // == our form + if((id == 0) || (id == view->tqparentDialog()->id())) // == our form return; // because of recursion when loading // we create the container widget @@ -110,22 +110,22 @@ KexiDBSubForm::setFormName(const QString &name) m_form->createToplevel(m_widget); // and load the sub form - QString data; - tristate res = conn->loadDataBlock(id, data, QString::null); + TQString data; + tristate res = conn->loadDataBlock(id, data, TQString()); if (res == true) res = KFormDesigner::FormIO::loadFormFromString(m_form, m_widget, data); if(res != true) { delete m_widget; m_widget = 0; updateScrollBars(); - m_formName = QString::null; + m_formName = TQString(); return; } m_form->setDesignMode(false); // Install event filters on the whole newly created form - KFormDesigner::ObjectTreeItem *tree = m_parentForm->objectTree()->lookup(QObject::name()); - KFormDesigner::installRecursiveEventFilter(this, tree->eventEater()); + KFormDesigner::ObjectTreeItem *tree = m_parentForm->objectTree()->lookup(TQT_TQOBJECT(this)->name()); + KFormDesigner::installRecursiveEventFilter(TQT_TQOBJECT(this), tree->eventEater()); } #include "kexidbsubform.moc" diff --git a/kexi/plugins/forms/widgets/kexidbsubform.h b/kexi/plugins/forms/widgets/kexidbsubform.h index 5b73f860..ea2bdbd3 100644 --- a/kexi/plugins/forms/widgets/kexidbsubform.h +++ b/kexi/plugins/forms/widgets/kexidbsubform.h @@ -21,32 +21,33 @@ #ifndef KexiDBSubForm_H #define KexiDBSubForm_H -#include <qscrollview.h> +#include <tqscrollview.h> #include <formeditor/form.h> //! @short A form embedded as a widget inside other form -class KEXIFORMUTILS_EXPORT KexiDBSubForm : public QScrollView +class KEXIFORMUTILS_EXPORT KexiDBSubForm : public TQScrollView { Q_OBJECT - Q_PROPERTY(QString formName READ formName WRITE setFormName DESIGNABLE true) + TQ_OBJECT + TQ_PROPERTY(TQString formName READ formName WRITE setFormName DESIGNABLE true) public: - KexiDBSubForm(KFormDesigner::Form *parentForm, QWidget *parent, const char *name); + KexiDBSubForm(KFormDesigner::Form *tqparentForm, TQWidget *tqparent, const char *name); ~KexiDBSubForm() {} //! \return the name of the subform to display inside this widget - QString formName() const { return m_formName; } + TQString formName() const { return m_formName; } //! Sets the name of the subform to display inside this widget - void setFormName(const QString &name); + void setFormName(const TQString &name); - //void paintEvent(QPaintEvent *ev); + //void paintEvent(TQPaintEvent *ev); private: KFormDesigner::Form *m_parentForm; KFormDesigner::Form *m_form; - QWidget *m_widget; - QString m_formName; + TQWidget *m_widget; + TQString m_formName; }; #endif diff --git a/kexi/plugins/forms/widgets/kexidbtextedit.cpp b/kexi/plugins/forms/widgets/kexidbtextedit.cpp index 8541fc01..6f6aa89d 100644 --- a/kexi/plugins/forms/widgets/kexidbtextedit.cpp +++ b/kexi/plugins/forms/widgets/kexidbtextedit.cpp @@ -26,16 +26,16 @@ #include <kstdaccel.h> #include <kdebug.h> -#include <qpainter.h> +#include <tqpainter.h> -KexiDBTextEdit::KexiDBTextEdit(QWidget *parent, const char *name) - : KTextEdit(parent, name) +KexiDBTextEdit::KexiDBTextEdit(TQWidget *tqparent, const char *name) + : KTextEdit(tqparent, name) , KexiDBTextWidgetInterface() , KexiFormDataItemInterface() - , m_menuExtender(this, this) + , m_menuExtender(TQT_TQOBJECT(this), this) , m_slotTextChanged_enabled(true) { - connect(this, SIGNAL(textChanged()), this, SLOT(slotTextChanged())); + connect(this, TQT_SIGNAL(textChanged()), this, TQT_SLOT(slotTextChanged())); installEventFilter(this); } @@ -43,16 +43,16 @@ KexiDBTextEdit::~KexiDBTextEdit() { } -void KexiDBTextEdit::setInvalidState( const QString& displayText ) +void KexiDBTextEdit::setInvalidState( const TQString& displayText ) { setReadOnly(true); //! @todo move this to KexiDataItemInterface::setInvalidStateInternal() ? - if (focusPolicy() & TabFocus) - setFocusPolicy(QWidget::ClickFocus); + if (focusPolicy() & TQ_TabFocus) + setFocusPolicy(TQ_ClickFocus); KTextEdit::setText(displayText); } -void KexiDBTextEdit::setValueInternal(const QVariant& add, bool removeOld) +void KexiDBTextEdit::setValueInternal(const TQVariant& add, bool removeOld) { if (m_columnInfo && m_columnInfo->field->type()==KexiDB::Field::Boolean) { //! @todo temporary solution for booleans! @@ -66,7 +66,7 @@ void KexiDBTextEdit::setValueInternal(const QVariant& add, bool removeOld) } } -QVariant KexiDBTextEdit::value() +TQVariant KexiDBTextEdit::value() { return text(); } @@ -96,20 +96,20 @@ bool KexiDBTextEdit::isReadOnly() const void KexiDBTextEdit::setReadOnly( bool readOnly ) { KTextEdit::setReadOnly( readOnly ); - QPalette p = palette(); - QColor c(readOnly ? lighterGrayBackgroundColor(kapp->palette()) : p.color(QPalette::Normal, QColorGroup::Base)); + TQPalette p = palette(); + TQColor c(readOnly ? lighterGrayBackgroundColor(kapp->palette()) : p.color(TQPalette::Normal, TQColorGroup::Base)); setPaper( c ); - p.setColor(QColorGroup::Base, c); - p.setColor(QColorGroup::Background, c); + p.setColor(TQColorGroup::Base, c); + p.setColor(TQColorGroup::Background, c); setPalette( p ); } -void KexiDBTextEdit::setText( const QString & text, const QString & context ) +void KexiDBTextEdit::setText( const TQString & text, const TQString & context ) { KTextEdit::setText(text, context); } -QWidget* KexiDBTextEdit::widget() +TQWidget* KexiDBTextEdit::widget() { return this; } @@ -130,7 +130,7 @@ bool KexiDBTextEdit::cursorAtEnd() void KexiDBTextEdit::clear() { - setText(QString::null, QString::null); + setText(TQString(), TQString()); } void KexiDBTextEdit::setColumnInfo(KexiDB::QueryColumnInfo* cinfo) @@ -141,16 +141,16 @@ void KexiDBTextEdit::setColumnInfo(KexiDB::QueryColumnInfo* cinfo) KexiDBTextWidgetInterface::setColumnInfo(m_columnInfo, this); } -void KexiDBTextEdit::paintEvent ( QPaintEvent *pe ) +void KexiDBTextEdit::paintEvent ( TQPaintEvent *pe ) { KTextEdit::paintEvent( pe ); - QPainter p(this); - KexiDBTextWidgetInterface::paint( this, &p, text().isEmpty(), alignment(), hasFocus() ); + TQPainter p(this); + KexiDBTextWidgetInterface::paint( this, &p, text().isEmpty(), tqalignment(), hasFocus() ); } -QPopupMenu * KexiDBTextEdit::createPopupMenu(const QPoint & pos) +TQPopupMenu * KexiDBTextEdit::createPopupMenu(const TQPoint & pos) { - QPopupMenu *contextMenu = KTextEdit::createPopupMenu(pos); + TQPopupMenu *contextMenu = KTextEdit::createPopupMenu(pos); m_menuExtender.createTitle(contextMenu); return contextMenu; } @@ -160,21 +160,21 @@ void KexiDBTextEdit::undo() cancelEditor(); } -void KexiDBTextEdit::setDisplayDefaultValue(QWidget* widget, bool displayDefaultValue) +void KexiDBTextEdit::setDisplayDefaultValue(TQWidget* widget, bool displayDefaultValue) { KexiFormDataItemInterface::setDisplayDefaultValue(widget, displayDefaultValue); // initialize display parameters for default / entered value KexiDisplayUtils::DisplayParameters * const params = displayDefaultValue ? m_displayParametersForDefaultValue : m_displayParametersForEnteredValue; - QPalette pal(palette()); - pal.setColor(QPalette::Active, QColorGroup::Text, params->textColor); + TQPalette pal(palette()); + pal.setColor(TQPalette::Active, TQColorGroup::Text, params->textColor); setPalette(pal); setFont(params->font); //! @todo support rich text... /* m_slotTextChanged_enabled = false; //for rich text... - const QString origText( text() ); - KTextEdit::setText(QString::null); + const TQString origText( text() ); + KTextEdit::setText(TQString()); setCurrentFont(params->font); setColor(params->textColor); KTextEdit::setText(origText); @@ -196,7 +196,7 @@ void KexiDBTextEdit::selectAll() KTextEdit::selectAll(); } -void KexiDBTextEdit::keyPressEvent( QKeyEvent *ke ) +void KexiDBTextEdit::keyPressEvent( TQKeyEvent *ke ) { // for instance, Windows uses Ctrl+Tab for moving between tabs, so do not steal this shortcut if (KStdAccel::tabNext().contains( KKey(ke) ) || KStdAccel::tabPrev().contains( KKey(ke) )) { diff --git a/kexi/plugins/forms/widgets/kexidbtextedit.h b/kexi/plugins/forms/widgets/kexidbtextedit.h index a380b070..c6f64136 100644 --- a/kexi/plugins/forms/widgets/kexidbtextedit.h +++ b/kexi/plugins/forms/widgets/kexidbtextedit.h @@ -33,17 +33,18 @@ class KEXIFORMUTILS_EXPORT KexiDBTextEdit : public KexiFormDataItemInterface { Q_OBJECT - Q_PROPERTY(QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) - Q_PROPERTY(QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) + TQ_OBJECT + TQ_PROPERTY(TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) + TQ_PROPERTY(TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) public: - KexiDBTextEdit(QWidget *parent, const char *name=0); + KexiDBTextEdit(TQWidget *tqparent, const char *name=0); virtual ~KexiDBTextEdit(); - inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); } - inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } - virtual QVariant value(); - virtual void setInvalidState( const QString& displayText ); + inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); } + inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } + virtual TQVariant value(); + virtual void setInvalidState( const TQString& displayText ); //! \return true if editor's value is null (not empty) //! Used for checking if a given constraint within table of form is met. @@ -59,7 +60,7 @@ class KEXIFORMUTILS_EXPORT KexiDBTextEdit : virtual bool isReadOnly() const; /*! \return the view widget of this item, e.g. line edit widget. */ - virtual QWidget* widget(); + virtual TQWidget* widget(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); @@ -71,16 +72,16 @@ class KEXIFORMUTILS_EXPORT KexiDBTextEdit : is displayed in a special way. Used by KexiFormDataProvider::fillDataItems(). \a widget is equal to 'this'. Reimplemented after KexiFormDataItemInterface. */ - virtual void setDisplayDefaultValue(QWidget* widget, bool displayDefaultValue); + virtual void setDisplayDefaultValue(TQWidget* widget, bool displayDefaultValue); //! Windows uses Ctrl+Tab for moving between tabs, so do not steal this shortcut - virtual void keyPressEvent( QKeyEvent *ke ); + virtual void keyPressEvent( TQKeyEvent *ke ); public slots: - inline void setDataSource(const QString &ds) { KexiFormDataItemInterface::setDataSource(ds); } - inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } + inline void setDataSource(const TQString &ds) { KexiFormDataItemInterface::setDataSource(ds); } + inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } virtual void setReadOnly( bool readOnly ); - virtual void setText( const QString & text, const QString & context ); + virtual void setText( const TQString & text, const TQString & context ); //! Reimplemented, so "undo" means the same as "cancelEditor" action //! @todo enable "real" undo internally so user can use ctrl+z while editing @@ -99,9 +100,9 @@ class KEXIFORMUTILS_EXPORT KexiDBTextEdit : void slotTextChanged(); protected: - virtual void paintEvent ( QPaintEvent * ); - virtual void setValueInternal(const QVariant& add, bool removeOld); - QPopupMenu * createPopupMenu(const QPoint & pos); + virtual void paintEvent ( TQPaintEvent * ); + virtual void setValueInternal(const TQVariant& add, bool removeOld); + TQPopupMenu * createPopupMenu(const TQPoint & pos); //! Used for extending context menu KexiDBWidgetContextMenuExtender m_menuExtender; diff --git a/kexi/plugins/forms/widgets/kexidbtimeedit.cpp b/kexi/plugins/forms/widgets/kexidbtimeedit.cpp index 82e61b83..f2546a44 100644 --- a/kexi/plugins/forms/widgets/kexidbtimeedit.cpp +++ b/kexi/plugins/forms/widgets/kexidbtimeedit.cpp @@ -20,43 +20,43 @@ #include "kexidbtimeedit.h" -#include <qtoolbutton.h> -#include <qlayout.h> -#include <qpainter.h> +#include <tqtoolbutton.h> +#include <tqlayout.h> +#include <tqpainter.h> #include <kpopupmenu.h> #include <kdatepicker.h> #include <kdatetbl.h> #include <kexiutils/utils.h> -KexiDBTimeEdit::KexiDBTimeEdit(const QTime &time, QWidget *parent, const char *name) - : QTimeEdit(time, parent, name), KexiFormDataItemInterface() +KexiDBTimeEdit::KexiDBTimeEdit(const TQTime &time, TQWidget *tqparent, const char *name) + : TQTimeEdit(time, tqparent, name), KexiFormDataItemInterface() { m_invalidState = false; setAutoAdvance(true); m_cleared = false; -#ifdef QDateTimeEditor_HACK - m_dte_time = KexiUtils::findFirstChild<QDateTimeEditor>(this, "QDateTimeEditor"); +#ifdef TQDateTimeEditor_HACK + m_dte_time = KexiUtils::findFirstChild<TQDateTimeEditor>(this, "TQDateTimeEditor"); #else m_dte_time = 0; #endif - connect(this, SIGNAL(valueChanged(const QTime&)), this, SLOT(slotValueChanged(const QTime&))); + connect(this, TQT_SIGNAL(valueChanged(const TQTime&)), this, TQT_SLOT(slotValueChanged(const TQTime&))); } KexiDBTimeEdit::~KexiDBTimeEdit() { } -void KexiDBTimeEdit::setInvalidState( const QString&) +void KexiDBTimeEdit::setInvalidState( const TQString&) { setEnabled(false); setReadOnly(true); m_invalidState = true; //! @todo move this to KexiDataItemInterface::setInvalidStateInternal() ? if (focusPolicy() & TabFocus) - setFocusPolicy(QWidget::ClickFocus); + setFocusPolicy(TQ_ClickFocus); } void @@ -65,20 +65,20 @@ KexiDBTimeEdit::setEnabled(bool enabled) // prevent the user from reenabling the widget when it is in invalid state if(enabled && m_invalidState) return; - QTimeEdit::setEnabled(enabled); + TQTimeEdit::setEnabled(enabled); } -void KexiDBTimeEdit::setValueInternal(const QVariant &add, bool removeOld) +void KexiDBTimeEdit::setValueInternal(const TQVariant &add, bool removeOld) { m_cleared = !m_origValue.isValid(); int setNumberOnFocus = -1; - QTime t; - QString addString(add.toString()); + TQTime t; + TQString addString(add.toString()); if (removeOld) { if (!addString.isEmpty() && addString[0].latin1()>='0' && addString[0].latin1() <='9') { setNumberOnFocus = addString[0].latin1()-'0'; - t = QTime(setNumberOnFocus, 0, 0); + t = TQTime(setNumberOnFocus, 0, 0); } } else @@ -87,11 +87,11 @@ void KexiDBTimeEdit::setValueInternal(const QVariant &add, bool removeOld) setTime(t); } -QVariant +TQVariant KexiDBTimeEdit::value() { - //QDateTime - a hack needed because QVariant(QTime) has broken isNull() - return QVariant(QDateTime( m_cleared ? QDate() : QDate(0,1,2)/*nevermind*/, time())); + //TQDateTime - a hack needed because TQVariant(TQTime) has broken isNull() + return TQVariant(TQDateTime( m_cleared ? TQDate() : TQDate(0,1,2)/*nevermind*/, time())); } bool KexiDBTimeEdit::valueIsNull() @@ -116,7 +116,7 @@ void KexiDBTimeEdit::setReadOnly(bool set) m_readOnly = set; } -QWidget* +TQWidget* KexiDBTimeEdit::widget() { return this; @@ -124,7 +124,7 @@ KexiDBTimeEdit::widget() bool KexiDBTimeEdit::cursorAtStart() { -#ifdef QDateTimeEditor_HACK +#ifdef TQDateTimeEditor_HACK return m_dte_time && hasFocus() && m_dte_time->focusSection()==0; #else return false; @@ -133,7 +133,7 @@ bool KexiDBTimeEdit::cursorAtStart() bool KexiDBTimeEdit::cursorAtEnd() { -#ifdef QDateTimeEditor_HACK +#ifdef TQDateTimeEditor_HACK return m_dte_time && hasFocus() && m_dte_time->focusSection()==int(m_dte_time->sectionCount()-1); #else @@ -143,12 +143,12 @@ bool KexiDBTimeEdit::cursorAtEnd() void KexiDBTimeEdit::clear() { - setTime(QTime()); + setTime(TQTime()); m_cleared = true; } void -KexiDBTimeEdit::slotValueChanged(const QTime&) +KexiDBTimeEdit::slotValueChanged(const TQTime&) { m_cleared = false; } diff --git a/kexi/plugins/forms/widgets/kexidbtimeedit.h b/kexi/plugins/forms/widgets/kexidbtimeedit.h index 9665b1f9..6b29a7ac 100644 --- a/kexi/plugins/forms/widgets/kexidbtimeedit.h +++ b/kexi/plugins/forms/widgets/kexidbtimeedit.h @@ -23,26 +23,27 @@ #include "kexiformdataiteminterface.h" #include "kexidbtextwidgetinterface.h" -#include <qdatetimeedit.h> +#include <tqdatetimeedit.h> -class QDateTimeEditor; +class TQDateTimeEditor; //! @short A db-aware time editor -class KEXIFORMUTILS_EXPORT KexiDBTimeEdit : public QTimeEdit, public KexiFormDataItemInterface +class KEXIFORMUTILS_EXPORT KexiDBTimeEdit : public TQTimeEdit, public KexiFormDataItemInterface { Q_OBJECT - Q_PROPERTY(QString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) - Q_PROPERTY(QCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) - Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true ) + TQ_OBJECT + TQ_PROPERTY(TQString dataSource READ dataSource WRITE setDataSource DESIGNABLE true) + TQ_PROPERTY(TQCString dataSourceMimeType READ dataSourceMimeType WRITE setDataSourceMimeType DESIGNABLE true) + TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE true ) public: - KexiDBTimeEdit(const QTime &time, QWidget *parent, const char *name=0); + KexiDBTimeEdit(const TQTime &time, TQWidget *tqparent, const char *name=0); virtual ~KexiDBTimeEdit(); - inline QString dataSource() const { return KexiFormDataItemInterface::dataSource(); } - inline QCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } - virtual QVariant value(); - virtual void setInvalidState( const QString& displayText ); + inline TQString dataSource() const { return KexiFormDataItemInterface::dataSource(); } + inline TQCString dataSourceMimeType() const { return KexiFormDataItemInterface::dataSourceMimeType(); } + virtual TQVariant value(); + virtual void setInvalidState( const TQString& displayText ); //! \return true if editor's value is null (not empty) //! Used for checking if a given constraint within table of form is met. @@ -58,7 +59,7 @@ class KEXIFORMUTILS_EXPORT KexiDBTimeEdit : public QTimeEdit, public KexiFormDat virtual bool isReadOnly() const; /*! \return the view widget of this item, e.g. line edit widget. */ - virtual QWidget* widget(); + virtual TQWidget* widget(); virtual bool cursorAtStart(); virtual bool cursorAtEnd(); @@ -67,18 +68,18 @@ class KEXIFORMUTILS_EXPORT KexiDBTimeEdit : public QTimeEdit, public KexiFormDat virtual void setEnabled(bool enabled); public slots: - inline void setDataSource(const QString &ds) { KexiFormDataItemInterface::setDataSource(ds); } - inline void setDataSourceMimeType(const QCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } + inline void setDataSource(const TQString &ds) { KexiFormDataItemInterface::setDataSource(ds); } + inline void setDataSourceMimeType(const TQCString &ds) { KexiFormDataItemInterface::setDataSourceMimeType(ds); } virtual void setReadOnly(bool set); protected slots: - void slotValueChanged(const QTime&); + void slotValueChanged(const TQTime&); protected: - virtual void setValueInternal(const QVariant& add, bool removeOld); + virtual void setValueInternal(const TQVariant& add, bool removeOld); private: - QDateTimeEditor* m_dte_time; + TQDateTimeEditor* m_dte_time; bool m_invalidState : 1; bool m_cleared : 1; bool m_readOnly : 1; diff --git a/kexi/plugins/forms/widgets/kexidbutils.cpp b/kexi/plugins/forms/widgets/kexidbutils.cpp index 0c08d64c..ba9f2aec 100644 --- a/kexi/plugins/forms/widgets/kexidbutils.cpp +++ b/kexi/plugins/forms/widgets/kexidbutils.cpp @@ -30,15 +30,15 @@ #include <widget/utils/kexicontextmenuutils.h> -QColor lighterGrayBackgroundColor(const QPalette& palette) +TQColor lighterGrayBackgroundColor(const TQPalette& palette) { return KexiUtils::blendedColors(palette.active().background(), palette.active().base(), 1, 2); } //------- -KexiDBWidgetContextMenuExtender::KexiDBWidgetContextMenuExtender( QObject* parent, KexiDataItemInterface* iface ) - : QObject(parent) +KexiDBWidgetContextMenuExtender::KexiDBWidgetContextMenuExtender( TQObject* tqparent, KexiDataItemInterface* iface ) + : TQObject(tqparent) , m_iface(iface) , m_contextMenuHasTitle(false) { @@ -48,7 +48,7 @@ KexiDBWidgetContextMenuExtender::~KexiDBWidgetContextMenuExtender() { } -void KexiDBWidgetContextMenuExtender::createTitle(QPopupMenu *menu) +void KexiDBWidgetContextMenuExtender::createTitle(TQPopupMenu *menu) { if (!menu) return; @@ -56,9 +56,9 @@ void KexiDBWidgetContextMenuExtender::createTitle(QPopupMenu *menu) KPopupTitle *titleItem = new KPopupTitle(); const int id = m_contextMenu->insertItem(titleItem, -1, 0); m_contextMenu->setItemEnabled(id, false); - QString icon; - if (dynamic_cast<QWidget*>(m_iface)) - icon = KexiFormPart::library()->iconName(dynamic_cast<QWidget*>(m_iface)->className()); + TQString icon; + if (dynamic_cast<TQWidget*>(m_iface)) + icon = KexiFormPart::library()->iconName(dynamic_cast<TQWidget*>(m_iface)->className()); m_contextMenuHasTitle = m_iface->columnInfo() ? KexiContextMenuUtils::updateTitle(m_contextMenu, diff --git a/kexi/plugins/forms/widgets/kexidbutils.h b/kexi/plugins/forms/widgets/kexidbutils.h index 386f1ee5..06f49406 100644 --- a/kexi/plugins/forms/widgets/kexidbutils.h +++ b/kexi/plugins/forms/widgets/kexidbutils.h @@ -20,36 +20,36 @@ #ifndef KDBWIDGETS_UTILS_H #define KDBWIDGETS_UTILS_H -#include <qpopupmenu.h> +#include <tqpopupmenu.h> #include <kexidataiteminterface.h> -QColor lighterGrayBackgroundColor(const QPalette& palette); +TQColor lighterGrayBackgroundColor(const TQPalette& palette); //! @short Used for extending editor widgets' context menu. /*! @internal This is performed by adding a title and disabling editing actions when "read only" flag is true. */ -class KexiDBWidgetContextMenuExtender : public QObject +class KexiDBWidgetContextMenuExtender : public TQObject { public: - KexiDBWidgetContextMenuExtender( QObject* parent, KexiDataItemInterface* iface ); + KexiDBWidgetContextMenuExtender( TQObject* tqparent, KexiDataItemInterface* iface ); ~KexiDBWidgetContextMenuExtender(); //! Creates title for context menu \a menu - void createTitle(QPopupMenu *menu); + void createTitle(TQPopupMenu *menu); //! Enables or disables context menu actions that can modify the value. //! The menu has to be previously provided by createTitle(). void updatePopupMenuActions(); /*! Updates title for context menu based on data item \a iface caption or name - Used in createTitle(QPopupMenu *menu) and KexiDBImageBox. + Used in createTitle(TQPopupMenu *menu) and KexiDBImageBox. \return true is the title has been added. */ - static bool updateContextMenuTitleForDataItem(QPopupMenu *menu, KexiDataItemInterface* iface, - const QString& icon = QString::null); + static bool updateContextMenuTitleForDataItem(TQPopupMenu *menu, KexiDataItemInterface* iface, + const TQString& icon = TQString()); protected: KexiDataItemInterface* m_iface; - QGuardedPtr<QPopupMenu> m_contextMenu; + TQGuardedPtr<TQPopupMenu> m_contextMenu; bool m_contextMenuHasTitle; //!< true if KPopupTitle has been added to the context menu. }; diff --git a/kexi/plugins/forms/widgets/kexiframe.cpp b/kexi/plugins/forms/widgets/kexiframe.cpp index b49386da..b33581d7 100644 --- a/kexi/plugins/forms/widgets/kexiframe.cpp +++ b/kexi/plugins/forms/widgets/kexiframe.cpp @@ -19,8 +19,8 @@ #include "kexiframe.h" -#include <qpainter.h> -#include <qdrawutil.h> +#include <tqpainter.h> +#include <tqdrawutil.h> #include <kexiutils/utils.h> //! @internal @@ -33,7 +33,7 @@ class KexiFrame::Private ~Private() { } - QColor frameColor; + TQColor frameColor; #if 0 //todo KexiFrame::Shape frameShape; @@ -43,15 +43,15 @@ class KexiFrame::Private //========================================================= -KexiFrame::KexiFrame( QWidget * parent, const char * name, WFlags f ) - : QFrame(parent, name, f) +KexiFrame::KexiFrame( TQWidget * tqparent, const char * name, WFlags f ) + : TQFrame(tqparent, name, f) , d( new Private() ) { //defaults - d->frameColor = palette().active().foreground(); + d->frameColor = tqpalette().active().foreground(); //! @todo obtain these defaults from current template's style... setLineWidth(2); - setFrameStyle(QFrame::StyledPanel|QFrame::Raised); + setFrameStyle(TQFrame::StyledPanel|TQFrame::Raised); } KexiFrame::~KexiFrame() @@ -59,19 +59,19 @@ KexiFrame::~KexiFrame() delete d; } -void KexiFrame::dragMoveEvent( QDragMoveEvent *e ) +void KexiFrame::dragMoveEvent( TQDragMoveEvent *e ) { - QFrame::dragMoveEvent(e); + TQFrame::dragMoveEvent(e); emit handleDragMoveEvent(e); } -void KexiFrame::dropEvent( QDropEvent *e ) +void KexiFrame::dropEvent( TQDropEvent *e ) { - QFrame::dropEvent(e); + TQFrame::dropEvent(e); emit handleDropEvent(e); } #define ClassName KexiFrame -#define SuperClassName QFrame +#define SuperClassName TQFrame #include "kexiframeutils_p.cpp" #include "kexiframe.moc" diff --git a/kexi/plugins/forms/widgets/kexiframe.h b/kexi/plugins/forms/widgets/kexiframe.h index 8d60d597..d960cefd 100644 --- a/kexi/plugins/forms/widgets/kexiframe.h +++ b/kexi/plugins/forms/widgets/kexiframe.h @@ -20,62 +20,63 @@ #ifndef KexiFrame_H #define KexiFrame_H -#include <qframe.h> +#include <tqframe.h> //! @short Frame widget for Kexi forms -class KEXIFORMUTILS_EXPORT KexiFrame : public QFrame +class KEXIFORMUTILS_EXPORT KexiFrame : public TQFrame { Q_OBJECT + TQ_OBJECT //todo Q_ENUMS( Shape Shadow ) - Q_PROPERTY( QColor frameColor READ frameColor WRITE setFrameColor DESIGNABLE true ) -//todo Q_OVERRIDE( Shape frameShape READ frameShape WRITE setFrameShape ) -//todo Q_OVERRIDE( Shadow frameShadow READ frameShadow WRITE setFrameShadow ) + TQ_PROPERTY( TQColor frameColor READ frameColor WRITE setFrameColor DESIGNABLE true ) +//todo TQ_OVERRIDE( Shape frameShape READ frameShape WRITE setFrameShape ) +//todo TQ_OVERRIDE( Shadow frameShadow READ frameShadow WRITE setFrameShadow ) public: - KexiFrame( QWidget * parent, const char * name = 0, WFlags f = 0 ); + KexiFrame( TQWidget * tqparent, const char * name = 0, WFlags f = 0 ); virtual ~KexiFrame(); - virtual const QColor& frameColor() const; + virtual const TQColor& frameColor() const; #if 0 //! @todo more options enum Shadow { - NoShadow = QFrame::Plain, - Raised = QFrame::Raised, - Sunken = QFrame::Sunken + NoShadow = TQFrame::Plain, + Raised = TQFrame::Raised, + Sunken = TQFrame::Sunken }; //! @todo more options - enum Shape { NoFrame = QFrame::NoFrame, //!< no frame - Box = QFrame::Box, //!< rectangular box - Panel = QFrame::Panel, //!< rectangular panel - StyledPanel = QFrame::StyledPanel, //!< rectangular panel depending on the GUI style - GroupBoxPanel = QFrame::GroupBoxPanel //!< rectangular group-box-like panel depending on the GUI style + enum Shape { NoFrame = TQFrame::NoFrame, //!< no frame + Box = TQFrame::Box, //!< rectangular box + Panel = TQFrame::Panel, //!< rectangular panel + StyledPanel = TQFrame::StyledPanel, //!< rectangular panel depending on the GUI style + GroupBoxPanel = TQFrame::GroupBoxPanel //!< rectangular group-box-like panel depending on the GUI style }; Shape frameShape() const; - void setFrameShape( KexiFrame::Shape shape ); + void setFrameShape( KexiFrame::Shape tqshape ); Shadow frameShadow() const; void setFrameShadow( KexiFrame::Shadow shadow ); #endif //! Used to emit handleDragMoveEvent() signal needed to control dragging over the container's surface - virtual void dragMoveEvent( QDragMoveEvent *e ); + virtual void dragMoveEvent( TQDragMoveEvent *e ); //! Used to emit handleDropEvent() signal needed to control dropping on the container's surface - virtual void dropEvent( QDropEvent *e ); + virtual void dropEvent( TQDropEvent *e ); public slots: - virtual void setPalette( const QPalette &pal ); - virtual void setFrameColor(const QColor& color); + virtual void setPalette( const TQPalette &pal ); + virtual void setFrameColor(const TQColor& color); signals: //! Needed to control dragging over the container's surface - void handleDragMoveEvent(QDragMoveEvent *e); + void handleDragMoveEvent(TQDragMoveEvent *e); //! Needed to control dropping on the container's surface - void handleDropEvent(QDropEvent *e); + void handleDropEvent(TQDropEvent *e); protected: - virtual void drawFrame( QPainter * ); + virtual void drawFrame( TQPainter * ); class Private; Private *d; diff --git a/kexi/plugins/forms/widgets/kexiframeutils_p.cpp b/kexi/plugins/forms/widgets/kexiframeutils_p.cpp index 11b8650a..331909ee 100644 --- a/kexi/plugins/forms/widgets/kexiframeutils_p.cpp +++ b/kexi/plugins/forms/widgets/kexiframeutils_p.cpp @@ -20,13 +20,13 @@ /* This file is included by KexiDBLabel and KexiFrame */ //! @todo add more frame types -void ClassName::drawFrame( QPainter *p ) +void ClassName::drawFrame( TQPainter *p ) { - if (frameShape() == QFrame::Box) { + if (frameShape() == TQFrame::Box) { if ( frameShadow() == Plain ) qDrawPlainRect( p, frameRect(), d->frameColor, lineWidth() ); else - qDrawShadeRect( p, frameRect(), colorGroup(), frameShadow() == QFrame::Sunken, + qDrawShadeRect( p, frameRect(), tqcolorGroup(), frameShadow() == TQFrame::Sunken, lineWidth(), midLineWidth() ); } else { @@ -34,28 +34,28 @@ void ClassName::drawFrame( QPainter *p ) } } -void ClassName::setPalette( const QPalette &pal ) +void ClassName::setPalette( const TQPalette &pal ) { - QPalette pal2(pal); - QColorGroup cg( pal2.active() ); - cg.setColor(QColorGroup::Light, KexiUtils::bleachedColor( d->frameColor, 150 )); - cg.setColor(QColorGroup::Mid, d->frameColor); - cg.setColor(QColorGroup::Dark, d->frameColor.dark(150)); + TQPalette pal2(pal); + TQColorGroup cg( pal2.active() ); + cg.setColor(TQColorGroup::Light, KexiUtils::bleachedColor( d->frameColor, 150 )); + cg.setColor(TQColorGroup::Mid, d->frameColor); + cg.setColor(TQColorGroup::Dark, d->frameColor.dark(150)); pal2.setActive(cg); - QColorGroup cg2( pal2.inactive() ); - cg2.setColor(QColorGroup::Light, cg.light() ); - cg2.setColor(QColorGroup::Mid, cg.mid()); - cg2.setColor(QColorGroup::Dark, cg.dark()); + TQColorGroup cg2( pal2.inactive() ); + cg2.setColor(TQColorGroup::Light, cg.light() ); + cg2.setColor(TQColorGroup::Mid, cg.mid()); + cg2.setColor(TQColorGroup::Dark, cg.dark()); pal2.setInactive(cg2); SuperClassName::setPalette(pal2); } -const QColor& ClassName::frameColor() const +const TQColor& ClassName::frameColor() const { return d->frameColor; } -void ClassName::setFrameColor(const QColor& color) +void ClassName::setFrameColor(const TQColor& color) { d->frameColor = color; //update light and dark colors @@ -69,9 +69,9 @@ ClassName::Shape ClassName::frameShape() const return d->frameShape; } -void ClassName::setFrameShape( ClassName::Shape shape ) +void ClassName::setFrameShape( ClassName::Shape tqshape ) { - d->frameShape = shape; + d->frameShape = tqshape; update(); } @@ -88,33 +88,33 @@ void ClassName::setFrameShadow( ClassName::Shadow shadow ) #endif #if 0 -void QFrame::drawFrame( QPainter *p ) +void TQFrame::drawFrame( TQPainter *p ) { - QPoint p1, p2; - QRect r = frameRect(); + TQPoint p1, p2; + TQRect r = frameRect(); int type = fstyle & MShape; int cstyle = fstyle & MShadow; -#ifdef QT_NO_DRAWUTIL +#ifdef TQT_NO_DRAWUTIL p->setPen( black ); // #### p->drawRect( r ); //### a bit too simple #else - const QColorGroup & g = colorGroup(); + const TQColorGroup & g = tqcolorGroup(); -#ifndef QT_NO_STYLE - QStyleOption opt(lineWidth(),midLineWidth()); +#ifndef TQT_NO_STYLE + TQStyleOption opt(lineWidth(),midLineWidth()); - QStyle::SFlags flags = QStyle::Style_Default; + TQStyle::SFlags flags = TQStyle::Style_Default; if (isEnabled()) - flags |= QStyle::Style_Enabled; + flags |= TQStyle::Style_Enabled; if (cstyle == Sunken) - flags |= QStyle::Style_Sunken; + flags |= TQStyle::Style_Sunken; else if (cstyle == Raised) - flags |= QStyle::Style_Raised; + flags |= TQStyle::Style_Raised; if (hasFocus()) - flags |= QStyle::Style_HasFocus; + flags |= TQStyle::Style_HasFocus; if (hasMouse()) - flags |= QStyle::Style_MouseOver; -#endif // QT_NO_STYLE + flags |= TQStyle::Style_MouseOver; +#endif // TQT_NO_STYLE switch ( type ) { @@ -127,60 +127,60 @@ void QFrame::drawFrame( QPainter *p ) break; case LineEditPanel: - style().drawPrimitive( QStyle::PE_PanelLineEdit, p, r, g, flags, opt ); + style().drawPrimitive( TQStyle::PE_PanelLineEdit, p, r, g, flags, opt ); break; case GroupBoxPanel: - style().drawPrimitive( QStyle::PE_PanelGroupBox, p, r, g, flags, opt ); + style().drawPrimitive( TQStyle::PE_PanelGroupBox, p, r, g, flags, opt ); break; case TabWidgetPanel: - style().drawPrimitive( QStyle::PE_PanelTabWidget, p, r, g, flags, opt ); + style().drawPrimitive( TQStyle::PE_PanelTabWidget, p, r, g, flags, opt ); break; case MenuBarPanel: -#ifndef QT_NO_STYLE - style().drawPrimitive(QStyle::PE_PanelMenuBar, p, r, g, flags, opt); +#ifndef TQT_NO_STYLE + style().drawPrimitive(TQStyle::PE_PanelMenuBar, p, r, g, flags, opt); break; -#endif // fall through to Panel if QT_NO_STYLE +#endif // fall through to Panel if TQT_NO_STYLE case ToolBarPanel: -#ifndef QT_NO_STYLE - style().drawPrimitive( QStyle::PE_PanelDockWindow, p, rect(), g, flags, opt); +#ifndef TQT_NO_STYLE + style().drawPrimitive( TQStyle::PE_PanelDockWindow, p, rect(), g, flags, opt); break; -#endif // fall through to Panel if QT_NO_STYLE +#endif // fall through to Panel if TQT_NO_STYLE case StyledPanel: -#ifndef QT_NO_STYLE +#ifndef TQT_NO_STYLE if ( cstyle == Plain ) qDrawPlainRect( p, r, g.foreground(), lwidth ); else - style().drawPrimitive(QStyle::PE_Panel, p, r, g, flags, opt); + style().drawPrimitive(TQStyle::PE_Panel, p, r, g, flags, opt); break; -#endif // fall through to Panel if QT_NO_STYLE +#endif // fall through to Panel if TQT_NO_STYLE case PopupPanel: -#ifndef QT_NO_STYLE +#ifndef TQT_NO_STYLE { - int vextra = style().pixelMetric(QStyle::PM_PopupMenuFrameVerticalExtra, this), - hextra = style().pixelMetric(QStyle::PM_PopupMenuFrameHorizontalExtra, this); + int vextra = style().tqpixelMetric(TQStyle::PM_PopupMenuFrameVerticalExtra, this), + hextra = style().tqpixelMetric(TQStyle::PM_PopupMenuFrameHorizontalExtra, this); if(vextra > 0 || hextra > 0) { - QRect fr = frameRect(); + TQRect fr = frameRect(); int fw = frameWidth(); if(vextra > 0) { - style().drawControl(QStyle::CE_PopupMenuVerticalExtra, p, this, - QRect(fr.x() + fw, fr.y() + fw, fr.width() - (fw*2), vextra), + style().tqdrawControl(TQStyle::CE_PopupMenuVerticalExtra, p, this, + TQRect(fr.x() + fw, fr.y() + fw, fr.width() - (fw*2), vextra), g, flags, opt); - style().drawControl(QStyle::CE_PopupMenuVerticalExtra, p, this, - QRect(fr.x() + fw, fr.bottom() - fw - vextra, fr.width() - (fw*2), vextra), + style().tqdrawControl(TQStyle::CE_PopupMenuVerticalExtra, p, this, + TQRect(fr.x() + fw, fr.bottom() - fw - vextra, fr.width() - (fw*2), vextra), g, flags, opt); } if(hextra > 0) { - style().drawControl(QStyle::CE_PopupMenuHorizontalExtra, p, this, - QRect(fr.x() + fw, fr.y() + fw + vextra, hextra, fr.height() - (fw*2) - vextra), + style().tqdrawControl(TQStyle::CE_PopupMenuHorizontalExtra, p, this, + TQRect(fr.x() + fw, fr.y() + fw + vextra, hextra, fr.height() - (fw*2) - vextra), g, flags, opt); - style().drawControl(QStyle::CE_PopupMenuHorizontalExtra, p, this, - QRect(fr.right() - fw - hextra, fr.y() + fw + vextra, hextra, fr.height() - (fw*2) - vextra), + style().tqdrawControl(TQStyle::CE_PopupMenuHorizontalExtra, p, this, + TQRect(fr.right() - fw - hextra, fr.y() + fw + vextra, hextra, fr.height() - (fw*2) - vextra), g, flags, opt); } } @@ -188,10 +188,10 @@ void QFrame::drawFrame( QPainter *p ) if ( cstyle == Plain ) qDrawPlainRect( p, r, g.foreground(), lwidth ); else - style().drawPrimitive(QStyle::PE_PanelPopup, p, r, g, flags, opt); + style().drawPrimitive(TQStyle::PE_PanelPopup, p, r, g, flags, opt); break; } -#endif // fall through to Panel if QT_NO_STYLE +#endif // fall through to Panel if TQT_NO_STYLE case Panel: if ( cstyle == Plain ) @@ -209,16 +209,16 @@ void QFrame::drawFrame( QPainter *p ) case HLine: case VLine: if ( type == HLine ) { - p1 = QPoint( r.x(), r.height()/2 ); - p2 = QPoint( r.x()+r.width(), p1.y() ); + p1 = TQPoint( r.x(), r.height()/2 ); + p2 = TQPoint( r.x()+r.width(), p1.y() ); } else { - p1 = QPoint( r.x()+r.width()/2, 0 ); - p2 = QPoint( p1.x(), r.height() ); + p1 = TQPoint( r.x()+r.width()/2, 0 ); + p2 = TQPoint( p1.x(), r.height() ); } if ( cstyle == Plain ) { - QPen oldPen = p->pen(); - p->setPen( QPen(g.foreground(),lwidth) ); + TQPen oldPen = p->pen(); + p->setPen( TQPen(g.foreground(),lwidth) ); p->drawLine( p1, p2 ); p->setPen( oldPen ); } @@ -227,6 +227,6 @@ void QFrame::drawFrame( QPainter *p ) lwidth, midLineWidth() ); break; } -#endif // QT_NO_DRAWUTIL +#endif // TQT_NO_DRAWUTIL #endif diff --git a/kexi/plugins/forms/widgets/kexipushbutton.cpp b/kexi/plugins/forms/widgets/kexipushbutton.cpp index acfda0a4..95d0b92e 100644 --- a/kexi/plugins/forms/widgets/kexipushbutton.cpp +++ b/kexi/plugins/forms/widgets/kexipushbutton.cpp @@ -20,8 +20,8 @@ #include "kexipushbutton.h" -KexiPushButton::KexiPushButton( const QString & text, QWidget * parent, const char * name ) -: KPushButton(text, parent, name) +KexiPushButton::KexiPushButton( const TQString & text, TQWidget * tqparent, const char * name ) +: KPushButton(text, tqparent, name) { } diff --git a/kexi/plugins/forms/widgets/kexipushbutton.h b/kexi/plugins/forms/widgets/kexipushbutton.h index 12c01631..3dd8f0a9 100644 --- a/kexi/plugins/forms/widgets/kexipushbutton.h +++ b/kexi/plugins/forms/widgets/kexipushbutton.h @@ -28,25 +28,26 @@ class KEXIFORMUTILS_EXPORT KexiPushButton : public KPushButton { Q_OBJECT - Q_PROPERTY(QString onClickAction READ onClickAction WRITE setOnClickAction DESIGNABLE true) - Q_PROPERTY(QString onClickActionOption READ onClickActionOption WRITE setOnClickActionOption DESIGNABLE true) + TQ_OBJECT + TQ_PROPERTY(TQString onClickAction READ onClickAction WRITE setOnClickAction DESIGNABLE true) + TQ_PROPERTY(TQString onClickActionOption READ onClickActionOption WRITE setOnClickActionOption DESIGNABLE true) public: - KexiPushButton( const QString & text, QWidget * parent, const char * name = 0 ); + KexiPushButton( const TQString & text, TQWidget * tqparent, const char * name = 0 ); ~KexiPushButton(); public slots: //! action string for "on click" event //! @see KexiFormPart::slotAssignAction() //! @see KexiFormEventAction::ActionData - QString onClickAction() const { return m_onClickActionData.string; } - void setOnClickAction(const QString& actionString) { m_onClickActionData.string = actionString; } + TQString onClickAction() const { return m_onClickActionData.string; } + void setOnClickAction(const TQString& actionString) { m_onClickActionData.string = actionString; } //! action option allowing to select whether the object should be opened in data view mode or printed, etc. //! @see KexiFormPart::slotAssignAction() //! @see KexiFormEventAction::ActionData - QString onClickActionOption() const { return m_onClickActionData.option; } - void setOnClickActionOption(const QString& option) { m_onClickActionData.option = option; } + TQString onClickActionOption() const { return m_onClickActionData.option; } + void setOnClickActionOption(const TQString& option) { m_onClickActionData.option = option; } protected: KexiFormEventAction::ActionData m_onClickActionData; |