📄 qdatatable.3qt
字号:
.PPSee also setSqlCursor()..SH "void QDataTable::setAutoDelete ( bool enable )\fC [virtual]\fR"Sets the cursor auto-delete flag to \fIenable\fR. If \fIenable\fR is TRUE, the table will automatically delete the cursor specified by setSqlCursor(). If \fIenable\fR is FALSE (the default), the cursor will not be deleted..SH "void QDataTable::setAutoEdit ( bool autoEdit )\fC [virtual]\fR"Sets whether the data table automatically applies edits to \fIautoEdit\fR. See the "autoEdit" property for details..SH "void QDataTable::setColumn ( uint col, const QString & fieldName, const QString & label = QString::null, int width = -1, const QIconSet & iconset = QIconSet ( ) )\fC [virtual]\fR"Sets the \fIcol\fR column to display using the field \fIfieldName\fR, column label \fIlabel\fR, width \fIwidth\fR and iconset \fIiconset\fR..PPIf \fIlabel\fR is specified, it is used as the column's header label, otherwise the field's display label is used when setSqlCursor() is called. The \fIiconset\fR is used to set the icon used by the column header; by default there is no icon..PPSee also setSqlCursor() and refresh()..SH "void QDataTable::setColumnWidth ( int col, int w )\fC [virtual slot]\fR"Sets the column \fIcol\fR to the width \fIw\fR. Note that unlike QTable the QDataTable is not immediately redrawn, you must call refresh() yourself..PPSee also refresh()..PPReimplemented from QTable..SH "void QDataTable::setConfirmCancels ( bool confirm )\fC [virtual]\fR"Sets whether the data table confirms cancel operations to \fIconfirm\fR. See the "confirmCancels" property for details..SH "void QDataTable::setConfirmDelete ( bool confirm )\fC [virtual]\fR"Sets whether the data table confirms delete operations to \fIconfirm\fR. See the "confirmDelete" property for details..SH "void QDataTable::setConfirmEdits ( bool confirm )\fC [virtual]\fR"Sets whether the data table confirms edit operations to \fIconfirm\fR. See the "confirmEdits" property for details..SH "void QDataTable::setConfirmInsert ( bool confirm )\fC [virtual]\fR"Sets whether the data table confirms insert operations to \fIconfirm\fR. See the "confirmInsert" property for details..SH "void QDataTable::setConfirmUpdate ( bool confirm )\fC [virtual]\fR"Sets whether the data table confirms update operations to \fIconfirm\fR. See the "confirmUpdate" property for details..SH "void QDataTable::setDateFormat ( const DateFormat f )\fC [virtual]\fR"Sets the format used for displaying date/time values to \fIf\fR. See the "dateFormat" property for details..SH "void QDataTable::setFalseText ( const QString & falseText )\fC [virtual]\fR"Sets the text used to represent false values to \fIfalseText\fR. See the "falseText" property for details..SH "void QDataTable::setFilter ( const QString & filter )\fC [virtual]\fR"Sets the data filter for the data table to \fIfilter\fR. See the "filter" property for details..SH "void QDataTable::setNullText ( const QString & nullText )\fC [virtual]\fR"Sets the text used to represent NULL values to \fInullText\fR. See the "nullText" property for details..SH "void QDataTable::setSize ( QSqlCursor * sql )\fC [protected]\fR"If the cursor's \fIsql\fR driver supports query sizes, the number of rows in the table is set to the size of the query. Otherwise, the table dynamically resizes itself as it is scrolled. If \fIsql\fR is not active, it is made active by issuing a select() on the cursor using the \fIsql\fR cursor's current filter and current sort..SH "void QDataTable::setSort ( const QStringList & sort )\fC [virtual]\fR"Sets the data table's sort to \fIsort\fR. See the "sort" property for details..SH "void QDataTable::setSort ( const QSqlIndex & sort )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the sort to be applied to the displayed data to \fIsort\fR. If there is no current cursor, nothing happens. A QSqlIndex contains field names and their ordering (ASC or DESC); these are used to compose the ORDER BY clause..PPSee also sort..SH "void QDataTable::setSqlCursor ( QSqlCursor * cursor = 0, bool autoPopulate = FALSE, bool autoDelete = FALSE )\fC [virtual]\fR"Sets \fIcursor\fR as the data source for the table. To force the display of the data from \fIcursor\fR, use refresh(). If \fIautoPopulate\fR is TRUE, columns are automatically created based upon the fields in the \fIcursor\fR record. If \fIautoDelete\fR is TRUE (the default is FALSE), the table will take ownership of the \fIcursor\fR and delete it when appropriate. If the \fIcursor\fR is read-only, the table becomes read-only. The table adopts the cursor's driver's definition for representing NULL values as strings..PPSee also refresh(), readOnly, setAutoDelete(), and QSqlDriver::nullText()..SH "void QDataTable::setTrueText ( const QString & trueText )\fC [virtual]\fR"Sets the text used to represent true values to \fItrueText\fR. See the "trueText" property for details..SH "QStringList QDataTable::sort () const"Returns the data table's sort. See the "sort" property for details..SH "void QDataTable::sortAscending ( int col )\fC [virtual slot]\fR"Sorts column \fIcol\fR in ascending order..PPSee also sorting..SH "void QDataTable::sortColumn ( int col, bool ascending = TRUE, bool wholeRows = FALSE )\fC [virtual]\fR"Sorts column \fIcol\fR in ascending order if \fIascending\fR is TRUE (the default); otherwise sorts in descending order..PPThe \fIwholeRows\fR parameter is ignored; QDataTable always sorts whole rows by the specified column..PPReimplemented from QTable..SH "void QDataTable::sortDescending ( int col )\fC [virtual slot]\fR"Sorts column \fIcol\fR in descending order..PPSee also sorting..SH "QSqlCursor * QDataTable::sqlCursor () const"Returns the cursor used by the data table..SH "QString QDataTable::text ( int row, int col ) const\fC [virtual]\fR"Returns the text in cell \fIrow\fR, \fIcol\fR, or an empty string if the cell is empty. If the cell's value is NULL then nullText() will be returned. If the cell does not exist then QString::null is returned..PPReimplemented from QTable..SH "QString QDataTable::trueText () const"Returns the text used to represent true values. See the "trueText" property for details..SH "bool QDataTable::updateCurrent ()\fC [virtual protected]\fR"For an editable table, issues an update using the cursor's edit buffer. If there is no current cursor or there is no current selection, nothing happens. If confirmEdits() or confirmUpdate() is TRUE, confirmEdit() is called to confirm the update. Returns TRUE if the update succeeded; otherwise returns FALSE..PPThe underlying cursor must have a valid primary index to ensure that a unique record is updated within the database otherwise the database may be changed to an inconsistent state..SH "QVariant QDataTable::value ( int row, int col ) const"Returns the value in cell \fIrow\fR, \fIcol\fR, or an invalid value if the cell does not exist or has no value..SS "Property Documentation".SH "bool autoEdit"This property holds whether the data table automatically applies edits..PPThe default value for this property is TRUE. When the user begins an insert or update in the table there are two possible outcomes when they navigate to another record:.PP<ol type=1>.TPthe insert or update is is performed -- this occurs if autoEdit is TRUE.TPthe insert or update is abandoned -- this occurs if autoEdit is FALSE.PPSet this property's value with setAutoEdit() and get this property's value with autoEdit()..SH "bool confirmCancels"This property holds whether the data table confirms cancel operations..PPIf the confirmCancel property is TRUE, all cancels must be confirmed by the user through a message box (this behavior can be changed by overriding the confirmCancel() function), otherwise all cancels occur immediately. The default is FALSE..PPSee also confirmEdits and confirmCancel()..PPSet this property's value with setConfirmCancels() and get this property's value with confirmCancels()..SH "bool confirmDelete"This property holds whether the data table confirms delete operations..PPIf the confirmDelete property is TRUE, all deletions must be confirmed by the user through a message box (this behaviour can be changed by overriding the confirmEdit() function), otherwise all delete operations occur immediately..PPSee also confirmCancels, confirmEdits, confirmUpdate, and confirmInsert..PPSet this property's value with setConfirmDelete() and get this property's value with confirmDelete()..SH "bool confirmEdits"This property holds whether the data table confirms edit operations..PPIf the confirmEdits property is TRUE, the data table confirms all edit operations (inserts, updates and deletes). Finer control of edit confirmation can be achieved using confirmCancels, confirmInsert, confirmUpdate and confirmDelete..PPSee also confirmCancels, confirmInsert, confirmUpdate, and confirmDelete..PPSet this property's value with setConfirmEdits() and get this property's value with confirmEdits()..SH "bool confirmInsert"This property holds whether the data table confirms insert operations..PPIf the confirmInsert property is TRUE, all insertions must be confirmed by the user through a message box (this behaviour can be changed by overriding the confirmEdit() function), otherwise all insert operations occur immediately..PPSee also confirmCancels, confirmEdits, confirmUpdate, and confirmDelete..PPSet this property's value with setConfirmInsert() and get this property's value with confirmInsert()..SH "bool confirmUpdate"This property holds whether the data table confirms update operations..PPIf the confirmUpdate property is TRUE, all updates must be confirmed by the user through a message box (this behaviour can be changed by overriding the confirmEdit() function), otherwise all update operations occur immediately..PPSee also confirmCancels, confirmEdits, confirmInsert, and confirmDelete..PPSet this property's value with setConfirmUpdate() and get this property's value with confirmUpdate()..SH "DateFormat dateFormat"This property holds the format used for displaying date/time values..PPThe dateFormat property is used for displaying date/time values in the table. The default value is Qt::LocalDate..PPSet this property's value with setDateFormat() and get this property's value with dateFormat()..SH "QString falseText"This property holds the text used to represent false values..PPThe falseText property will be used to represent NULL values in the table. The default value is "False"..PPSet this property's value with setFalseText() and get this property's value with falseText()..SH "QString filter"This property holds the data filter for the data table..PPThe filter applies to the data shown in the table. To view data with a new filter, use refresh(). A filter string is an SQL WHERE clause without the WHERE keyword..PPThere is no default filter..PPSee also sort..PPSet this property's value with setFilter() and get this property's value with filter()..SH "QString nullText"This property holds the text used to represent NULL values..PPThe nullText property will be used to represent NULL values in the table. The default value is provided by the cursor's driver..PPSet this property's value with setNullText() and get this property's value with nullText()..SH "int numCols"This property holds the number of columns in the table..PPGet this property's value with numCols()..SH "int numRows"This property holds the number of rows in the table..PPGet this property's value with numRows()..SH "QStringList sort"This property holds the data table's sort..PPThe table's sort affects the order in which data records are displayed in the table. To apply a sort, use refresh()..PPWhen examining the sort property, a string list is returned with each item having the form 'fieldname order' (e.g., 'id ASC', 'surname DESC')..PPThere is no default sort..PPNote that if you want to iterate over the sort list, you should iterate over a copy, e.g..PP.nf.br QStringList list = myDataTable.sort();.br QStringList::Iterator it = list.begin();.br while( it != list.end() ) {.br myProcessing( *it );.br ++it;.br }.br.fi.PPSee also filter and refresh()..PPSet this property's value with setSort() and get this property's value with sort()..SH "QString trueText"This property holds the text used to represent true values..PPThe trueText property will be used to represent NULL values in the table. The default value is "True"..PPSet this property's value with setTrueText() and get this property's value with trueText()..SH "SEE ALSO".BR http://doc.trolltech.com/qdatatable.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qdatatable.3qt) and the Qtversion (3.1.1).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -