mirror of
https://github.com/johndoe6345789/tustu.git
synced 2026-04-24 21:55:12 +00:00
- Updated Main.qml to improve UI layout and replace menu with a toolbar. - Created reusable QML components: DraggableGauge, StatusIndicator, and TopButton. - Implemented EngineSimulator class in main.py for real-time engine data simulation. - Simplified GaugeClusterView by utilizing new components and removing internal timers. - Added README.md for component documentation and usage examples. - Enhanced overall maintainability and performance of the application.
2.7 KiB
2.7 KiB
QML Component Library
This directory contains reusable QML components for the TunerStudio MS application.
Components
DraggableGauge.qml
Draggable gauge component that can be repositioned on the canvas.
Properties:
title(string): Gauge title textminValue(real): Minimum value on gauge scalemaxValue(real): Maximum value on gauge scalevalue(real): Current gauge valueunits(string): Unit text displayed on gauge
Usage:
DraggableGauge {
x: 20; y: 20
title: "RPM"
minValue: 0
maxValue: 8000
value: engineData.rpm
units: "RPM"
}
StatusIndicator.qml
Small status indicator rectangle for displaying engine states.
Properties:
text(string): Status text to displaybgColor(color): Background color of indicatortextColor(color): Text color (default: white)
Usage:
StatusIndicator {
text: "Battery OK"
bgColor: "#27ae60"
}
TopButton.qml
Toolbar button component with hover and active states.
Properties:
text(string): Button labelisActive(bool): Whether button is in active state- Standard ToolButton properties
Usage:
TopButton {
text: "Fuel Set-Up"
onClicked: {
// Handle click
}
}
File Structure
app_qml/
├── components/
│ ├── DraggableGauge.qml # Draggable gauge component
│ ├── StatusIndicator.qml # Status badge component
│ ├── TopButton.qml # Toolbar button component
│ └── README.md # This file
├── Main.qml # Main application window
├── GaugeClusterView.qml # Gauge cluster view
├── RoundGauge.qml # Round gauge widget
├── BarGauge.qml # Bar gauge widget
└── main.py # Python launcher with engine simulator
Integration
To use components in your QML files:
import "components"
ApplicationWindow {
// Use components
DraggableGauge { ... }
StatusIndicator { ... }
TopButton { ... }
}
Engine Data
Engine data is provided by the Python EngineSimulator class in main.py and exposed to QML as engineData:
Available properties:
rpm(float): Engine RPM (0-8000)throttle(float): Throttle position (0-100%)temp(float): Coolant temperature (°C)afr(float): Air/Fuel ratio (10-20)boost(float): Boost pressure (PSI)voltage(float): Battery voltage (V)pulseWidth(float): Injector pulse width (ms)ignition(float): Ignition timing (degrees)
Example:
DraggableGauge {
title: "RPM"
value: engineData.rpm // Real-time value from Python
minValue: 0
maxValue: 8000
}