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

C++ drag函数代码示例

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

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



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

示例1: Q_D

void QDeclarative1MouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
    Q_D(QDeclarative1MouseArea);
    d->moved = false;
    d->stealMouse = d->preventStealing;
    if (!d->absorb)
        QDeclarativeItem::mousePressEvent(event);
    else {
        d->longPress = false;
        d->saveEvent(event);
        if (d->drag) {
            d->dragX = drag()->axis() & QDeclarative1Drag::XAxis;
            d->dragY = drag()->axis() & QDeclarative1Drag::YAxis;
        }
        if (d->drag)
            d->drag->setActive(false);
        setHovered(true);
        d->startScene = event->scenePos();
        // we should only start timer if pressAndHold is connected to.
        if (d->isPressAndHoldConnected())
            d->pressAndHoldTimer.start(PressAndHoldDelay, this);
        setKeepMouseGrab(d->stealMouse);
        event->setAccepted(setPressed(true));
    }
}
开发者ID:yinyunqiao,项目名称:qtdeclarative,代码行数:25,代码来源:qdeclarativemousearea.cpp


示例2: ofSetColor

//--------------------------------------------------------------
void ofApp::draw(){
    ofSetColor(0, 0, 0);
    ofNoFill();
    drag(segments[0], mouseX, mouseY);
    for(int i=1; i<numSegments; i++){
        Segment* segmentA = segments[i];
        Segment* segmentB = segments[i - 1];
        drag(segmentA, segmentB->x, segmentB->y);
    }
    for(int i=0; i<numSegments; i++){
        segments[i]->update();
    }
}
开发者ID:AlexanderMazaletskiy,项目名称:oF_motion,代码行数:14,代码来源:ofApp.cpp


示例3: drag

void IKLine::nextFrame(ci::Vec2f toPosition, float damping)
{
	oldX += (toPosition.x - oldX) * damping;
	oldY += (toPosition.y - oldY) * damping;
	
	drag( _segments[0], oldX, oldY);
	
	for (int i = 1; i < segmentNum; i++)
	{
		Segment* segmentA = _segments[i];
		Segment* segmentB = _segments[i-1];
		drag( segmentA, segmentB->x, segmentB->y );
	}
}
开发者ID:eighteight,项目名称:CinderEight,代码行数:14,代码来源:IKLine.cpp


示例4: topLevelAt

void QSimpleDrag::move(const QMouseEvent *me)
{
    QBasicDrag::move(me);
    QWindow *window = topLevelAt(me->globalPos());
    if (!window)
        return;

    const QPoint pos = me->globalPos() - window->geometry().topLeft();
    const QPlatformDragQtResponse qt_response =
        QWindowSystemInterface::handleDrag(window, drag()->mimeData(), pos, drag()->supportedActions());

    updateCursor(qt_response.acceptedAction());
    setCanDrop(qt_response.isAccepted());
}
开发者ID:AlexSoehn,项目名称:qt-base-deb,代码行数:14,代码来源:qsimpledrag.cpp


示例5: moveShapedPixmapWindow

void QSimpleDrag::move(const QPoint &globalPos)
{
    //### not high-DPI aware
    moveShapedPixmapWindow(globalPos);
    QWindow *window = topLevelAt(globalPos);
    if (!window)
        return;

    const QPoint pos = globalPos - window->geometry().topLeft();
    const QPlatformDragQtResponse qt_response =
        QWindowSystemInterface::handleDrag(window, drag()->mimeData(), pos, drag()->supportedActions());

    updateCursor(qt_response.acceptedAction());
    setCanDrop(qt_response.isAccepted());
}
开发者ID:OniLink,项目名称:Qt5-Rehost,代码行数:15,代码来源:qsimpledrag.cpp


示例6: clear_selection

void ViewWidget::mouse_left_press_event(QMouseEvent *event)
{
	(void)event;

	const bool ctrl_pressed =
		QApplication::keyboardModifiers() & Qt::ControlModifier;

	// Clear selection if control is not pressed and this item is unselected
	if ((!mouse_down_item_ || !mouse_down_item_->selected()) &&
		!ctrl_pressed)
		clear_selection();

	// Set the signal selection state if the item has been clicked
	if (mouse_down_item_) {
		if (ctrl_pressed)
			mouse_down_item_->select(!mouse_down_item_->selected());
		else
			mouse_down_item_->select(true);
	}

	// Save the offsets of any signals which will be dragged
	bool item_dragged = false;
	const auto items = this->items();
	for (auto &i : items)
		if (i->selected()) {
			item_dragged = true;
			i->drag();
		}

	// Do the background drag
	if (!item_dragged)
		drag();

	selection_changed();
}
开发者ID:danielkitta,项目名称:pulseview,代码行数:35,代码来源:viewwidget.cpp


示例7: obj

void VHDDExplorer::OnListDrag(wxListEvent& event)
{
	m_drop_target->SetSrcIndx(event.GetIndex());
	wxDataObjectSimple obj(wxDF_PRIVATE);
	wxDropSource drag(obj, m_list);
	drag.DoDragDrop(wxDrag_AllowMove);
}
开发者ID:Aishou,项目名称:rpcs3,代码行数:7,代码来源:VHDDManager.cpp


示例8: eventFilter

 bool eventFilter( QObject *o, QEvent *e )
 {
     if ( e->type() == QEvent::MouseMove )
     {
         if ( static_cast<QMouseEvent*>(e)->buttons() & Qt::LeftButton )
             return drag( qobject_cast<Token*>(o) );
     }
     else if ( e->type() == QEvent::MouseButtonPress )
     {
         if ( static_cast<QMouseEvent*>(e)->buttons() & Qt::LeftButton )
         {
             setCursor( qobject_cast<QWidget*>(o), Qt::ClosedHandCursor );
             return true; // don't propagate to parents
         }
         return false;
     }
     else if ( e->type() == QEvent::MouseButtonRelease )
     {
         if ( !( static_cast<QMouseEvent*>(e)->buttons() & Qt::LeftButton ) )
         {
             setCursor( qobject_cast<QWidget*>(o), Qt::OpenHandCursor );
             emit static_cast<TokenDropTarget*>( parent() )->focusReceived( qobject_cast<QWidget*>(o) );
             return true; // don't propagate to parents
         }
         return false;
     }
     else if ( e->type() == QEvent::FocusIn )
         emit static_cast<TokenDropTarget*>( parent() )->focusReceived( qobject_cast<QWidget*>(o) );
     else if ( e->type() == QEvent::Hide )
     {
         setCursor( qobject_cast<QWidget*>(o), Qt::OpenHandCursor );
         return false;
     }
     return false;
 }
开发者ID:ErrAza,项目名称:amarok,代码行数:35,代码来源:TokenDropTarget.cpp


示例9: GetCursorPos

void CModViewView::OnMouseMove(UINT nFlags, CPoint point) 
{
	CView::OnMouseMove(nFlags, point);

	GetCursorPos(&point);

	if (!DraggingMouse()) 
	{
		ScreenToClient(&point);
		g_iViewAreaMouseX = point.x;
		g_iViewAreaMouseY = point.y;
		return;
	}


	static int _i=0;
//	OutputDebugString(va("(%d):   x:(%d) y:(%d)   (dragstart: %d %d)\n",_i++,point.x,point.y, DragStartPoint.x,DragStartPoint.y));

	if (drag( (mkey_enum)nFlags, point.x, point.y ))
	{
		SetCursorPos(DragStartPoint.x,DragStartPoint.y);		
		//OutputDebugString("drag-painting\n");
		Invalidate(false);
		//UpdateWindow();		
	}
}
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:26,代码来源:modviewview.cpp


示例10: drag

void GidaspowDrag::setForce() const
{
    // get viscosity field
    #ifdef comp
        const volScalarField nufField = particleCloud_.turbulence().mu() / rho_;
    #else
        const volScalarField& nufField = particleCloud_.turbulence().nu();
    #endif

    for(int index = 0;index <  particleCloud_.numberOfParticles(); ++index)
    {
        //if(mask[index][0])
        //{
            vector drag(0,0,0);
            label cellI = particleCloud_.cellIDs()[index][0];

            if (cellI > -1) // particle Found
            {
                vector Us = particleCloud_.velocity(index);
                vector Ur = U_[cellI]-Us;
                scalar magUr = mag(Ur);
                scalar ds = 2*particleCloud_.radius(index);
                scalar voidfraction = particleCloud_.voidfraction(index);
                scalar rho = rho_[cellI];
                scalar nuf = nufField[cellI];
                scalar CdMagUrLag=0;//Cd of the very particle
                scalar KslLag;      //momentum exchange of the very particle

                if(voidfraction > 0.8) //dilute
                {
                    CdMagUrLag = (24.0*nuf/(ds*voidfraction))
                                 *(scalar(1)+0.15*Foam::pow(ds*voidfraction*magUr/nuf, 0.687));
                    KslLag = 0.75*((1-voidfraction)*rho*voidfraction*CdMagUrLag
                                /(ds*Foam::pow(voidfraction,2.65)));
                }
                else  //dense
                {
                    KslLag = (150*Foam::pow(1-voidfraction,2)*nuf*rho)/
                             (voidfraction*ds*ds+SMALL)
                            +
                             (1.75*(1-voidfraction) * magUr * rho)/
                             ((ds));
                }

                //divide by number of particles per unit volume - Enwald (Int J Multiphase Flow, 22, 21-61, pp39
                KslLag /= (particleCloud_.averagingM().UsWeightField()[cellI]/particleCloud_.mesh().V()[cellI]);

                drag = KslLag*Ur;

                if (modelType_=="B")
                    drag /= voidfraction;
            }

            // set force on particle
            if(treatExplicit_) for(int j=0;j<3;j++) expForces()[index][j] += drag[j];
            else  for(int j=0;j<3;j++) impForces()[index][j] += drag[j];
            for(int j=0;j<3;j++) DEMForces()[index][j] += drag[j];
        //}// end if mask
    }// end loop particles
}
开发者ID:hbweigao,项目名称:CFDEMcoupling-PUBLIC,代码行数:60,代码来源:GidaspowDrag.C


