summaryrefslogtreecommitdiffstats
path: root/kexi/plugins/forms/widgets/kexidblineedit.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/plugins/forms/widgets/kexidblineedit.cpp
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/plugins/forms/widgets/kexidblineedit.cpp')
-rw-r--r--kexi/plugins/forms/widgets/kexidblineedit.cpp94
1 files changed, 47 insertions, 47 deletions
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;