equal
deleted
inserted
replaced
20 ** |
20 ** |
21 ** If you have questions regarding the use of this file, please contact |
21 ** If you have questions regarding the use of this file, please contact |
22 ** Nokia at developer.feedback@nokia.com. |
22 ** Nokia at developer.feedback@nokia.com. |
23 ** |
23 ** |
24 ****************************************************************************/ |
24 ****************************************************************************/ |
|
25 #include "hbinputscreenshotwidget.h" |
|
26 |
25 #include <QPixmap> |
27 #include <QPixmap> |
26 #include <QPainter> |
28 #include <QPainter> |
27 |
29 |
28 #include <hbeffect.h> |
30 #include <hbeffect.h> |
29 #include <hbwidget_p.h> |
31 #include <hbwidget_p.h> |
|
32 #include <hbinputregioncollector_p.h> |
30 #include "hbframedrawerpool_p.h" |
33 #include "hbframedrawerpool_p.h" |
31 |
34 |
32 #include "hbinputscreenshotwidget.h" |
|
33 #include "hbinputvkbwidget.h" |
35 #include "hbinputvkbwidget.h" |
34 |
|
35 |
36 |
36 /*! |
37 /*! |
37 @proto |
38 @proto |
38 @hbinput |
39 @hbinput |
39 \class HbInputVkbWidget |
40 \class HbInputVkbWidget |
62 qreal mCloseHandleWidth; |
63 qreal mCloseHandleWidth; |
63 |
64 |
64 }; |
65 }; |
65 |
66 |
66 HbInputScreenshotWidgetPrivate::HbInputScreenshotWidgetPrivate() |
67 HbInputScreenshotWidgetPrivate::HbInputScreenshotWidgetPrivate() |
67 : mIconDrawer(0), mCloseHandleHeight(0), mCloseHandleWidth(0) |
68 : mIconDrawer(0), mCloseHandleHeight(0), mCloseHandleWidth(0) |
68 { |
69 { |
69 } |
70 } |
70 |
71 |
71 HbInputScreenshotWidgetPrivate::~HbInputScreenshotWidgetPrivate() |
72 HbInputScreenshotWidgetPrivate::~HbInputScreenshotWidgetPrivate() |
72 { |
73 { |
77 /// @endcond |
78 /// @endcond |
78 |
79 |
79 /*! |
80 /*! |
80 Costructs the object. |
81 Costructs the object. |
81 */ |
82 */ |
82 HbInputScreenshotWidget::HbInputScreenshotWidget(QGraphicsItem* parent) |
83 HbInputScreenshotWidget::HbInputScreenshotWidget(QGraphicsItem *parent) |
83 : HbWidget(*new HbInputScreenshotWidgetPrivate, parent) |
84 : HbWidget(*new HbInputScreenshotWidgetPrivate, parent) |
84 { |
85 { |
85 Q_D(HbInputScreenshotWidget); |
86 Q_D(HbInputScreenshotWidget); |
86 d->q_ptr = this; |
87 d->q_ptr = this; |
|
88 HbInputRegionCollector::instance()->attach(this); |
87 |
89 |
88 setPos(QPointF(0,0)); |
90 setPos(QPointF(0, 0)); |
89 |
91 |
90 #ifdef HB_EFFECTS |
92 #ifdef HB_EFFECTS |
91 HbEffect::disable(this); |
93 HbEffect::disable(this); |
92 #endif // HB_EFFECTS |
94 #endif // HB_EFFECTS |
93 |
95 |
94 #if QT_VERSION >= 0x040600 |
|
95 // Make sure the keypad never steals focus. |
96 // Make sure the keypad never steals focus. |
96 setFlag(QGraphicsItem::ItemIsPanel, true); |
97 setFlag(QGraphicsItem::ItemIsPanel, true); |
97 setActive(false); |
98 setActive(false); |
98 #endif |
|
99 } |
99 } |
100 |
100 |
101 /*! |
101 /*! |
102 Destructs the object. |
102 Destructs the object. |
103 */ |
103 */ |
104 HbInputScreenshotWidget::~HbInputScreenshotWidget() |
104 HbInputScreenshotWidget::~HbInputScreenshotWidget() |
105 { |
105 { |
106 } |
106 } |
107 |
107 |
108 void HbInputScreenshotWidget::setScreenshot(QPixmap &pixmap) |
108 void HbInputScreenshotWidget::setScreenshot(QPixmap &pixmap) |
109 { |
109 { |
110 Q_D(HbInputScreenshotWidget); |
110 Q_D(HbInputScreenshotWidget); |
122 } |
122 } |
123 |
123 |
124 /*! |
124 /*! |
125 handles mouse press event. |
125 handles mouse press event. |
126 */ |
126 */ |
127 void HbInputScreenshotWidget::mousePressEvent(QGraphicsSceneMouseEvent* event) |
127 void HbInputScreenshotWidget::mousePressEvent(QGraphicsSceneMouseEvent *event) |
128 { |
128 { |
129 Q_UNUSED(event); |
129 Q_UNUSED(event); |
130 } |
130 } |
131 |
131 |
132 /*! |
132 /*! |
133 Handles mouse release event. |
133 Handles mouse release event. |
134 */ |
134 */ |
135 void HbInputScreenshotWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) |
135 void HbInputScreenshotWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) |
136 { |
136 { |
137 Q_UNUSED(event); |
137 Q_UNUSED(event); |
138 } |
138 } |
139 |
139 |
140 /*! |
140 /*! |
141 The paint method. Draws the widget. |
141 The paint method. Draws the widget. |
142 */ |
142 */ |
143 void HbInputScreenshotWidget::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) |
143 void HbInputScreenshotWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
144 { |
144 { |
145 Q_UNUSED(option); |
145 Q_UNUSED(option); |
146 Q_UNUSED(widget); |
146 Q_UNUSED(widget); |
147 |
147 |
148 Q_D(HbInputScreenshotWidget); |
148 Q_D(HbInputScreenshotWidget); |
149 if (!d->mPixmap.isNull()){ |
149 if (!d->mPixmap.isNull()) { |
150 QRectF rect = boundingRect(); |
150 QRectF rect = boundingRect(); |
151 |
151 |
152 painter->save(); |
152 painter->save(); |
153 painter->translate(rect.width() / 2 - d->mCloseHandleWidth / 2, 0); |
153 painter->translate(rect.width() / 2 - d->mCloseHandleWidth / 2, 0); |
154 rect.setWidth(d->mCloseHandleWidth); |
154 rect.setWidth(d->mCloseHandleWidth); |
156 d->mIconDrawer->paint(painter, rect); |
156 d->mIconDrawer->paint(painter, rect); |
157 painter->restore(); |
157 painter->restore(); |
158 |
158 |
159 painter->save(); |
159 painter->save(); |
160 painter->translate(0, d->mCloseHandleHeight); |
160 painter->translate(0, d->mCloseHandleHeight); |
161 painter->drawPixmap(0, 0, d->mPixmap); |
161 painter->drawPixmap(0, 0, d->mPixmap); |
162 painter->restore(); |
162 painter->restore(); |
163 } |
163 } |
164 } |
164 } |
165 |
165 |
166 |
166 |