1
0
Fork 0

Launcher: tip for drag/zoom of diagrams

This commit is contained in:
James Turner 2021-03-17 12:58:24 +00:00
parent b76b6548a1
commit 1dd6ab3cfb
5 changed files with 47 additions and 3 deletions

View file

@ -35,6 +35,7 @@ public:
TopRight,
TopLeft,
LeftTop, // on the left side, at the top
NoArrow
};
Q_ENUM(Arrow)

View file

@ -43,6 +43,7 @@ static std::initializer_list<TipGeometryByArrowLocation> static_tipGeometries =
{GettingStartedTip::Arrow::LeftCenter, QRectF{0.0, 0.0, tipBoxWidth, dummyHeight}, Qt::AlignVCenter},
{GettingStartedTip::Arrow::RightCenter, QRectF{-(tipBoxWidth + TipBackgroundBox::arrowHeight()), 0.0, tipBoxWidth, dummyHeight}, Qt::AlignVCenter},
{GettingStartedTip::Arrow::LeftTop, QRectF{0.0, topHeightOffset, tipBoxWidth, dummyHeight}, Qt::AlignTop},
{GettingStartedTip::Arrow::NoArrow, QRectF{-halfBoxWidth, 0.0, tipBoxWidth, dummyHeight}, Qt::AlignVCenter},
};
@ -338,14 +339,16 @@ QRectF GettingStartedTipsController::tipGeometry() const
}
QRectF g = it->geometry;
if ((arrow == GettingStartedTip::Arrow::LeftCenter) || (arrow == GettingStartedTip::Arrow::RightCenter)
|| (arrow == GettingStartedTip::Arrow::LeftTop)) {
if ((arrow == GettingStartedTip::Arrow::LeftCenter)
|| (arrow == GettingStartedTip::Arrow::RightCenter)
|| (arrow == GettingStartedTip::Arrow::LeftTop)
|| (arrow == GettingStartedTip::Arrow::NoArrow))
{
g.setHeight(_activeTipHeight);
} else {
g.setHeight(_activeTipHeight + TipBackgroundBox::arrowHeight());
}
switch (it->verticalAlignment) {
case Qt::AlignBottom:
g.moveBottom(0);

View file

@ -97,6 +97,15 @@ QPainterPath pathFromArrowAndGeometry(GettingStartedTip::Arrow arrow, const QRec
pp.closeSubpath();
break;
case GettingStartedTip::Arrow::NoArrow:
pp.moveTo(0.0, g.top());
pp.lineTo(g.right(), g.top());
pp.lineTo(g.right(), g.bottom());
pp.lineTo(0.0, g.bottom());
pp.closeSubpath();
break;
default:
qWarning() << Q_FUNC_INFO << "unhandled:" << arrow;
break;

View file

@ -12,6 +12,8 @@ Item {
onGuidChanged: _location.setBaseLocation(this)
}
GettingStartedScope.controller: tips.controller
readonly property bool isHeliport: airportData.type === Positioned.Heliport
readonly property bool haveParking: airportData.airportHasParkings
@ -37,6 +39,13 @@ Item {
approachExtensionEnabled: _location.onFinal
approachExtension: _location.offsetDistance
GettingStartedTip {
tipId: "locationDiagram"
anchors.centerIn: parent
arrow: GettingStartedTip.NoArrow
text: qsTr("Click here to select a runway or parking position, and drag to pan. Mouse-wheel zooms in and out.")
}
}
// not very declarative, try to remove this over time
@ -383,4 +392,10 @@ Item {
} // main layout column
} // main panel rectangle
GettingStartedTipLayer {
id: tips
anchors.fill: parent
scopeId: "locationAirportDetails"
}
}

View file

@ -17,6 +17,8 @@ Item {
}
}
GettingStartedScope.controller: tips.controller
NavaidDiagram {
id: diagram
anchors.fill: parent
@ -25,6 +27,13 @@ Item {
offsetBearing: _location.offsetRadial
offsetDistance: _location.offsetDistance
heading: _location.heading
GettingStartedTip {
tipId: "locationNavDiagram"
anchors.centerIn: parent
arrow: GettingStartedTip.NoArrow
text: qsTr("Drag here to move the map. Mouse-wheel zooms in and out.")
}
}
Rectangle {
@ -158,4 +167,11 @@ Item {
}
} // main layout column
} // main panel rectangle
GettingStartedTipLayer {
id: tips
anchors.fill: parent
scopeId: "locationNavDetails"
}
}