From bd0f3345a938b35ce6a12f6150373b0955b8dd12 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 10 Jul 2011 15:24:15 -0500 Subject: Add Qt3 development HEAD version --- doc/html/qsqlpropertymap.html | 199 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 doc/html/qsqlpropertymap.html (limited to 'doc/html/qsqlpropertymap.html') diff --git a/doc/html/qsqlpropertymap.html b/doc/html/qsqlpropertymap.html new file mode 100644 index 0000000..a65cdc6 --- /dev/null +++ b/doc/html/qsqlpropertymap.html @@ -0,0 +1,199 @@ + + + + + +QSqlPropertyMap Class + + + + + + + +
+ +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

QSqlPropertyMap Class Reference
[sql module]

+ +

The QSqlPropertyMap class is used to map widgets to SQL fields. +More... +

#include <qsqlpropertymap.h> +

List of all member functions. +

Public Members

+ +

Static Public Members

+ +

Detailed Description

+ + +The QSqlPropertyMap class is used to map widgets to SQL fields. +

+ +

The SQL module uses Qt object + properties to insert and extract values from editor +widgets. +

This class is used to map editors to SQL fields. This works by +associating SQL editor class names to the properties used to +insert and extract values to/from the editor. +

For example, a QLineEdit can be used to edit text strings and +other data types in QDataTables or QSqlForms. Several properties +are defined in QLineEdit, but only the text property is used to +insert and extract text from a QLineEdit. Both QDataTable and +QSqlForm use the global QSqlPropertyMap for inserting and +extracting values to and from an editor widget. The global +property map defines several common widgets and properties that +are suitable for many applications. You can add and remove widget +properties to suit your specific needs. +

If you want to use custom editors with your QDataTable or +QSqlForm, you must install your own QSqlPropertyMap for that table +or form. Example: +

+    QSqlPropertyMap *myMap  = new QSqlPropertyMap();
+    QSqlForm        *myForm = new QSqlForm( this );
+    MyEditor myEditor( this );
+
+    // Set the QSqlForm's record buffer to the update buffer of
+    // a pre-existing QSqlCursor 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();
+    ...
+    
+ +

You can also replace the global QSqlPropertyMap that is used by +default. (Bear in mind that QSqlPropertyMap takes ownership of the +new default map.) +

+    QSqlPropertyMap *myMap = new QSqlPropertyMap;
+
+    myMap->insert( "MyEditor", "content" );
+    QSqlPropertyMap::installDefaultMap( myMap );
+    ...
+    
+ +

See also QDataTable, QSqlForm, QSqlEditorFactory, and Database Classes. + +


Member Function Documentation

+

QSqlPropertyMap::QSqlPropertyMap () +

+

Constructs a QSqlPropertyMap. +

The default property mappings used by Qt widgets are: +

+
Widgets Property +
QCheckBox, +QRadioButton +checked +
QComboBox, +QListBox +currentItem +
QDateEdit +date +
QDateTimeEdit +dateTime +
QTextBrowser +source +
QButton, +QDial, +QLabel, +QLineEdit, +QMultiLineEdit, +QPushButton, +QTextEdit, +text +
QTimeEdit +time +
QLCDNumber, +QScrollBar +QSlider, +QSpinBox +value +
+ +

QSqlPropertyMap::~QSqlPropertyMap () [virtual] +

+Destroys the QSqlPropertyMap. +

Note that if the QSqlPropertyMap is installed with +installPropertyMap() the object it was installed into, e.g. the +QSqlForm, takes ownership and will delete the QSqlPropertyMap when +necessary. + +

QSqlPropertyMap * QSqlPropertyMap::defaultMap () [static] +

+Returns the application global QSqlPropertyMap. + +

void QSqlPropertyMap::insert ( const QString & classname, const QString & property ) +

+Insert a new classname/property pair, which is used for custom SQL +field editors. There must be a Q_PROPERTY clause in the classname class declaration for the property. + +

Example: sql/overview/custom1/main.cpp. +

void QSqlPropertyMap::installDefaultMap ( QSqlPropertyMap * map ) [static] +

+Replaces the global default property map with map. All +QDataTable and QSqlForm instantiations will use this new map for +inserting and extracting values to and from editors. +QSqlPropertyMap takes ownership of \a map, and destroys it when it is no longer needed. + +

QVariant QSqlPropertyMap::property ( QWidget * widget ) +

+Returns the mapped property of widget as a QVariant. + +

void QSqlPropertyMap::remove ( const QString & classname ) +

+Removes classname from the map. + +

void QSqlPropertyMap::setProperty ( QWidget * widget, const QVariant & value ) [virtual] +

+Sets the property of widget to value. + + +

+This file is part of the Qt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


+ +
Copyright © 2007 +TrolltechTrademarks +
Qt 3.3.8
+
+ -- cgit v1.2.3