calendarui/views/src/calenpluginlabel.cpp
changeset 45 b6db4fd4947b
parent 23 fd30d51f876b
child 51 0b38fc5b94c6
equal deleted inserted replaced
23:fd30d51f876b 45:b6db4fd4947b
    14 * Description:  CalenPluginLabel implementation.
    14 * Description:  CalenPluginLabel implementation.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // System includes
    18 // System includes
       
    19 #include <hbtapgesture.h>
    19 
    20 
    20 // User includes
    21 // User includes
    21 #include "calenservices.h"
    22 #include "calenservices.h"
    22 #include "calenpluginlabel.h"
    23 #include "calenpluginlabel.h"
    23 /*!
    24 /*!
    27  */
    28  */
    28 
    29 
    29 /*!
    30 /*!
    30  constructor
    31  constructor
    31  */
    32  */
    32 CalenPluginLabel::CalenPluginLabel(MCalenServices& services, 
    33 Q_DECL_EXPORT CalenPluginLabel::CalenPluginLabel(MCalenServices& services, 
    33                                    QGraphicsItem* parent) :
    34                                    QGraphicsItem* parent) :
    34 	HbLabel(parent),mServices(services)
    35 	HbLabel(parent),mServices(services)
    35 {
    36 {
    36 	setAlignment(Qt::AlignCenter);
    37 	setAlignment(Qt::AlignCenter);
    37 	setFontSpec(HbFontSpec(HbFontSpec::Secondary));
    38 	grabGesture(Qt::TapGesture);
    38 	setPlainText("Reg plugin");
       
    39 }
    39 }
    40 
    40 
    41 /*!
    41 /*!
    42  Destructor
    42  Destructor
    43  */
    43  */
    44 CalenPluginLabel::~CalenPluginLabel()
    44 Q_DECL_EXPORT CalenPluginLabel::~CalenPluginLabel()
    45 {
    45 {
    46 }
    46 }
    47 
    47 
       
    48 
    48 /*!
    49 /*!
    49  To handle mouse press event.
    50 	Functo listen for all gestures
    50  \sa QGraphicsItem
    51 */
    51  */
    52 void CalenPluginLabel::gestureEvent(QGestureEvent *event)
    52 void CalenPluginLabel::mousePressEvent(QGraphicsSceneMouseEvent* event)
       
    53 {
    53 {
    54 	Q_UNUSED(event);
    54     if(HbTapGesture *gesture = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) {
    55 	
    55         if (gesture->state() == Qt::GestureFinished) {
    56 	mServices.IssueCommandL(ECalenRegionalPluginTapEvent);
    56             if (gesture->tapStyleHint() == HbTapGesture::Tap) {
       
    57                 // Regional label is tapped
       
    58                 mServices.IssueCommandL(ECalenRegionalPluginTapEvent);
       
    59                 event->accept(Qt::TapGesture);
       
    60             }
       
    61         }
       
    62     }
    57 }
    63 }
    58 
    64 
       
    65 
    59 // End of file  --Don't remove this.
    66 // End of file  --Don't remove this.