Skip to content
Snippets Groups Projects
Commit 82a59a16 authored by Stepan Salenikovich's avatar Stepan Salenikovich
Browse files

roles: add ObjectType role and enum

This is to simplify client and LRC logic when working with
models which store objects of multiple types.

Issue: #81198
Change-Id: Ibae1f96f8d2ceb25cae5fb7c9974f77a612707d0
parent 9f2c7d2f
Branches
Tags
No related merge requests found
...@@ -36,6 +36,7 @@ enum class Role ...@@ -36,6 +36,7 @@ enum class Role
{ {
DisplayRole = Qt::DisplayRole , DisplayRole = Qt::DisplayRole ,
Object = Qt::UserRole + 1, Object = Qt::UserRole + 1,
ObjectType ,
Name , Name ,
Number , Number ,
LastUsed , LastUsed ,
...@@ -45,4 +46,20 @@ enum class Role ...@@ -45,4 +46,20 @@ enum class Role
DropState , DropState ,
UserRole = Qt::UserRole + 100 // this should always be the last role in the list UserRole = Qt::UserRole + 100 // this should always be the last role in the list
}; };
/**
* All LRC models that store more than one type of class (eg: RecentModel) should return a member of
* this enum when ::data(Ring::Role::ObjectType) is called on one of their indeces. This is to
* simplify LRC and client logic by not having to dynamic_cast the pointer stored in the index.
*/
enum class ObjectType
{
Person,
ContactMethod,
Call,
Media,
};
} // namespace Ring } // namespace Ring
Q_DECLARE_METATYPE(Ring::ObjectType)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment