mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-03 16:58:24 +02:00
[qt6][qml] Clean-up code and harmonize comments
This commit is contained in:
parent
b12d1fed06
commit
5a0b1c0c95
85 changed files with 575 additions and 538 deletions
|
@ -7,6 +7,7 @@ import Utils 1.0
|
|||
* ColorChart is a color picker based on a set of predefined colors.
|
||||
* It takes the form of a ToolButton that pops-up its palette when pressed.
|
||||
*/
|
||||
|
||||
ToolButton {
|
||||
id: root
|
||||
|
||||
|
@ -28,10 +29,10 @@ ToolButton {
|
|||
id: palettePopup
|
||||
|
||||
padding: 4
|
||||
// content width is missing side padding (hence the + padding*2)
|
||||
// Content width is missing side padding (hence the + padding*2)
|
||||
implicitWidth: colorChart.contentItem.width + padding * 2
|
||||
|
||||
// center the current color
|
||||
// Center the current color
|
||||
y: -(root.height - padding) / 2
|
||||
x: -colorChart.currentItem.x - padding
|
||||
|
||||
|
@ -44,14 +45,14 @@ ToolButton {
|
|||
spacing: 2
|
||||
currentIndex: root.currentIndex
|
||||
model: root.colors
|
||||
// display each color as a ToolButton with a custom background
|
||||
// Display each color as a ToolButton with a custom background
|
||||
delegate: ToolButton {
|
||||
padding: 0
|
||||
width: root.width
|
||||
height: root.height
|
||||
background: Rectangle {
|
||||
color: modelData
|
||||
// display border of current/selected item
|
||||
// Display border of current/selected item
|
||||
border.width: hovered || index === colorChart.currentIndex ? 1 : 0
|
||||
border.color: Colors.sysPalette.midlight
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import QtQuick.Layouts
|
|||
* FloatingPane provides a Pane with a slightly transparent default background
|
||||
* using palette.base as color. Useful to create floating toolbar/overlays.
|
||||
*/
|
||||
|
||||
Pane {
|
||||
id: root
|
||||
|
||||
|
@ -14,5 +15,9 @@ Pane {
|
|||
|
||||
padding: 6
|
||||
anchors.margins: 2
|
||||
background: Rectangle { color: root.palette.base; opacity: opaque ? 1.0 : 0.7; radius: root.radius }
|
||||
background: Rectangle {
|
||||
color: root.palette.base
|
||||
opacity: opaque ? 1.0 : 0.7
|
||||
radius: root.radius
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import QtQuick.Layouts
|
|||
/**
|
||||
* A custom GroupBox with predefined header.
|
||||
*/
|
||||
|
||||
GroupBox {
|
||||
id: root
|
||||
|
||||
|
@ -20,13 +21,14 @@ GroupBox {
|
|||
background: Item {}
|
||||
|
||||
label: Pane {
|
||||
padding: 2
|
||||
width: root.width
|
||||
background: Rectangle {
|
||||
id: labelBg
|
||||
color: palette.base
|
||||
opacity: 0.8
|
||||
}
|
||||
padding: 2
|
||||
width: root.width
|
||||
|
||||
RowLayout {
|
||||
width: parent.width
|
||||
Label {
|
||||
|
|
|
@ -5,6 +5,7 @@ import QtQuick.Layouts
|
|||
/**
|
||||
* KeyValue allows to create a list of key/value, like a table.
|
||||
*/
|
||||
|
||||
Rectangle {
|
||||
property alias key: keyLabel.text
|
||||
property alias value: valueText.text
|
||||
|
@ -19,7 +20,6 @@ Rectangle {
|
|||
Rectangle {
|
||||
anchors.margins: 2
|
||||
color: Qt.darker(activePalette.window, 1.1)
|
||||
// Layout.preferredWidth: sizeHandle.x
|
||||
Layout.minimumWidth: 10.0 * Qt.application.font.pixelSize
|
||||
Layout.maximumWidth: 15.0 * Qt.application.font.pixelSize
|
||||
Layout.fillWidth: false
|
||||
|
@ -45,7 +45,10 @@ Rectangle {
|
|||
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
background: Rectangle { anchors.fill: parent; color: Qt.darker(activePalette.window, 1.05) }
|
||||
background: Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Qt.darker(activePalette.window, 1.05)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ Dialog {
|
|||
|
||||
default property alias children: layout.children
|
||||
|
||||
// the content of this MessageDialog as a string
|
||||
// The content of this MessageDialog as a string
|
||||
readonly property string asString: titleLabel.text + "\n\n" + text + "\n" + detailedText + "\n" + helperText + "\n"
|
||||
|
||||
/// Return the text content of this dialog as a simple string.
|
||||
|
@ -40,7 +40,7 @@ Dialog {
|
|||
rightPadding: leftPadding
|
||||
|
||||
background: Item {
|
||||
// hidden text edit to perform copy in clipboard
|
||||
// Hidden text edit to perform copy in clipboard
|
||||
TextEdit {
|
||||
id: textContent
|
||||
visible: false
|
||||
|
|
|
@ -2,7 +2,6 @@ import QtQuick
|
|||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
|
||||
/**
|
||||
* Panel is a container control with preconfigured header/footer.
|
||||
*
|
||||
|
@ -12,6 +11,7 @@ import QtQuick.Layouts
|
|||
*
|
||||
* The footer is empty (and not visible) by default. It does not provided any layout.
|
||||
*/
|
||||
|
||||
Page {
|
||||
id: root
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ import QtQuick.Layouts
|
|||
|
||||
import MaterialIcons 2.2
|
||||
|
||||
|
||||
/**
|
||||
* Basic SearchBar component with an appropriate icon and a TextField.
|
||||
*/
|
||||
|
||||
FocusScope {
|
||||
property alias textField: field
|
||||
property alias text: field.text
|
||||
|
@ -36,7 +36,7 @@ FocusScope {
|
|||
Layout.fillWidth: true
|
||||
selectByMouse: true
|
||||
|
||||
// ensure the field has focus when the text is modified
|
||||
// Ensure the field has focus when the text is modified
|
||||
onTextChanged: {
|
||||
forceActiveFocus()
|
||||
}
|
||||
|
|
|
@ -47,16 +47,16 @@ Page {
|
|||
}
|
||||
|
||||
Rectangle {
|
||||
property bool commonBorder : false
|
||||
property bool commonBorder: false
|
||||
|
||||
property int lBorderwidth : index === mainTabBar.currentIndex ? 2 : 1
|
||||
property int rBorderwidth : index === mainTabBar.currentIndex ? 2 : 1
|
||||
property int tBorderwidth : index === mainTabBar.currentIndex ? 2 : 1
|
||||
property int bBorderwidth : 0
|
||||
property int lBorderwidth: index === mainTabBar.currentIndex ? 2 : 1
|
||||
property int rBorderwidth: index === mainTabBar.currentIndex ? 2 : 1
|
||||
property int tBorderwidth: index === mainTabBar.currentIndex ? 2 : 1
|
||||
property int bBorderwidth: 0
|
||||
|
||||
property int commonBorderWidth : 1
|
||||
property int commonBorderWidth: 1
|
||||
|
||||
z : -1
|
||||
z: -1
|
||||
|
||||
color: Qt.darker(root.palette.window, 1.50)
|
||||
|
||||
|
@ -66,10 +66,10 @@ Page {
|
|||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
|
||||
topMargin : commonBorder ? -commonBorderWidth : -tBorderwidth
|
||||
bottomMargin : commonBorder ? -commonBorderWidth : -bBorderwidth
|
||||
leftMargin : commonBorder ? -commonBorderWidth : -lBorderwidth
|
||||
rightMargin : commonBorder ? -commonBorderWidth : -rBorderwidth
|
||||
topMargin: commonBorder ? -commonBorderWidth : -tBorderwidth
|
||||
bottomMargin: commonBorder ? -commonBorderWidth : -bBorderwidth
|
||||
leftMargin: commonBorder ? -commonBorderWidth : -lBorderwidth
|
||||
rightMargin: commonBorder ? -commonBorderWidth : -rBorderwidth
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import Utils 1.0
|
|||
* Text file viewer with auto-reload feature.
|
||||
* Uses a ListView with one delegate by line instead of a TextArea for performance reasons.
|
||||
*/
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
|
@ -115,7 +116,7 @@ Item {
|
|||
clip: true
|
||||
focus: true
|
||||
|
||||
// custom key navigation handling
|
||||
// Custom key navigation handling
|
||||
keyNavigationEnabled: false
|
||||
highlightFollowsCurrentItem: true
|
||||
highlightMoveDuration: 0
|
||||
|
@ -145,14 +146,14 @@ Item {
|
|||
}
|
||||
|
||||
function setText(value) {
|
||||
// store current first index
|
||||
// Store current first index
|
||||
var topIndex = firstVisibleIndex()
|
||||
// store whether autoscroll to bottom is active
|
||||
// Store whether autoscroll to bottom is active
|
||||
var scrollToBottom = atYEnd && autoscroll.checked
|
||||
// replace text
|
||||
// Replace text
|
||||
text = value
|
||||
|
||||
// restore content position by either:
|
||||
// Restore content position by either:
|
||||
// - autoscrolling to bottom
|
||||
if (scrollToBottom)
|
||||
positionViewAtEnd()
|
||||
|
@ -183,7 +184,7 @@ Item {
|
|||
// TextMetrics for textual progress bar
|
||||
TextMetrics {
|
||||
id: progressMetrics
|
||||
// total number of character in textual progress bar
|
||||
// Total number of character in textual progress bar
|
||||
property int count: 51
|
||||
property string character: '*'
|
||||
text: character.repeat(count)
|
||||
|
@ -230,15 +231,15 @@ Item {
|
|||
Loader {
|
||||
id: delegateLoader
|
||||
Layout.fillWidth: true
|
||||
// default line delegate
|
||||
// Default line delegate
|
||||
sourceComponent: line_component
|
||||
|
||||
// line delegate selector based on content
|
||||
// Line delegate selector based on content
|
||||
StateGroup {
|
||||
states: [
|
||||
State {
|
||||
name: "progressBar"
|
||||
// detect textual progressbar (non empty line with only progressbar character)
|
||||
// Detect textual progressbar (non-empty line with only progressbar character)
|
||||
when: logLine.line.trim().length
|
||||
&& logLine.line.split(progressMetrics.character).length - 1 === logLine.line.trim().length
|
||||
PropertyChanges {
|
||||
|
@ -281,7 +282,7 @@ Item {
|
|||
Keys.forwardTo: [textView]
|
||||
|
||||
color: {
|
||||
// color line according to log level
|
||||
// Color line according to log level
|
||||
if (text.indexOf("[warning]") >= 0)
|
||||
return Colors.orange
|
||||
else if(text.indexOf("[error]") >= 0)
|
||||
|
@ -350,7 +351,7 @@ Item {
|
|||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
textView.setText(xhr.status === 200 ? xhr.responseText : "")
|
||||
loading = false
|
||||
// re-trigger reload source file
|
||||
// Re-trigger reload source file
|
||||
if (autoReload)
|
||||
reloadTimer.restart()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue