KDbLookupFieldSchema

Search for usage in LXR

#include <KDbLookupFieldSchema.h>

Public Types

enum class  DisplayWidget { ComboBox = 0 , ListBox = 1 }
 

Public Member Functions

 KDbLookupFieldSchema (const KDbLookupFieldSchema &schema)
 
int boundColumn () const
 
bool columnHeadersVisible () const
 
QList< int > columnWidths () const
 
DisplayWidget displayWidget () const
 
void getProperties (QMap< QByteArray, QVariant > *values) const
 
bool limitToList () const
 
int maxVisibleRecords () const
 
bool operator!= (const KDbLookupFieldSchema &other) const
 
KDbLookupFieldSchemaoperator= (const KDbLookupFieldSchema &other)
 
bool operator== (const KDbLookupFieldSchema &other) const
 
KDbLookupFieldSchemaRecordSource recordSource () const
 
void saveToDom (QDomDocument *doc, QDomElement *parentEl)
 
void setBoundColumn (int column)
 
void setColumnHeadersVisible (bool set)
 
void setColumnWidths (const QList< int > &widths)
 
void setDisplayWidget (DisplayWidget widget)
 
void setLimitToList (bool set)
 
void setMaxVisibleRecords (int count)
 
bool setProperties (const QMap< QByteArray, QVariant > &values)
 
bool setProperty (const QByteArray &propertyName, const QVariant &value)
 
void setRecordSource (const KDbLookupFieldSchemaRecordSource &recordSource)
 
void setVisibleColumns (const QList< int > &list)
 
int visibleColumn (int index) const
 
QList< int > visibleColumns () const
 

Static Public Member Functions

static KDbLookupFieldSchemaloadFromDom (const QDomElement &lookupEl)
 

Detailed Description

Provides information about lookup field's setup.

KDbLookupFieldSchema object is owned by KDbTableSchema and created upon creating or retrieving the table schema from the database metadata.

See also
KDbLookupFieldSchema *KDbTableSchema::lookupFieldSchema( KDbField& field ) const

Definition at line 123 of file KDbLookupFieldSchema.h.

Member Enumeration Documentation

◆ DisplayWidget

used in displayWidget()

Enumerator
ComboBox 

(the default) combobox widget should be displayed in forms for this lookup field

ListBox 

listbox widget should be displayed in forms for this lookup field

Definition at line 192 of file KDbLookupFieldSchema.h.

Constructor & Destructor Documentation

◆ KDbLookupFieldSchema() [1/2]

KDbLookupFieldSchema::KDbLookupFieldSchema ( )

Definition at line 203 of file KDbLookupFieldSchema.cpp.

◆ KDbLookupFieldSchema() [2/2]

KDbLookupFieldSchema::KDbLookupFieldSchema ( const KDbLookupFieldSchema & schema)

Definition at line 208 of file KDbLookupFieldSchema.cpp.

◆ ~KDbLookupFieldSchema()

KDbLookupFieldSchema::~KDbLookupFieldSchema ( )

Definition at line 213 of file KDbLookupFieldSchema.cpp.

Member Function Documentation

◆ boundColumn()

int KDbLookupFieldSchema::boundColumn ( ) const
Returns
bound column: an integer specifying a column that is bound (counted from 0). -1 means unspecified value.
Todo
in later implementation there can be more columns

Definition at line 675 of file KDbLookupFieldSchema.cpp.

◆ columnHeadersVisible()

bool KDbLookupFieldSchema::columnHeadersVisible ( ) const
Returns
true if column headers are visible in the associated combo box popup or the list view. The default is false.

Definition at line 713 of file KDbLookupFieldSchema.cpp.

◆ columnWidths()

QList< int > KDbLookupFieldSchema::columnWidths ( ) const
Returns
a number of ordered integers specifying column widths; -1 means 'default width' for a given column.

Definition at line 703 of file KDbLookupFieldSchema.cpp.

◆ displayWidget()

KDbLookupFieldSchema::DisplayWidget KDbLookupFieldSchema::displayWidget ( ) const
Returns
the widget type that should be displayed within the forms for this lookup field. The default is ComboBox. For the Table View, combo box is always displayed.

Definition at line 738 of file KDbLookupFieldSchema.cpp.

◆ getProperties()

void KDbLookupFieldSchema::getProperties ( QMap< QByteArray, QVariant > * values) const

Gets property values for the lookup schema. values is cleared before filling. This function is used e.g. for altering table design.

Definition at line 561 of file KDbLookupFieldSchema.cpp.

◆ limitToList()

bool KDbLookupFieldSchema::limitToList ( ) const
Returns
true if , only values present on the list can be selected using the combo box. The default is true.

Definition at line 728 of file KDbLookupFieldSchema.cpp.

◆ loadFromDom()

KDbLookupFieldSchema * KDbLookupFieldSchema::loadFromDom ( const QDomElement & lookupEl)
static

Loads data of lookup column schema from DOM tree. The data can be outdated or invalid, so the app should handle such cases.

Returns
a new KDbLookupFieldSchema object even if lookupEl contains no valid contents.
Todo
handle fieldlist (retrieve from external table or so?), use KDbLookupFieldSchemaRecordSource::setValues()

Definition at line 346 of file KDbLookupFieldSchema.cpp.

◆ maxVisibleRecords()