示例11: curDoc

void
CCurveTextJig::doIt()
{

	AcDbObjectId eId;
	if(!m_pCurvetext) return;

	double startDist = m_pCurvetext->getStartDist();
	double length = m_pCurvetext->getLength();
	m_pCurvetext->setInJig(true);
	// sets the input point monitor
	//
	curDoc()->inputPointManager()->addPointMonitor(&m_InputPoint);
	// starts the drag sequence
	//
	AcEdJig::DragStatus stat = drag();
	// remove the input point monitor
	//
	curDoc()->inputPointManager()->removePointMonitor(&m_InputPoint);
	m_pCurvetext->setInJig(false);
	// if cancel, resets the orignal state
	//
    if(stat == AcEdJig::kCancel)
	{
		m_pCurvetext->setStartDist(startDist);
		m_pCurvetext->setLength(length);
		m_pCurvetext->recordGraphicsModified();
		return;
	}
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:30,代码来源:CurveTextJig.cpp


示例12: keyReleaseEvent

void
QtUtil :: Grid3DView :: keyReleaseEvent (QKeyEvent * e)
{
	switch (e -> key ())
	{

	case Qt :: Key_Shift:
		
		if (0 == m_drag_info .di && 0 == m_drag_info .dk)
		{
			m_drag_info = DragInfo ();

			QWidget :: keyReleaseEvent (e);

			update ();

			return;
		}
		
		drag (to_global (m_drag_info .di, m_drag_info .dk));

		m_drag_info = DragInfo ();
		
		break;

	case Qt :: Key_Up:
	case Qt :: Key_Down:
		
		if (false == m_drag_info .dragging)
		{
			QWidget :: keyReleaseEvent (e);

			return;
		}
		
		m_drag_info .dk = 0;
		
		update ();

		break;

	case Qt :: Key_Left:
	case Qt :: Key_Right:
		if (false == m_drag_info .dragging)
		{
			QWidget :: keyReleaseEvent (e);

			return;
		}

		m_drag_info .di = 0;
		
		update ();

		break;
	};

	e -> accept ();
}
开发者ID:spraff,项目名称:monolith,代码行数:59,代码来源:Grid3DView.cpp


示例13: assert

// ------------------------------------------------------------------------
// window to display an adventure map
// ------------------------------------------------------------------------
void t_adventure_map_window::left_button_up( t_mouse_event const& event )
{
	assert( m_frame );

	if (m_dragging)
	{
		drag( event.screen_point );
		release_mouse();
		m_dragging = false;
	}

	if (m_object_mover != 0)
	{
		halt_movement();
		return;
	}

	if ( m_spell_targeter != 0 )
	{
		m_spell_targeter->cast_spell( *this, event.client_point );
		clear_spell_targeter();
		return;
	}

	t_army* army = m_frame->get_selected_army();
	if (army == 0)
		return;

	// otherwise, move the temporary hero.
	t_adventure_path_point path_point;
	t_adventure_path path;

	// abort if this is not a valid location.
	if (!get_path_point( event.client_point, path_point ))
		return;

    if (!(show_move_path()))
    {
	    m_frame->get_path_finder()->get_path( path_point, path );
		army->set_path( path );
    }

	// check if the army has a valid path, and the path matches this point.
	if (army->get_destination() == path_point)
	{
		// start army moving.
		m_frame->start_army_moving( army );
		return;
	}

	if (!m_frame->get_path_finder()->get_path( path_point, path ))
	{
		army->set_path( path );
		return;
	}
	army->set_path( path );
	m_map->display_path( path, army->get_movement() );
	m_frame->update_buttons();
}
开发者ID:sundoom,项目名称:sunstudio,代码行数:62,代码来源:adventure_map_window.cpp


示例14: cancel

void QSimpleDrag::cancel()
{
    QBasicDrag::cancel();
    if (drag() && m_current_window) {
        QWindowSystemInterface::handleDrag(m_current_window, 0, QPoint(), Qt::IgnoreAction);
        m_current_window = 0;
    }
}
开发者ID:AlexSoehn,项目名称:qt-base-deb,代码行数:8,代码来源:qsimpledrag.cpp


示例15: NEEDMOTION

void Menu::press(const Event& e) {
	NEEDMOTION(false)
    Canvas* c = canvas();
    if (c != nil) {
	impl_->save_cursor(c);
	drag(e);
    }
}
开发者ID:PNCG,项目名称:neuron,代码行数:8,代码来源:menu.cpp


示例16: raise

void Client::takeButtonPress( Window w, unsigned int button, bool mod1,
			      int x, int y)
{
    if ( w == close_button ) {
	awaiting_close = true;
	ws->painter()->setButtonBackground( close_button,
					    Painter::CLOSE_BUTTON,
					    active,
					    true,
					    button_size, 
					    button_size );
    }
    if ( w == iconize_button ) {
	awaiting_iconize = true;
	ws->painter()->setButtonBackground( iconize_button,
					    Painter::ICONIZE_BUTTON,
					    active,
					    true,
					    button_size,
					    button_size );
    }
    if ( w == titlebar || w == frame ) {
	raise();
	redraw( true, true ); 
	if ( button == 1 && !awaiting_close && !awaiting_iconize )
	    drag();
    } else if ( isWindow( w ) ) { 
	if ( mod1 ) { /* mod click */
	    switch (button) {
	    case 1:
		raise();
		redraw( true, true ); 
		drag();
		break;
	    case 2:
		break;
	    case 3:
 		raise();
		redraw( true, true ); 
		resize();
		break;
	    }
	}
    }
}
开发者ID:nic0lae,项目名称:freebsddistro,代码行数:45,代码来源:client.cpp


示例17: drag

	void SnakeLayer::update(float dt)
	{
		if (direction == Point::ZERO) return;

		drag(dt);
		truncate();
		if (testDie()) return;
		testPick();
	}
开发者ID:OscarLeif,项目名称:CocosNeat,代码行数:9,代码来源:SnakeLayer.cpp


示例18: Invalidate

void DropView::MouseMoved(BPoint where, uint32 code, const BMessage *msg)
{
	// check for our drag message
	if (msg != NULL && msg->what == dropWhat)
	{
		// if we ain't occupied, aren't about to be and
		// the mouse just entered
		if (!hasOccupant && !occupantLoading && code == B_ENTERED_VIEW)
		{
			// you can drop that here!
			// give the user some visual feedback
			drawHighlight = true;
			// force redraw
			Invalidate(Bounds());
		}
		else if (code == B_EXITED_VIEW)
		{
			// it left, stop highlighting
			drawHighlight = false;
			// force redraw
			Invalidate(Bounds());
		}
	}
	else if (msg != NULL && msg->what == JE_CONTAINER_VIEW_DND && isDragging)
	{
		// this is a drag initiated by us
		// if the mouse is leaving the view, then our occupant
		// is being removed
		
		if (code == B_EXITED_VIEW)
		{
			// tell the main window our plugin is gone
			((MainWindow *)Window())->UnloadPlugin(piType,id);
			ToggleOccupant(false);
		}
	}
	else if (trackingMouse)
	{
		// we're tracking the mouse after it clicked on us
		float dx = where.x - mouseDownPt.x; // delta x
		float dy = where.y - mouseDownPt.y; // delta y
		float dp = (float)sqrt((dx*dx)+(dy*dy)); // delta magnitude
		
		// if the mouse has moved futher than 5 pixels in any direction
		if (dp > 5.0)
		{
			// initiate a drag
			BMessage drag(JE_CONTAINER_VIEW_DND);
			DragMessage(&drag, new BBitmap(iconBitmap), B_OP_OVER, BPoint(where.x-2.0, where.y-2.0));
			
			// stop tracking the mouse
			trackingMouse = false;
			// our occupant is being dragged
			isDragging = true;
		}
	}
}
开发者ID:carriercomm,项目名称:BeOS-Projects,代码行数:57,代码来源:DropView.cpp


示例19: setDispPrompt

void TunnelDragJig::doIt()
{
    setDispPrompt( _T( "\n指定基点:" ) );
    if( kNormal != acquirePoint( basePt ) ) return;

    if( kNormal == drag() )
    {
        CopyBack( m_pWS, m_objId );
    }
}
开发者ID:kanbang,项目名称:myexercise,代码行数:10,代码来源:TunnelDragJig.cpp


示例20: setDispPrompt

void GoafDragJig::doIt()
{
    setDispPrompt( _T( "\nÖ¸¶¨»ùµã£º" ) );
    if( kNormal != acquirePoint( basePt ) ) return;

    if( kNormal == drag() )
    {
        CopyBack( m_pGoaf, m_objId );
    }
}
开发者ID:kanbang,项目名称:myexercise,代码行数:10,代码来源:GoafDragJig.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ drain函数代码示例发布时间:2022-05-30
下一篇:
C++ draft函数代码示例发布时间: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