1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

First pass at popup info for alarms in system health widget

This commit is contained in:
David Willis 2012-06-24 01:22:43 +01:00
parent a0ad94ad8a
commit f492ea8527
2 changed files with 18 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include "systemalarms.h"
#include <QDebug>
#include <QWhatsThis>
/*
* Initialize the widget
@ -195,3 +196,18 @@ void SystemHealthGadgetWidget::resizeEvent(QResizeEvent *event)
Q_UNUSED(event);
fitInView(background, Qt::KeepAspectRatio );
}
void SystemHealthGadgetWidget::mousePressEvent ( QMouseEvent * event )
{
QGraphicsScene *graphicsScene = scene();
if(graphicsScene){
QPoint point = event->pos();
foreach(QGraphicsItem* sceneItem, items(point)){
QGraphicsSvgItem *clickedItem = dynamic_cast<QGraphicsSvgItem*>(sceneItem);
if(clickedItem && (clickedItem != foreground) && clickedItem != background){
QWhatsThis::showText(event->globalPos(), clickedItem->elementId().split('-').at(0) + "\nIt's all gone horribly wrong!");
}
}
}
}

View File

@ -34,6 +34,7 @@
#include <QGraphicsView>
#include <QtSvg/QSvgRenderer>
#include <QtSvg/QGraphicsSvgItem>
#include <QMouseEvent>
#include <QFile>
#include <QTimer>
@ -52,6 +53,7 @@ public:
protected:
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *event);
void mousePressEvent ( QMouseEvent * event );
private slots:
void updateAlarms(UAVObject *systemAlarm); // Called by the systemalarms UAVObject