本文整理汇总了C++中drag函数的典型用法代码示例。如果您正苦于以下问题:C++ drag函数的具体用法?C++ drag怎么用?C++ drag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
}
示例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();
}
}
示例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 );
}
}
示例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());
}
示例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());
}
示例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();
}
示例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);
}
示例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;
}
示例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();
}
}
示例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
}
示例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;
}
}
示例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 ();
}
示例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();
}
示例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;
}
}
示例15: NEEDMOTION
void Menu::press(const Event& e) {
NEEDMOTION(false)
Canvas* c = canvas();
if (c != nil) {
impl_->save_cursor(c);
drag(e);
}
}