Hi,
@wysota:
yes I do.
Here is the class chain mouse press evets:
The QGraphicsView subclass (this gets called):
void QCTimeLineWidget
::mousePressEvent(QMouseEvent *event
) {
if(event->button() == Qt::RightButton)
{
//do some stuff
event->accept();
}
else event->ignore();
}
void QCTimeLineWidget::mousePressEvent(QMouseEvent *event)
{
QGraphicsView::mousePressEvent(event);
if(event->button() == Qt::RightButton)
{
//do some stuff
event->accept();
}
else event->ignore();
}
To copy to clipboard, switch view to plain text mode
The Scene subclass (this gets called), and "no mouse grabber" is also being printed:
{
std::cout<<"scene event"<<std::endl;
if(!mouseGrabberItem()) std::cout<<"no mouse grabber"<<std::endl;
}
void SliderScene::mousePressEvent(QGraphicsSceneMouseEvent * mouseEvent )
{
std::cout<<"scene event"<<std::endl;
if(!mouseGrabberItem()) std::cout<<"no mouse grabber"<<std::endl;
QGraphicsScene::mousePressEvent(mouseEvent);
}
To copy to clipboard, switch view to plain text mode
the QGrphicsRectItem subclass - not getting called (but that is no surprise since there is no mouse grabber item in the scene - but I don't know why)
{
setBoundingRect
(QRectF(0,
0,
20,
20));
}
{
std::cout<<"CPLContainer mouse clicked"<<std::endl;
}
CPLContainer::CPLContainer(QGraphicsItem *parent)
: QGraphicsRectItem(parent)
{
setBoundingRect(QRectF(0,0,20,20));
setFlag(QGraphicsItem::ItemIsMovable);
setFlag(QGraphicsItem::ItemIsSelectable);
}
void CPLContainer::mousePressEvent ( QGraphicsSceneMouseEvent * event )
{
std::cout<<"CPLContainer mouse clicked"<<std::endl;
QGraphicsRectItem::mousePressEvent(event);
}
To copy to clipboard, switch view to plain text mode
Thanks again for the help.
Bookmarks