Block select on TAP graph

This commit is contained in:
Mark Watkins 2014-08-12 16:43:10 +10:00
parent a00e8a5d31
commit bb61e8962c
4 changed files with 11 additions and 6 deletions

View File

@ -160,6 +160,8 @@ gGraph::gGraph(QString name, gGraphView *graphview, QString title, QString units
invalidate_yAxisImage = true; invalidate_yAxisImage = true;
invalidate_xAxisImage = true; invalidate_xAxisImage = true;
m_block_select = false;
m_enforceMinY = m_enforceMaxY = false; m_enforceMinY = m_enforceMaxY = false;
m_showTitle = true; m_showTitle = true;
m_printing = false; m_printing = false;

View File

@ -303,6 +303,9 @@ class gGraph : public QObject
inline qint64 selectedDuration() const { return m_selectedDuration; } inline qint64 selectedDuration() const { return m_selectedDuration; }
inline QString selDurString() const { return m_selDurString; } inline QString selDurString() const { return m_selDurString; }
inline bool blockSelect() const { return m_block_select; }
void setBlockSelect(bool b) { m_block_select = b; }
protected: protected:
//! \brief Mouse Wheel events //! \brief Mouse Wheel events
virtual void wheelEvent(QWheelEvent *event); virtual void wheelEvent(QWheelEvent *event);
@ -362,6 +365,7 @@ class gGraph : public QObject
bool m_printing; bool m_printing;
bool m_pinned; bool m_pinned;
short m_zoomY; short m_zoomY;
bool m_block_select;
QRect m_rect; QRect m_rect;
qint64 m_selectedDuration; qint64 m_selectedDuration;

View File

@ -1508,9 +1508,9 @@ void gGraphView::mousePressEvent(QMouseEvent *event)
m_sizer_point.setX(x); m_sizer_point.setX(x);
m_sizer_point.setY(py); // point at top of graph.. m_sizer_point.setY(py); // point at top of graph..
this->setCursor(Qt::ClosedHandCursor); this->setCursor(Qt::ClosedHandCursor);
} else } else if (!g->blockSelect()) {
{
if (m_metaselect) { if (m_metaselect) {
if (m_selected_graph) { if (m_selected_graph) {
m_selected_graph->m_selecting_area = false; m_selected_graph->m_selecting_area = false;
@ -1575,10 +1575,8 @@ void gGraphView::mousePressEvent(QMouseEvent *event)
m_sizer_point.setX(x); m_sizer_point.setX(x);
m_sizer_point.setY(py); // point at top of graph.. m_sizer_point.setY(py); // point at top of graph..
this->setCursor(Qt::ClosedHandCursor); this->setCursor(Qt::ClosedHandCursor);
} } else if (!g->blockSelect()) {
if (m_metaselect) {
{
if (m_metaselect) {
if (m_selected_graph) { if (m_selected_graph) {
m_selected_graph->m_selecting_area = false; m_selected_graph->m_selecting_area = false;
} }

View File

@ -342,6 +342,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
graphlist[STR_GRAPH_TAP] = TAP2 = new gGraph(STR_GRAPH_TAP, GraphView, QObject::tr("Time @ Pressure"), QObject::tr("Time at Pressure"), default_height); graphlist[STR_GRAPH_TAP] = TAP2 = new gGraph(STR_GRAPH_TAP, GraphView, QObject::tr("Time @ Pressure"), QObject::tr("Time at Pressure"), default_height);
TAP2->AddLayer(new gFlagsLabelArea(nullptr),LayerLeft,gYAxis::Margin); TAP2->AddLayer(new gFlagsLabelArea(nullptr),LayerLeft,gYAxis::Margin);
TAP2->AddLayer(AddCPAP(new MinutesAtPressure())); TAP2->AddLayer(AddCPAP(new MinutesAtPressure()));
TAP2->setBlockSelect(true);
if (p_profile->general->calculateRDI()) { if (p_profile->general->calculateRDI()) {
AHI->AddLayer(AddCPAP(new gLineChart(CPAP_RDI, COLOR_RDI, square))); AHI->AddLayer(AddCPAP(new gLineChart(CPAP_RDI, COLOR_RDI, square)));