aboutsummaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_qt3support_sql_q3sqlpropertymap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/codesnippets/doc/src/snippets/code/src_qt3support_sql_q3sqlpropertymap.cpp')
-rw-r--r--doc/codesnippets/doc/src/snippets/code/src_qt3support_sql_q3sqlpropertymap.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/doc/codesnippets/doc/src/snippets/code/src_qt3support_sql_q3sqlpropertymap.cpp b/doc/codesnippets/doc/src/snippets/code/src_qt3support_sql_q3sqlpropertymap.cpp
new file mode 100644
index 000000000..55146de18
--- /dev/null
+++ b/doc/codesnippets/doc/src/snippets/code/src_qt3support_sql_q3sqlpropertymap.cpp
@@ -0,0 +1,35 @@
+//! [0]
+Q3SqlPropertyMap *myMap = new Q3SqlPropertyMap();
+Q3SqlForm *myForm = new Q3SqlForm(this);
+MyEditor myEditor(this);
+
+// Set the Q3SqlForm's record buffer to the update buffer of
+// a pre-existing Q3SqlCursor called 'cur'.
+myForm->setRecord(cur->primeUpdate());
+
+// Install the customized map
+myMap->insert("MyEditor", "content");
+myForm->installPropertyMap(myMap); // myForm now owns myMap
+...
+// Insert a field into the form that uses a myEditor to edit the
+// field 'somefield'
+myForm->insert(&myEditor, "somefield");
+
+// Update myEditor with the value from the mapped database field
+myForm->readFields();
+...
+// Let the user edit the form
+...
+// Update the database fields with the values in the form
+myForm->writeFields();
+...
+//! [0]
+
+
+//! [1]
+Q3SqlPropertyMap *myMap = new Q3SqlPropertyMap;
+
+myMap->insert("MyEditor", "content");
+Q3SqlPropertyMap::installDefaultMap(myMap);
+...
+//! [1]