int KDbLookupFieldSchema::maxVisibleRecords ( ) const
Returns
integer property specifying a maximum number of records that can be displayed in a combo box popup or a list box. The default is equal to KDB_LOOKUP_FIELD_DEFAULT_MAX_VISIBLE_RECORD_COUNT constant.

Definition at line 723 of file KDbLookupFieldSchema.cpp.

◆ operator!=()

bool KDbLookupFieldSchema::operator!= ( const KDbLookupFieldSchema & other) const
inline
Returns
true if this lookup schema is not equal to other; otherwise returns false.
Since
3.1

Definition at line 239 of file KDbLookupFieldSchema.h.

◆ operator=()

KDbLookupFieldSchema & KDbLookupFieldSchema::operator= ( const KDbLookupFieldSchema & other)

Assigns other to this lookup schema and returns a reference to this lookup schema.

Definition at line 748 of file KDbLookupFieldSchema.cpp.

◆ operator==()

bool KDbLookupFieldSchema::operator== ( const KDbLookupFieldSchema & other) const
Returns
true if this lookup schema is equal to other; otherwise returns false.
Since
3.1

Definition at line 756 of file KDbLookupFieldSchema.cpp.

◆ recordSource()

KDbLookupFieldSchemaRecordSource KDbLookupFieldSchema::recordSource ( ) const
Returns
record source information for the lookup field schema

Definition at line 282 of file KDbLookupFieldSchema.cpp.

◆ saveToDom()

void KDbLookupFieldSchema::saveToDom ( QDomDocument * doc,
QDomElement * parentEl )

Saves data of lookup column schema to parentEl DOM element of doc document. Does nothing if doc or parentEl is nullptr.

Definition at line 479 of file KDbLookupFieldSchema.cpp.

◆ setBoundColumn()

void KDbLookupFieldSchema::setBoundColumn ( int column)

Sets bound column number to column.

See also
boundColumn()

Definition at line 680 of file KDbLookupFieldSchema.cpp.

◆ setColumnHeadersVisible()

void KDbLookupFieldSchema::setColumnHeadersVisible ( bool set)

Sets "column headers visibility" flag.

See also
columnHeadersVisible()

Definition at line 718 of file KDbLookupFieldSchema.cpp.

◆ setColumnWidths()

void KDbLookupFieldSchema::setColumnWidths ( const QList< int > & widths)

Sets column widths.

See also
columnWidths()

Definition at line 708 of file KDbLookupFieldSchema.cpp.

◆ setDisplayWidget()

void KDbLookupFieldSchema::setDisplayWidget ( DisplayWidget widget)

Sets type of widget to display within the forms for this lookup field.

See also
displayWidget()

Definition at line 743 of file KDbLookupFieldSchema.cpp.

◆ setLimitToList()

void KDbLookupFieldSchema::setLimitToList ( bool set)

Sets "limit to list" flag.

See also
limitToList()

Definition at line 733 of file KDbLookupFieldSchema.cpp.

◆ setMaxVisibleRecords()

void KDbLookupFieldSchema::setMaxVisibleRecords ( int count)

Sets maximum number of records that can be displayed in a combo box popup or a list box. If count is 0, KDB_LOOKUP_FIELD_DEFAULT_MAX_VISIBLE_RECORD_COUNT is set. If count is greater than KDB_LOOKUP_FIELD_MAX_LIST_ROWS, KDB_LOOKUP_FIELD_MAX_LIST_ROWS is set.

Definition at line 292 of file KDbLookupFieldSchema.cpp.

◆ setProperties()

bool KDbLookupFieldSchema::setProperties ( const QMap< QByteArray, QVariant > & values)

Sets property values for the lookup schema. Properties coming from extended schema are also supported. Properties not listed are kept untouched. This function is used e.g. for altering table design.

Returns
true on successful set and false on failure because of invalid value or invalid property name.

Definition at line 616 of file KDbLookupFieldSchema.cpp.

◆ setProperty()

bool KDbLookupFieldSchema::setProperty ( const QByteArray & propertyName,
const QVariant & value )

Sets property of name propertyName and value value for the lookup schema lookup

Returns
true on successful set and false on failure because of invalid value or invalid property name.

Definition at line 567 of file KDbLookupFieldSchema.cpp.

◆ setRecordSource()

void KDbLookupFieldSchema::setRecordSource ( const KDbLookupFieldSchemaRecordSource & recordSource)

Sets record source for the lookup field schema

Definition at line 287 of file KDbLookupFieldSchema.cpp.

◆ setVisibleColumns()

void KDbLookupFieldSchema::setVisibleColumns ( const QList< int > & list)

Sets a list of visible columns to list.

See also
visibleColumns()

Definition at line 690 of file KDbLookupFieldSchema.cpp.

◆ visibleColumn()

int KDbLookupFieldSchema::visibleColumn ( int index) const

A helper method. If index >= visibleColumns().count(), -1 is returned, else index is returned.

Definition at line 695 of file KDbLookupFieldSchema.cpp.

◆ visibleColumns()

QList< int > KDbLookupFieldSchema::visibleColumns ( ) const
Returns
a list of visible columns: a list of integers specifying indices (counted from 0) of columns within the row source that are visible in the combo box. Empty list means unspecified value.

Definition at line 685 of file KDbLookupFieldSchema.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 Mon Nov 4 2024 16:38:32 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.