Exemplo n.º 1
0
void CarouselGraphicsWidget::mousePressEvent(QMouseEvent *event)
{
	QGraphicsView::mousePressEvent(event);

	QGraphicsItem *item = itemAt(event->pos());
	if (item && item->isEnabled()) {
		emit itemClicked(item);
	} else {
		// TODO really want mouse/touchscreen drag
		// Clicking anywhere other than the item in the foreground
		// will cause the carousel to rotate one way or the other
		if (event->x() < scene()->sceneRect().width()/2)
			m_back();
		else
			m_next();
	}
}