mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +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);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
setScene(new QGraphicsScene(this));
|
||||
setRenderHints(QPainter::Antialiasing);
|
||||
|
||||
|
||||
m_renderer = new QSvgRenderer();
|
||||
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_needle1 = new QGraphicsSvgItem();
|
||||
m_needle2 = 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();
|
||||
|
||||
needle1Target = 0;
|
||||
@ -259,6 +267,9 @@ void AirspeedGadgetWidget::setDialFile(QString dfn, QString bg, QString fg, QStr
|
||||
}
|
||||
|
||||
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
|
||||
// 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