KDbTableViewColumn

Search for usage in LXR

#include <KDbTableViewColumn.h>

Public Types

enum class  FieldIsOwned { Yes , No }
 

Public Member Functions

 KDbTableViewColumn (const KDbQuerySchema &query, KDbQueryColumnInfo *aColumnInfo, KDbQueryColumnInfo *aVisibleLookupColumnInfo=nullptr)
 
 KDbTableViewColumn (const QString &name, KDbField::Type ctype, const QString &caption, const QString &description=QString())
 
 KDbTableViewColumn (const QString &name, KDbField::Type ctype, KDbField::Constraints cconst=KDbField::NoConstraints, KDbField::Options options=KDbField::NoOptions, int maxLength=0, int precision=0, QVariant defaultValue=QVariant(), const QString &caption=QString(), const QString &description=QString())
 
 KDbTableViewColumn (KDbField *f, FieldIsOwned isOwned=FieldIsOwned::No)
 
virtual bool acceptsFirstChar (const QChar &ch) const
 
QString captionAliasOrName () const
 
KDbQueryColumnInfocolumnInfo ()
 
const KDbQueryColumnInfocolumnInfo () const
 
KDbFieldfield ()
 
const KDbFieldfield () const
 
QIcon icon () const
 
bool isDBAware () const
 
bool isHeaderTextVisible () const
 
bool isReadOnly () const
 
bool isRelatedDataEditable () const
 
bool isVisible () const
 
KDbTableViewDatarelatedData ()
 
const KDbTableViewDatarelatedData () const
 
void setHeaderTextVisible (bool visible)
 
void setIcon (const QIcon &icon)
 
void setReadOnly (bool ro)
 
void setRelatedData (KDbTableViewData *data)
 
void setRelatedDataEditable (bool set)
 
void setValidator (KDbValidator *v)
 
void setVisible (bool v)
 
void setWidth (int w)
 
KDbValidatorvalidator () const
 
KDbQueryColumnInfovisibleLookupColumnInfo ()
 
const KDbQueryColumnInfovisibleLookupColumnInfo () const
 
int width () const
 

Protected Member Functions

 KDbTableViewColumn (bool)
 
void setData (KDbTableViewData *data)
 

Detailed Description

Definition of a single column for table view.

Todo
improve API

Definition at line 40 of file KDbTableViewColumn.h.

Member Enumeration Documentation

◆ FieldIsOwned

Specifies if the associated KDbField object is owned by the column so it will be automatically destroyed when needed by this column.

Definition at line 45 of file KDbTableViewColumn.h.

Constructor & Destructor Documentation

◆ KDbTableViewColumn() [1/5]

KDbTableViewColumn::KDbTableViewColumn ( KDbField * f,
FieldIsOwned isOwned = FieldIsOwned::No )
explicit

Not db-aware ctor. if isOwned is Yes, the field will be owned by this column so it will be automatically destroyed when needed by this column.

Definition at line 87 of file KDbTableViewColumn.cpp.

◆ KDbTableViewColumn() [2/5]

KDbTableViewColumn::KDbTableViewColumn ( const QString & name,
KDbField::Type ctype,
KDbField::Constraints cconst = KDbField::NoConstraints,
KDbField::Options options = KDbField::NoOptions,
int maxLength = 0,
int precision = 0,
QVariant defaultValue = QVariant(),
const QString & caption = QString(),
const QString & description = QString() )

Not db-aware, convenience ctor, like above. The field is created using specified parameters that are equal to these accepted by KDbField ctor. The column will be the owner of this automatically generated field.

Definition at line 96 of file KDbTableViewColumn.cpp.

◆ KDbTableViewColumn() [3/5]

KDbTableViewColumn::KDbTableViewColumn ( const QString & name,
KDbField::Type ctype,
const QString & caption,
const QString & description = QString() )

Not db-aware, convenience ctor, simplified version of the above.

Definition at line 112 of file KDbTableViewColumn.cpp.

◆ KDbTableViewColumn() [4/5]

KDbTableViewColumn::KDbTableViewColumn ( const KDbQuerySchema & query,
KDbQueryColumnInfo * aColumnInfo,
KDbQueryColumnInfo * aVisibleLookupColumnInfo = nullptr )

Db-aware version.

Todo
compute other auto-name?
Todo
remove this when queries become editable ^^^^^^^^^^^^^^

Definition at line 130 of file KDbTableViewColumn.cpp.

◆ ~KDbTableViewColumn()

KDbTableViewColumn::~KDbTableViewColumn ( )
virtual

Definition at line 171 of file KDbTableViewColumn.cpp.

◆ KDbTableViewColumn() [5/5]

KDbTableViewColumn::KDbTableViewColumn ( bool )
explicitprotected

special ctor that does not allocate d member;

Definition at line 165 of file KDbTableViewColumn.cpp.

Member Function Documentation

◆ acceptsFirstChar()

bool KDbTableViewColumn::acceptsFirstChar ( const QChar & ch) const
virtual

Definition at line 331 of file KDbTableViewColumn.cpp.

◆ captionAliasOrName()

QString KDbTableViewColumn::captionAliasOrName ( ) const
Returns
whatever is available:
  • field's caption
  • or field's alias (from query)
  • or finally - field's name

Definition at line 265 of file KDbTableViewColumn.cpp.

◆ columnInfo() [1/2]

KDbQueryColumnInfo * KDbTableViewColumn::columnInfo ( )

A rich field information for db-aware data. For not-db-aware data it is always 0 (use field() instead).

Definition at line 305 of file KDbTableViewColumn.cpp.

◆ columnInfo() [2/2]

const KDbQueryColumnInfo * KDbTableViewColumn::columnInfo ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 310 of file KDbTableViewColumn.cpp.

◆ field() [1/2]

KDbField * KDbTableViewColumn::field ( )
Returns
field for this column. For db-aware information is taken from columnInfo().

Definition at line 285 of file KDbTableViewColumn.cpp.

◆ field() [2/2]

const KDbField * KDbTableViewColumn::field ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 290 of file KDbTableViewColumn.cpp.

◆ icon()

QIcon KDbTableViewColumn::icon ( ) const
Returns
bame of icon displayed in the caption area (header).

Definition at line 250 of file KDbTableViewColumn.cpp.

◆ isDBAware()

bool KDbTableViewColumn::isDBAware ( ) const
Returns
true if data is stored in DB, not only in memeory.

Definition at line 325 of file KDbTableViewColumn.cpp.

◆ isHeaderTextVisible()

bool KDbTableViewColumn::isHeaderTextVisible ( ) const
Returns
true if caption has to be displayed in the column's header, (or field's name if caption is empty.

Definition at line 260 of file KDbTableViewColumn.cpp.

◆ isReadOnly()

bool KDbTableViewColumn::isReadOnly ( ) const
Returns
true if the column is read-only For db-aware column this can depend on whether the column is in parent table of this query.
See also
setReadOnly()

Definition at line 217 of file KDbTableViewColumn.cpp.

◆ isRelatedDataEditable()

bool KDbTableViewColumn::isRelatedDataEditable ( ) const

Only usable if related data is set (ie. this is for combo boxes).

Returns
'editable' flag for this column. False by default.
See also
setRelatedDataEditable(bool).

Definition at line 300 of file KDbTableViewColumn.cpp.

◆ isVisible()

bool KDbTableViewColumn::isVisible ( ) const

Column visibility. By default column is visible.

Definition at line 227 of file KDbTableViewColumn.cpp.

◆ relatedData() [1/2]

KDbTableViewData * KDbTableViewColumn::relatedData ( )

For not-db-aware data only: Related data data for this column, what defines simple one-field. nullptr by default.

See also
setRelatedData()

