src/hbwidgets/itemviews/hblistviewitem_p.h
changeset 34 ed14f46c0e55
parent 2 06ff229162e9
equal deleted inserted replaced
31:7516d6d86cf5 34:ed14f46c0e55
    30 
    30 
    31 #include "hblistviewitem.h"
    31 #include "hblistviewitem.h"
    32 #include "hbabstractviewitem_p.h"
    32 #include "hbabstractviewitem_p.h"
    33 #include "hbabstractitemview.h"
    33 #include "hbabstractitemview.h"
    34 
    34 
    35 class HbStyleOptionListViewItem;
    35 class QGraphicsObject;
    36 
       
    37 class QGraphicsItem;
       
    38 
    36 
    39 class HbListViewItemShared : public HbAbstractViewItemShared
    37 class HbListViewItemShared : public HbAbstractViewItemShared
    40 {
    38 {
    41     public:
    39 public:
    42 
    40 
    43         HbListViewItemShared() :
    41     HbListViewItemShared() :
    44             HbAbstractViewItemShared(),
    42         HbAbstractViewItemShared(),
    45             mTextFormat(Qt::PlainText),
    43         mTextFormat(Qt::PlainText),
    46             mStretchingStyle(HbListViewItem::NoStretching),
    44         mStretchingStyle(HbListViewItem::NoStretching),
    47             mGraphicsSize(HbListViewItem::MediumIcon),
    45         mGraphicsSize(HbListViewItem::MediumIcon),
    48             mMinimumSecondaryTextRowCount(-1),
    46         mMinimumSecondaryTextRowCount(-1),
    49             mMaximumSecondaryTextRowCount(-1)
    47         mMaximumSecondaryTextRowCount(-1)
    50         {
    48     {
    51         }
    49     }
    52 
    50 
    53         Qt::TextFormat    mTextFormat;
    51     ~HbListViewItemShared()
    54         HbListViewItem::StretchingStyle mStretchingStyle;
    52     {
    55         HbListViewItem::GraphicsSize mGraphicsSize;
    53     }
    56         int mMinimumSecondaryTextRowCount;
    54 
    57         int mMaximumSecondaryTextRowCount;
    55 
       
    56 public:
       
    57 
       
    58     Qt::TextFormat    mTextFormat;
       
    59     HbListViewItem::StretchingStyle mStretchingStyle;
       
    60     HbListViewItem::GraphicsSize mGraphicsSize;
       
    61     int mMinimumSecondaryTextRowCount;
       
    62     int mMaximumSecondaryTextRowCount;
    58 };
    63 };
    59 
    64 
    60 class HbListViewItemPrivate : public HbAbstractViewItemPrivate
    65 class HbListViewItemPrivate : public HbAbstractViewItemPrivate
    61 {
    66 {
    62     Q_DECLARE_PUBLIC(HbListViewItem)
    67     Q_DECLARE_PUBLIC(HbListViewItem)
    78     void setDecorationRole(const QVariant &value,
    83     void setDecorationRole(const QVariant &value,
    79                            const int index);
    84                            const int index);
    80     void setDisplayRole(const QString &value,
    85     void setDisplayRole(const QString &value,
    81                         const int index);
    86                         const int index);
    82 
    87 
    83     inline HbStyle::Primitive displayPrimitive() const {
    88     inline HbStyle::PrimitiveType displayPrimitive() const {
    84         HbStyle::Primitive primitive = HbStyle::P_ListViewItem_text;
    89         HbStyle::PrimitiveType primitive = HbStyle::PT_TextItem;
    85         const HbListViewItemShared *sd = static_cast<const HbListViewItemShared *>(mSharedData.constData());
    90         const HbListViewItemShared *sd = static_cast<const HbListViewItemShared *>(mSharedData.constData());
    86 
    91 
    87         if (sd->mTextFormat != Qt::PlainText) {
    92         if (sd->mTextFormat != Qt::PlainText) {
    88             primitive = HbStyle::P_ListViewItem_richtext;
    93             primitive = HbStyle::PT_RichTextItem;
    89         }
    94         }
    90         return primitive;
    95         return primitive;
    91     }
    96     }
    92 
    97 
    93     inline bool isLandscape() const {
    98     inline bool isLandscape() const {
    99         }
   104         }
   100         return false;
   105         return false;
   101     }
   106     }
   102 
   107 
   103     inline bool isStretching() const {
   108     inline bool isStretching() const {
   104         if (    isLandscape()
   109         if (static_cast<const HbListViewItemShared*>(mSharedData.constData())->mStretchingStyle == HbListViewItem::StretchLandscape
   105             &&  static_cast<const HbListViewItemShared*>(mSharedData.constData())->mStretchingStyle == HbListViewItem::StretchLandscape) {
   110             && isLandscape()) {
   106             return true;
   111             return true;
   107         }
   112         }
   108         return false;
   113         return false;
   109     }
   114     }
   110 
   115 
   113         return !(   graphicsSize == HbListViewItem::Thumbnail
   118         return !(   graphicsSize == HbListViewItem::Thumbnail
   114                 ||  graphicsSize == HbListViewItem::WideThumbnail
   119                 ||  graphicsSize == HbListViewItem::WideThumbnail
   115                 ||  isStretching()); 
   120                 ||  isStretching()); 
   116     }
   121     }
   117 
   122 
   118     inline HbStyle::Primitive decorationPrimitive(const QVariant& decoration) {
   123     inline HbStyle::PrimitiveType decorationPrimitive(const QVariant& decoration) {
   119         HbStyle::Primitive primitive = HbStyle::P_None;
   124         HbStyle::PrimitiveType primitive = HbStyle::PT_None;
   120 
   125 
   121         if (decoration.isValid()) {
   126         if (decoration.isValid()) {
   122             if (decoration.canConvert<HbIcon>() || decoration.canConvert<QIcon>()) {
   127             if (decoration.canConvert<HbIcon>() || decoration.canConvert<QIcon>()) {
   123                 primitive = HbStyle::P_ListViewItem_icon;
   128                 primitive = HbStyle::PT_IconItem;
   124             }
   129             }
   125         }
   130         }
   126         return primitive;
   131         return primitive;
   127     }
   132     }
   128 
   133 
   129     QList<QGraphicsItem *> mDisplayRoleTextItems;
   134     QList<QGraphicsObject *> mDisplayRoleTextItems;
   130     QList<QGraphicsItem *> mDecorationRoleItems;
   135     QList<QGraphicsObject *> mDecorationRoleItems;
   131 
   136 
   132     QStringList     mStringList;
   137     QStringList     mStringList;
   133     QVariantList    mDecorationList;
   138     QVariantList    mDecorationList;
   134 };
   139 };
   135 
   140