kexi
kexidbintspinbox.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "kexidbintspinbox.h"
00022
00023 #include <qlineedit.h>
00024 #include <knumvalidator.h>
00025
00026 KexiDBIntSpinBox::KexiDBIntSpinBox(QWidget *parent, const char *name)
00027 : KIntSpinBox(parent, name) , KexiFormDataItemInterface()
00028 {
00029 connect(this, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged()));
00030 }
00031
00032 KexiDBIntSpinBox::~KexiDBIntSpinBox()
00033 {
00034 }
00035
00036 void KexiDBIntSpinBox::setInvalidState( const QString& displayText )
00037 {
00038 m_invalidState = true;
00039 setEnabled(false);
00040 setReadOnly(true);
00042 if (focusPolicy() & TabFocus)
00043 setFocusPolicy(QWidget::ClickFocus);
00044 setSpecialValueText(displayText);
00045 KIntSpinBox::setValue(minValue());
00046 }
00047
00048 void
00049 KexiDBIntSpinBox::setEnabled(bool enabled)
00050 {
00051
00052 if(enabled && m_invalidState)
00053 return;
00054 KIntSpinBox::setEnabled(enabled);
00055 }
00056
00057 void KexiDBIntSpinBox::setValueInternal(const QVariant&, bool)
00058 {
00059 KIntSpinBox::setValue(m_origValue.toInt());
00060 }
00061
00062 QVariant
00063 KexiDBIntSpinBox::value()
00064 {
00065 return KIntSpinBox::value();
00066 }
00067
00068 void KexiDBIntSpinBox::slotValueChanged()
00069 {
00070 signalValueChanged();
00071 }
00072
00073 bool KexiDBIntSpinBox::valueIsNull()
00074 {
00075 return cleanText().isEmpty();
00076 }
00077
00078 bool KexiDBIntSpinBox::valueIsEmpty()
00079 {
00080 return false;
00081 }
00082
00083 bool KexiDBIntSpinBox::isReadOnly() const
00084 {
00085 return editor()->isReadOnly();
00086 }
00087
00088 void KexiDBIntSpinBox::setReadOnly(bool set)
00089 {
00090 editor()->setReadOnly(set);
00091 }
00092
00093 QWidget*
00094 KexiDBIntSpinBox::widget()
00095 {
00096 return this;
00097 }
00098
00099 bool KexiDBIntSpinBox::cursorAtStart()
00100 {
00101 return false;
00102 }
00103
00104 bool KexiDBIntSpinBox::cursorAtEnd()
00105 {
00106 return false;
00107 }
00108
00109 void KexiDBIntSpinBox::clear()
00110 {
00111 KIntSpinBox::setValue(minValue());
00112 }
00113
00114 #include "kexidbintspinbox.moc"
|