21#include "kexitableedit.h"
22#include "kexidataawareobjectiface.h"
23#include <kexidb/field.h>
24#include <kexidb/utils.h>
34: TQWidget(dynamic_cast<TQScrollView*>(parent) ? dynamic_cast<TQScrollView*>(parent)->viewport() : parent)
38 ,m_scrollView(dynamic_cast<TQScrollView*>(parent))
39 ,m_usesSelectedTextColor(true)
44 setPaletteBackgroundColor( palette().color(TQPalette::Active, TQColorGroup::Base) );
45 installEventFilter( this);
48 if (displayedField()->isFPNumericType()) {
55 else if (displayedField()->isIntegerType()) {
71 m_rightMarginWhenFocused = 0;
74KexiTableEdit::~KexiTableEdit()
80 if (m_column->visibleLookupColumnInfo)
81 return m_column->visibleLookupColumnInfo->field;
83 return m_column->field();
90 m_view->installEventFilter( this);
91 setFocusProxy(m_view);
102 TQWidget::resize(w, h);
106 m_view->resize(w, h);
112KexiTableEdit::eventFilter(TQObject* watched, TQEvent* e)
125 if(e->type() == TQEvent::KeyPress)
127 TQKeyEvent* ev = static_cast<TQKeyEvent* >(e);
129 if(ev->key() == Key_Escape)
145 p->drawRect(x, y, w, h);
149 TQString &txt, int &align, int &, int &y_offset, int &w, int &h )
174 TQ_LLONG num = val.toLongLong();
178 txt = TQString::number(num);
182 txt = val.toString();
189 const TQString& txt, int align, int x, int y_offset, int w, int h, const TQColor& fillColor,
190 const TQFontMetrics &fm, bool readOnly, bool fullRowSelection )
192 if (!readOnly && !fullRowSelection && !txt.isEmpty()) {
193 TQRect bound=fm.boundingRect(x, y_offset, w - (x+x), h, align, txt);
195 bound.setWidth( TQMIN( bound.width()+2, w - (x+x)+1 ) );
196 if (align & TQt::AlignLeft) {
197 bound.setX(bound.x()-1);
199 else if (align & TQt::AlignRight) {
200 bound.moveLeft( w - bound.width() );
203 bound.setHeight(h-1);
204 p->fillRect(bound, fillColor);
206 else if (fullRowSelection) {
207 p->fillRect(0, 0, w, h, fillColor);
213 return fm.width( val.toString() );
234 return focused ? m_rightMarginWhenFocused : m_rightMargin;
237#include "kexitableedit.moc"
bool isFPNumericType() const
bool isIntegerType() const
int visibleDecimalPlaces() const
The KexiDataAwareObjectInterface is an interface for record-based data object.
virtual TQVariant value()=0
void repaintRelatedCell()
virtual bool showToolTipIfNeeded(const TQVariant &value, const TQRect &rect, const TQFontMetrics &fm, bool focused)
virtual void setupContents(TQPainter *p, bool focused, const TQVariant &val, TQString &txt, int &align, int &x, int &y_offset, int &w, int &h)
virtual void resize(int w, int h)
virtual void paintSelectionBackground(TQPainter *p, bool focused, const TQString &txt, int align, int x, int y_offset, int w, int h, const TQColor &fillColor, const TQFontMetrics &fm, bool readOnly, bool fullRowSelection)
void setViewWidget(TQWidget *v)
KexiDB::Field * displayedField() const
void moveChild(TQWidget *child, int x, int y)
TQScrollView * m_scrollView may be 0 if the parent is not a scrollview
int rightMargin(bool focused) const
virtual int widthForValue(TQVariant &val, const TQFontMetrics &fm)
virtual void paintFocusBorders(TQPainter *p, TQVariant &cal, int x, int y, int w, int h)
KEXI_DB_EXPORT TQString formatNumberForVisibleDecimalPlaces(double value, int decimalPlaces)
|