equal
deleted
inserted
replaced
17 |
17 |
18 #include "cntimagelabel.h" |
18 #include "cntimagelabel.h" |
19 |
19 |
20 #include <hbinstantfeedback.h> |
20 #include <hbinstantfeedback.h> |
21 #include <hbtapgesture.h> |
21 #include <hbtapgesture.h> |
|
22 #include <hbeffect.h> |
22 #include <QGraphicsSceneMouseEvent> |
23 #include <QGraphicsSceneMouseEvent> |
23 |
24 |
24 CntImageLabel::CntImageLabel(QGraphicsItem *parent) : |
25 CntImageLabel::CntImageLabel(QGraphicsItem *parent) : |
25 HbLabel(parent) |
26 HbLabel(parent) |
26 { |
27 { |
27 grabGesture(Qt::TapGesture); |
28 grabGesture(Qt::TapGesture); |
|
29 HbEffect::add(this, "groupbox_icon_click", "iconclick"); |
28 } |
30 } |
29 |
31 |
30 CntImageLabel::~CntImageLabel() |
32 CntImageLabel::~CntImageLabel() |
31 { |
33 { |
32 |
34 |
36 { |
38 { |
37 if (HbTapGesture *tap = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) |
39 if (HbTapGesture *tap = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) |
38 { |
40 { |
39 switch (tap->state()) |
41 switch (tap->state()) |
40 { |
42 { |
|
43 case Qt::GestureStarted: |
|
44 HbEffect::start(this, QString("iconclick")); |
|
45 break; |
41 case Qt::GestureFinished: |
46 case Qt::GestureFinished: |
42 if (tap->tapStyleHint() == HbTapGesture::Tap) |
47 if (tap->tapStyleHint() == HbTapGesture::Tap) |
43 { |
48 { |
44 HbInstantFeedback::play(HbFeedback::Basic); |
49 HbInstantFeedback::play(HbFeedback::Basic); |
45 emit iconClicked(); |
50 emit iconClicked(); |
46 } |
51 } |
47 break; |
52 break; |
48 case Qt::GestureUpdated: |
53 case Qt::GestureUpdated: |
49 if (tap->tapStyleHint() == HbTapGesture::TapAndHold) |
54 if (tap->tapStyleHint() == HbTapGesture::TapAndHold) |
50 { |
55 { |
|
56 HbEffect::cancel(this, QString("iconclick")); |
51 emit iconLongPressed(tap->scenePosition()); |
57 emit iconLongPressed(tap->scenePosition()); |
52 } |
58 } |
53 break; |
59 break; |
54 default: |
60 default: |
55 break; |
61 break; |
56 } |
62 } |
57 event->accept(); |
63 event->accept(); |