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


C++ QCursor::setShape方法代码示例

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


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

示例1: mouseMoveEvent

void Preview::mouseMoveEvent( QMouseEvent* e )
{
	e;
	QCursor c = cursor();
	QPoint mapFromGlobal = this->mapFromGlobal( c.pos() );
	if ( GetAsyncKeyState( VK_LBUTTON ) < 0 && mapFromGlobal.x() >= 0 && mapFromGlobal.x() <= width() &&
		 mapFromGlobal.y() >= 0 && mapFromGlobal.y() <= height() && MouseInput::globalMouseInput.oldMousePosition != glm::vec2( c.pos().x() , c.pos().y() ) )
	{
		if ( !MouseInput::globalMouseInput.getDeltaTracking() )MouseInput::globalMouseInput.setDeltaTracking( true );
		glm::vec2 oldPos = MouseInput::globalMouseInput.oldMousePosition;
		MouseInput::globalMouseInput.updateMousePosition( glm::vec2( c.pos().x() , c.pos().y() ) );
		
		c.setPos( QPoint( oldPos.x , oldPos.y ) );
		c.setShape( Qt::BlankCursor );
	}
	else if ( MouseInput::globalMouseInput.oldMousePosition != glm::vec2( c.pos().x() , c.pos().y() ) )
	{
		c.setShape( Qt::ArrowCursor );
		if ( MouseInput::globalMouseInput.getDeltaTracking() )MouseInput::globalMouseInput.setDeltaTracking( false );
		MouseInput::globalMouseInput.oldMousePosition = glm::vec2( c.pos().x() , c.pos().y() );
		MouseInput::globalMouseInput.updateMousePosition( glm::vec2( c.pos().x() , c.pos().y() ) );
	}
	clearFocus();
	setCursor( c );
	setFocus();
}
开发者ID:pokelege,项目名称:PokEngine_Source,代码行数:26,代码来源:Preview.cpp

示例2: updateCursor

void GLWidget::updateCursor()
{
    QCursor cursor = this->cursor();
    cursor.setShape(Qt::ArrowCursor);
    if(leftMouseButtonMode == ROTATE)
    {
        cursor.setShape(Qt::SizeAllCursor);
    }
    else if(leftMouseButtonMode == PANNING)
    {
        cursor.setShape(Qt::SizeAllCursor);
    }
    QWidget::setCursor(cursor);
}
开发者ID:cravesoft,项目名称:stlviewer,代码行数:14,代码来源:glwidget.cpp

示例3: ShowCursor

void OpenGLWindow::ShowCursor()
{
	cursorClip = false;
	QCursor c = cursor();
	c.setShape(Qt::ArrowCursor);
	setCursor(c);
}
开发者ID:ReDEnergy,项目名称:3DSound-Prototypying,代码行数:7,代码来源:OpenGLWindow.cpp

示例4: wireSlot

void CircuitsWidget::wireSlot(int, Component *c) {
	QCursor cr;
	cr.setShape(Qt::CrossCursor);
	setCursor(cr);
	connectingComponent = true;
	componentOnConnection = c;
}
开发者ID:danfloyd111,项目名称:circuits,代码行数:7,代码来源:circuitsWidget.cpp

示例5: showRubberFeature

void QgsSpatialQueryDialog::showRubberFeature( QgsVectorLayer* lyr, QgsFeatureId id )
{
  mRubberSelectId->reset();

  Qt::CursorShape shapeCurrent = cursor().shape();

  QCursor c;
  c.setShape( Qt::WaitCursor );
  setCursor( c );

  mRubberSelectId->addFeature( lyr, id );
  mRubberSelectId->show();

  c.setShape( shapeCurrent );
  setCursor( c );
} // void QgsSpatialQueryDialog::showRubberFeature( QgsVectorLayer* lyr, int id )
开发者ID:AaronGaim,项目名称:QGIS,代码行数:16,代码来源:qgsspatialquerydialog.cpp

示例6: HideCursor

void OpenGLWindow::HideCursor()
{
	skipClipFrame = true;
	cursorClip = true;
	QCursor c = cursor();
	c.setShape(Qt::BlankCursor);
	setCursor(c);
}
开发者ID:ReDEnergy,项目名称:3DSound-Prototypying,代码行数:8,代码来源:OpenGLWindow.cpp

示例7: on_zoomToolButton_toggled

void VisualizationWidget::on_zoomToolButton_toggled( bool checked )
{
	if (checked)
	{
		vtkSmartPointer<vtkInteractorStyleRubberBandZoom> interactorStyle =
		        vtkSmartPointer<vtkInteractorStyleRubberBandZoom>::New();
		vtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(interactorStyle);
		QCursor cursor;
		cursor.setShape(Qt::CrossCursor);
		vtkWidget->setCursor(cursor);
	}
	else
	{
		vtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(_interactorStyle);
		QCursor cursor;
		cursor.setShape(Qt::ArrowCursor);
		vtkWidget->setCursor(cursor);
	}
}
开发者ID:LEONOB2014,项目名称:ogs,代码行数:19,代码来源:VisualizationWidget.cpp

示例8:

void GL_insert_ball_layer_2::keyPressEvent(QKeyEvent *e) {
	switch (e->key()) {
		case Qt::Key_Control:
//			widget->cursor()->setShape(Qt::CrossCursor);
			QCursor c = widget->get_default_cursor();
			c.setShape(Qt::CrossCursor);
			widget->setCursor(c);
			break;
	}
}
开发者ID:ialhashim,项目名称:mesecina2d,代码行数:10,代码来源:GL_insert_ball_layer_2.cpp

示例9: smooth_zoom

void GL_navigate_layer_2::mouseReleaseEvent(QMouseEvent *e) {
	switch (s) {
		case PAN:
			s = NONE;
			break;
		case ZOOM:
			s = NONE;
			break;
		case ZOOM_RECT:
			rubber_band->hide();
			delete rubber_band;
			rubber_band = 0;
			widget->repaintGL();

			if((e->x() != first_x) && (e->y() != first_y)) {
				double x, y, xfirst2, yfirst2;
				x = widget->x_real(e->x());
				y = widget->y_real(e->y());
				xfirst2 = widget->x_real(first_x);
				yfirst2 = widget->y_real(first_y);

				double	xmin, xmax, ymin, ymax;
				if(x < xfirst2) {xmin = x; xmax = xfirst2;}
				else {xmin = xfirst2; xmax = x;};
				if(y < yfirst2) {ymin = y; ymax = yfirst2;}
				else {ymin = yfirst2; ymax = y;};

				if (is_alt(e)) widget->set_window(xmin, xmax, ymin, ymax);
				else smooth_zoom(xmin, xmax, ymin, ymax);
			} else if (widget->has_boundingbox()) {
				// jump to bounding box
				double x_min = widget->get_bounding_xmin();
				double x_max = widget->get_bounding_xmax();
				double y_min = widget->get_bounding_ymin();
				double y_max = widget->get_bounding_ymax();
				if (x_min != x_max && y_min != y_max)	{
					double margin_percent= BOUNDING_BOX_MARGIN_PERCENT;
					double x_margin = (x_max - x_min) * margin_percent;
					double y_margin = (y_max - y_min) * margin_percent;
					x_min -= x_margin;	x_max += x_margin;
					y_min -= y_margin;	y_max += y_margin;
					if (is_alt(e)) widget->set_window(x_min, x_max, y_min, y_max);
					else smooth_zoom(x_min, x_max, y_min, y_max);
				}
			}
			s = NONE;
			break;
	}
	if (is_pure(e) || is_alt(e) || is_shift(e)) widget->setCursor(QCursor( QPixmap( (const char**)hand_xpm)));
	else {
			QCursor c = widget->get_default_cursor();
			c.setShape(Qt::CrossCursor);
			widget->setCursor(c);
	}
}
开发者ID:UhtredBosch,项目名称:mesecina,代码行数:55,代码来源:GL_navigate_layer_2.cpp

示例10: setPickingType

void CSceneGraph::setPickingType(PICKING_TYPE_ID itype)
{
	m_nPickingType = itype;		//0: polyobj, 1: face, 2: line
	QCursor cursor;
	switch(m_nPickingType){
	case CSceneGraph::PICK_OBJECT:
		cursor.setShape(Qt::PointingHandCursor);
		break;
	case CSceneGraph::PICK_FACE:
		cursor.setShape(Qt::SizeAllCursor);
		break;
	case CSceneGraph::PICK_LINE:
		cursor.setShape(Qt::CrossCursor);
		break;
	default:
		cursor.setShape(Qt::ArrowCursor);
		break;
	}
	emit pickingCursorChanged(&cursor);
}
开发者ID:nanzhang790,项目名称:View3dn,代码行数:20,代码来源:scenegraph.cpp

示例11: mousePressEvent

void GLWidget::mousePressEvent(QMouseEvent *event)
{
    lastPos = event->pos();
    QCursor cursor = this->cursor();
    if(leftMouseButtonMode == ROTATE)
    {
        cursor.setShape(Qt::SizeAllCursor);
    }
    if(leftMouseButtonMode == PANNING)
    {
        cursor.setShape(Qt::SizeAllCursor);
    }
    if(event->buttons() & Qt::RightButton)
    {
        cursor.setShape(Qt::SizeAllCursor);
    }
    else if(event->buttons() & Qt::MidButton)
    {
        cursor.setShape(Qt::SizeAllCursor);
    }
    QWidget::setCursor(cursor);
}
开发者ID:cravesoft,项目名称:stlviewer,代码行数:22,代码来源:glwidget.cpp

示例12: mouseReleaseEvent

void OpenGLWindow::mouseReleaseEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton)
    {
        QCursor c = cursor();
        c.setShape(Qt::OpenHandCursor);
        setCursor(c);

        leftButton = false;

    }

    event->accept();
}
开发者ID:flair2005,项目名称:WebCamCap,代码行数:14,代码来源:openglwindow.cpp

示例13: initializeGL

void Preview::initializeGL()
{
	CommonGraphicsCommands::initializeGlobalGraphics();
	GameObjectManager::globalGameObjectManager.initialize();
	std::string err;
	ShaderInfo* shader = GraphicsShaderManager::globalShaderManager.createShaderInfo( FileReader( "assets/shaders/VertexShader.glsl" ).c_str() , FileReader( "assets/shaders/FragmentShader.glsl" ).c_str() , &err );
	std::cout << err.c_str() << std::endl;

	renderable = GraphicsRenderingManager::globalRenderingManager.addRenderable();
	renderable->geometryInfo = 0;
	renderable->shaderInfo = shader;
	renderable->culling = CT_BACK;
	renderable->depthTestEnabled = true;
	renderable->sharedUniforms = &GraphicsSharedUniformManager::globalSharedUniformManager;
	renderable->initialize( 10 , 1 );

	colorTexture = GraphicsTextureManager::globalTextureManager.addTexture( 0 , 0 , 0 , 0 );
	renderable->addTexture( colorTexture );

	GameObject* previewModel = GameObjectManager::globalGameObjectManager.addGameObject();
	previewModel->addComponent( renderable );
	
	animation = new AnimationRenderingInfo;
	previewModel->addComponent( animation );

	Camera* camera = GraphicsCameraManager::globalCameraManager.addCamera();
	camera->direction = glm::normalize( glm::vec3( -1 , 0 , -1 ) );
	camera->initializeRenderManagers();
	camera->nearestObject = 0.01f;
	camera->addRenderList( &GraphicsRenderingManager::globalRenderingManager );
	fpsInput = new FirstPersonCameraInput;
	fpsInput->moveSensitivity = 1;
	fpsInput->rotationSensitivity = 0.1f;
	GameObject* cameraMan = GameObjectManager::globalGameObjectManager.addGameObject();
	cameraMan->translate = glm::vec3( 6 , 5 , 15 );
	cameraMan->addComponent( camera );
	cameraMan->addComponent( fpsInput );

	MouseInput::globalMouseInput.updateOldMousePosition = false;

	setMouseTracking( true );
	QCursor c = cursor();
	c.setPos( mapToGlobal( QPoint( width() / 2 , height() / 2 ) ) );
	c.setShape( Qt::BlankCursor );
	setCursor( c );
	MouseInput::globalMouseInput.updateMousePosition( glm::vec2( width() / 2 , height() / 2 ) );
	timer = new QTimer();
	connect( timer , SIGNAL( timeout() ) , this , SLOT( update() ) );
	timer->start( 0 );
}
开发者ID:pokelege,项目名称:PokEngine_Source,代码行数:50,代码来源:Preview.cpp

示例14: mousePressEvent

void OpenGLWindow::mousePressEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton)
    {
        QCursor c = cursor();
        c.setShape(Qt::DragMoveCursor);
        setCursor(c);

        leftButton = true;
        currentMousePos.x = event->x();
        currentMousePos.y = event->y();
    }

    event->accept();
}
开发者ID:flair2005,项目名称:WebCamCap,代码行数:15,代码来源:openglwindow.cpp

示例15: mousePressEvent

void GameView::mousePressEvent(QMouseEvent*)
{
	if (m_editor->isGameMode())
	{
		setFocus();
		setMouseTracking(true);
		grabMouse();
		grabKeyboard();
		QCursor c = cursor();
		c.setPos(mapToGlobal(QPoint(width() / 2, height() / 2)));
		c.setShape(Qt::BlankCursor);
		setCursor(c);
		m_editor->getEngine().getInputSystem().enable(true);
		m_isInputHandling = true;
	}
}
开发者ID:gamedevforks,项目名称:LumixEngine,代码行数:16,代码来源:gameview.cpp


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