##// END OF EJS Templates
fix to example. Event handling prototyping.
sauimone -
r2169:04485231feed
parent child
Show More
@@ -70,7 +70,7 MainWidget::MainWidget(QWidget *parent) :
70 70
71 71 QPushButton *disConnectButton = new QPushButton("Disconnect markers");
72 72 connect(disConnectButton, SIGNAL(clicked()), this, SLOT(disconnectMarkers()));
73 m_buttonLayout->addWidget(connectButton, 8, 0);
73 m_buttonLayout->addWidget(disConnectButton, 9, 0);
74 74
75 75
76 76 m_legendPosX = new QDoubleSpinBox();
@@ -40,7 +40,7 LegendMarkerItem::LegendMarkerItem(QLegendMarkerPrivate *marker, QGraphicsObject
40 40 m_space(4)
41 41 {
42 42 // qDebug() << "LegendMarkerItem created for marker:" << m_marker;
43 setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton);
43 // setAcceptedMouseButtons(Qt::LeftButton|Qt::RightButton);
44 44 m_rectItem->setRect(m_markerRect);
45 45 // setZValue(zValue() + 20);
46 46 // qDebug() << "z:" << this->zValue();
@@ -168,7 +168,7 void LegendMarkerItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
168 168 qDebug() << "LegendMarkerItem::mousePressEvent";
169 169 // QGraphicsObject::mousePressEvent(event);
170 170 //TODO: selected signal removed for now
171 emit m_marker->handleMousePressEvent(event);
171 m_marker->handleMousePressEvent(event);
172 172 QGraphicsItem::mousePressEvent(event);
173 173 }
174 174
@@ -451,7 +451,7 QLegendPrivate::QLegendPrivate(ChartPresenter *presenter, QChart *chart, QLegend
451 451 m_attachedToChart(true),
452 452 m_backgroundVisible(false)
453 453 {
454
454 m_items->setHandlesChildEvents(false);
455 455 }
456 456
457 457 QLegendPrivate::~QLegendPrivate()
@@ -23,6 +23,7
23 23 #include "legendmarkeritem_p.h"
24 24 #include <QDebug>
25 25 #include <QFontMetrics>
26 #include <QGraphicsSceneEvent>
26 27
27 28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 29 /*
@@ -116,8 +117,10 QLegendMarkerPrivate::~QLegendMarkerPrivate()
116 117
117 118 void QLegendMarkerPrivate::handleMousePressEvent(QGraphicsSceneEvent *event)
118 119 {
119 // Just emit clicked signal for now
120 Q_UNUSED(event);
120 // Just emit clicked signal for now (our default logic for events)
121 // This could propably be on the LegendMarkerItem?
122 // TODO: how to handle scrolling vs clicking? drag event?
123 event->accept();
121 124 Q_Q(QLegendMarker);
122 125 emit q->clicked();
123 126 }
General Comments 0
You need to be logged in to leave comments. Login now