From 0e272ec96fbcce93ec3be49eca753a7cd0079893 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 5 Sep 2012 14:58:54 +0200 Subject: Support for Qt QUuid persistence This support was added to the basic sub-profile. New test: qt/common/basic. Updated the qt example to use QUuid as an object id. --- qt/employee.hxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'qt/employee.hxx') diff --git a/qt/employee.hxx b/qt/employee.hxx index f2c34da..82bbcfb 100644 --- a/qt/employee.hxx +++ b/qt/employee.hxx @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -72,7 +73,8 @@ public: const QDate& born, const QByteArray& publicKey, QSharedPointer employer) - : first_ (first), + : id_ (QUuid::createUuid ()), + first_ (first), last_ (last), born_ (born), publicKey_ (publicKey), @@ -80,6 +82,14 @@ public: { } + // Id. + // + const QUuid& + id () const + { + return id_; + } + // Name. // const QString& @@ -141,8 +151,8 @@ private: Employee () {} - #pragma db id auto - unsigned long id_; + #pragma db id + QUuid id_; QString first_; QString last_; -- cgit v1.1