QOrganizerCollection Class
The QOrganizerCollection class represents a collection of items in a manager. More...
Header: | #include <QOrganizerCollection> |
Public Types
enum | MetaDataKey { KeyName, KeyDescription, KeyColor, KeySecondaryColor, KeyImage, KeyExtended } |
Public Functions
QOrganizerCollection() | |
QOrganizerCollection(const QOrganizerCollection &other) | |
~QOrganizerCollection() | |
QVariant | extendedMetaData(const QString &key) const |
QOrganizerCollectionId | id() const |
QVariant | metaData(MetaDataKey key) const |
QMap<QOrganizerCollection::MetaDataKey, QVariant> | metaData() const |
void | setExtendedMetaData(const QString &key, const QVariant &value) |
void | setId(const QOrganizerCollectionId &id) |
void | setMetaData(MetaDataKey key, const QVariant &value) |
void | setMetaData(const QMap<QOrganizerCollection::MetaDataKey, QVariant> &metaData) |
bool | operator!=(const QOrganizerCollection &other) const |
QOrganizerCollection & | operator=(const QOrganizerCollection &other) |
bool | operator==(const QOrganizerCollection &other) const |
Related Non-Members
Q_ORGANIZER_EXPORT | operator<<(QDebug dbg, const QOrganizerCollection &collection) |
Detailed Description
The QOrganizerCollection class represents a collection of items in a manager.
A collection has an ID and optionally some metadata, and contains zero or more items. Each different manager will have different requirements before a collection may be saved in it. Some managers do not allow collections to be saved at all, while others may require a collection to have some minimal amount of meta data defined in it prior to save. For example, most managers require a valid value for the QOrganizerCollection::KeyName meta data key to be set prior to save.
Every QOrganizerItem is contained within a collection when stored in a manager. To save an item in a collection, the client should call QOrganizerItem::setCollectionId() on the item, passing in the ID of the destination collection as the argument, and then save the item in the manager. To move an item from one collection to another, the client must fetch the item from the manager, set the collection ID in the item to the ID of the collection to which the client wishes the item to be moved, and then resave the item in the manager. That is, the collection which an item is part of is treated as a property of the item.
Member Type Documentation
enum QOrganizerCollection::MetaDataKey
This enumeration describes the key of the organizer collection metadata.
Constant | Value | Description |
---|---|---|
QOrganizerCollection::KeyName | 0 | This metadata describes the name of the collection. |
QOrganizerCollection::KeyDescription | 1 | This metadata gives a description of the collection. |
QOrganizerCollection::KeyColor | 2 | This metadata describes the color of the collection. |
QOrganizerCollection::KeySecondaryColor | 3 | This metadata describes the secondary color of the collection. |
QOrganizerCollection::KeyImage | 4 | This metadata describes the image of the collection. |
QOrganizerCollection::KeyExtended | 5 | This is an extened metadata, which is stored as a QVariantMap. |
Member Function Documentation
QOrganizerCollection::QOrganizerCollection()
Constructs a new collection.
QOrganizerCollection::QOrganizerCollection(const QOrganizerCollection &other)
Constructs a new copy of the other collection.
QOrganizerCollection::~QOrganizerCollection()
Cleans up any memory in use by the collection.
QVariant QOrganizerCollection::extendedMetaData(const QString &key) const
Returns the value of extended metadata with the given key.
See also setExtendedMetaData().
QOrganizerCollectionId QOrganizerCollection::id() const
Returns the ID of the collection.
See also setId().
QVariant QOrganizerCollection::metaData(MetaDataKey key) const
Returns the meta data of the collection for the given key.
See also setMetaData().
QMap<QOrganizerCollection::MetaDataKey, QVariant> QOrganizerCollection::metaData() const
Returns the meta data of the collection.
void QOrganizerCollection::setExtendedMetaData(const QString &key, const QVariant &value)
Sets the value of the extended metadata with the given key to value.
See also extendedMetaData().
void QOrganizerCollection::setId(const QOrganizerCollectionId &id)
Sets the ID of the collection to id.
If the ID is set to a null (default-constructed) ID, saving the collection will cause the manager to save the collection as a new collection.
See also id().
void QOrganizerCollection::setMetaData(MetaDataKey key, const QVariant &value)
Sets the meta data of the collection for the given key to the given value.
See also metaData().
void QOrganizerCollection::setMetaData(const QMap<QOrganizerCollection::MetaDataKey, QVariant> &metaData)
Sets the metadata of the collection to be metaData.
bool QOrganizerCollection::operator!=(const QOrganizerCollection &other) const
Returns true if the collection is not the same as the other collection.
QOrganizerCollection &QOrganizerCollection::operator=(const QOrganizerCollection &other)
Assigns this collection to be equal to the other collection.
bool QOrganizerCollection::operator==(const QOrganizerCollection &other) const
Returns true if the collection is the same as that of the other collection, false if either the ID or any of the stored metadata are not the same.
Related Non-Members
Q_ORGANIZER_EXPORT operator<<(QDebug dbg, const QOrganizerCollection &collection)
Streams the collection to the given debug stream dbg, and returns the stream.