• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setCurrentTool函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setCurrentTool函数的典型用法代码示例。如果您正苦于以下问题:C++ setCurrentTool函数的具体用法?C++ setCurrentTool怎么用?C++ setCurrentTool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: setCurrentTool

BOOL LLToolCompGun::handleHover(S32 x, S32 y, MASK mask)
{
	// *NOTE: This hack is here to make mouselook kick in again after
	// item selected from context menu.
	if ( mCur == mNull && !gPopupMenuView->getVisible() )
	{
		LLSelectMgr::getInstance()->deselectAll();
		setCurrentTool( (LLTool*) mGrab );
	}

	// Note: if the tool changed, we can't delegate the current mouse event
	// after the change because tools can modify the mouse during selection and deselection.
	// Instead we let the current tool handle the event and then make the change.
	// The new tool will take effect on the next frame.

	mCur->handleHover( x, y, mask );

	// If mouse button not down...
	if( !gViewerWindow->getLeftMouseDown())
	{
		// let ALT switch from gun to grab
		if ( mCur == mGun && (mask & MASK_ALT) )
		{
			setCurrentTool( (LLTool*) mGrab );
		}
		else if ( mCur == mGrab && !(mask & MASK_ALT) )
		{
			setCurrentTool( (LLTool*) mGun );
			setMouseCapture(TRUE);
		}
	}

	return TRUE; 
}
开发者ID:Barosonix,项目名称:AstraViewer,代码行数:34,代码来源:lltoolcomp.cpp


示例2: QMainWindow

MainWindow2::MainWindow2( QWidget *parent ) :
QMainWindow( parent ),
ui( new Ui::MainWindow2 )
{
    ui->setupUi( this );
    
    m_object = new Object();
    m_object->defaultInitialisation();

    editor = new Editor( this );
    m_pScribbleArea = editor->getScribbleArea();
    m_pTimeLine = new TimeLine( this, editor );
    makeTimeLineConnections();

    arrangePalettes();
    createMenus();
    loadAllShortcuts();

    // must run after 'arragePalettes'
    editor->setObject( m_object );
    editor->resetUI();

    readSettings();

    makeColorPaletteConnections();
	makeColorWheelConnections();

    connect(editor, SIGNAL(needSave()), this, SLOT(saveDocument()));
    connect(m_pToolSet, SIGNAL(clearButtonClicked()), editor, SLOT(clearCurrentFrame()));
    connect(editor, SIGNAL(changeTool(ToolType)), m_pToolSet, SLOT(setCurrentTool(ToolType)));

    editor->setCurrentLayer( this->editor->m_pObject->getLayerCount() - 1 );
}
开发者ID:Verlet,项目名称:pencil,代码行数:33,代码来源:mainwindow2.cpp


示例3: mBaseTool

LLToolMgr::LLToolMgr()
	:
	mBaseTool(NULL), 
	mSavedTool(NULL),
	mTransientTool( NULL ),
	mOverrideTool( NULL ),
	mSelectedTool( NULL ),
	mCurrentToolset( NULL )
{
	// Not a panel, register these callbacks globally.
	LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Active", boost::bind(&LLToolMgr::inEdit, this));
//	LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&LLToolMgr::canEdit, this));
// [RLVa:KB] - Checked: 2010-09-11 (RLVa-1.2.1d) | Added: RLVa-1.2.1d | Ansa: Changed because of FIRE-5552
	LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&RlvUIEnabler::isBuildEnabled));
// [/RLVa:KB]
	LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this, _2));
	
	gToolNull = new LLTool(LLStringUtil::null);  // Does nothing
	setCurrentTool(gToolNull);

	gBasicToolset		= new LLToolset();
	gCameraToolset		= new LLToolset();
//	gLandToolset		= new LLToolset();
	gMouselookToolset	= new LLToolset();
	gFaceEditToolset	= new LLToolset();
	gMouselookToolset->setShowFloaterTools(false);
	gFaceEditToolset->setShowFloaterTools(false);
}
开发者ID:gabeharms,项目名称:firestorm,代码行数:28,代码来源:lltoolmgr.cpp


