当前位置: 首页>>代码示例>>C++>>正文


C++ SbTime::setToTimeOfDay方法代码示例

本文整理汇总了C++中SbTime::setToTimeOfDay方法的典型用法代码示例。如果您正苦于以下问题:C++ SbTime::setToTimeOfDay方法的具体用法?C++ SbTime::setToTimeOfDay怎么用?C++ SbTime::setToTimeOfDay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SbTime的用法示例。


在下文中一共展示了SbTime::setToTimeOfDay方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wheelEvent

void QXipIvWidget::wheelEvent(QWheelEvent* event)
{
// TODO: Find a solution for Linux and Mac
#if WIN32
    SbTime time;
    time.setToTimeOfDay();
    SoMouseWheelEvent e;
    e.setTime(time);
    if (event->modifiers() & Qt::ShiftModifier)
        e.setShiftDown(TRUE);
    if (event->modifiers() & Qt::ControlModifier)
        e.setCtrlDown(TRUE);
//#if WIN32
    e.setDelta(event->delta());
    e.setDelta(event->delta() / 120);
	e.setPosition( SbVec2s(event->pos().x(), this->height() - event->pos().y() ) );
//#endif
    if (m_sceneManager->processEvent(&e))
    {
        processDelayQueue();
        updateCursor(true);
    }
    else
    {
        updateCursor(false);
    }
#endif
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:28,代码来源:QXipIvWidget.cpp

示例2: mousePressEvent

void QCtkXipSGWidget::mousePressEvent(QMouseEvent *event)
{
  if(mInteractingField)
    mInteractingField->setValue(1);

  // store old pos for delta mode
  mOldPos = SbVec2s(event->pos().x(), event->pos().y());



  event->accept();

  // Pass the QT mouse button event to open inventor
  SbTime time;
  time.setToTimeOfDay();
  SoMouseButtonEvent e;
  e.setTime(time);

  switch (event->button())
  {
  default:
  case Qt::LeftButton:    e.setButton(SoMouseButtonEvent::BUTTON1); break;
  case Qt::MidButton:        e.setButton(SoMouseButtonEvent::BUTTON2); break;
  case Qt::RightButton:    e.setButton(SoMouseButtonEvent::BUTTON3); break;
  }
  if (event->modifiers() & Qt::ShiftModifier)
    e.setShiftDown(TRUE);
  if (event->modifiers() & Qt::ControlModifier)
    e.setCtrlDown(TRUE);
  e.setState(SoButtonEvent::DOWN);
  e.setPosition(SbVec2s(event->pos().x(), mHeight - event->pos().y()));

  if (mSceneManager->processEvent(&e))
  {
    //processDelayQueue();
    //repaint();
    updateCursor(true);
  }
  else
  {
    updateCursor(false);
  }
}
开发者ID:ivowolf,项目名称:vtkIvPropProject,代码行数:43,代码来源:qCtkXipSGWidget.cpp

示例3: keyEvent

void QCtkXipSGWidget::keyEvent(QKeyEvent *event)
{

  // Pass the QtKeyEvent to open inventor
  SoKeyboardEvent e;
  SbTime time;
  time.setToTimeOfDay();
  e.setTime(time);

  if (event->modifiers() & Qt::ShiftModifier)
    e.setShiftDown(TRUE);
  if (event->modifiers() & Qt::ControlModifier)
    e.setCtrlDown(TRUE);
  if (event->modifiers() & Qt::AltModifier)
    e.setAltDown(TRUE);

  if(event->type() == QEvent::KeyPress)
    e.setState(SoButtonEvent::DOWN);
  else if(event->type() == QEvent::KeyRelease)
    e.setState(SoButtonEvent::UP);

  if(mQtInventorKeyMap.find((Qt::Key)event->key()) != mQtInventorKeyMap.end())
  {
    e.setKey(mQtInventorKeyMap[(Qt::Key)event->key()]);
  }
  if(mQtInventorKeyMap.find((Qt::Key)event->nativeVirtualKey()) != mQtInventorKeyMap.end())
  {
    e.setKey(mQtInventorKeyMap[(Qt::Key)event->nativeVirtualKey()]);
  }

  event->accept();

  if (mSceneManager->processEvent(&e))
  {
    //repaint();
    update();
  }
}
开发者ID:ivowolf,项目名称:vtkIvPropProject,代码行数:38,代码来源:qCtkXipSGWidget.cpp

示例4: mouseReleaseEvent

void QXipIvWidget::mouseReleaseEvent(QMouseEvent* event)
{
	event->accept();

	if (m_mouseMode == RESIZE_NONE)
	{
		SbTime time;
		time.setToTimeOfDay();
		SoMouseButtonEvent e;
		e.setTime(time);

		switch (event->button())
		{
		    default:
		    case Qt::LeftButton:	e.setButton(SoMouseButtonEvent::BUTTON1); break;
		    case Qt::MidButton:		e.setButton(SoMouseButtonEvent::BUTTON2); break;
		    case Qt::RightButton:	e.setButton(SoMouseButtonEvent::BUTTON3); break;
		}
		if (event->modifiers() & Qt::ShiftModifier) e.setShiftDown(TRUE);
		if (event->modifiers() & Qt::ControlModifier) e.setCtrlDown(TRUE);

		e.setState(SoButtonEvent::UP);
		e.setPosition(SbVec2s(event->pos().x(), m_height - event->pos().y()));

		if (m_sceneManager->processEvent(&e))
		{
			processDelayQueue();
			updateCursor(true);
		}
		else
		{
			updateCursor(false);
		}
	}

	m_mouseMode = RESIZE_NONE;
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:37,代码来源:QXipIvWidget.cpp

示例5: mouseMoveEvent

void QXipIvWidget::mouseMoveEvent(QMouseEvent* event)
{
	QWidget* pWidget = parentWidget()->parentWidget();

//    qDebug() << "QXipIvWidget::mouseMoveEvent";

	bool onResizeBorder = false;

	//if (!event->buttons())
	//{
	//	if ((event->pos().x() > (this->width() - 10)) || (event->pos().y() > (this->height() - 10)))
	//	{
	//		if ((event->pos().x() > (this->width() - 10)) || (event->pos().y() > (this->height() - 10)))
	//		{
	//			if ((event->pos().x() > (this->width() - 10)) && (event->pos().y() > (this->height() - 10)))
	//			{
	//				setCursor(Qt::SizeFDiagCursor);
	//				onResizeBorder = true;
	//			}
	//			else if (event->pos().x() > (this->width() - 10))
	//			{
	//				setCursor(Qt::SizeHorCursor);
	//				onResizeBorder = true;
	//			}
	//			else if (event->pos().y() > (this->height() - 10))
	//			{
	//				setCursor(Qt::SizeVerCursor);
	//				onResizeBorder = true;
	//			}
	//		}
	//	}
	//}

	switch (m_mouseMode)
	{
	case RESIZE_NONE:
		if (!onResizeBorder)
		{
			event->accept();

			SbTime time;
			time.setToTimeOfDay();
			SoLocation2Event e;
			e.setTime(time);
			if (event->modifiers() & Qt::ShiftModifier)
				e.setShiftDown(TRUE);
			if (event->modifiers() & Qt::ControlModifier)
				e.setCtrlDown(TRUE);
			e.setPosition(SbVec2s(event->pos().x(), m_height - event->pos().y()));
			if (m_sceneManager->processEvent(&e))
			{
				processDelayQueue();
				updateCursor(true);
			}
			else
			{
				updateCursor(false);
			}
		} break;
	case RESIZE_WIDTH:
		{
			pWidget->resize(mapTo(pWidget, event->pos()).x() + 3, pWidget->size().height());
			event->accept();
		} break;
	case RESIZE_HEIGHT:
		{
			pWidget->resize(pWidget->size().width(), mapTo(pWidget, event->pos()).y() + 3);
			event->accept();
		} break;
	case RESIZE_CORNER:
		{
			pWidget->resize(mapTo(pWidget, event->pos()).x() + 3, mapTo(pWidget, event->pos()).y() + 3);
			event->accept();
		} break;
	}
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:76,代码来源:QXipIvWidget.cpp

示例6: mousePressEvent

void QXipIvWidget::mousePressEvent(QMouseEvent* event)
{
	//m_mouseMode = RESIZE_NONE;
	//if ((event->pos().x() > (this->width() - 10)) || (event->pos().y() > (this->height() - 10)))
	//{
	//	//if ((event->pos().x() > (this->width() - 10)) || (event->pos().y() > (this->height() - 10)))
	//	{
	//		if ((event->pos().x() > (this->width() - 10)) && (event->pos().y() > (this->height() - 10)))
	//		{
	//			m_mouseMode = RESIZE_CORNER;

	//			setCursor(Qt::SizeFDiagCursor);
	//		}
	//		else if (event->pos().x() > (this->width() - 10))
	//		{
	//			m_mouseMode = RESIZE_WIDTH;

	//			setCursor(Qt::SizeHorCursor);
	//		}
	//		else if (event->pos().y() > (this->height() - 10))
	//		{
	//			m_mouseMode = RESIZE_HEIGHT;

	//			setCursor(Qt::SizeVerCursor);
	//		}
	//	}

	//	event->accept();

	//	return;
	//}

	event->accept();

    // Pass the QT mouse button event to open inventor
	SbTime time;
	time.setToTimeOfDay();
	SoMouseButtonEvent e;
	e.setTime(time);

	switch (event->button())
	{
	    default:
	        case Qt::LeftButton:	e.setButton(SoMouseButtonEvent::BUTTON1); break;
	        case Qt::MidButton:     e.setButton(SoMouseButtonEvent::BUTTON2); break;
            case Qt::RightButton:   emit mouseRightButtonPressed(); break;
	}
	if (event->modifiers() & Qt::ShiftModifier) 
        e.setShiftDown(TRUE);
	if (event->modifiers() & Qt::ControlModifier)
        e.setCtrlDown(TRUE);
	e.setState(SoButtonEvent::DOWN);
	e.setPosition(SbVec2s(event->pos().x(), m_height - event->pos().y()));

	if (m_sceneManager->processEvent(&e))
	{
		processDelayQueue();
		updateCursor(true);
	}
	else
	{
		updateCursor(false);
	}
}
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:64,代码来源:QXipIvWidget.cpp

示例7: mouseMoveEvent

void QCtkXipSGWidget::mouseMoveEvent(QMouseEvent *event)
{
  bool onResizeBorder = false;

  if (!event->buttons())
  {
    if ((event->pos().x() > (this->width() - 10)) || (event->pos().y() > (this->height() - 10)))
    {
      if ((event->pos().x() > (this->width() - 10)) || (event->pos().y() > (this->height() - 10)))
      {
        if ((event->pos().x() > (this->width() - 10)) && (event->pos().y() > (this->height() - 10)))
        {
          setCursor(Qt::SizeFDiagCursor);
          onResizeBorder = true;
        }
        else if (event->pos().x() > (this->width() - 10))
        {
          setCursor(Qt::SizeHorCursor);
          onResizeBorder = true;
        }
        else if (event->pos().y() > (this->height() - 10))
        {
          setCursor(Qt::SizeVerCursor);
          onResizeBorder = true;
        }
      }
    }
  }

  event->accept();

  SbTime time;
  time.setToTimeOfDay();

  // get mouse delta field
  //SoSFBool *deltaField = (SoSFBool *) SoDB::getGlobalField("MOUSE_DELTA_MODE");
  //if ( deltaField && deltaField->getValue() )
  //{


  if (mSceneManager && mIsSceneManagerActive) 
  {
    SbTime time;
    time.setToTimeOfDay();
    //SoLocation2Event event;
    //event.setTime(time);
    //if (event->modifiers() & Qt::ShiftModifier) 
    // event.setShiftDown(TRUE);
    //if (event->modifiers() & Qt::ControlModifier) 
    // event.setCtrlDown(TRUE);
    SbVec2s pos = SbVec2s(event->pos().x(),event->pos().y());
    //SbVec2s delta =  pos - mOldPos;
    //delta[1] = -delta[1];

    mOldPos = pos;
    SoLocation2Event e;
    e.setTime(time);
    if (event->modifiers() & Qt::ShiftModifier)
      e.setShiftDown(TRUE);
    if (event->modifiers() & Qt::ControlModifier)
      e.setCtrlDown(TRUE);

    e.setPosition(SbVec2s(event->pos().x(), mHeight - event->pos().y()));
    if (mSceneManager->processEvent(&e))
    {
      //processDelayQueue();
      //repaint();
      updateCursor(true);
    }
    else
    {
      updateCursor(false);
    }
  }


}
开发者ID:ivowolf,项目名称:vtkIvPropProject,代码行数:77,代码来源:qCtkXipSGWidget.cpp


注:本文中的SbTime::setToTimeOfDay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。