QSqlPropertyMap(3qt)

πŸ“¦ version 3.3.8b, in fedora 43, fedora 44

✨ NAME ✨

okay so this is the man page for QSqlPropertyMap(3qt) β€” it lives in the Qt 3 docs, manual section 3qt, and it's the little class that maps widgets to SQL fields. that's the whole vibe. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

first thing, you gotta pull the header in:

#include <qsqlpropertymap.h>

πŸ’œ Public Members

  • QSqlPropertyMap ()
  • virtual ~QSqlPropertyMap ()
  • QVariant property ( QWidget * widget )
  • virtual void setProperty ( QWidget * widget, const QVariant & value )
  • void insert ( const QString & classname, const QString & property )
  • void remove ( const QString & classname )

πŸ’œ Static Public Members

  • QSqlPropertyMap * defaultMap ()
  • void installDefaultMap ( QSqlPropertyMap * map )

🌸 DESCRIPTION 🌸

so, the QSqlPropertyMap class is used to map widgets to SQL fields. that's literally its job description, bestie.

the SQL module uses Qt object properties to insert and extract values from editor widgets. ✨

this class is what maps editors to SQL fields β€” it works by associating SQL editor class names to the properties used to insert and extract values to/from the editor. it's giving matchmaker but for widgets and database columns fr fr.

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. and you can add and remove widget properties to suit your specific needs. slay, customisation. πŸ’…

if you want to use custom editors with your QDataTable or QSqlForm, you must install your own QSqlPropertyMap for that table or form. example, no cap:

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's used by default. (bear in mind that QSqlPropertyMap takes ownership of the new default map. remember that. it's important. πŸ‘‘)

QSqlPropertyMap *myMap = new QSqlPropertyMap;
myMap->insert( "MyEditor", "content" );
QSqlPropertyMap::installDefaultMap( myMap );
...
also see QDataTable, QSqlForm, QSqlEditorFactory, and Database Classes. iykyk πŸ¦‹

🌈 MEMBER FUNCTION DOCUMENTATION 🌈

πŸ’– QSqlPropertyMap::QSqlPropertyMap ()

constructs a QSqlPropertyMap. iconic behaviour, honestly.

the default property mappings used by Qt widgets are literally rendered in the source man page as:

<center>.nf
</center>

(yes bestie that's what it says, character for character, i'm not making it up 😭)

πŸ’– 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. it's the main character of property maps. πŸ‘‘

πŸ’– 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. no Q_PROPERTY, no deal. βœ‹

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 &#92;a map, and destroys it when it is no longer needed.

that &#92; is exactly how it's written in the original page β€” i'm keeping it verbatim because the rule is: vibes change, facts don't. πŸ’€

πŸ’– QVariant QSqlPropertyMap::property ( QWidget * widget )

returns the mapped property of widget as a QVariant. cute, useful, does exactly what it says. ✨

πŸ’– void QSqlPropertyMap::remove ( const QString & classname )

removes classname from the map. bye bye πŸ‘‹

πŸ’– void QSqlPropertyMap::setProperty ( QWidget * widget, const QVariant & value ) [virtual]

sets the property of widget to value. periodt.


πŸ¦‹ SEE ALSO πŸ¦‹


Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.


🌟 AUTHOR 🌟

Generated automatically from the source code.


πŸ’€ BUGS πŸ’€

if you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. good bug reports help us to help you. thank you. 🫢

the definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. this man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. (iconic of them tbh 😭)

if you find errors in this manual page, please report them to qt-bugs@trolltech.com. please include the name of the manual page (qsqlpropertymap.3qt) and the Qt version (3.3.8).


okay bestie that's the whole page, every flag, every signature, every warning, untouched. mwah. πŸ’–

Trolltech AS β€” 2 February 2007 β€” and the Qt version in question is 3.3.8, if you were wondering which era of Qt we're stanning today. πŸŽ€

πŸ“¦ where this page comes from