1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/sql/qdatabrowser.cpp:56 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QDataBrowser Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QDataBrowser Class Reference<br><small>[<a href="sql.html">sql module</a>]</small></h1>
|
---|
33 |
|
---|
34 | <p>The QDataBrowser class provides data manipulation and
|
---|
35 | navigation for data entry forms.
|
---|
36 | <a href="#details">More...</a>
|
---|
37 | <p><tt>#include <<a href="qdatabrowser-h.html">qdatabrowser.h</a>></tt>
|
---|
38 | <p>Inherits <a href="qwidget.html">QWidget</a>.
|
---|
39 | <p><a href="qdatabrowser-members.html">List of all member functions.</a>
|
---|
40 | <h2>Public Members</h2>
|
---|
41 | <ul>
|
---|
42 | <li class=fn><a href="#QDataBrowser"><b>QDataBrowser</b></a> ( QWidget * parent = 0, const char * name = 0, WFlags fl = 0 )</li>
|
---|
43 | <li class=fn><a href="#~QDataBrowser"><b>~QDataBrowser</b></a> ()</li>
|
---|
44 | <li class=fn>enum <a href="#Boundary-enum"><b>Boundary</b></a> { Unknown, None, BeforeBeginning, Beginning, End, AfterEnd }</li>
|
---|
45 | <li class=fn>Boundary <a href="#boundary"><b>boundary</b></a> ()</li>
|
---|
46 | <li class=fn>void <a href="#setBoundaryChecking"><b>setBoundaryChecking</b></a> ( bool active )</li>
|
---|
47 | <li class=fn>bool <a href="#boundaryChecking"><b>boundaryChecking</b></a> () const</li>
|
---|
48 | <li class=fn>void <a href="#setSort-2"><b>setSort</b></a> ( const QSqlIndex & sort )</li>
|
---|
49 | <li class=fn>void <a href="#setSort"><b>setSort</b></a> ( const QStringList & sort )</li>
|
---|
50 | <li class=fn>QStringList <a href="#sort"><b>sort</b></a> () const</li>
|
---|
51 | <li class=fn>void <a href="#setFilter"><b>setFilter</b></a> ( const QString & filter )</li>
|
---|
52 | <li class=fn>QString <a href="#filter"><b>filter</b></a> () const</li>
|
---|
53 | <li class=fn>virtual void <a href="#setSqlCursor"><b>setSqlCursor</b></a> ( QSqlCursor * cursor, bool autoDelete = FALSE )</li>
|
---|
54 | <li class=fn>QSqlCursor * <a href="#sqlCursor"><b>sqlCursor</b></a> () const</li>
|
---|
55 | <li class=fn>virtual void <a href="#setForm"><b>setForm</b></a> ( QSqlForm * form )</li>
|
---|
56 | <li class=fn>QSqlForm * <a href="#form"><b>form</b></a> ()</li>
|
---|
57 | <li class=fn>virtual void <a href="#setConfirmEdits"><b>setConfirmEdits</b></a> ( bool confirm )</li>
|
---|
58 | <li class=fn>virtual void <a href="#setConfirmInsert"><b>setConfirmInsert</b></a> ( bool confirm )</li>
|
---|
59 | <li class=fn>virtual void <a href="#setConfirmUpdate"><b>setConfirmUpdate</b></a> ( bool confirm )</li>
|
---|
60 | <li class=fn>virtual void <a href="#setConfirmDelete"><b>setConfirmDelete</b></a> ( bool confirm )</li>
|
---|
61 | <li class=fn>virtual void <a href="#setConfirmCancels"><b>setConfirmCancels</b></a> ( bool confirm )</li>
|
---|
62 | <li class=fn>bool <a href="#confirmEdits"><b>confirmEdits</b></a> () const</li>
|
---|
63 | <li class=fn>bool <a href="#confirmInsert"><b>confirmInsert</b></a> () const</li>
|
---|
64 | <li class=fn>bool <a href="#confirmUpdate"><b>confirmUpdate</b></a> () const</li>
|
---|
65 | <li class=fn>bool <a href="#confirmDelete"><b>confirmDelete</b></a> () const</li>
|
---|
66 | <li class=fn>bool <a href="#confirmCancels"><b>confirmCancels</b></a> () const</li>
|
---|
67 | <li class=fn>virtual void <a href="#setReadOnly"><b>setReadOnly</b></a> ( bool active )</li>
|
---|
68 | <li class=fn>bool <a href="#isReadOnly"><b>isReadOnly</b></a> () const</li>
|
---|
69 | <li class=fn>virtual void <a href="#setAutoEdit"><b>setAutoEdit</b></a> ( bool autoEdit )</li>
|
---|
70 | <li class=fn>bool <a href="#autoEdit"><b>autoEdit</b></a> () const</li>
|
---|
71 | <li class=fn>virtual bool <a href="#seek"><b>seek</b></a> ( int i, bool relative = FALSE )</li>
|
---|
72 | </ul>
|
---|
73 | <h2>Public Slots</h2>
|
---|
74 | <ul>
|
---|
75 | <li class=fn>virtual void <a href="#refresh"><b>refresh</b></a> ()</li>
|
---|
76 | <li class=fn>virtual void <a href="#insert"><b>insert</b></a> ()</li>
|
---|
77 | <li class=fn>virtual void <a href="#update"><b>update</b></a> ()</li>
|
---|
78 | <li class=fn>virtual void <a href="#del"><b>del</b></a> ()</li>
|
---|
79 | <li class=fn>virtual void <a href="#first"><b>first</b></a> ()</li>
|
---|
80 | <li class=fn>virtual void <a href="#last"><b>last</b></a> ()</li>
|
---|
81 | <li class=fn>virtual void <a href="#next"><b>next</b></a> ()</li>
|
---|
82 | <li class=fn>virtual void <a href="#prev"><b>prev</b></a> ()</li>
|
---|
83 | <li class=fn>virtual void <a href="#readFields"><b>readFields</b></a> ()</li>
|
---|
84 | <li class=fn>virtual void <a href="#writeFields"><b>writeFields</b></a> ()</li>
|
---|
85 | <li class=fn>virtual void <a href="#clearValues"><b>clearValues</b></a> ()</li>
|
---|
86 | <li class=fn>void <a href="#updateBoundary"><b>updateBoundary</b></a> ()</li>
|
---|
87 | </ul>
|
---|
88 | <h2>Signals</h2>
|
---|
89 | <ul>
|
---|
90 | <li class=fn>void <a href="#firstRecordAvailable"><b>firstRecordAvailable</b></a> ( bool available )</li>
|
---|
91 | <li class=fn>void <a href="#lastRecordAvailable"><b>lastRecordAvailable</b></a> ( bool available )</li>
|
---|
92 | <li class=fn>void <a href="#nextRecordAvailable"><b>nextRecordAvailable</b></a> ( bool available )</li>
|
---|
93 | <li class=fn>void <a href="#prevRecordAvailable"><b>prevRecordAvailable</b></a> ( bool available )</li>
|
---|
94 | <li class=fn>void <a href="#currentChanged"><b>currentChanged</b></a> ( const QSqlRecord * record )</li>
|
---|
95 | <li class=fn>void <a href="#primeInsert"><b>primeInsert</b></a> ( QSqlRecord * buf )</li>
|
---|
96 | <li class=fn>void <a href="#primeUpdate"><b>primeUpdate</b></a> ( QSqlRecord * buf )</li>
|
---|
97 | <li class=fn>void <a href="#primeDelete"><b>primeDelete</b></a> ( QSqlRecord * buf )</li>
|
---|
98 | <li class=fn>void <a href="#beforeInsert"><b>beforeInsert</b></a> ( QSqlRecord * buf )</li>
|
---|
99 | <li class=fn>void <a href="#beforeUpdate"><b>beforeUpdate</b></a> ( QSqlRecord * buf )</li>
|
---|
100 | <li class=fn>void <a href="#beforeDelete"><b>beforeDelete</b></a> ( QSqlRecord * buf )</li>
|
---|
101 | <li class=fn>void <a href="#cursorChanged"><b>cursorChanged</b></a> ( QSqlCursor::Mode mode )</li>
|
---|
102 | </ul>
|
---|
103 | <h2>Properties</h2>
|
---|
104 | <ul>
|
---|
105 | <li class=fn>bool <a href="#autoEdit-prop"><b>autoEdit</b></a> - whether the browser automatically applies edits</li>
|
---|
106 | <li class=fn>bool <a href="#boundaryChecking-prop"><b>boundaryChecking</b></a> - whether boundary checking is active</li>
|
---|
107 | <li class=fn>bool <a href="#confirmCancels-prop"><b>confirmCancels</b></a> - whether the browser confirms cancel operations</li>
|
---|
108 | <li class=fn>bool <a href="#confirmDelete-prop"><b>confirmDelete</b></a> - whether the browser confirms deletions</li>
|
---|
109 | <li class=fn>bool <a href="#confirmEdits-prop"><b>confirmEdits</b></a> - whether the browser confirms edits</li>
|
---|
110 | <li class=fn>bool <a href="#confirmInsert-prop"><b>confirmInsert</b></a> - whether the data browser confirms insertions</li>
|
---|
111 | <li class=fn>bool <a href="#confirmUpdate-prop"><b>confirmUpdate</b></a> - whether the browser confirms updates</li>
|
---|
112 | <li class=fn>QString <a href="#filter-prop"><b>filter</b></a> - the data browser's filter</li>
|
---|
113 | <li class=fn>bool <a href="#readOnly-prop"><b>readOnly</b></a> - whether the browser is read-only</li>
|
---|
114 | <li class=fn>QStringList <a href="#sort-prop"><b>sort</b></a> - the data browser's sort</li>
|
---|
115 | </ul>
|
---|
116 | <h2>Protected Members</h2>
|
---|
117 | <ul>
|
---|
118 | <li class=fn>virtual bool <a href="#insertCurrent"><b>insertCurrent</b></a> ()</li>
|
---|
119 | <li class=fn>virtual bool <a href="#updateCurrent"><b>updateCurrent</b></a> ()</li>
|
---|
120 | <li class=fn>virtual bool <a href="#deleteCurrent"><b>deleteCurrent</b></a> ()</li>
|
---|
121 | <li class=fn>virtual bool <a href="#currentEdited"><b>currentEdited</b></a> ()</li>
|
---|
122 | <li class=fn>virtual QSql::Confirm <a href="#confirmEdit"><b>confirmEdit</b></a> ( QSql::Op m )</li>
|
---|
123 | <li class=fn>virtual QSql::Confirm <a href="#confirmCancel"><b>confirmCancel</b></a> ( QSql::Op m )</li>
|
---|
124 | <li class=fn>virtual void <a href="#handleError"><b>handleError</b></a> ( const QSqlError & error )</li>
|
---|
125 | </ul>
|
---|
126 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
127 |
|
---|
128 |
|
---|
129 | The QDataBrowser class provides data manipulation and
|
---|
130 | navigation for data entry forms.
|
---|
131 | <p>
|
---|
132 |
|
---|
133 |
|
---|
134 | <p> A high-level API is provided for navigating through data records
|
---|
135 | in a cursor, for inserting, updating and deleting records, and for
|
---|
136 | refreshing data in the display.
|
---|
137 | <p> If you want a read-only form to present database data use
|
---|
138 | <a href="qdataview.html">QDataView</a>; if you want a table-based presentation of your data use
|
---|
139 | <a href="qdatatable.html">QDataTable</a>.
|
---|
140 | <p> A QDataBrowser is used to associate a dataset with a form in much
|
---|
141 | the same way as a QDataTable associates a dataset with a table.
|
---|
142 | Once the data browser has been constructed it can be associated
|
---|
143 | with a dataset with <a href="#setSqlCursor">setSqlCursor</a>(), and with a form with
|
---|
144 | <a href="#setForm">setForm</a>(). Boundary checking, sorting and filtering can be set
|
---|
145 | with <a href="#setBoundaryChecking">setBoundaryChecking</a>(), <a href="#setSort">setSort</a>() and <a href="#setFilter">setFilter</a>(),
|
---|
146 | respectively.
|
---|
147 | <p> The <a href="#insertCurrent">insertCurrent</a>() function reads the fields from the default
|
---|
148 | form into the default cursor and performs the insert. The
|
---|
149 | <a href="#updateCurrent">updateCurrent</a>() and <a href="#deleteCurrent">deleteCurrent</a>() functions perform similarly to
|
---|
150 | update and delete the current record respectively.
|
---|
151 | <p> The user can be asked to confirm all edits with <a href="#setConfirmEdits">setConfirmEdits</a>().
|
---|
152 | For more precise control use <a href="#setConfirmInsert">setConfirmInsert</a>(),
|
---|
153 | <a href="#setConfirmUpdate">setConfirmUpdate</a>(), <a href="#setConfirmDelete">setConfirmDelete</a>() and <a href="#setConfirmCancels">setConfirmCancels</a>().
|
---|
154 | Use <a href="#setAutoEdit">setAutoEdit</a>() to control the behaviour of the form when the
|
---|
155 | user edits a record and then navigates.
|
---|
156 | <p> The record set is navigated using <a href="#first">first</a>(), <a href="#next">next</a>(), <a href="#prev">prev</a>(), <a href="#last">last</a>()
|
---|
157 | and <a href="#seek">seek</a>(). The form's display is updated with <a href="#refresh">refresh</a>(). When
|
---|
158 | navigation takes place the <a href="#firstRecordAvailable">firstRecordAvailable</a>(),
|
---|
159 | <a href="#lastRecordAvailable">lastRecordAvailable</a>(), <a href="#nextRecordAvailable">nextRecordAvailable</a>() and
|
---|
160 | <a href="#prevRecordAvailable">prevRecordAvailable</a>() signals are emitted. When the cursor record
|
---|
161 | is changed due to navigation the <a href="#cursorChanged">cursorChanged</a>() signal is
|
---|
162 | emitted.
|
---|
163 | <p> If you want finer control of the insert, update and delete
|
---|
164 | processes then you can use the lower level functions to perform
|
---|
165 | these operations as described below.
|
---|
166 | <p> The form is populated with data from the database with
|
---|
167 | <a href="#readFields">readFields</a>(). If the user is allowed to edit, (see <a href="#setReadOnly">setReadOnly</a>()),
|
---|
168 | write the form's data back to the cursor's edit buffer with
|
---|
169 | <a href="#writeFields">writeFields</a>(). You can clear the values in the form with
|
---|
170 | <a href="#clearValues">clearValues</a>(). Editing is performed as follows:
|
---|
171 | <ul>
|
---|
172 | <li> <em>insert</em> When the data browser enters insertion mode it emits the
|
---|
173 | <a href="#primeInsert">primeInsert</a>() signal which you can connect to, for example to
|
---|
174 | pre-populate fields. Call writeFields() to write the user's edits to
|
---|
175 | the cursor's edit buffer then call <a href="#insert">insert</a>() to insert the record
|
---|
176 | into the database. The <a href="#beforeInsert">beforeInsert</a>() signal is emitted just before
|
---|
177 | the cursor's edit buffer is inserted into the database; connect to
|
---|
178 | this for example, to populate fields such as an auto-generated
|
---|
179 | primary key.
|
---|
180 | <li> <em>update</em> For updates the <a href="#primeUpdate">primeUpdate</a>() signal is emitted when
|
---|
181 | the data browser enters update mode. After calling writeFields()
|
---|
182 | call <a href="#update">update</a>() to update the record and connect to the <a href="#beforeUpdate">beforeUpdate</a>()
|
---|
183 | signal to manipulate the user's data before the update takes place.
|
---|
184 | <li> <em>delete</em> For deletion the <a href="#primeDelete">primeDelete</a>() signal is emitted when
|
---|
185 | the data browser enters deletion mode. After calling <a href="#writeFields">writeFields</a>()
|
---|
186 | call <a href="#del">del</a>() to delete the record and connect to the <a href="#beforeDelete">beforeDelete</a>()
|
---|
187 | signal, for example to record an audit of the deleted record.
|
---|
188 | </ul>
|
---|
189 | <p> <p>See also <a href="database.html">Database Classes</a>.
|
---|
190 |
|
---|
191 | <hr><h2>Member Type Documentation</h2>
|
---|
192 | <h3 class=fn><a name="Boundary-enum"></a>QDataBrowser::Boundary</h3>
|
---|
193 |
|
---|
194 | <p> This enum describes where the data browser is positioned.
|
---|
195 | <ul>
|
---|
196 | <li><tt>QDataBrowser::Unknown</tt> - the boundary cannot be determined (usually because
|
---|
197 | there is no default cursor, or the default cursor is not active).
|
---|
198 | <li><tt>QDataBrowser::None</tt> - the browser is not positioned on a boundary, but it is
|
---|
199 | positioned on a record somewhere in the middle.
|
---|
200 | <li><tt>QDataBrowser::BeforeBeginning</tt> - the browser is positioned before the
|
---|
201 | first available record.
|
---|
202 | <li><tt>QDataBrowser::Beginning</tt> - the browser is positioned at the first record.
|
---|
203 | <li><tt>QDataBrowser::End</tt> - the browser is positioned at the last
|
---|
204 | record.
|
---|
205 | <li><tt>QDataBrowser::AfterEnd</tt> - the browser is positioned after the last
|
---|
206 | available record.
|
---|
207 | </ul>
|
---|
208 | <hr><h2>Member Function Documentation</h2>
|
---|
209 | <h3 class=fn><a name="QDataBrowser"></a>QDataBrowser::QDataBrowser ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags fl = 0 )
|
---|
210 | </h3>
|
---|
211 | Constructs a data browser which is a child of <em>parent</em>, with the
|
---|
212 | name <em>name</em> and widget flags set to <em>fl</em>.
|
---|
213 |
|
---|
214 | <h3 class=fn><a name="~QDataBrowser"></a>QDataBrowser::~QDataBrowser ()
|
---|
215 | </h3>
|
---|
216 | Destroys the object and frees any allocated resources.
|
---|
217 |
|
---|
218 | <h3 class=fn>bool <a name="autoEdit"></a>QDataBrowser::autoEdit () const
|
---|
219 | </h3><p>Returns TRUE if the browser automatically applies edits; otherwise returns FALSE.
|
---|
220 | See the <a href="qdatabrowser.html#autoEdit-prop">"autoEdit"</a> property for details.
|
---|
221 | <h3 class=fn>void <a name="beforeDelete"></a>QDataBrowser::beforeDelete ( <a href="qsqlrecord.html">QSqlRecord</a> * buf )<tt> [signal]</tt>
|
---|
222 | </h3>
|
---|
223 |
|
---|
224 | <p> This signal is emitted just before the cursor's edit buffer is
|
---|
225 | deleted from the database. The <em>buf</em> parameter points to the edit
|
---|
226 | buffer being deleted. You might connect to this signal to capture
|
---|
227 | some auditing information about the deletion.
|
---|
228 |
|
---|
229 | <h3 class=fn>void <a name="beforeInsert"></a>QDataBrowser::beforeInsert ( <a href="qsqlrecord.html">QSqlRecord</a> * buf )<tt> [signal]</tt>
|
---|
230 | </h3>
|
---|
231 |
|
---|
232 | <p> This signal is emitted just before the cursor's edit buffer is
|
---|
233 | inserted into the database. The <em>buf</em> parameter points to the
|
---|
234 | edit buffer being inserted. You might connect to this signal to
|
---|
235 | populate a generated primary key for example.
|
---|
236 |
|
---|
237 | <h3 class=fn>void <a name="beforeUpdate"></a>QDataBrowser::beforeUpdate ( <a href="qsqlrecord.html">QSqlRecord</a> * buf )<tt> [signal]</tt>
|
---|
238 | </h3>
|
---|
239 |
|
---|
240 | <p> This signal is emitted just before the cursor's edit buffer is
|
---|
241 | updated in the database. The <em>buf</em> parameter points to the edit
|
---|
242 | buffer being updated. You might connect to this signal to capture
|
---|
243 | some auditing information about the update.
|
---|
244 |
|
---|
245 | <h3 class=fn><a href="qdatabrowser.html#Boundary-enum">Boundary</a> <a name="boundary"></a>QDataBrowser::boundary ()
|
---|
246 | </h3>
|
---|
247 | Returns an enum indicating the boundary status of the browser.
|
---|
248 | <p> This is achieved by moving the default cursor and checking the
|
---|
249 | position, however the current default form values will not be
|
---|
250 | altered. After checking for the boundary, the cursor is moved back
|
---|
251 | to its former position. See <a href="#Boundary-enum">QDataBrowser::Boundary</a>.
|
---|
252 | <p> <p>See also <a href="#Boundary-enum">Boundary</a>.
|
---|
253 |
|
---|
254 | <h3 class=fn>bool <a name="boundaryChecking"></a>QDataBrowser::boundaryChecking () const
|
---|
255 | </h3><p>Returns TRUE if boundary checking is active; otherwise returns FALSE.
|
---|
256 | See the <a href="qdatabrowser.html#boundaryChecking-prop">"boundaryChecking"</a> property for details.
|
---|
257 | <h3 class=fn>void <a name="clearValues"></a>QDataBrowser::clearValues ()<tt> [virtual slot]</tt>
|
---|
258 | </h3>
|
---|
259 | Clears all the values in the form.
|
---|
260 | <p> All the edit buffer field values are set to their 'zero state',
|
---|
261 | e.g. 0 for numeric fields and "" for string fields. Then the
|
---|
262 | widgets are updated using the property map. For example, a
|
---|
263 | combobox that is property-mapped to integers would scroll to the
|
---|
264 | first item. See the <a href="qsqlpropertymap.html">QSqlPropertyMap</a> constructor for the default
|
---|
265 | mappings of widgets to properties.
|
---|
266 |
|
---|
267 | <h3 class=fn><a href="qsql.html#Confirm-enum">QSql::Confirm</a> <a name="confirmCancel"></a>QDataBrowser::confirmCancel ( <a href="qsql.html#Op-enum">QSql::Op</a> m )<tt> [virtual protected]</tt>
|
---|
268 | </h3>
|
---|
269 | Protected virtual function which returns a confirmation for
|
---|
270 | cancelling an edit mode <em>m</em>. Derived classes can reimplement this
|
---|
271 | function and provide their own confirmation dialog. The default
|
---|
272 | implementation uses a message box which prompts the user to
|
---|
273 | confirm the edit action.
|
---|
274 |
|
---|
275 | <h3 class=fn>bool <a name="confirmCancels"></a>QDataBrowser::confirmCancels () const
|
---|
276 | </h3><p>Returns TRUE if the browser confirms cancel operations; otherwise returns FALSE.
|
---|
277 | See the <a href="qdatabrowser.html#confirmCancels-prop">"confirmCancels"</a> property for details.
|
---|
278 | <h3 class=fn>bool <a name="confirmDelete"></a>QDataBrowser::confirmDelete () const
|
---|
279 | </h3><p>Returns TRUE if the browser confirms deletions; otherwise returns FALSE.
|
---|
280 | See the <a href="qdatabrowser.html#confirmDelete-prop">"confirmDelete"</a> property for details.
|
---|
281 | <h3 class=fn><a href="qsql.html#Confirm-enum">QSql::Confirm</a> <a name="confirmEdit"></a>QDataBrowser::confirmEdit ( <a href="qsql.html#Op-enum">QSql::Op</a> m )<tt> [virtual protected]</tt>
|
---|
282 | </h3>
|
---|
283 | Protected virtual function which returns a confirmation for an
|
---|
284 | edit of mode <em>m</em>. Derived classes can reimplement this function
|
---|
285 | and provide their own confirmation dialog. The default
|
---|
286 | implementation uses a message box which prompts the user to
|
---|
287 | confirm the edit action.
|
---|
288 |
|
---|
289 | <h3 class=fn>bool <a name="confirmEdits"></a>QDataBrowser::confirmEdits () const
|
---|
290 | </h3><p>Returns TRUE if the browser confirms edits; otherwise returns FALSE.
|
---|
291 | See the <a href="qdatabrowser.html#confirmEdits-prop">"confirmEdits"</a> property for details.
|
---|
292 | <h3 class=fn>bool <a name="confirmInsert"></a>QDataBrowser::confirmInsert () const
|
---|
293 | </h3><p>Returns TRUE if the data browser confirms insertions; otherwise returns FALSE.
|
---|
294 | See the <a href="qdatabrowser.html#confirmInsert-prop">"confirmInsert"</a> property for details.
|
---|
295 | <h3 class=fn>bool <a name="confirmUpdate"></a>QDataBrowser::confirmUpdate () const
|
---|
296 | </h3><p>Returns TRUE if the browser confirms updates; otherwise returns FALSE.
|
---|
297 | See the <a href="qdatabrowser.html#confirmUpdate-prop">"confirmUpdate"</a> property for details.
|
---|
298 | <h3 class=fn>void <a name="currentChanged"></a>QDataBrowser::currentChanged ( const <a href="qsqlrecord.html">QSqlRecord</a> * record )<tt> [signal]</tt>
|
---|
299 | </h3>
|
---|
300 |
|
---|
301 | <p> This signal is emitted whenever the current cursor position
|
---|
302 | changes. The <em>record</em> parameter points to the contents of the
|
---|
303 | current cursor's record.
|
---|
304 |
|
---|
305 | <h3 class=fn>bool <a name="currentEdited"></a>QDataBrowser::currentEdited ()<tt> [virtual protected]</tt>
|
---|
306 | </h3>
|
---|
307 | Returns TRUE if the form's edit buffer differs from the current
|
---|
308 | cursor buffer; otherwise returns FALSE.
|
---|
309 |
|
---|
310 | <h3 class=fn>void <a name="cursorChanged"></a>QDataBrowser::cursorChanged ( <a href="qsqlcursor.html#Mode-enum">QSqlCursor::Mode</a> mode )<tt> [signal]</tt>
|
---|
311 | </h3>
|
---|
312 |
|
---|
313 | <p> This signal is emitted whenever the cursor record was changed due
|
---|
314 | to navigation. The <em>mode</em> parameter is the edit that just took
|
---|
315 | place, e.g. Insert, Update or Delete. See <a href="qsqlcursor.html#Mode-enum">QSqlCursor::Mode</a>.
|
---|
316 |
|
---|
317 | <h3 class=fn>void <a name="del"></a>QDataBrowser::del ()<tt> [virtual slot]</tt>
|
---|
318 | </h3>
|
---|
319 | Performs a delete operation on the data browser's cursor. If there
|
---|
320 | is no default cursor or no default form, nothing happens.
|
---|
321 | <p> Otherwise, the following happens:
|
---|
322 | <p> The current form's record is deleted from the database, providing
|
---|
323 | that the data browser is not in insert mode. If the data browser
|
---|
324 | is actively inserting a record (see <a href="#insert">insert</a>()), the insert action
|
---|
325 | is canceled, and the browser navigates to the last valid record
|
---|
326 | that was current. If there is an error, <a href="#handleError">handleError</a>() is called.
|
---|
327 |
|
---|
328 | <h3 class=fn>bool <a name="deleteCurrent"></a>QDataBrowser::deleteCurrent ()<tt> [virtual protected]</tt>
|
---|
329 | </h3>
|
---|
330 | Performs a delete on the default cursor using the values from the
|
---|
331 | default form and updates the default form. If there is no default
|
---|
332 | form or no default cursor, nothing happens. If the deletion was
|
---|
333 | successful, the cursor is repositioned to the nearest record and
|
---|
334 | TRUE is returned. The nearest record is the next record if there
|
---|
335 | is one otherwise the previous record if there is one. If an error
|
---|
336 | occurred during the deletion from the database, <a href="#handleError">handleError</a>() is
|
---|
337 | called and FALSE is returned.
|
---|
338 | <p> <p>See also <a href="qwidget.html#cursor-prop">cursor</a>, <a href="#form">form</a>(), and <a href="#handleError">handleError</a>().
|
---|
339 |
|
---|
340 | <h3 class=fn><a href="qstring.html">QString</a> <a name="filter"></a>QDataBrowser::filter () const
|
---|
341 | </h3><p>Returns the data browser's filter.
|
---|
342 | See the <a href="qdatabrowser.html#filter-prop">"filter"</a> property for details.
|
---|
343 | <h3 class=fn>void <a name="first"></a>QDataBrowser::first ()<tt> [virtual slot]</tt>
|
---|
344 | </h3>
|
---|
345 | Moves the default cursor to the first record and refreshes the
|
---|
346 | default form to display this record. If there is no default form
|
---|
347 | or no default cursor, nothing happens. If the data browser
|
---|
348 | successfully navigated to the first record, the default cursor is
|
---|
349 | primed for update and the <a href="#primeUpdate">primeUpdate</a>() signal is emitted.
|
---|
350 | <p> If the browser is already positioned on the first record nothing
|
---|
351 | happens.
|
---|
352 | <p>
|
---|
353 | <h3 class=fn>void <a name="firstRecordAvailable"></a>QDataBrowser::firstRecordAvailable ( bool available )<tt> [signal]</tt>
|
---|
354 | </h3>
|
---|
355 |
|
---|
356 | <p> This signal is emitted whenever the position of the cursor
|
---|
357 | changes. The <em>available</em> parameter indicates whether or not the
|
---|
358 | first record in the default cursor is available.
|
---|
359 |
|
---|
360 | <h3 class=fn><a href="qsqlform.html">QSqlForm</a> * <a name="form"></a>QDataBrowser::form ()
|
---|
361 | </h3>
|
---|
362 | Returns the data browser's default form or 0 if no form has been
|
---|
363 | set.
|
---|
364 |
|
---|
365 | <h3 class=fn>void <a name="handleError"></a>QDataBrowser::handleError ( const <a href="qsqlerror.html">QSqlError</a> & error )<tt> [virtual protected]</tt>
|
---|
366 | </h3>
|
---|
367 | Virtual function which handles the error <em>error</em>. The default
|
---|
368 | implementation warns the user with a message box.
|
---|
369 |
|
---|
370 | <h3 class=fn>void <a name="insert"></a>QDataBrowser::insert ()<tt> [virtual slot]</tt>
|
---|
371 | </h3>
|
---|
372 | Performs an insert operation on the data browser's cursor. If
|
---|
373 | there is no default cursor or no default form, nothing happens.
|
---|
374 | <p> If auto-editing is on (see <a href="#setAutoEdit">setAutoEdit</a>()), the following happens:
|
---|
375 | <p> <ul>
|
---|
376 | <li> If the browser is already actively inserting a record,
|
---|
377 | the current form's data is inserted into the database.
|
---|
378 | <li> If the browser is not inserting a record, but the current record
|
---|
379 | was changed by the user, the record is updated in the database with
|
---|
380 | the current form's data (i.e. with the changes).
|
---|
381 | </ul>
|
---|
382 | <p> If there is an error handling any of the above auto-edit actions,
|
---|
383 | <a href="#handleError">handleError</a>() is called and no insert or update is performed.
|
---|
384 | <p> If no error occurred, or auto-editing is not enabled, the data browser
|
---|
385 | begins actively inserting a record into the database by performing the
|
---|
386 | following actions:
|
---|
387 | <p> <ul>
|
---|
388 | <li> The default cursor is primed for insert using <a href="qsqlcursor.html#primeInsert">QSqlCursor::primeInsert</a>().
|
---|
389 | <li> The <a href="#primeInsert">primeInsert</a>() signal is emitted.
|
---|
390 | <li> The form is updated with the values in the default cursor's.
|
---|
391 | edit buffer so that the user can fill in the values to be inserted.
|
---|
392 | </ul>
|
---|
393 | <p>
|
---|
394 | <h3 class=fn>bool <a name="insertCurrent"></a>QDataBrowser::insertCurrent ()<tt> [virtual protected]</tt>
|
---|
395 | </h3>
|
---|
396 | Reads the fields from the default form into the default cursor and
|
---|
397 | performs an insert on the default cursor. If there is no default
|
---|
398 | form or no default cursor, nothing happens. If an error occurred
|
---|
399 | during the insert into the database, <a href="#handleError">handleError</a>() is called and
|
---|
400 | FALSE is returned. If the insert was successfull, the cursor is
|
---|
401 | refreshed and relocated to the newly inserted record, the
|
---|
402 | <a href="#cursorChanged">cursorChanged</a>() signal is emitted, and TRUE is returned.
|
---|
403 | <p> <p>See also <a href="#cursorChanged">cursorChanged</a>(), <a href="#sqlCursor">sqlCursor</a>(), <a href="#form">form</a>(), and <a href="#handleError">handleError</a>().
|
---|
404 |
|
---|
405 | <h3 class=fn>bool <a name="isReadOnly"></a>QDataBrowser::isReadOnly () const
|
---|
406 | </h3><p>Returns TRUE if the browser is read-only; otherwise returns FALSE.
|
---|
407 | See the <a href="qdatabrowser.html#readOnly-prop">"readOnly"</a> property for details.
|
---|
408 | <h3 class=fn>void <a name="last"></a>QDataBrowser::last ()<tt> [virtual slot]</tt>
|
---|
409 | </h3>
|
---|
410 | Moves the default cursor to the last record and refreshes the
|
---|
411 | default form to display this record. If there is no default form
|
---|
412 | or no default cursor, nothing happens. If the data browser
|
---|
413 | successfully navigated to the last record, the default cursor is
|
---|
414 | primed for update and the <a href="#primeUpdate">primeUpdate</a>() signal is emitted.
|
---|
415 | <p> If the browser is already positioned on the last record nothing
|
---|
416 | happens.
|
---|
417 |
|
---|
418 | <h3 class=fn>void <a name="lastRecordAvailable"></a>QDataBrowser::lastRecordAvailable ( bool available )<tt> [signal]</tt>
|
---|
419 | </h3>
|
---|
420 |
|
---|
421 | <p> This signal is emitted whenever the position of the cursor
|
---|
422 | changes. The <em>available</em> parameter indicates whether or not the
|
---|
423 | last record in the default cursor is available.
|
---|
424 |
|
---|
425 | <h3 class=fn>void <a name="next"></a>QDataBrowser::next ()<tt> [virtual slot]</tt>
|
---|
426 | </h3>
|
---|
427 | Moves the default cursor to the next record and refreshes the
|
---|
428 | default form to display this record. If there is no default form
|
---|
429 | or no default cursor, nothing happens. If the data browser
|
---|
430 | successfully navigated to the next record, the default cursor is
|
---|
431 | primed for update and the <a href="#primeUpdate">primeUpdate</a>() signal is emitted.
|
---|
432 | <p> If the browser is positioned on the last record nothing happens.
|
---|
433 |
|
---|
434 | <h3 class=fn>void <a name="nextRecordAvailable"></a>QDataBrowser::nextRecordAvailable ( bool available )<tt> [signal]</tt>
|
---|
435 | </h3>
|
---|
436 |
|
---|
437 | <p> This signal is emitted whenever the position of the cursor
|
---|
438 | changes. The <em>available</em> parameter indicates whether or not the
|
---|
439 | next record in the default cursor is available.
|
---|
440 |
|
---|
441 | <h3 class=fn>void <a name="prev"></a>QDataBrowser::prev ()<tt> [virtual slot]</tt>
|
---|
442 | </h3>
|
---|
443 | Moves the default cursor to the previous record and refreshes the
|
---|
444 | default form to display this record. If there is no default form
|
---|
445 | or no default cursor, nothing happens. If the data browser
|
---|
446 | successfully navigated to the previous record, the default cursor
|
---|
447 | is primed for update and the <a href="#primeUpdate">primeUpdate</a>() signal is emitted.
|
---|
448 | <p> If the browser is positioned on the first record nothing happens.
|
---|
449 |
|
---|
450 | <h3 class=fn>void <a name="prevRecordAvailable"></a>QDataBrowser::prevRecordAvailable ( bool available )<tt> [signal]</tt>
|
---|
451 | </h3>
|
---|
452 |
|
---|
453 | <p> This signal is emitted whenever the position of the cursor
|
---|
454 | changes. The <em>available</em> parameter indicates whether or not the
|
---|
455 | previous record in the default cursor is available.
|
---|
456 |
|
---|
457 | <h3 class=fn>void <a name="primeDelete"></a>QDataBrowser::primeDelete ( <a href="qsqlrecord.html">QSqlRecord</a> * buf )<tt> [signal]</tt>
|
---|
458 | </h3>
|
---|
459 |
|
---|
460 | <p> This signal is emitted when the data browser enters deletion mode.
|
---|
461 | The <em>buf</em> parameter points to the record buffer being deleted.
|
---|
462 | (Note that <a href="qsqlcursor.html#primeDelete">QSqlCursor::primeDelete</a>() is <em>not</em> called on the
|
---|
463 | default cursor, as this would corrupt values in the form.)
|
---|
464 | Connect to this signal in order to, for example, save a copy of
|
---|
465 | the deleted record for auditing purposes.
|
---|
466 | <p> <p>See also <a href="#del">del</a>().
|
---|
467 |
|
---|
468 | <h3 class=fn>void <a name="primeInsert"></a>QDataBrowser::primeInsert ( <a href="qsqlrecord.html">QSqlRecord</a> * buf )<tt> [signal]</tt>
|
---|
469 | </h3>
|
---|
470 |
|
---|
471 | <p> This signal is emitted when the data browser enters insertion
|
---|
472 | mode. The <em>buf</em> parameter points to the record buffer that is to
|
---|
473 | be inserted. Connect to this signal to, for example, <a href="primes.html#prime">prime</a> the
|
---|
474 | record buffer with default data values, auto-numbered fields etc.
|
---|
475 | (Note that <a href="qsqlcursor.html#primeInsert">QSqlCursor::primeInsert</a>() is <em>not</em> called on the
|
---|
476 | default cursor, as this would corrupt values in the form.)
|
---|
477 | <p> <p>See also <a href="#insert">insert</a>().
|
---|
478 |
|
---|
479 | <h3 class=fn>void <a name="primeUpdate"></a>QDataBrowser::primeUpdate ( <a href="qsqlrecord.html">QSqlRecord</a> * buf )<tt> [signal]</tt>
|
---|
480 | </h3>
|
---|
481 |
|
---|
482 | <p> This signal is emitted when the data browser enters update mode.
|
---|
483 | Note that during navigation (<a href="#first">first</a>(), <a href="#last">last</a>(), <a href="#next">next</a>(), <a href="#prev">prev</a>()),
|
---|
484 | each record that is shown in the default form is primed for
|
---|
485 | update. The <em>buf</em> parameter points to the record buffer being
|
---|
486 | updated. (Note that <a href="qsqlcursor.html#primeUpdate">QSqlCursor::primeUpdate</a>() is <em>not</em> called on
|
---|
487 | the default cursor, as this would corrupt values in the form.)
|
---|
488 | Connect to this signal in order to, for example, keep track of
|
---|
489 | which records have been updated, perhaps for auditing purposes.
|
---|
490 | <p> <p>See also <a href="#update">update</a>().
|
---|
491 |
|
---|
492 | <h3 class=fn>void <a name="readFields"></a>QDataBrowser::readFields ()<tt> [virtual slot]</tt>
|
---|
493 | </h3>
|
---|
494 | Reads the fields from the default cursor's edit buffer and
|
---|
495 | displays them in the form. If there is no default cursor or no
|
---|
496 | default form, nothing happens.
|
---|
497 |
|
---|
498 | <h3 class=fn>void <a name="refresh"></a>QDataBrowser::refresh ()<tt> [virtual slot]</tt>
|
---|
499 | </h3>
|
---|
500 | Refreshes the data browser's data using the default cursor. The
|
---|
501 | browser's current filter and sort are applied if they have been
|
---|
502 | set.
|
---|
503 | <p> <p>See also <a href="#filter-prop">filter</a> and <a href="#sort-prop">sort</a>.
|
---|
504 |
|
---|
505 | <h3 class=fn>bool <a name="seek"></a>QDataBrowser::seek ( int i, bool relative = FALSE )<tt> [virtual]</tt>
|
---|
506 | </h3>
|
---|
507 | Moves the default cursor to the record specified by the index <em>i</em>
|
---|
508 | and refreshes the default form to display this record. If there is
|
---|
509 | no default form or no default cursor, nothing happens. If <em>relative</em> is TRUE (the default is FALSE), the cursor is moved
|
---|
510 | relative to its current position. If the data browser successfully
|
---|
511 | navigated to the desired record, the default cursor is primed for
|
---|
512 | update and the <a href="#primeUpdate">primeUpdate</a>() signal is emitted.
|
---|
513 | <p> If the browser is already positioned on the desired record nothing
|
---|
514 | happens.
|
---|
515 |
|
---|
516 | <h3 class=fn>void <a name="setAutoEdit"></a>QDataBrowser::setAutoEdit ( bool autoEdit )<tt> [virtual]</tt>
|
---|
517 | </h3><p>Sets whether the browser automatically applies edits to <em>autoEdit</em>.
|
---|
518 | See the <a href="qdatabrowser.html#autoEdit-prop">"autoEdit"</a> property for details.
|
---|
519 | <h3 class=fn>void <a name="setBoundaryChecking"></a>QDataBrowser::setBoundaryChecking ( bool active )
|
---|
520 | </h3><p>Sets whether boundary checking is active to <em>active</em>.
|
---|
521 | See the <a href="qdatabrowser.html#boundaryChecking-prop">"boundaryChecking"</a> property for details.
|
---|
522 | <h3 class=fn>void <a name="setConfirmCancels"></a>QDataBrowser::setConfirmCancels ( bool confirm )<tt> [virtual]</tt>
|
---|
523 | </h3><p>Sets whether the browser confirms cancel operations to <em>confirm</em>.
|
---|
524 | See the <a href="qdatabrowser.html#confirmCancels-prop">"confirmCancels"</a> property for details.
|
---|
525 | <h3 class=fn>void <a name="setConfirmDelete"></a>QDataBrowser::setConfirmDelete ( bool confirm )<tt> [virtual]</tt>
|
---|
526 | </h3><p>Sets whether the browser confirms deletions to <em>confirm</em>.
|
---|
527 | See the <a href="qdatabrowser.html#confirmDelete-prop">"confirmDelete"</a> property for details.
|
---|
528 | <h3 class=fn>void <a name="setConfirmEdits"></a>QDataBrowser::setConfirmEdits ( bool confirm )<tt> [virtual]</tt>
|
---|
529 | </h3><p>Sets whether the browser confirms edits to <em>confirm</em>.
|
---|
530 | See the <a href="qdatabrowser.html#confirmEdits-prop">"confirmEdits"</a> property for details.
|
---|
531 | <h3 class=fn>void <a name="setConfirmInsert"></a>QDataBrowser::setConfirmInsert ( bool confirm )<tt> [virtual]</tt>
|
---|
532 | </h3><p>Sets whether the data browser confirms insertions to <em>confirm</em>.
|
---|
533 | See the <a href="qdatabrowser.html#confirmInsert-prop">"confirmInsert"</a> property for details.
|
---|
534 | <h3 class=fn>void <a name="setConfirmUpdate"></a>QDataBrowser::setConfirmUpdate ( bool confirm )<tt> [virtual]</tt>
|
---|
535 | </h3><p>Sets whether the browser confirms updates to <em>confirm</em>.
|
---|
536 | See the <a href="qdatabrowser.html#confirmUpdate-prop">"confirmUpdate"</a> property for details.
|
---|
537 | <h3 class=fn>void <a name="setFilter"></a>QDataBrowser::setFilter ( const <a href="qstring.html">QString</a> & filter )
|
---|
538 | </h3><p>Sets the data browser's filter to <em>filter</em>.
|
---|
539 | See the <a href="qdatabrowser.html#filter-prop">"filter"</a> property for details.
|
---|
540 | <h3 class=fn>void <a name="setForm"></a>QDataBrowser::setForm ( <a href="qsqlform.html">QSqlForm</a> * form )<tt> [virtual]</tt>
|
---|
541 | </h3>
|
---|
542 | Sets the browser's default form to <em>form</em>. The cursor and all
|
---|
543 | navigation and data manipulation functions that the browser
|
---|
544 | provides become available to the <em>form</em>.
|
---|
545 |
|
---|
546 | <h3 class=fn>void <a name="setReadOnly"></a>QDataBrowser::setReadOnly ( bool active )<tt> [virtual]</tt>
|
---|
547 | </h3><p>Sets whether the browser is read-only to <em>active</em>.
|
---|
548 | See the <a href="qdatabrowser.html#readOnly-prop">"readOnly"</a> property for details.
|
---|
549 | <h3 class=fn>void <a name="setSort"></a>QDataBrowser::setSort ( const <a href="qstringlist.html">QStringList</a> & sort )
|
---|
550 | </h3><p>Sets the data browser's sort to <em>sort</em>.
|
---|
551 | See the <a href="qdatabrowser.html#sort-prop">"sort"</a> property for details.
|
---|
552 | <h3 class=fn>void <a name="setSort-2"></a>QDataBrowser::setSort ( const <a href="qsqlindex.html">QSqlIndex</a> & sort )
|
---|
553 | </h3>
|
---|
554 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
555 | <p> Sets the data browser's sort to the <a href="qsqlindex.html">QSqlIndex</a> <em>sort</em>. To apply
|
---|
556 | the new sort, use <a href="#refresh">refresh</a>().
|
---|
557 | <p>
|
---|
558 | <h3 class=fn>void <a name="setSqlCursor"></a>QDataBrowser::setSqlCursor ( <a href="qsqlcursor.html">QSqlCursor</a> * cursor, bool autoDelete = FALSE )<tt> [virtual]</tt>
|
---|
559 | </h3>
|
---|
560 | Sets the default cursor used by the data browser to <em>cursor</em>. If
|
---|
561 | <em>autoDelete</em> is TRUE (the default is FALSE), the data browser
|
---|
562 | takes ownership of the <em>cursor</em> pointer, which will be deleted
|
---|
563 | when the browser is destroyed, or when <a href="#setSqlCursor">setSqlCursor</a>() is called
|
---|
564 | again. To activate the <em>cursor</em> use <a href="#refresh">refresh</a>(). The cursor's edit
|
---|
565 | buffer is used in the default form to browse and edit records.
|
---|
566 | <p> <p>See also <a href="#sqlCursor">sqlCursor</a>(), <a href="#form">form</a>(), and <a href="#setForm">setForm</a>().
|
---|
567 |
|
---|
568 | <h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="sort"></a>QDataBrowser::sort () const
|
---|
569 | </h3><p>Returns the data browser's sort.
|
---|
570 | See the <a href="qdatabrowser.html#sort-prop">"sort"</a> property for details.
|
---|
571 | <h3 class=fn><a href="qsqlcursor.html">QSqlCursor</a> * <a name="sqlCursor"></a>QDataBrowser::sqlCursor () const
|
---|
572 | </h3>
|
---|
573 | Returns the default cursor used for navigation, or 0 if there is
|
---|
574 | no default cursor.
|
---|
575 | <p> <p>See also <a href="#setSqlCursor">setSqlCursor</a>().
|
---|
576 |
|
---|
577 | <h3 class=fn>void <a name="update"></a>QDataBrowser::update ()<tt> [virtual slot]</tt>
|
---|
578 | </h3>
|
---|
579 | Performs an update operation on the data browser's cursor.
|
---|
580 | <p> If there is no default cursor or no default form, nothing happens.
|
---|
581 | Otherwise, the following happens:
|
---|
582 | <p> If the data browser is actively inserting a record (see <a href="#insert">insert</a>()),
|
---|
583 | that record is inserted into the database using <a href="#insertCurrent">insertCurrent</a>().
|
---|
584 | Otherwise, the database is updated with the current form's data
|
---|
585 | using <a href="#updateCurrent">updateCurrent</a>(). If there is an error handling either
|
---|
586 | action, <a href="#handleError">handleError</a>() is called.
|
---|
587 |
|
---|
588 | <h3 class=fn>void <a name="updateBoundary"></a>QDataBrowser::updateBoundary ()<tt> [slot]</tt>
|
---|
589 | </h3>
|
---|
590 | If <a href="#boundaryChecking">boundaryChecking</a>() is TRUE, checks the boundary of the current
|
---|
591 | default cursor and emits signals which indicate the position of
|
---|
592 | the cursor.
|
---|
593 |
|
---|
594 | <h3 class=fn>bool <a name="updateCurrent"></a>QDataBrowser::updateCurrent ()<tt> [virtual protected]</tt>
|
---|
595 | </h3>
|
---|
596 | Reads the fields from the default form into the default cursor and
|
---|
597 | performs an update on the default cursor. If there is no default
|
---|
598 | form or no default cursor, nothing happens. If an error occurred
|
---|
599 | during the update on the database, <a href="#handleError">handleError</a>() is called and
|
---|
600 | FALSE is returned. If the update was successfull, the cursor is
|
---|
601 | refreshed and relocated to the updated record, the <a href="#cursorChanged">cursorChanged</a>()
|
---|
602 | signal is emitted, and TRUE is returned.
|
---|
603 | <p> <p>See also <a href="qwidget.html#cursor-prop">cursor</a>, <a href="#form">form</a>(), and <a href="#handleError">handleError</a>().
|
---|
604 |
|
---|
605 | <h3 class=fn>void <a name="writeFields"></a>QDataBrowser::writeFields ()<tt> [virtual slot]</tt>
|
---|
606 | </h3>
|
---|
607 | Writes the form's data to the default cursor's edit buffer. If
|
---|
608 | there is no default cursor or no default form, nothing happens.
|
---|
609 |
|
---|
610 | <hr><h2>Property Documentation</h2>
|
---|
611 | <h3 class=fn>bool <a name="autoEdit-prop"></a>autoEdit</h3>
|
---|
612 | <p>This property holds whether the browser automatically applies edits.
|
---|
613 | <p>The default value for this property is TRUE. When the user begins
|
---|
614 | an insertion or an update on a form there are two possible
|
---|
615 | outcomes when they navigate to another record:
|
---|
616 | <p> <ul>
|
---|
617 | <li> the insert or update is is performed -- this occurs if autoEdit is TRUE
|
---|
618 | <li> the insert or update is discarded -- this occurs if autoEdit is FALSE
|
---|
619 | </ul>
|
---|
620 |
|
---|
621 | <p>Set this property's value with <a href="#setAutoEdit">setAutoEdit</a>() and get this property's value with <a href="#autoEdit">autoEdit</a>().
|
---|
622 | <h3 class=fn>bool <a name="boundaryChecking-prop"></a>boundaryChecking</h3>
|
---|
623 | <p>This property holds whether boundary checking is active.
|
---|
624 | <p>When boundary checking is active (the default), signals are
|
---|
625 | emitted indicating the current position of the default cursor.
|
---|
626 | <p> <p>See also <a href="#boundary">boundary</a>().
|
---|
627 |
|
---|
628 | <p>Set this property's value with <a href="#setBoundaryChecking">setBoundaryChecking</a>() and get this property's value with <a href="#boundaryChecking">boundaryChecking</a>().
|
---|
629 | <h3 class=fn>bool <a name="confirmCancels-prop"></a>confirmCancels</h3>
|
---|
630 | <p>This property holds whether the browser confirms cancel operations.
|
---|
631 | <p>If this property is TRUE, all cancels must be confirmed by the
|
---|
632 | user through a message box (this behavior can be changed by
|
---|
633 | overriding the <a href="#confirmCancel">confirmCancel</a>() function), otherwise all cancels
|
---|
634 | occur immediately. The default is FALSE.
|
---|
635 | <p> <p>See also <a href="#confirmEdits-prop">confirmEdits</a> and <a href="#confirmCancel">confirmCancel</a>().
|
---|
636 |
|
---|
637 | <p>Set this property's value with <a href="#setConfirmCancels">setConfirmCancels</a>() and get this property's value with <a href="#confirmCancels">confirmCancels</a>().
|
---|
638 | <h3 class=fn>bool <a name="confirmDelete-prop"></a>confirmDelete</h3>
|
---|
639 | <p>This property holds whether the browser confirms deletions.
|
---|
640 | <p>If this property is TRUE, the browser confirms deletions,
|
---|
641 | otherwise deletions happen immediately.
|
---|
642 | <p> <p>See also <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmEdits-prop">confirmEdits</a>, <a href="#confirmUpdate-prop">confirmUpdate</a>, <a href="#confirmInsert-prop">confirmInsert</a>, and <a href="#confirmEdit">confirmEdit</a>().
|
---|
643 |
|
---|
644 | <p>Set this property's value with <a href="#setConfirmDelete">setConfirmDelete</a>() and get this property's value with <a href="#confirmDelete">confirmDelete</a>().
|
---|
645 | <h3 class=fn>bool <a name="confirmEdits-prop"></a>confirmEdits</h3>
|
---|
646 | <p>This property holds whether the browser confirms edits.
|
---|
647 | <p>If this property is TRUE, the browser confirms all edit operations
|
---|
648 | (insertions, updates and deletions), otherwise all edit operations
|
---|
649 | happen immediately. Confirmation is achieved by presenting the
|
---|
650 | user with a message box -- this behavior can be changed by
|
---|
651 | reimplementing the <a href="#confirmEdit">confirmEdit</a>() function,
|
---|
652 | <p> <p>See also <a href="#confirmEdit">confirmEdit</a>(), <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmInsert-prop">confirmInsert</a>, <a href="#confirmUpdate-prop">confirmUpdate</a>, and <a href="#confirmDelete-prop">confirmDelete</a>.
|
---|
653 |
|
---|
654 | <p>Set this property's value with <a href="#setConfirmEdits">setConfirmEdits</a>() and get this property's value with <a href="#confirmEdits">confirmEdits</a>().
|
---|
655 | <h3 class=fn>bool <a name="confirmInsert-prop"></a>confirmInsert</h3>
|
---|
656 | <p>This property holds whether the data browser confirms insertions.
|
---|
657 | <p>If this property is TRUE, the browser confirms insertions,
|
---|
658 | otherwise insertions happen immediately.
|
---|
659 | <p> <p>See also <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmEdits-prop">confirmEdits</a>, <a href="#confirmUpdate-prop">confirmUpdate</a>, <a href="#confirmDelete-prop">confirmDelete</a>, and <a href="#confirmEdit">confirmEdit</a>().
|
---|
660 |
|
---|
661 | <p>Set this property's value with <a href="#setConfirmInsert">setConfirmInsert</a>() and get this property's value with <a href="#confirmInsert">confirmInsert</a>().
|
---|
662 | <h3 class=fn>bool <a name="confirmUpdate-prop"></a>confirmUpdate</h3>
|
---|
663 | <p>This property holds whether the browser confirms updates.
|
---|
664 | <p>If this property is TRUE, the browser confirms updates, otherwise
|
---|
665 | updates happen immediately.
|
---|
666 | <p> <p>See also <a href="#confirmCancels-prop">confirmCancels</a>, <a href="#confirmEdits-prop">confirmEdits</a>, <a href="#confirmInsert-prop">confirmInsert</a>, <a href="#confirmDelete-prop">confirmDelete</a>, and <a href="#confirmEdit">confirmEdit</a>().
|
---|
667 |
|
---|
668 | <p>Set this property's value with <a href="#setConfirmUpdate">setConfirmUpdate</a>() and get this property's value with <a href="#confirmUpdate">confirmUpdate</a>().
|
---|
669 | <h3 class=fn><a href="qstring.html">QString</a> <a name="filter-prop"></a>filter</h3>
|
---|
670 | <p>This property holds the data browser's filter.
|
---|
671 | <p>The filter applies to the data shown in the browser. Call
|
---|
672 | <a href="#refresh">refresh</a>() to apply the new filter. A filter is a string containing
|
---|
673 | a SQL WHERE clause without the WHERE keyword, e.g. "id>1000",
|
---|
674 | "name LIKE 'A%'", etc.
|
---|
675 | <p> There is no default filter.
|
---|
676 | <p> <p>See also <a href="#sort-prop">sort</a>.
|
---|
677 |
|
---|
678 | <p>Set this property's value with <a href="#setFilter">setFilter</a>() and get this property's value with <a href="#filter">filter</a>().
|
---|
679 | <h3 class=fn>bool <a name="readOnly-prop"></a>readOnly</h3>
|
---|
680 | <p>This property holds whether the browser is read-only.
|
---|
681 | <p>The default is FALSE, i.e. data can be edited. If the data browser
|
---|
682 | is read-only, no database edits will be allowed.
|
---|
683 |
|
---|
684 | <p>Set this property's value with <a href="#setReadOnly">setReadOnly</a>() and get this property's value with <a href="#isReadOnly">isReadOnly</a>().
|
---|
685 | <h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="sort-prop"></a>sort</h3>
|
---|
686 | <p>This property holds the data browser's sort.
|
---|
687 | <p>The data browser's sort affects the order in which records are
|
---|
688 | viewed in the browser. Call <a href="#refresh">refresh</a>() to apply the new sort.
|
---|
689 | <p> When retrieving the sort property, a string list is returned in
|
---|
690 | the form 'fieldname order', e.g. 'id ASC', 'surname DESC'.
|
---|
691 | <p> There is no default sort.
|
---|
692 | <p> Note that if you want to iterate over the list, you should iterate
|
---|
693 | over a copy, e.g.
|
---|
694 | <pre>
|
---|
695 | <a href="qstringlist.html">QStringList</a> list = myDataBrowser.sort();
|
---|
696 | QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
|
---|
697 | while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
|
---|
698 | myProcessing( *it );
|
---|
699 | ++it;
|
---|
700 | }
|
---|
701 | </pre>
|
---|
702 |
|
---|
703 |
|
---|
704 | <p>Set this property's value with <a href="#setSort">setSort</a>() and get this property's value with <a href="#sort">sort</a>().
|
---|
705 | <!-- eof -->
|
---|
706 | <hr><p>
|
---|
707 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
708 | Copyright © 1995-2007
|
---|
709 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
710 | <table width=100% cellspacing=0 border=0><tr>
|
---|
711 | <td>Copyright © 2007
|
---|
712 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
713 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
714 | </table></div></address></body>
|
---|
715 | </html>
|
---|