示例#1
0
void PagerApplet::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
	QGraphicsPixmapItem* item = m_listPixmapDesktops.at(0);
	int newDesktop = (int)(event->pos().x() / item->pixmap().width());
	if (m_currentDesktop != newDesktop)
		xfitMan().setActiveDesktop(newDesktop);
	if(isUnderMouse())
		if(event->buttons() == Qt::RightButton)
			showContextMenu(localToScreen(QPoint(0, 0)));
}
bool ofxGuiInputField<Type>::mouseDragged(ofMouseEventArgs & args){

	ofxGuiElement::mouseDragged(args);

	if(!hasFocus || !bMousePressed)
		return false;

	float cursorX = args.x - (localToScreen(getShape()).getRight() - textPadding - inputWidth);
	int cursorPos = ofMap(cursorX,0,inputWidth,0,input.size(),true);
	calculateSelectionArea(mousePressedPos,cursorPos);
	return false;
}
bool ofxGuiInputField<Type>::mousePressed(ofMouseEventArgs & args){

	ofxGuiElement::mousePressed(args);

	if(isMouseOver()){
		bMousePressed = true;
		hasFocus = true;

		float cursorX = args.x - (localToScreen(getShape()).getRight() - textPadding - inputWidth);
		int cursorPos = ofMap(cursorX,0,inputWidth,0,input.size(),true);
		mousePressedPos = cursorPos;

		calculateSelectionArea(cursorPos, cursorPos);

		pressCounter++;

	}else{
		if(hasFocus){
			leaveFocus();
		}
	}
	return false;
}
示例#4
0
void DemoApplet::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
{
	if(isUnderMouse())
		showContextMenu(localToScreen(QPoint(0, 0)));
}