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 + , Setup-Bereich umschalten Ctrl + W Widgets anzeigen
Tipp: Doppelklicken Sie auf eine Gruppe oder ein Diagramm, um es in einem
anderen Fenster anzuzeigen.
Tipp: Doppelklicken Sie auf eine Gruppe, ein Diagramm oder ein Widget, um es in
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 + , 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 + , 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 + , 切换设置窗格 Ctrl + W 显示小部件选项卡
提示:双击任何组或图表可在另一个窗口中查看它。
提示:双击任何组,图表或小部件以在另一个窗口中查看它。

View File

@ -41,8 +41,14 @@ MouseArea {
//
// Signals
//
signal rightClicked()
signal selectionChanged()
//
// Accepted buttons
//
acceptedButtons: Qt.RightButton | Qt.LeftButton
//
// Selects all the items that are "touched" by the selection rectangle
//
@ -124,6 +130,7 @@ MouseArea {
//
onClicked: {
if (mouse.button == Qt.RightButton) {
root.rightClicked()
mouse.accepted = false
return
}
@ -142,6 +149,7 @@ MouseArea {
//
onPressed: {
if(mouse.button == Qt.RightButton) {
root.rightClicked()
mouse.accepted = false
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
// is "touched" by the selector rectangle
@ -343,6 +331,7 @@ Rectangle {
//onMouseYChanged: root.updateCaretLineLocation(this)
anchors.leftMargin: lineCountRect.width + app.spacing
anchors.rightMargin: scrollbar.width + app.spacing - 2
onRightClicked: contextMenu.popup()
onDoubleClicked: {
var index = listView.currentIndex
@ -353,6 +342,17 @@ Rectangle {
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
//

View File

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

View File

@ -41,7 +41,8 @@ Control {
// 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
//
RowLayout {
spacing: app.spacing
spacing: 0
visible: graphGenerator.count > 0
Slider {
id: slider
to: 100
to: 25
from: 1
value: 10
live: false
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
value: Cpp_UI_GraphProvider.displayedPoints
onValueChanged: Cpp_UI_GraphProvider.displayedPoints = value
onValueChanged: Cpp_UI_GraphProvider.displayedPoints = value * Math.pow(10, mult.value)
}
Item {
width: app.spacing
}
Label {
font.pixelSize: 12
font.family: app.monoFont
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 {
anchors.fill: parent
color: app.windowBackgroundColor
color: group.backgroundColor
}
Widgets.GroupDelegate {
@ -459,7 +481,7 @@ Control {
Rectangle {
anchors.fill: parent
color: app.windowBackgroundColor
color: graph.backgroundColor
}
Widgets.GraphDelegate {

View File

@ -24,6 +24,8 @@ import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
import QtQuick.Window 2.12 as QtWindow
import "../Widgets" as Widgets
Control {
@ -105,6 +107,39 @@ Control {
groupIndex: index
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
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
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
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
}
}
}
}
}