ginebra2/PopupWebChromeItem.cpp
changeset 16 3c88a81ff781
parent 3 0954f5dd2cd0
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
    21 
    21 
    22 #include "PopupWebChromeItem.h"
    22 #include "PopupWebChromeItem.h"
    23 #include "ChromeWidget.h"
    23 #include "ChromeWidget.h"
    24 #include "WebChromeSnippet.h"
    24 #include "WebChromeSnippet.h"
    25 #include "ExternalEventCharm.h"
    25 #include "ExternalEventCharm.h"
       
    26 #include "qstmgestureevent.h"
    26 
    27 
    27 namespace GVA {
    28 namespace GVA {
    28 
    29 
    29 PopupWebChromeItem::PopupWebChromeItem(
    30 PopupWebChromeItem::PopupWebChromeItem(
    30         ChromeWidget * chrome,
    31         ChromeWidget * chrome,
    58 bool PopupWebChromeItem::event(QEvent * e)
    59 bool PopupWebChromeItem::event(QEvent * e)
    59 {
    60 {
    60     switch (e->type()) {
    61     switch (e->type()) {
    61       case QEvent::Show:
    62       case QEvent::Show:
    62         if(snippet() && m_modal) {
    63         if(snippet() && m_modal) {
       
    64             QStm_Gesture::setGestureGrabberItem(this);
    63             chrome()->emitPopupShown(snippet()->objectName());
    65             chrome()->emitPopupShown(snippet()->objectName());
    64         }
    66         }
    65         break;
    67         break;
    66       case QEvent::Hide:
    68       case QEvent::Hide:
    67         if(snippet() && m_modal) {
    69         if(snippet() && m_modal) {
       
    70             QStm_Gesture::setGestureGrabberItem(NULL);
    68             chrome()->emitPopupHidden(snippet()->objectName());
    71             chrome()->emitPopupHidden(snippet()->objectName());
    69         }
    72         }
    70         break;
    73         break;
       
    74 
       
    75         case QEvent::Gesture:
       
    76             if(snippet() && m_modal) {
       
    77                 QStm_Gesture* gesture = getQStmGesture(e);
       
    78                 if (gesture) {
       
    79                     QPointF pos = gesture->scenePosition(this);
       
    80                     if (gesture->isGestureEnded() || this->sceneBoundingRect().contains(pos)) {
       
    81                         WebChromeItem::event(e);
       
    82                     }
       
    83                 }
       
    84                 return true;
       
    85             }
       
    86         break;
       
    87 
    71       default: break;
    88       default: break;
    72     }
    89     }
    73 
    90 
    74     // Let the parent class handle the event.
    91     // Let the parent class handle the event.
    75 
    92