示例4: AbstractViewInspector

QDeclarativeViewInspector::QDeclarativeViewInspector(QDeclarativeView *view,
                                                   QObject *parent) :
    AbstractViewInspector(parent),
    data(new QDeclarativeViewInspectorPrivate(this))
{
    data->view = view;
    data->manipulatorLayer = new LiveLayerItem(view->scene());
    data->selectionTool = new LiveSelectionTool(this);
    data->zoomTool = new ZoomTool(this);
    data->colorPickerTool = new ColorPickerTool(this);
    data->boundingRectHighlighter = new BoundingRectHighlighter(this);
    setCurrentTool(data->selectionTool);

    // to capture ChildRemoved event when viewport changes
    data->view->installEventFilter(this);

    data->setViewport(data->view->viewport());

    connect(data->view, SIGNAL(statusChanged(QDeclarativeView::Status)),
            data.data(), SLOT(_q_onStatusChanged(QDeclarativeView::Status)));

    connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)),
            SIGNAL(selectedColorChanged(QColor)));
    connect(data->colorPickerTool, SIGNAL(selectedColorChanged(QColor)),
            this, SLOT(sendColorChanged(QColor)));

    changeTool(InspectorProtocol::SelectTool);
}
开发者ID:wpbest,项目名称:copperspice,代码行数:28,代码来源:qdeclarativeviewinspector.cpp


示例5: setCurrentTool

void LLToolCompInspect::keyUp(KEY key, MASK mask)
{
	if (KEY_ALT == key && mCur == LLToolCamera::getInstance())
	{
		setCurrentTool(mDefault);
		mIsToolCameraActive = FALSE;
	}
}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:8,代码来源:lltoolcomp.cpp


示例6: LLToolComposite

LLToolCompGun::LLToolCompGun()
	: LLToolComposite(std::string("Mouselook"))
{
	mGun = new LLToolGun(this);
	mGrab = new LLToolGrab(this);
	mNull = sNullTool;

	setCurrentTool(mGun);
	mDefault = mGun;
}
开发者ID:Barosonix,项目名称:AstraViewer,代码行数:10,代码来源:lltoolcomp.cpp


示例7: setCurrentTool

void LLToolCompGun::onMouseCaptureLost()
{
	if (mComposite)
	{
		mComposite->onMouseCaptureLost();
		return;
	}
	mCur->onMouseCaptureLost();

	// JC - I don't know if this is necessary.  Maybe we could lose capture
	// if someone ALT-Tab's out when in mouselook.
	setCurrentTool( (LLTool*) mGun );
}
开发者ID:Boy,项目名称:rainbow,代码行数:13,代码来源:lltoolcomp.cpp


示例8: LLToolComposite

LLToolCompGun::LLToolCompGun()
	: LLToolComposite(std::string("Mouselook"))
	, mMenuShown(false), mTimerFOV(), mOriginalFOV(), mStartFOV(), mTargetFOV()
{
	mGun = new LLToolGun(this);
	mGrab = new LLToolGrab(this);
	mNull = sNullTool;

	setCurrentTool(mGun);
	mDefault = mGun;

	mTimerFOV.stop();
}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:13,代码来源:lltoolcomp.cpp


示例9: viewport

