1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

TelemetryWidget: rescaled .svg; transparent background; hide data rates when not connected.

This commit is contained in:
Mike LaBranche 2012-08-03 09:24:26 -07:00
parent 5320a73adc
commit 83c920799d
2 changed files with 33 additions and 21 deletions

View File

@ -9,11 +9,11 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="990"
height="765"
width="620.10828"
height="82.577499"
id="svg2"
version="1.1"
inkscape:version="0.48.2 r9819"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="tx-rx.svg">
<defs
id="defs4" />
@ -25,25 +25,32 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.58"
inkscape:cx="243.88087"
inkscape:cy="482.05004"
inkscape:cx="89.172147"
inkscape:cy="14.870213"
inkscape:document-units="px"
inkscape:current-layer="txrxBackground"
showgrid="false"
showguides="false"
inkscape:guide-bbox="true"
inkscape:window-width="1463"
inkscape:window-width="1440"
inkscape:window-height="686"
inkscape:window-x="200"
inkscape:window-y="200"
inkscape:window-maximized="0">
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
borderlayer="false"
inkscape:showpageshadow="false"
showborder="true">
<sodipodi:guide
orientation="1,0"
position="159.7561,421.95122"
position="5.047377,-45.228607"
id="guide3775" />
<sodipodi:guide
orientation="0,1"
position="339.02439,473.17073"
position="184.31566,5.990903"
id="guide3912" />
</sodipodi:namedview>
<metadata
@ -62,7 +69,7 @@
inkscape:label="bg"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-287.36218)"
transform="translate(-154.70873,-502.60486)"
style="display:inline">
<g
id="g3963">
@ -213,7 +220,7 @@
sodipodi:role="line">Tx</tspan></text>
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-weight:bold;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Bold;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Bold"
x="163.79311"
y="572.0863"
id="text3044"
@ -229,7 +236,8 @@
inkscape:groupmode="layer"
id="layer3"
inkscape:label="tx"
style="display:inline">
style="display:inline"
transform="translate(-154.70873,-215.24268)">
<rect
style="fill:#00c200;fill-opacity:1;stroke:none;display:inline"
id="tx0"
@ -310,7 +318,8 @@
inkscape:groupmode="layer"
id="layer2"
inkscape:label="rx"
style="display:inline">
style="display:inline"
transform="translate(-154.70873,-215.24268)">
<rect
style="fill:#00c200;fill-opacity:1;stroke:none;display:inline"
id="rx0"

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -7,16 +7,17 @@
TelemetryMonitorWidget::TelemetryMonitorWidget(QWidget *parent) : QGraphicsView(parent)
{
setMinimumSize(160,80);
setMaximumSize(160,80);
setMinimumSize(180,100);
setMaximumSize(180,100);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFrameStyle(QFrame::NoFrame);
setBackgroundBrush(Qt::transparent);
setStyleSheet("background:transparent;");
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(Qt::FramelessWindowHint);
QGraphicsScene *scene = new QGraphicsScene(0,0,160,80, this);
scene->setBackgroundBrush(Qt::transparent);
QGraphicsScene *scene = new QGraphicsScene(0,0,180,100, this);
QSvgRenderer *renderer = new QSvgRenderer();
if (renderer->load(QString(":/core/images/tx-rx.svg"))) {
@ -146,10 +147,12 @@ void TelemetryMonitorWidget::showTelemetry()
QRectF rect = graph->boundingRect();
txSpeed->setPos(rect.right() - 110, rect.top());
txSpeed->setPlainText(QString("%0").arg(connected ? txValue : 0.0));
txSpeed->setPlainText(QString("%0").arg(txValue));
txSpeed->setVisible(connected);
rxSpeed->setPos(rect.right() - 110, rect.top() + (rect.height() / 2));
rxSpeed->setPlainText(QString("%0").arg(connected ? rxValue : 0.0));
rxSpeed->setPlainText(QString("%0").arg(rxValue));
rxSpeed->setVisible(connected);
update();
}
@ -165,7 +168,7 @@ void TelemetryMonitorWidget::resizeEvent(QResizeEvent* event)
{
Q_UNUSED(event);
graph->setPos(0,-100);
graph->setPos(0,-130);
fitInView(graph, Qt::KeepAspectRatio);
}