Пример #1
0
bool CChartTable::eventFilter( QObject* _pqObject, QEvent* _pqEvent )
{
  //qDebug( "DEBUG[%s] %d", Q_FUNC_INFO, _pqEvent->type() );
  switch( _pqEvent->type() )
  {

  case QEvent::KeyPress:
    return handlerKeyEvent( static_cast<QKeyEvent *>(_pqEvent) );

  case QEvent::Wheel:
    if( _pqObject == tabBar() ) return false;
    return handlerWheelEvent( static_cast<QWheelEvent *>(_pqEvent) );

  case QEvent::MouseButtonDblClick:
  case QEvent::MouseButtonPress:
  case QEvent::MouseButtonRelease:
  case QEvent::MouseMove:
    if( _pqObject != (QObject*)QTabWidget::currentWidget() ) return false;
    if( microtime() - fdGestureTimeLast < 0.350 ) return false; // Ongoing gestures tend to send QMouseEvent artefacts; let's get rid of those
    return handlerMouseEvent( static_cast<QMouseEvent *>(_pqEvent) );

  case QEvent::Gesture:
    if( _pqObject != (QObject*)QTabWidget::currentWidget() ) return false;
    fdGestureTimeLast = microtime();
    return handlerGestureEvent( static_cast<QGestureEvent *>(_pqEvent) );

  default:; // Ignore other events

  }
  return QTabWidget::eventFilter( _pqObject, _pqEvent );
}
Пример #2
0
uchar handlerOSStateMachine(){
	uchar pendingState = OS_CurrentState;
	switch(OS_CurrentState){
	case OS_STATE_IDLE:{
		TURN_OFF_Lcd_L;//关液晶屏背光
		PWM_CONTROL_FLAG = CLOSE;//关闭PWM
		pendingState   =  OS_STATE_LOAD;
	}break;
	case OS_STATE_LOAD:{//系统检测状态
		if(OS_LastState != OS_STATE_LOAD){
			showWelcome();
		}else{
			//这里增加开机的状态监测
			KaiJi();//开机启动,确认上电电压,使用数组,电路自检等
			if((OS_Time-OS_StateTime) > 30){//显示3S. 30*100 = 3S
				pendingState = OS_STATE_WORK;
			}
		}
	}break;
	case OS_STATE_WORK:{//系统正常工作状态
		handlerLCD();//处理显示
		////////////////////////////////////////////////////////////////////////////////////////////////////
		//////  这里需要增加和修改 PWM, 电池检测等操作.                                                  ///
		//////    PWM请按照"PWM处理逻辑"进行相应的增加                                                   ///
		//////    关于电压的AD, 在这里可以一次循环读取一个值. 在充放电的逻辑处理中禁止读取.这样效率很高  ///
		////////////////////////////////////////////////////////////////////////////////////////////////////

		//SelectMode();
		//SystemModeType = OUTPUT_MODE;
		//LoadCurrentDealWith();
		//SwitchBatteryState();
		//LedDisplay();
		//if(PVCount > 50)                      //5s检测处理一次 50
		//{
		//	PVCount = 0;
		//	SolarPanelDealWith();			   //根据太阳能电池板的电压,进行相应的处理,并获得当前太阳能电池板的状态 
		//}
		//if(PWMChargeFlag == 1)                 //调用PWM充电函数100ms 监测一次
		//{
		//	PWMChargeFlag = 0;                 //定时器值还原
		//	PWMCharge();
		//} 
		////////////////////////////////////////////////////////////////////////////////////////////////
		handlerKeyEvent();//没有逻辑消耗按键.这里将按键消耗掉
	}break;
	}
	tranform_OS_State(pendingState);
	return TRUE;
}