void WindowManager::registerWidget(QWidget *widget) { if (isBlackListed(widget)) { addEventFilter(widget, this); } else if (isDragable(widget)) { addEventFilter(widget, this); } }
bool UIWidget::onMouseMove(const Point& mousePos, const Point& mouseMoved) { if(isDragable() && isPressed() && !m_dragging && !g_ui.getDraggingWidget()) { setDragging(true); g_ui.setDraggingWidget(asUIWidget()); onDragEnter(mousePos - mouseMoved); } return callLuaField<bool>("onMouseMove", mousePos, mouseMoved); }
void SFencesView::OnMouseMove( UINT nFlags, CPoint point ) { CRect rcWnd = GetWindowRect(); UINT nMouseLoc = OnWndNcHitTest(point); // Í϶¯´°¿Ú if (isDragable(nFlags) && HTCLIENT == nMouseLoc && !m_bZoom) { dragFences(rcWnd, point); } // Ëõ·Å´°¿Ú else { zoomFences(rcWnd, point, nMouseLoc); } }
//_____________________________________________________________ void WindowManager::registerWidget( QWidget* widget ) { if( isBlackListed( widget ) ) { /* also install filter for blacklisted widgets to be able to catch the relevant events and prevent the drag to happen */ Utils::addEventFilter(widget, this); } else if( isDragable( widget ) ) { Utils::addEventFilter(widget, this); } }
//_____________________________________________________________ void WindowManager::registerWidget( QWidget* widget ) { if( isBlackListed( widget ) || isDragable( widget ) ) { /* install filter for dragable widgets. also install filter for blacklisted widgets to be able to catch the relevant events and prevent the drag to happen */ widget->removeEventFilter( this ); widget->installEventFilter( this ); } }
void DynamicGoo::paint(QPainter &p){ //Check rutine //Real paint stuff //check if is dragged if (isDragging()){ p.setBrush(Qt::transparent); p.setPen(QPen(color,3)); p.drawEllipse(toPoint(body->GetPosition()), getRadius()+10,getRadius()+10); //p.drawRect(boundingRect()); } //check if is selected and draggable else if (selected && isDragable()){ if (!hasJoint()) p.setPen(QPen(color,3,Qt::DashLine)); else p.setPen(QPen(color,3,Qt::DotLine)); p.setBrush(Qt::transparent); p.drawEllipse(toPoint(body->GetPosition()), getRadius()+10,getRadius()+10); } //paint goo p.setPen(secondaryColor); QColor center=secondaryColor; center.setRgb((center.red()+50 > 255 ? 255 : center.red()+50),(center.green()+50 > 255 ? 255 : center.green()+50),(center.blue()+50 > 255 ? 255 : center.blue()+50)); if (sleeping){ p.setBrush(center); p.drawEllipse(getPPosition(),getRadius(),getRadius()); } else { b2Vec2 speed=body->GetLinearVelocity(); float angle=qAtan2(speed.x,speed.y); float module=(isFalling() ? speed.Length()/8 : (!hasJoint() ? speed.Length()/15 : 0)); p.save(); p.translate(getPPosition()); if (!isDragging()) p.rotate((hasJoint() ? 0 :-angle*180.0/3.141628)); else p.rotate(this->angle); p.setBrush(secondaryColor); p.drawEllipse(QPoint(0,0),qRound(getRadius()-module),qRound(getRadius()+module)); rx=3;//+=(rand()%5-2); ry=-2;//+=(rand()%5-2); counter++; QRadialGradient rg(rx,ry,getRadius()+5); rg.setColorAt(0,center); rg.setColorAt(1,Qt::transparent); p.setBrush(rg); p.drawEllipse(QPoint(0,0),qRound(getRadius()-module),qRound(getRadius()+module)); if ((counter>=delay && !hasJoint()) || isDragging() || isFalling()){ if (!isDragging() && !isFalling()) { bool nE=!(rand()%5); if (eye) nE=rand()%3; if (eye!=nE && nE){ eyeSizeL=qrand()%3+5; eyeSizeR=eyeSizeL+qrand()%4-1; } eye=nE; counter=0; } else if (!eye) { eyeSizeL=qrand()%3+5; eyeSizeR=eyeSizeL+qrand()%4-1; eye=true; this->angle=qrand()%360; } } if (eye && !hasJoint()&& !onGround) { p.setPen(secondaryColor); QRadialGradient rG2(-9,13,eyeSizeL); QRadialGradient rG3(9,13,eyeSizeR); rG2.setColorAt(0,Qt::white); rG2.setColorAt(1,Qt::lightGray); p.setBrush(rG2); p.drawEllipse(QPoint(-9,12),eyeSizeL,eyeSizeL); rG3.setColorAt(0,Qt::white); rG3.setColorAt(1,Qt::lightGray); p.setBrush(rG3); p.drawEllipse(QPoint(9,12),eyeSizeR,eyeSizeR); p.setBrush(Qt::black); p.setPen(Qt::transparent); p.drawEllipse(QPoint(-9,14),2,2); p.drawEllipse(QPoint(9,13),2,2); } p.restore(); } }