bool
QcMapItem::childMouseEventFilter(QQuickItem * item, QEvent * event)
{
  Q_UNUSED(item);

  // item is QQuickMouseArea
  qInfo() << item << "\n" << event;

  if (!isVisible() or !isEnabled() or !is_interactive())
    return QQuickItem::childMouseEventFilter(item, event);

  switch (event->type()) {
  case QEvent::MouseButtonPress:
  case QEvent::MouseMove:
  case QEvent::MouseButtonRelease:
    return send_mouse_event(static_cast<QMouseEvent *>(event));

  case QEvent::TouchBegin:
  case QEvent::TouchUpdate:
  case QEvent::TouchEnd:
  case QEvent::TouchCancel: {
    QTouchEvent * touch_event = static_cast<QTouchEvent *>(event);
    if (touch_event->touchPoints().count() >= 2)
      // 1 touch point = handle with MouseEvent (event is always synthesized)
      // let the synthesized mouse event grab the mouse,
      // note there is no mouse grabber at this point since
      // touch event comes first (see Qt::AA_SynthesizeMouseForUnhandledTouchEvents)
      return send_touch_event(touch_event);
  }

  case QEvent::UngrabMouse: {
    QQuickWindow * _window = window();
    if (!_window and
        (( !_window->mouseGrabberItem() or
          ( _window->mouseGrabberItem() and _window->mouseGrabberItem() != this ))))
      // child lost grab, we could even lost some events
      // if grab already belongs for example in item in diffrent window,
      // clear up states
      mouseUngrabEvent();
    break;
  }

  default:
    break;
  }

  return QQuickItem::childMouseEventFilter(item, event);
}
void touch_handle(int x1, int y1, int x2, int y2, int action)
{
	int tempx[2], tempy[2],temp_action;
	tempx[0] = x1;
	tempx[1] = x2;
	tempy[0] = y1;
	tempy[1] = y2;

	temp_action = action;
	LOGD("temp_action = %d at %d line\n", temp_action , __LINE__);
	action = update_state(action);
	LOGD("action = %d at %d line\n", action, __LINE__);
	if(temp_action == 261)
		return;

	switch(action)
	{
		case 0:
			/*
			else if(finger_count == 2)
			{
				press[0] = 1;
				press[1] = 1;
				LOGD("send multi touch event tempx[0] = %d, tempy[0] = %d, tempx[1] = %d, tempy[1] = %d ---%d line----\n",\
						tempx[0], tempy[0], tempx[1], tempy[1], __LINE__);
				send_multi_touch_event(tempx, tempy, press);
			}
			*/
			break;
		case 1:
			if(finger_count == 0 && !move_flag)
			{
				send_touch_event(x1, y1, 1);
				send_touch_event(x1, y1, 0);
			}
			else if(finger_count == 0 && move_flag)
			{
				send_touch_event(x1, y1, 0);
				move_flag = 0;
			}
			/*
			else if(finger_count == 1 && temp_action == 262)   // the second finger up
			{
				press[0] = 1;
				press[1] = 0;
				send_multi_touch_event(tempx, tempy, press);
				LOGD("send multi touch event tempx[0] = %d, tempy[0] = %d, tempx[1] = %d, tempy[1] = %d ---%d line----\n",\
						tempx[0], tempy[0], tempx[1], tempy[1], __LINE__);
			}
			else if(finger_count == 1 && temp_action == 6)   // the first finger up
			{
				press[0] = 0;
				press[1] = 1;
				send_multi_touch_event(tempx, tempy, press);
				LOGD("send multi touch event tempx[0] = %d, tempy[0] = %d, tempx[1] = %d, tempy[1] = %d ---%d line----\n",\
						tempx[0], tempy[0], tempx[1], tempy[1], __LINE__);
			}
			*/
			break;
		case 2:
			if(finger_count == 1)
			{
				send_touch_event(x1, y1, 1);
				move_flag = 1;
			}
			/*	
			else if(finger_count == 2)
			{
				press[0] = 1;
				press[1] = 1;
				send_multi_touch_event(tempx, tempy, press);
				LOGD("send multi touch event tempx[0] = %d, tempy[0] = %d, tempx[1] = %d, tempy[1] = %d ---%d line----\n",\
						tempx[0], tempy[0], tempx[1], tempy[1], __LINE__);
			}
			*/
			break;
		default:
			break;
		
	}

}