void QgsComposerView::keyReleaseEvent( QKeyEvent * e )
{
  if ( e->key() == Qt::Key_Space && !e->isAutoRepeat() && mPanning )
  {
    //end of panning with space key
    mPanning = false;

    //reset cursor
    if ( mCurrentTool == Pan )
    {
      viewport()->setCursor( Qt::OpenHandCursor );
    }
    else
    {
      if ( composition() )
      {
        //allow cursor changes again
        composition()->setPreventCursorChange( false );
      }
      viewport()->setCursor( Qt::ArrowCursor );
    }
    return;
  }
  else if ( e->key() == Qt::Key_Space && !e->isAutoRepeat() && mTemporaryZoomStatus != QgsComposerView::Inactive )
  {
    //temporary keyboard-based zoom tool is active and space key has been released
    if ( mMarqueeZoom )
    {
      //currently in the middle of a marquee operation, so don't switch tool back immediately
      //instead, wait until mouse button has been released before switching tool back
      mTemporaryZoomStatus = QgsComposerView::ActiveUntilMouseRelease;
    }
    else
    {
      //switch tool back
      mTemporaryZoomStatus = QgsComposerView::Inactive;
      setCurrentTool( mPreviousTool );
    }
  }
  else if ( mCurrentTool == QgsComposerView::Zoom )
  {
    //if zoom tool is active, respond to changes in the shift key status and update cursor accordingly
    if ( ! e->isAutoRepeat() )
    {
      QPixmap myZoomQPixmap = QPixmap(( const char ** )( e->modifiers() & Qt::ShiftModifier ? zoom_out : zoom_in ) );
      QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
      viewport()->setCursor( zoomCursor );
    }
    return;
  }
}
开发者ID:kiith-sa,项目名称:QGIS,代码行数:51,代码来源:qgscomposerview.cpp


示例10: mBaseTool

LLToolMgr::LLToolMgr()
	:
	mBaseTool(NULL), 
	mSavedTool(NULL),
	mTransientTool( NULL ),
	mOverrideTool( NULL ),
	mSelectedTool( NULL ),
	mCurrentToolset( NULL )
{
	gToolNull = new LLTool(LLStringUtil::null);  // Does nothing
	setCurrentTool(gToolNull);

	gBasicToolset		= new LLToolset();
	gCameraToolset		= new LLToolset();
//	gLandToolset		= new LLToolset();
	gMouselookToolset	= new LLToolset();
	gFaceEditToolset	= new LLToolset();
}
开发者ID:meta7,项目名称:Meta7-Viewer,代码行数:18,代码来源:lltoolmgr.cpp


示例11: setCurrentTool

void LLToolMgr::setCurrentToolset(LLToolset* current)
{
	if (!current) return;

	// switching toolsets?
	if (current != mCurrentToolset)
	{
		// deselect current tool
		if (mSelectedTool)
		{
			mSelectedTool->handleDeselect();
		}
		mCurrentToolset = current;
		// select first tool of new toolset only if toolset changed
		mCurrentToolset->selectFirstTool();
	}
	// update current tool based on new toolset
	setCurrentTool( mCurrentToolset->getSelectedTool() );
}
开发者ID:meta7,项目名称:Meta7-Viewer,代码行数:19,代码来源:lltoolmgr.cpp


示例12: mBaseTool

LLToolMgr::LLToolMgr()
	:
	mBaseTool(NULL), 
	mSavedTool(NULL),
	mTransientTool( NULL ),
	mOverrideTool( NULL ),
	mSelectedTool( NULL ),
	mCurrentToolset( NULL )
{
	gToolNull = new LLTool(LLStringUtil::null);  // Does nothing
	setCurrentTool(gToolNull);

	gBasicToolset		= new LLToolset("Basic");
	gCameraToolset		= new LLToolset("Camera");
//	gLandToolset		= new LLToolset("Land");
	gMouselookToolset	= new LLToolset("MouseLook");
	gFaceEditToolset	= new LLToolset("FaceEdit");
	gMouselookToolset->setShowFloaterTools(false);
	gFaceEditToolset->setShowFloaterTools(false);
}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:20,代码来源:lltoolmgr.cpp


示例13: switch

void SGViewInspector::changeTool(InspectorProtocol::Tool tool)
{
    switch (tool) {
    case InspectorProtocol::ColorPickerTool:
        // TODO
        emit colorPickerActivated();
        break;
    case InspectorProtocol::SelectMarqueeTool:
        // TODO
        emit marqueeSelectToolActivated();
        break;
    case InspectorProtocol::SelectTool:
        setCurrentTool(m_selectionTool);
        emit selectToolActivated();
        break;
    case InspectorProtocol::ZoomTool:
        // TODO
        emit zoomToolActivated();
        break;
    }
}
开发者ID:yinyunqiao,项目名称:qtdeclarative,代码行数:21,代码来源:sgviewinspector.cpp