Definition at line 275 of file KDbTableViewColumn.cpp.

◆ relatedData() [2/2]

const KDbTableViewData * KDbTableViewColumn::relatedData ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 280 of file KDbTableViewColumn.cpp.

◆ setData()

void KDbTableViewColumn::setData ( KDbTableViewData * data)
protected

used by KDbTableViewData::addColumn()

Definition at line 189 of file KDbTableViewColumn.cpp.

◆ setHeaderTextVisible()

void KDbTableViewColumn::setHeaderTextVisible ( bool visible)

If visible is true, caption has to be displayed in the column's header, (or field's name if caption is empty. True by default.

Definition at line 255 of file KDbTableViewColumn.cpp.

◆ setIcon()

void KDbTableViewColumn::setIcon ( const QIcon & icon)

Sets icon for displaying in the caption area (header).

Definition at line 245 of file KDbTableViewColumn.cpp.

◆ setReadOnly()

void KDbTableViewColumn::setReadOnly ( bool ro)

forces readOnly flag to be set to ro

Todo
synchronize this with table view:

Definition at line 222 of file KDbTableViewColumn.cpp.

◆ setRelatedData()

void KDbTableViewColumn::setRelatedData ( KDbTableViewData * data)

For not-db-aware data only: Sets related data data for this column, what defines simple one-field, one-to-many relationship between this column and the primary key in data. The relationship will be used to generate a popup editor instead of just regular editor. This assignment has no result if data has no primary key defined. data is owned, so is will be destroyed when needed. It is also destroyed when another data (or nullptr) is set for the same column.

Definition at line 194 of file KDbTableViewColumn.cpp.

◆ setRelatedDataEditable()

void KDbTableViewColumn::setRelatedDataEditable ( bool set)

Only usable if related data is set (ie. this is for combo boxes). Sets 'editable' flag for this column, what means a new value can be entered by hand. This is similar to QComboBox::setEditable().

Definition at line 295 of file KDbTableViewColumn.cpp.

◆ setValidator()

void KDbTableViewColumn::setValidator ( KDbValidator * v)

Assigns validator v for this column. If the validator has no parent object, it will be owned by the column, so you don't need to care about destroying it.

Definition at line 180 of file KDbTableViewColumn.cpp.

◆ setVisible()

void KDbTableViewColumn::setVisible ( bool v)

Changes column visibility.

KDbTableViewData is informed about this change.

Todo
react on changes of KDbQueryColumnInfo::visible too

Definition at line 232 of file KDbTableViewColumn.cpp.

◆ setWidth()

void KDbTableViewColumn::setWidth ( int w)

Sets visible width for this column to w (usually in pixels or points). 0 means there is no hint for the width.

Definition at line 360 of file KDbTableViewColumn.cpp.

◆ validator()

KDbValidator * KDbTableViewColumn::validator ( ) const
Returns
validator assigned for this column of 0 if there is no validator assigned.

Definition at line 270 of file KDbTableViewColumn.cpp.

◆ visibleLookupColumnInfo() [1/2]

KDbQueryColumnInfo * KDbTableViewColumn::visibleLookupColumnInfo ( )

A rich field information for db-aware data. Specifies information for a column that should be visible instead of columnInfo. For example case see KDbQueryColumnInfo::Vector KDbQuerySchema::fieldsExpanded(KDbQuerySchema::FieldsExpandedMode mode = Default)

For not-db-aware data it is always nullptr.

Definition at line 315 of file KDbTableViewColumn.cpp.

◆ visibleLookupColumnInfo() [2/2]

const KDbQueryColumnInfo * KDbTableViewColumn::visibleLookupColumnInfo ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 320 of file KDbTableViewColumn.cpp.

◆ width()

int KDbTableViewColumn::width ( ) const
Returns
width of this field (usually in pixels or points). 0 (the default) means there is no hint for the width.

Definition at line 365 of file KDbTableViewColumn.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:00:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.