From 82a59a165bb207e77591ea6cd23e5a80e5e2a931 Mon Sep 17 00:00:00 2001 From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com> Date: Mon, 5 Oct 2015 18:34:16 -0400 Subject: [PATCH] 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 --- src/itemdataroles.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/itemdataroles.h b/src/itemdataroles.h index 0737bea5..2c9334e6 100644 --- a/src/itemdataroles.h +++ b/src/itemdataroles.h @@ -36,6 +36,7 @@ enum class Role { DisplayRole = Qt::DisplayRole , Object = Qt::UserRole + 1, + ObjectType , Name , Number , LastUsed , @@ -45,4 +46,20 @@ enum class Role DropState , 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 + +Q_DECLARE_METATYPE(Ring::ObjectType) -- GitLab