oopapidocs
2.0
|
an example DataObject More...
#include <country.h>
Public Types | |
enum | CountryType |
For Q_ENUMS macro to work, we must have the enum type definition in the same class as the Q_ENUMS. | |
Public Member Functions | |
Country & | operator= (const Country &newCountry) |
Since country is derived from QObject, which has a private assignment operator, the compiler-supplied assignment operator will not work, so we must define our own. | |
QString | toString () const |
Static Public Member Functions | |
static QStringList | getCountryNames () |
an example DataObject
This is a very simple object with a single enum property, Country. It is an example of how one can convert from QStrings to enum values and back. It does no string hardcoding anywhere.
Since Country is derived (indirectly) from QObject, which has a private copy constructor, the compiler-supplied copy constructor will not work here. In fact, care should be taken to make sure that only Country references are passed to or returned from functions.
QStringList Country::getCountryNames | ( | ) | [static] |
Definition at line 9 of file country.cpp.
QString Country::toString | ( | ) | const [virtual] |
Reimplemented from DataObject.
Definition at line 21 of file country.cpp.