示例14: viewportRect

void QgsComposerView::endMarqueeZoom( QMouseEvent* e )
{
  mMarqueeZoom = false;

  QRectF boundsRect;

  if ( !mRubberBandItem || ( mRubberBandItem->rect().width() < 0.1 && mRubberBandItem->rect().height() < 0.1 ) )
  {
    //just a click, so zoom to clicked point and recenter
    double scaleFactor = 0.5;
    //get current visible part of scene
    QRect viewportRect( 0, 0, viewport()->width(), viewport()->height() );
    QgsRectangle visibleRect = QgsRectangle( mapToScene( viewportRect ).boundingRect() );

    //transform the mouse pos to scene coordinates
    QPointF scenePoint = mapToScene( e->pos() );

    visibleRect.scale( scaleFactor, scenePoint.x(), scenePoint.y() );
    boundsRect = visibleRect.toRectF();
  }
  else
  {
    //marquee zoom
    //zoom bounds are size marquee object
    boundsRect = QRectF( mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(),
                         mRubberBandItem->rect().width(), mRubberBandItem->rect().height() );
  }

  removeRubberBand();
  //zoom view to fit desired bounds
  fitInView( boundsRect, Qt::KeepAspectRatio );

  if ( mTemporaryZoomStatus == QgsComposerView::ActiveUntilMouseRelease )
  {
    //user was using the temporary keyboard activated zoom tool
    //and the control or space key was released before mouse button, so end temporary zoom
    mTemporaryZoomStatus = QgsComposerView::Inactive;
    setCurrentTool( mPreviousTool );
  }
}
开发者ID:kiith-sa,项目名称:QGIS,代码行数:40,代码来源:qgscomposerview.cpp


示例15: mBaseTool

LLToolMgr::LLToolMgr()
	:
	mBaseTool(NULL), 
	mSavedTool(NULL),
	mTransientTool( NULL ),
	mOverrideTool( NULL ),
	mSelectedTool( NULL ),
	mCurrentToolset( NULL )
{
	// Not a panel, register these callbacks globally.
	LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Active", boost::bind(&LLToolMgr::inEdit, this));
	LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&LLToolMgr::canEdit, this));
	LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this));
	
	gToolNull = new LLTool(LLStringUtil::null);  // Does nothing
	setCurrentTool(gToolNull);

	gBasicToolset		= new LLToolset();
	gCameraToolset		= new LLToolset();
//	gLandToolset		= new LLToolset();
	gMouselookToolset	= new LLToolset();
	gFaceEditToolset	= new LLToolset();
}
开发者ID:HyangZhao,项目名称:NaCl-main,代码行数:23,代码来源:lltoolmgr.cpp


示例16: mapToScene

void QgsComposerView::pasteItems( PasteMode mode )
{
  if ( !composition() )
  {
    return;
  }

  QDomDocument doc;
  QClipboard *clipboard = QApplication::clipboard();
  if ( doc.setContent( clipboard->mimeData()->data( "text/xml" ) ) )
  {
    QDomElement docElem = doc.documentElement();
    if ( docElem.tagName() == "ComposerItemClipboard" )
    {
      if ( composition() )
      {
        QPointF pt;
        if ( mode == QgsComposerView::PasteModeCursor || mode == QgsComposerView::PasteModeInPlace )
        {
          // place items at cursor position
          pt = mapToScene( mapFromGlobal( QCursor::pos() ) );
        }
        else
        {
          // place items in center of viewport
          pt = mapToScene( viewport()->rect().center() );
        }
        bool pasteInPlace = ( mode == PasteModeInPlace );
        composition()->addItemsFromXML( docElem, doc, 0, true, &pt, pasteInPlace );
      }
    }
  }

  //switch back to select tool so that pasted items can be moved/resized (#8958)
  setCurrentTool( QgsComposerView::Select );
}
开发者ID:kiith-sa,项目名称:QGIS,代码行数:36,代码来源:qgscomposerview.cpp


示例17: setCurrentTool

