mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Gadget now clips the rendering area to the background, which solves the rendering issue of the attitude indicator sky.ground rendering outside of the dial.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@826 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
22ccee665b
commit
2ff5424944
@ -37,14 +37,22 @@ AirspeedGadgetWidget::AirspeedGadgetWidget(QWidget *parent) : QGraphicsView(pare
|
|||||||
setMinimumSize(64,64);
|
setMinimumSize(64,64);
|
||||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||||
setScene(new QGraphicsScene(this));
|
setScene(new QGraphicsScene(this));
|
||||||
|
setRenderHints(QPainter::Antialiasing);
|
||||||
|
|
||||||
|
|
||||||
m_renderer = new QSvgRenderer();
|
m_renderer = new QSvgRenderer();
|
||||||
m_background = new QGraphicsSvgItem();
|
m_background = new QGraphicsSvgItem();
|
||||||
|
// All other items will be clipped to the shape of the background
|
||||||
|
m_background->setFlags(QGraphicsItem::ItemClipsChildrenToShape|
|
||||||
|
QGraphicsItem::ItemClipsToShape);
|
||||||
m_foreground = new QGraphicsSvgItem();
|
m_foreground = new QGraphicsSvgItem();
|
||||||
m_needle1 = new QGraphicsSvgItem();
|
m_needle1 = new QGraphicsSvgItem();
|
||||||
m_needle2 = new QGraphicsSvgItem();
|
m_needle2 = new QGraphicsSvgItem();
|
||||||
m_needle3 = new QGraphicsSvgItem();
|
m_needle3 = new QGraphicsSvgItem();
|
||||||
|
m_foreground->setParentItem(m_background);
|
||||||
|
m_needle1->setParentItem(m_background);
|
||||||
|
m_needle2->setParentItem(m_background);
|
||||||
|
m_needle3->setParentItem(m_background);
|
||||||
|
|
||||||
paint();
|
paint();
|
||||||
|
|
||||||
needle1Target = 0;
|
needle1Target = 0;
|
||||||
@ -259,6 +267,9 @@ void AirspeedGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QStr
|
|||||||
}
|
}
|
||||||
|
|
||||||
l_scene->setSceneRect(m_background->boundingRect());
|
l_scene->setSceneRect(m_background->boundingRect());
|
||||||
|
m_renderer->setViewBox(m_background->boundingRect());
|
||||||
|
|
||||||
|
|
||||||
// Now Initialize the center for all transforms of the dial needles to the
|
// Now Initialize the center for all transforms of the dial needles to the
|
||||||
// center of the background:
|
// center of the background:
|
||||||
// - Move the center of the needle to the center of the background.
|
// - Move the center of the needle to the center of the background.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user