Kexi API Documentation (2.0 alpha)

KexiDateTableEdit Class Reference

#include <kexidatetableedit.h>

Inheritance diagram for KexiDateTableEdit:

KexiInputTableEdit KexiTableEdit QWidget KexiDataItemInterface List of all members.

Detailed Description

Editor class for Date type. It is a replacement QDateEdit due to usability problems: people are accustomed to use single-character cursor. Date format is retrieved from the KDE global settings. and input/output is performed using KLineEdit (from KexiInputTableEdit).

Definition at line 34 of file kexidatetableedit.h.

Public Member Functions

 KexiDateTableEdit (KexiTableViewColumn &column, QWidget *parent=0)
virtual ~KexiDateTableEdit ()
virtual void setupContents (QPainter *p, bool focused, const QVariant &val, QString &txt, int &align, int &x, int &y_offset, int &w, int &h)
virtual QVariant value ()
virtual bool valueIsNull ()
virtual bool valueIsEmpty ()
virtual bool valueIsValid ()
virtual void handleAction (const QString &actionName)
virtual void handleCopyAction (const QVariant &value, const QVariant &visibleValue)

Protected Member Functions

void setValueInInternalEditor (const QVariant &value)
 helper
virtual void setValueInternal (const QVariant &add, bool removeOld)
QDate dateValue () const

Protected Attributes

KexiDateFormatter m_formatter
 Used to format and convert date values.


Constructor & Destructor Documentation

KexiDateTableEdit::KexiDateTableEdit KexiTableViewColumn column,
QWidget parent = 0
 

Todo:
add QValidator so date like "2006-59-67" cannot be even entered

Definition at line 51 of file kexidatetableedit.cpp.

References KexiDateFormatter::inputMask(), m_formatter, and KexiInputTableEdit::m_lineedit.

KexiDateTableEdit::~KexiDateTableEdit  )  [virtual]
 

Definition at line 61 of file kexidatetableedit.cpp.


Member Function Documentation

QDate KexiDateTableEdit::dateValue  )  const [protected]
 

Definition at line 119 of file kexidatetableedit.cpp.

References m_formatter, KexiInputTableEdit::m_lineedit, and KexiDateFormatter::stringToDate().

Referenced by valueIsNull().

void KexiDateTableEdit::handleAction const QString actionName  )  [virtual]
 

Reimplemented after KexiInputTableEdit.

Reimplemented from KexiInputTableEdit.

Definition at line 145 of file kexidatetableedit.cpp.

References KexiTableEdit::editRequested(), KexiInputTableEdit::handleAction(), m_formatter, KexiInputTableEdit::m_lineedit, setValueInInternalEditor(), and KexiDateFormatter::stringToDate().

void KexiDateTableEdit::handleCopyAction const QVariant &  value,
const QVariant &  visibleValue
[virtual]
 

Reimplemented after KexiInputTableEdit.

Reimplemented from KexiInputTableEdit.

Definition at line 136 of file kexidatetableedit.cpp.

References KexiDateFormatter::dateToString(), and m_formatter.

void KexiDateTableEdit::setupContents QPainter *  p,
bool  focused,
const QVariant &  val,
QString txt,
int &  align,
int &  x,
int &  y_offset,
int &  w,
int &  h
[virtual]
 

For reimplementation. Sets up and paints cell's contents using context of val value. focused is true if the cell is focused. align is set using Qt::AlignmentFlags. Some additional things may be painted using p, but it is not needed to paint the text (this is done automatically outside of this method).

Before calling, x, y_offset, w, h parameters are initialized, but you can tune these values depending on the context. You should set txt to a text representation of val, otherwise no text will be painted.

p can be 0 - in this case no painting should be performed, becasue caller only expects that x, y_offset, w, h, txt parameters are tuned, if needed. p painter's pen is set to foreground color (usually black) that should be used to paint foreground information, if needed. For example boolean editor widget paints a rectangle using this color.

Reimplemented from KexiTableEdit.

Definition at line 87 of file kexidatetableedit.cpp.

References KexiDateFormatter::dateToString(), and m_formatter.

void KexiDateTableEdit::setValueInInternalEditor const QVariant &  value  )  [protected]
 

helper

Definition at line 65 of file kexidatetableedit.cpp.

References KexiDateFormatter::dateToString(), m_formatter, and KexiInputTableEdit::m_lineedit.

Referenced by handleAction(), and setValueInternal().

void KexiDateTableEdit::setValueInternal const QVariant &  add_,
bool  removeOld
[protected, virtual]
 

Todo:
cut string if too long..

Reimplemented from KexiInputTableEdit.

Definition at line 73 of file kexidatetableedit.cpp.

References KexiInputTableEdit::m_lineedit, KexiDataItemInterface::m_origValue, and setValueInInternalEditor().

QVariant KexiDateTableEdit::value  )  [virtual]
 

js

Todo:
PRESERVE PRECISION!
Todo:
check constraints

Reimplemented from KexiInputTableEdit.

Definition at line 124 of file kexidatetableedit.cpp.

References m_formatter, KexiInputTableEdit::m_lineedit, and KexiDateFormatter::stringToVariant().

bool KexiDateTableEdit::valueIsEmpty  )  [virtual]
 

Returns:
true if editor's value is empty (not null). Only few field types can accept "EMPTY" property (check this with KexiDB::Field::hasEmptyProperty()),

Reimplemented from KexiInputTableEdit.

Definition at line 114 of file kexidatetableedit.cpp.

References valueIsNull().

bool KexiDateTableEdit::valueIsNull  )  [virtual]
 

Returns:
true if editor's value is null (not empty)

Reimplemented from KexiInputTableEdit.

Definition at line 106 of file kexidatetableedit.cpp.

References dateValue(), KexiDateFormatter::isEmpty(), m_formatter, and KexiInputTableEdit::m_lineedit.

Referenced by valueIsEmpty().

bool KexiDateTableEdit::valueIsValid  )  [virtual]
 

Returns:
true if editor's value is valid for a given type Used for checking if an entered value is valid, E.g. a part of time value can be entered: "12:8" and this is invalid, not only null. Null time or date is valid in Kexi, so it is not enough to test value().isValid(). Default implementation just returns true.

Reimplemented from KexiDataItemInterface.

Definition at line 129 of file kexidatetableedit.cpp.

References KexiDateFormatter::isEmpty(), m_formatter, KexiInputTableEdit::m_lineedit, and KexiDateFormatter::stringToDate().


Member Data Documentation

KexiDateFormatter KexiDateTableEdit::m_formatter [protected]
 

Used to format and convert date values.

Definition at line 61 of file kexidatetableedit.h.

Referenced by dateValue(), handleAction(), handleCopyAction(), KexiDateTableEdit(), setupContents(), setValueInInternalEditor(), value(), valueIsNull(), and valueIsValid().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for Kexi 2.0 alpha.
Documentation copyright © 2002-2007 the Kexi Team.
Generated on Tue Apr 1 20:49:56 2008 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003