mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-04 03:41:56 +02:00
[ui] add CompatibilityBadge on CompatibilityNodes
* add badge icon on nodes in GraphEditor * add badge banner in AttributeEditor with upgrade button when available
This commit is contained in:
parent
ca712ef2aa
commit
0128cd56f0
5 changed files with 126 additions and 3 deletions
79
meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml
Normal file
79
meshroom/ui/qml/GraphEditor/CompatibilityBadge.qml
Normal file
|
@ -0,0 +1,79 @@
|
|||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.3
|
||||
import MaterialIcons 2.2
|
||||
|
||||
|
||||
/** Node Badge to inform about compatibility issues
|
||||
* Provides 2 delegates (can be set using sourceComponent property):
|
||||
* - iconDelegate (default): icon + tooltip with information about the issue
|
||||
* - bannerDelegate: banner with issue info + upgrade request button
|
||||
*/
|
||||
Loader {
|
||||
id: root
|
||||
|
||||
property bool canUpgrade
|
||||
property string issueDetails
|
||||
property color color: canUpgrade ? "#E68A00" : "#F44336"
|
||||
|
||||
signal upgradeRequest()
|
||||
|
||||
sourceComponent: iconDelegate
|
||||
|
||||
property Component iconDelegate: Component {
|
||||
|
||||
Label {
|
||||
|
||||
text: MaterialIcons.warning
|
||||
font.family: MaterialIcons.fontFamily
|
||||
font.pointSize: 12
|
||||
color: root.color
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPressed: mouse.accepted = false
|
||||
ToolTip.text: issueDetails
|
||||
ToolTip.visible: containsMouse
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property Component bannerDelegate: Component {
|
||||
|
||||
Pane {
|
||||
padding: 6
|
||||
clip: true
|
||||
background: Rectangle { color: root.color }
|
||||
|
||||
RowLayout {
|
||||
width: parent.width
|
||||
Column {
|
||||
Layout.fillWidth: true
|
||||
Label {
|
||||
width: parent.width
|
||||
elide: Label.ElideMiddle
|
||||
font.bold: true
|
||||
text: "Compatibility issue"
|
||||
color: "white"
|
||||
}
|
||||
Label {
|
||||
width: parent.width
|
||||
elide: Label.ElideMiddle
|
||||
text: root.issueDetails
|
||||
color: "white"
|
||||
}
|
||||
}
|
||||
Button {
|
||||
visible: root.canUpgrade && (parent.width > width) ? 1 : 0
|
||||
palette.window: root.color
|
||||
palette.button: Qt.darker(root.color, 1.2)
|
||||
palette.buttonText: "white"
|
||||
text: "Upgrade"
|
||||
onClicked: upgradeRequest()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue