diff --git a/examples/newlegend/mainwidget.cpp b/examples/newlegend/mainwidget.cpp index 4d0d260..68bf8cc 100644 --- a/examples/newlegend/mainwidget.cpp +++ b/examples/newlegend/mainwidget.cpp @@ -70,7 +70,7 @@ MainWidget::MainWidget(QWidget *parent) : QPushButton *disConnectButton = new QPushButton("Disconnect markers"); connect(disConnectButton, SIGNAL(clicked()), this, SLOT(disconnectMarkers())); - m_buttonLayout->addWidget(connectButton, 8, 0); + m_buttonLayout->addWidget(disConnectButton, 9, 0); m_legendPosX = new QDoubleSpinBox(); diff --git a/src/legend/legendmarkeritem.cpp b/src/legend/legendmarkeritem.cpp index bf1e590..4e281f3 100644 --- a/src/legend/legendmarkeritem.cpp +++ b/src/legend/legendmarkeritem.cpp @@ -40,7 +40,7 @@ LegendMarkerItem::LegendMarkerItem(QLegendMarkerPrivate *marker, QGraphicsObject m_space(4) { // qDebug() << "LegendMarkerItem created for marker:" << m_marker; - setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton); +// setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton); m_rectItem->setRect(m_markerRect); // setZValue(zValue() + 20); // qDebug() << "z:" << this->zValue(); @@ -168,7 +168,7 @@ void LegendMarkerItem::mousePressEvent(QGraphicsSceneMouseEvent *event) qDebug() << "LegendMarkerItem::mousePressEvent"; // QGraphicsObject::mousePressEvent(event); //TODO: selected signal removed for now - emit m_marker->handleMousePressEvent(event); + m_marker->handleMousePressEvent(event); QGraphicsItem::mousePressEvent(event); } diff --git a/src/legend/qlegend.cpp b/src/legend/qlegend.cpp index 757ebee..0b77e89 100644 --- a/src/legend/qlegend.cpp +++ b/src/legend/qlegend.cpp @@ -451,7 +451,7 @@ QLegendPrivate::QLegendPrivate(ChartPresenter *presenter, QChart *chart, QLegend m_attachedToChart(true), m_backgroundVisible(false) { - + m_items->setHandlesChildEvents(false); } QLegendPrivate::~QLegendPrivate() diff --git a/src/legend/qlegendmarker.cpp b/src/legend/qlegendmarker.cpp index 3c08b21..4c973bf 100644 --- a/src/legend/qlegendmarker.cpp +++ b/src/legend/qlegendmarker.cpp @@ -23,6 +23,7 @@ #include "legendmarkeritem_p.h" #include #include +#include QTCOMMERCIALCHART_BEGIN_NAMESPACE /* @@ -116,8 +117,10 @@ QLegendMarkerPrivate::~QLegendMarkerPrivate() void QLegendMarkerPrivate::handleMousePressEvent(QGraphicsSceneEvent *event) { - // Just emit clicked signal for now - Q_UNUSED(event); + // Just emit clicked signal for now (our default logic for events) + // This could propably be on the LegendMarkerItem? + // TODO: how to handle scrolling vs clicking? drag event? + event->accept(); Q_Q(QLegendMarker); emit q->clicked(); }