QueryLoadable.
More...
#include <queryloadable.h>
|
| virtual bool | loadFromQuery (const QSqlQuery &query)=0 |
| | Load the object's state from the current row of a query result.
|
| |
|
| static QDateTime | utcTime (const QVariant &value) |
| | Convert a QVariant database value to a UTC QDateTime.
|
| |
| template<typename T > |
| static T | enumFromString (const QString &value) |
| | Convert a single-character string to an enum value by casting the first character.
|
| |
QueryLoadable.
A pure abstract class to provide an interface to classes which are able to load themselves via an active QSqlQuery.
Stephen Punak, January 11 2025
Pure abstract interface for classes that can populate themselves from an active QSqlQuery.
Definition at line 14 of file queryloadable.h.
◆ enumFromString()
template<typename T >
| static T QueryLoadable::enumFromString |
( |
const QString & |
value | ) |
|
|
inlinestaticprotected |
Convert a single-character string to an enum value by casting the first character.
- Parameters
-
| value | The string representation of the enum. |
- Returns
- The enum value, or a default-constructed T if the string is empty.
Definition at line 35 of file queryloadable.h.
◆ loadFromQuery()
| virtual bool QueryLoadable::loadFromQuery |
( |
const QSqlQuery & |
query | ) |
|
|
pure virtual |
Load the object's state from the current row of a query result.
- Parameters
-
| query | The active QSqlQuery positioned at the row to load from. |
- Returns
- true on success, false on failure.
◆ utcTime()
| static QDateTime QueryLoadable::utcTime |
( |
const QVariant & |
value | ) |
|
|
staticprotected |
Convert a QVariant database value to a UTC QDateTime.
- Parameters
-
| value | The QVariant containing the datetime value. |
- Returns
- The corresponding QDateTime in UTC.
The documentation for this class was generated from the following file: