Make widgets double-clickable

This commit is contained in:
Alex Spataru 2021-02-08 00:20:42 -05:00
parent 4b9c33ff6d
commit f0b8cb9348
9 changed files with 194 additions and 46 deletions

View File

@ -30,5 +30,5 @@ Tastatürkürzel:
Ctrl + O CSV-Datei abspielen Ctrl + D Dashboard anzeigen Ctrl + O CSV-Datei abspielen Ctrl + D Dashboard anzeigen
Ctrl + , Setup-Bereich umschalten Ctrl + W Widgets anzeigen Ctrl + , Setup-Bereich umschalten Ctrl + W Widgets anzeigen
Tipp: Doppelklicken Sie auf eine Gruppe oder ein Diagramm, um es in einem Tipp: Doppelklicken Sie auf eine Gruppe, ein Diagramm oder ein Widget, um es in
anderen Fenster anzuzeigen. einem anderen Fenster anzuzeigen.

View File

@ -28,4 +28,4 @@ Keyboard shortcuts:
Ctrl + O Open CSV file for playback Ctrl + D Show dashboard tab Ctrl + O Open CSV file for playback Ctrl + D Show dashboard tab
Ctrl + , Toggle setup pane Ctrl + W Show widgets tab Ctrl + , Toggle setup pane Ctrl + W Show widgets tab
Tip: Double-click on any group or chart to view it in another window. Tip: Double-click on any group, chart or widget to view it in another window.

View File

@ -28,4 +28,5 @@ Atajos de teclado:
Ctrl + O Reproducir archivo CSV Ctrl + D Mostrar el dashboard Ctrl + O Reproducir archivo CSV Ctrl + D Mostrar el dashboard
Ctrl + , Mostar panel de configuración Ctrl + W Mostrar los widgets Ctrl + , Mostar panel de configuración Ctrl + W Mostrar los widgets
Consejo: haga doble clic en cualquier grupo o gráfico para verlo en otra ventana. Consejo: haga doble clic en cualquier grupo, gráfico o widget para verlo en
otra ventana.

View File

@ -23,4 +23,4 @@ ____/ // __/ / _ / / /_/ /_ / ____/ // /_ / /_/ // /_/ / _ / / /_/ /
Ctrl + O 打开CSV文件进行播放 Ctrl + D 显示仪表板选项卡 Ctrl + O 打开CSV文件进行播放 Ctrl + D 显示仪表板选项卡
Ctrl + , 切换设置窗格 Ctrl + W 显示小部件选项卡 Ctrl + , 切换设置窗格 Ctrl + W 显示小部件选项卡
提示:双击任何组或图表可在另一个窗口中查看它。 提示:双击任何组,图表或小部件以在另一个窗口中查看它。

View File

@ -41,8 +41,14 @@ MouseArea {
// //
// Signals // Signals
// //
signal rightClicked()
signal selectionChanged() signal selectionChanged()
//
// Accepted buttons
//
acceptedButtons: Qt.RightButton | Qt.LeftButton
// //
// Selects all the items that are "touched" by the selection rectangle // Selects all the items that are "touched" by the selection rectangle
// //
@ -124,6 +130,7 @@ MouseArea {
// //
onClicked: { onClicked: {
if (mouse.button == Qt.RightButton) { if (mouse.button == Qt.RightButton) {
root.rightClicked()
mouse.accepted = false mouse.accepted = false
return return
} }
@ -142,6 +149,7 @@ MouseArea {
// //
onPressed: { onPressed: {
if(mouse.button == Qt.RightButton) { if(mouse.button == Qt.RightButton) {
root.rightClicked()
mouse.accepted = false mouse.accepted = false
return return
} }

View File

@ -317,18 +317,6 @@ Rectangle {
} }
} }
//
// Simple implementation of a vertical text cursor
//
MouseArea {
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.IBeamCursor
acceptedButtons: Qt.RightButton
onClicked: contextMenu.popup()
//onMouseYChanged: root.updateCaretLineLocation(this)
}
// //
// Implementation of a rectangular selection that selects any line that is // Implementation of a rectangular selection that selects any line that is
// is "touched" by the selector rectangle // is "touched" by the selector rectangle
@ -343,6 +331,7 @@ Rectangle {
//onMouseYChanged: root.updateCaretLineLocation(this) //onMouseYChanged: root.updateCaretLineLocation(this)
anchors.leftMargin: lineCountRect.width + app.spacing anchors.leftMargin: lineCountRect.width + app.spacing
anchors.rightMargin: scrollbar.width + app.spacing - 2 anchors.rightMargin: scrollbar.width + app.spacing - 2
onRightClicked: contextMenu.popup()
onDoubleClicked: { onDoubleClicked: {
var index = listView.currentIndex var index = listView.currentIndex
@ -353,6 +342,17 @@ Rectangle {
dragSelector.selectionChanged() dragSelector.selectionChanged()
} }
} }
onWheel: {
var yValue = wheel.angleDelta.y / 15
if (Math.abs(yValue) < 2)
return
if (yValue > 0)
root.scrollUp(yValue, true)
else
root.scrollDown(Math.abs(yValue), true)
}
} }
// //
@ -375,23 +375,6 @@ Rectangle {
} }
} }
//
// Mouse wheel navigation
//
MouseArea {
anchors.fill: parent
onWheel: {
var yValue = wheel.angleDelta.y / 15
if (Math.abs(yValue) < 2)
return
if (yValue > 0)
root.scrollUp(yValue, true)
else
root.scrollDown(Math.abs(yValue), true)
}
}
// //
// Line selector rectangles // Line selector rectangles
// //

View File

@ -108,15 +108,15 @@ Page {
id: _bt id: _bt
flat: true flat: true
enabled: false enabled: false
icon.width: 24
icon.height: 24
Layout.minimumWidth: 32
Layout.maximumWidth: 32
icon.color: root.titleColor icon.color: root.titleColor
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.maximumHeight: parent.height Layout.maximumHeight: parent.height
Layout.minimumHeight: parent.height Layout.minimumHeight: parent.height
Layout.minimumWidth: root.headerHeight
Layout.maximumWidth: root.headerHeight
icon.source: "qrc:/icons/equalizer.svg" icon.source: "qrc:/icons/equalizer.svg"
icon.width: root.headerHeight * 24 / 32
icon.height: root.headerHeight * 24 / 32
} }
Label { Label {

View File

@ -41,7 +41,8 @@ Control {
// Settings // Settings
// //
Settings { Settings {
property alias horizontalRange: slider.value property alias numPoints: slider.value
property alias multiplier: mult.value
} }
// //
@ -163,24 +164,45 @@ Control {
// Horizontal range slider // Horizontal range slider
// //
RowLayout { RowLayout {
spacing: app.spacing spacing: 0
visible: graphGenerator.count > 0 visible: graphGenerator.count > 0
Slider { Slider {
id: slider id: slider
to: 100 to: 25
from: 1 from: 1
value: 10
live: false live: false
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
value: Cpp_UI_GraphProvider.displayedPoints onValueChanged: Cpp_UI_GraphProvider.displayedPoints = value * Math.pow(10, mult.value)
onValueChanged: Cpp_UI_GraphProvider.displayedPoints = value }
Item {
width: app.spacing
} }
Label { Label {
font.pixelSize: 12
font.family: app.monoFont font.family: app.monoFont
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
text: Math.ceil(slider.position * (slider.to)) text: Math.ceil(slider.position * (slider.to)) + "×10^"
}
Item {
width: app.spacing
}
SpinBox {
id: mult
to: 6
from: 0
value: 1
editable: true
Layout.maximumWidth: 42
font.family: app.monoFont
Layout.alignment: Qt.AlignVCenter
onValueChanged: Cpp_UI_GraphProvider.displayedPoints = slider.value * Math.pow(10, mult.value)
} }
} }
@ -402,7 +424,7 @@ Control {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: app.windowBackgroundColor color: group.backgroundColor
} }
Widgets.GroupDelegate { Widgets.GroupDelegate {
@ -459,7 +481,7 @@ Control {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: app.windowBackgroundColor color: graph.backgroundColor
} }
Widgets.GraphDelegate { Widgets.GraphDelegate {

View File

@ -24,6 +24,8 @@ import QtQuick 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import QtQuick.Window 2.12 as QtWindow
import "../Widgets" as Widgets import "../Widgets" as Widgets
Control { Control {
@ -105,6 +107,39 @@ Control {
groupIndex: index groupIndex: index
anchors.fill: parent anchors.fill: parent
} }
MouseArea {
anchors.fill: parent
onDoubleClicked: windowGyro.show()
}
QtWindow.Window {
id: windowGyro
minimumWidth: root.minimumWidgetSize * 1.2
minimumHeight: root.minimumWidgetSize * 1.2
title: gyro.title
flags: Qt.Dialog |
Qt.WindowStaysOnTopHint |
Qt.WindowCloseButtonHint |
Qt.WindowTitleHint
Rectangle {
anchors.fill: parent
color: gyro.backgroundColor
}
Widgets.GyroDelegate {
id: gyro
showIcon: true
gradient: false
headerHeight: 48
groupIndex: index
anchors.margins: 0
anchors.fill: parent
borderColor: backgroundColor
}
}
} }
} }
@ -121,6 +156,39 @@ Control {
groupIndex: index groupIndex: index
anchors.fill: parent anchors.fill: parent
} }
MouseArea {
anchors.fill: parent
onDoubleClicked: windowAcc.show()
}
QtWindow.Window {
id: windowAcc
minimumWidth: root.minimumWidgetSize * 1.2
minimumHeight: root.minimumWidgetSize * 1.2
title: acc.title
flags: Qt.Dialog |
Qt.WindowStaysOnTopHint |
Qt.WindowCloseButtonHint |
Qt.WindowTitleHint
Rectangle {
anchors.fill: parent
color: acc.backgroundColor
}
Widgets.AccelerometerDelegate {
id: acc
showIcon: true
gradient: false
headerHeight: 48
groupIndex: index
anchors.margins: 0
anchors.fill: parent
borderColor: backgroundColor
}
}
} }
} }
@ -137,6 +205,39 @@ Control {
groupIndex: index groupIndex: index
anchors.fill: parent anchors.fill: parent
} }
MouseArea {
anchors.fill: parent
onDoubleClicked: windowMap.show()
}
QtWindow.Window {
id: windowMap
minimumWidth: root.minimumWidgetSize * 1.2
minimumHeight: root.minimumWidgetSize * 1.2
title: map.title
flags: Qt.Dialog |
Qt.WindowStaysOnTopHint |
Qt.WindowCloseButtonHint |
Qt.WindowTitleHint
Rectangle {
anchors.fill: parent
color: map.backgroundColor
}
Widgets.MapDelegate {
id: map
showIcon: true
gradient: false
headerHeight: 48
groupIndex: index
anchors.margins: 0
anchors.fill: parent
borderColor: backgroundColor
}
}
} }
} }
@ -153,6 +254,39 @@ Control {
datasetIndex: index datasetIndex: index
anchors.fill: parent anchors.fill: parent
} }
MouseArea {
anchors.fill: parent
onDoubleClicked: windowBar.show()
}
QtWindow.Window {
id: windowBar
minimumWidth: root.minimumWidgetSize * 1.2
minimumHeight: root.minimumWidgetSize * 1.2
title: bar.title
flags: Qt.Dialog |
Qt.WindowStaysOnTopHint |
Qt.WindowCloseButtonHint |
Qt.WindowTitleHint
Rectangle {
anchors.fill: parent
color: bar.backgroundColor
}
Widgets.BarDelegate {
id: bar
showIcon: true
gradient: false
headerHeight: 48
datasetIndex: index
anchors.margins: 0
anchors.fill: parent
borderColor: backgroundColor
}
}
} }
} }
} }