void ToolManager::onActionTriggered(QAction *action)
{
	setCurrentTool(_actionHash[action]);
}
开发者ID:h2so5,项目名称:PaintField,代码行数:4,代码来源:toolmanager.cpp


示例18: setCurrentTool

void QgsComposerView::keyPressEvent( QKeyEvent * e )
{
  if ( !composition() )
  {
    return;
  }

  if ( mPanning )
    return;

  if ( mTemporaryZoomStatus != QgsComposerView::Inactive )
  {
    //temporary keyboard based zoom is active
    if ( e->isAutoRepeat() )
    {
      return;
    }

    //respond to changes in ctrl key status
    if ( !( e->modifiers() & Qt::ControlModifier ) && !mMarqueeZoom )
    {
      //space pressed, but control key was released, end of temporary zoom tool
      mTemporaryZoomStatus = QgsComposerView::Inactive;
      setCurrentTool( mPreviousTool );
    }
    else if ( !( e->modifiers() & Qt::ControlModifier ) && mMarqueeZoom )
    {
      //control key released, but user is mid-way through a marquee zoom
      //so end temporary zoom when user releases the mouse button
      mTemporaryZoomStatus = QgsComposerView::ActiveUntilMouseRelease;
    }
    else
    {
      //both control and space pressed
      //set cursor to zoom in/out depending on shift key status
      QPixmap myZoomQPixmap = QPixmap(( const char ** )( e->modifiers() & Qt::ShiftModifier ? zoom_out : zoom_in ) );
      QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
      viewport()->setCursor( zoomCursor );
    }
    return;
  }

  if ( e->key() == Qt::Key_Space && ! e->isAutoRepeat() )
  {
    if ( !( e->modifiers() & Qt::ControlModifier ) )
    {
      // Pan composer with space bar
      mPanning = true;
      mMouseLastXY = mMouseCurrentXY;
      if ( composition() )
      {
        //prevent cursor changes while panning
        composition()->setPreventCursorChange( true );
      }
      viewport()->setCursor( Qt::ClosedHandCursor );
      return;
    }
    else
    {
      //ctrl+space pressed, so switch to temporary keyboard based zoom tool
      mTemporaryZoomStatus = QgsComposerView::Active;
      mPreviousTool = mCurrentTool;
      setCurrentTool( Zoom );
      //set cursor to zoom in/out depending on shift key status
      QPixmap myZoomQPixmap = QPixmap(( const char ** )( e->modifiers() & Qt::ShiftModifier ? zoom_out : zoom_in ) );
      QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
      viewport()->setCursor( zoomCursor );
      return;
    }
  }

  if ( mCurrentTool == QgsComposerView::Zoom )
  {
    //using the zoom tool, respond to changes in shift key status and update mouse cursor accordingly
    if ( ! e->isAutoRepeat() )
    {
      QPixmap myZoomQPixmap = QPixmap(( const char ** )( e->modifiers() & Qt::ShiftModifier ? zoom_out : zoom_in ) );
      QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
      viewport()->setCursor( zoomCursor );
    }
    return;
  }

  QList<QgsComposerItem*> composerItemList = composition()->selectedComposerItems();
  QList<QgsComposerItem*>::iterator itemIt = composerItemList.begin();

  // increment used for cursor key item movement
  double increment = 1.0;
  if ( e->modifiers() & Qt::ShiftModifier )
  {
    //holding shift while pressing cursor keys results in a big step
    increment = 10.0;
  }

  if ( e->key() == Qt::Key_Left )
  {
    for ( ; itemIt != composerItemList.end(); ++itemIt )
    {
      ( *itemIt )->beginCommand( tr( "Item moved" ), QgsComposerMergeCommand::ItemMove );
      ( *itemIt )->move( -1 * increment, 0.0 );
//.........这里部分代码省略.........
开发者ID:kiith-sa,项目名称:QGIS,代码行数:101,代码来源:qgscomposerview.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setCurrentVictim函数代码示例发布时间:2022-05-30
下一篇:
C++ setCurrentThreadName函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap