279 {HbPopup::NoTimeout,0}, |
279 {HbPopup::NoTimeout,0}, |
280 {HbPopup::ConfirmationNoteTimeout,1500}, |
280 {HbPopup::ConfirmationNoteTimeout,1500}, |
281 {HbPopup::StandardTimeout,3000}, |
281 {HbPopup::StandardTimeout,3000}, |
282 {HbPopup::ContextMenuTimeout,6000}, |
282 {HbPopup::ContextMenuTimeout,6000}, |
283 }; |
283 }; |
|
284 |
|
285 /* |
|
286 Currently, virtual keyboard must be able to position a popup |
|
287 containing an editor to an arbitrary place. VKB does its best to |
|
288 reposition the popup back to original position when needed. At least in |
|
289 orientation switch the old position naturally is wrong, hence popup |
|
290 must be relayouted. |
|
291 |
|
292 It would be unreasonable to make special checks for popup in vkb |
|
293 side. It also would be unreasonable to do special checks for vkb in |
|
294 popup side. Hence this semi-hidden dynamic property for |
|
295 communicating this special case. |
|
296 |
|
297 WARNING: Do not count on this special behaviour, we might remove it |
|
298 without prior notice. If you do require such a behavior, please |
|
299 raise a feature request and we might make this a proper API. |
|
300 */ |
|
301 const char* KPositionManagedByVKB("PositionManagedByVKB"); |
284 |
302 |
285 /* |
303 /* |
286 \primitives |
304 \primitives |
287 \primitive{background} HbFrameItem representing the popup background. The background can be |
305 \primitive{background} HbFrameItem representing the popup background. The background can be |
288 weak or strong (different graphical styles) depending on popup type. |
306 weak or strong (different graphical styles) depending on popup type. |
422 itemFlags |= QGraphicsItem::ItemClipsChildrenToShape; |
440 itemFlags |= QGraphicsItem::ItemClipsChildrenToShape; |
423 itemFlags |= QGraphicsItem::ItemSendsGeometryChanges; |
441 itemFlags |= QGraphicsItem::ItemSendsGeometryChanges; |
424 itemFlags |= QGraphicsItem::ItemIsPanel; |
442 itemFlags |= QGraphicsItem::ItemIsPanel; |
425 q->setFlags(itemFlags); |
443 q->setFlags(itemFlags); |
426 q->setActive(false); |
444 q->setActive(false); |
|
445 |
|
446 q->setAcceptTouchEvents(true); |
427 } |
447 } |
428 |
448 |
429 void HbPopupPrivate::_q_appearEffectEnded(HbEffect::EffectStatus status) |
449 void HbPopupPrivate::_q_appearEffectEnded(HbEffect::EffectStatus status) |
430 { |
450 { |
431 Q_UNUSED(status); |
451 Q_UNUSED(status); |
|
452 } |
|
453 |
|
454 void HbPopupPrivate::_q_maskEffectDestroyed() |
|
455 { |
|
456 mVgMaskEffect = 0; |
432 } |
457 } |
433 |
458 |
434 CSystemToneService* HbPopupPrivate::systemToneService() |
459 CSystemToneService* HbPopupPrivate::systemToneService() |
435 { |
460 { |
436 return HbInstancePrivate::d_ptr()->systemTone(); |
461 return HbInstancePrivate::d_ptr()->systemTone(); |
716 } else { |
741 } else { |
717 delete mVgMaskEffect; |
742 delete mVgMaskEffect; |
718 mVgMaskEffect = 0; |
743 mVgMaskEffect = 0; |
719 } |
744 } |
720 } |
745 } |
|
746 if (mVgMaskEffect) { |
|
747 // Make sure that mask effect is reset when destroyed |
|
748 QObject::connect(mVgMaskEffect, SIGNAL(destroyed()), q, SLOT(_q_maskEffectDestroyed())); |
|
749 } |
721 } |
750 } |
722 QPixmap image(q->backgroundItem()->boundingRect().size().toSize()); |
751 QPixmap image(q->backgroundItem()->boundingRect().size().toSize()); |
723 image.fill(Qt::transparent); |
752 image.fill(Qt::transparent); |
724 QPainter imagePainter(&image); |
753 QPainter imagePainter(&image); |
725 q->backgroundItem()->paint(&imagePainter, 0, 0); |
754 q->backgroundItem()->paint(&imagePainter, 0, 0); |
970 */ |
999 */ |
971 QVariant HbPopup::itemChange ( GraphicsItemChange change, const QVariant & value ) |
1000 QVariant HbPopup::itemChange ( GraphicsItemChange change, const QVariant & value ) |
972 { |
1001 { |
973 Q_D(HbPopup); |
1002 Q_D(HbPopup); |
974 |
1003 |
975 if (change == QGraphicsItem::ItemPositionChange) { |
1004 if (change == QGraphicsItem::ItemPositionChange) { |
|
1005 // Skipping X-coordinate changes made by VKB since popupmanager handles popup to be in the |
|
1006 // center of the screen |
|
1007 if (property(KPositionManagedByVKB).isValid() && property(KPositionManagedByVKB).toBool() && |
|
1008 !d->mAutoLayouting && value.isValid() && !value.toPointF().isNull()) { |
|
1009 QPointF newPointF(geometry().x(), value.toPointF().y()); |
|
1010 d->mAutoLayouting = false; |
|
1011 return newPointF; |
|
1012 } |
976 d->mAutoLayouting = false; |
1013 d->mAutoLayouting = false; |
977 } |
1014 } |
978 if (change == QGraphicsItem::ItemVisibleHasChanged) { |
1015 if (change == QGraphicsItem::ItemVisibleHasChanged) { |
979 if (value.toBool()) { |
1016 if (value.toBool()) { |
980 if (d->hasEffects && boundingRect().isValid() && d->polished) { |
1017 if (d->hasEffects && boundingRect().isValid() && d->polished) { |
1222 } |
1259 } |
1223 d->memberToDisconnectOnClose.clear(); |
1260 d->memberToDisconnectOnClose.clear(); |
1224 HbWidget::closeEvent(event); |
1261 HbWidget::closeEvent(event); |
1225 } |
1262 } |
1226 |
1263 |
1227 |
|
1228 /* |
|
1229 Currently, virtual keyboard must be able to position a popup |
|
1230 containing an editor to an arbitrary place. VKB does its best to |
|
1231 reposition the popup back to original position when needed. At least in |
|
1232 orientation switch the old position naturally is wrong, hence popup |
|
1233 must be relayouted. |
|
1234 |
|
1235 It would be unreasonable to make special checks for popup in vkb |
|
1236 side. It also would be unreasonable to do special checks for vkb in |
|
1237 popup side. Hence this semi-hidden dynamic property for |
|
1238 communicating this special case. |
|
1239 |
|
1240 WARNING: Do not count on this special behaviour, we might remove it |
|
1241 without prior notice. If you do require such a behavior, please |
|
1242 raise a feature request and we might make this a proper API. |
|
1243 */ |
|
1244 const char* KPositionManagedByVKB("PositionManagedByVKB"); |
|
1245 |
|
1246 /*! |
1264 /*! |
1247 Reimplemented from QGraphicsWidget. |
1265 Reimplemented from QGraphicsWidget. |
1248 */ |
1266 */ |
1249 bool HbPopup::event(QEvent *event) |
1267 bool HbPopup::event(QEvent *event) |
1250 { |
1268 { |