Visual updates

This commit is contained in:
2026-04-04 14:29:18 +02:00
parent 884e8e903e
commit 911f169b5e
13 changed files with 19 additions and 160 deletions

View File

@@ -20,7 +20,7 @@ qt_add_executable(BionxControl WIN32 MACOSX_BUNDLE
bcdriverstatewidget.cpp bcdriverstatewidget.h bcdriverstatewidget.cpp bcdriverstatewidget.h
bcdrivertinycan.cpp bcdrivertinycan.h bcdrivertinycan.cpp bcdrivertinycan.h
bcmainwindow.cpp bcmainwindow.h bcmainwindow.ui bcmainwindow.cpp bcmainwindow.h bcmainwindow.ui
bcthemeswitchbutton.cpp bcthemeswitchbutton.h bcthemebutton.cpp bcthemebutton.h
bctoggleswitch.cpp bctoggleswitch.h bctoggleswitch.cpp bctoggleswitch.h
bctransmitter.cpp bctransmitter.h bctransmitter.cpp bctransmitter.h
bcvalue.cpp bcvalue.h bcvalue.cpp bcvalue.h

4
bc.h
View File

@@ -64,6 +64,10 @@ namespace BCTags
inline constexpr auto Yes = "Yes"_L1; inline constexpr auto Yes = "Yes"_L1;
inline constexpr auto No = "No"_L1; inline constexpr auto No = "No"_L1;
inline constexpr auto Host = "bionxcontrol"_L1;
} }
/** /**

View File

@@ -62,8 +62,10 @@ QWidget* BCValueDelegate::createEditor(QWidget *parent, const QStyleOptionViewIt
const BCValue& bcValue = *(_valueList[ index.row() ].get()); const BCValue& bcValue = *(_valueList[ index.row() ].get());
BCValue::ValueRange params;
bool hasData = bcValue.hasValuesForSlider( params );
//qDebug() << " --- Create Editor: " << bcValue.label() << " value: " << params.value << " min: " << params.min << " max: " << params.max << " ratio:" << bcValue.calcMinMaxRatio()*100.0 << '%'; qDebug() << " --- Create Editor: " << bcValue.label() << " value: " << params.value << " min: " << params.min << " max: " << params.max << " ratio:" << bcValue.calcMinMaxRatio()*100.0 << '%';
if( bcValue.isBoolean() ) if( bcValue.isBoolean() )
{ {
@@ -72,17 +74,15 @@ QWidget* BCValueDelegate::createEditor(QWidget *parent, const QStyleOptionViewIt
// Signal für sofortige Updates // Signal für sofortige Updates
connect(toggleSwitch, &BCToggleSwitch::toggled, this, [this, toggleSwitch](bool checked) connect(toggleSwitch, &BCToggleSwitch::toggled, this, [this, toggleSwitch](bool checked)
{ {
qDebug() << "--- toggled: " << checked; qDebug() << "--- toggled: " << checked;
// Commit data sofort bei Änderung // Commit data sofort bei Änderung
emit const_cast<BCValueDelegate*>(this)->commitData(toggleSwitch); emit const_cast<BCValueDelegate*>(this)->commitData(toggleSwitch);
}); });
return toggleSwitch; return toggleSwitch;
} }
BCValue::ValueRange params;
bool hasData = bcValue.hasValuesForSlider( params );
if( !hasData ) if( !hasData )
return nullptr; return nullptr;
@@ -95,17 +95,6 @@ QWidget* BCValueDelegate::createEditor(QWidget *parent, const QStyleOptionViewIt
// Commit data sofort bei Änderung // Commit data sofort bei Änderung
emit const_cast<BCValueDelegate*>(this)->commitData(valueSlider); emit const_cast<BCValueDelegate*>(this)->commitData(valueSlider);
}); });
/*
// Signal für sofortige Updates
connect(valueSlider, &BCValueSlider::valueCommited, this, [this, valueSlider](int newValue)
{
qDebug() << " --- value set:" << newValue;
// Commit data sofort bei Änderung
emit const_cast<BCValueDelegate*>(this)->commitData(valueSlider);
});
*/
return valueSlider; return valueSlider;
} }
@@ -125,18 +114,6 @@ void BCValueDelegate::updateEditorGeometry(QWidget* editor, const QStyleOptionVi
const BCValue& bcValue = *(_valueList[ index.row()].get()); const BCValue& bcValue = *(_valueList[ index.row()].get());
QRect editorRect = bcValue.isBoolean() ? adjustEditorRect(option.rect, 0, 6, -130, -6) : adjustEditorRect(option.rect, 0, 0, 8, 0); QRect editorRect = bcValue.isBoolean() ? adjustEditorRect(option.rect, 0, 6, -130, -6) : adjustEditorRect(option.rect, 0, 0, 8, 0);
/*
if( !bcValue.isBoolean())
{
editorRect = adjustEditorRect( option.rect,0,0,8,0 );
}
else
{
editorRect = adjustEditorRect(option.rect, 0, 6, -130, -6);
}
*/
editor->setGeometry(editorRect); editor->setGeometry(editorRect);
} }
@@ -161,7 +138,7 @@ void BCValueDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, c
} }
model->setData(index, reValue, Qt::EditRole); model->setData(index, reValue, Qt::EditRole);
return;
} }

View File

@@ -1,24 +0,0 @@
cmake_minimum_required(VERSION 3.16)
project(HelloWorldQt6 VERSION 1.0.0 LANGUAGES CXX)
# Wir nutzen modernes C++
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Qt-spezifische Automatismen aktivieren
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
# Qt6 Widgets-Modul suchen
find_package(Qt6 REQUIRED COMPONENTS Widgets)
# Executable definieren und Quelldateien hinzufügen
add_executable(HelloWorldApp
main.cpp
MainWindow.cpp
MainWindow.hpp
)
# Qt6 Bibliotheken linken
target_link_libraries(HelloWorldApp PRIVATE Qt6::Widgets)

View File

@@ -1,34 +0,0 @@
# Wir nutzen Debian Trixie als Basis für das aktuelle Raspberry Pi OS
FROM debian:trixie
# Verhindert interaktive Prompts während der Installation
ENV DEBIAN_FRONTEND=noninteractive
# 1. Multiarch für arm64 aktivieren
RUN dpkg --add-architecture arm64 && \
apt-get update && \
apt-get upgrade -y
# 2. Host-Build-Tools und Cross-Compiler installieren
RUN apt-get install -y \
build-essential \
crossbuild-essential-arm64 \
cmake \
ninja-build \
git \
pkg-config
# 3. Qt6 für den HOST installieren (für moc, uic, etc.)
RUN apt-get install -y \
qt6-base-dev \
qt6-tools-dev-tools
# 4. Qt6 Bibliotheken für das TARGET (arm64) installieren
RUN apt-get install -y \
qt6-base-dev:arm64 \
libglvnd-dev:arm64
# Aufräumen
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /workspace

View File

@@ -1,17 +0,0 @@
#include "MainWindow.hpp"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
// Button erstellen
m_helloButton = new QPushButton("Hello World", this);
// Den Button zum zentralen Widget des Fensters machen
setCentralWidget(m_helloButton);
// Eine angenehme Startgröße für das Fenster setzen
resize(400, 300);
// Ein kleines Extra: Klick auf den Button schließt die App
connect(m_helloButton, &QPushButton::clicked, this, &QMainWindow::close);
}

View File

@@ -1,14 +0,0 @@
#pragma once
#include <QMainWindow>
#include <QPushButton>
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
private:
QPushButton *m_helloButton;
};

View File

@@ -1,25 +0,0 @@
# Name des Zielsystems
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
# Die Cross-Compiler aus dem Debian-Paket
set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++)
# Wo das System nach Bibliotheken und Headern suchen soll (Sysroot)
set(CMAKE_SYSROOT /)
# Pfade für pkg-config anpassen, damit es die arm64 .pc Dateien findet
set(ENV{PKG_CONFIG_DIR} "")
set(ENV{PKG_CONFIG_LIBDIR} "/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig")
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${CMAKE_SYSROOT})
# Suchverhalten für find_package(), find_library() etc.
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # Programme (wie moc) auf dem Host suchen
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # Libs nur im Target (arm64) suchen
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Header nur im Target (arm64) suchen
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) # CMake-Pakete nur im Target suchen
# *** WICHTIG FÜR QT6 ***
# Sagt Qt, wo es die Host-Tools für das Code-Generieren findet
set(QT_HOST_PATH "/usr")

View File

@@ -1,11 +0,0 @@
#include <QApplication>
#include "MainWindow.hpp"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
MainWindow window;
window.show();
return app.exec();
}

View File

@@ -47,8 +47,9 @@ int main(int argc, char *argv[])
QApplication app(argc, argv); QApplication app(argc, argv);
BCMainWindow mainWindow; BCMainWindow mainWindow;
//mainWindow.resize(800, 480);
if (QSysInfo::machineHostName() == "BionxControl") if (QSysInfo::machineHostName() == BCTags::Host )
{ {
mainWindow.setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); mainWindow.setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
mainWindow.showFullScreen(); mainWindow.showFullScreen();

View File

@@ -253,6 +253,8 @@ QLineEdit:disabled {
} }
/*
QSlider { QSlider {
background: hotpink; background: hotpink;
} }
*/

View File

@@ -41,7 +41,7 @@
<Value ID='Cons_Throttle_Maxspeed_Hi' Label='Throttle Speed Limit' UnitLabel='km/h' Factor='0.1' Min='0' Max='70' ValueType='Float'/> <Value ID='Cons_Throttle_Maxspeed_Hi' Label='Throttle Speed Limit' UnitLabel='km/h' Factor='0.1' Min='0' Max='70' ValueType='Float'/>
<Value ID='Cons_Geometry_Circ_Hi' Label='Wheel Circumference' IsWord='true' UnitLabel='mm' Min='0' Max='2300' Factor='1.5625' ValueType='Number'/> <Value ID='Cons_Geometry_Circ_Hi' Label='Wheel Circumference' IsWord='true' UnitLabel='mm' Min='0' Max='2300' Factor='1.5625' ValueType='Number'/>
<Value ID='Cons_Assist_Mountain_Cap' Label='Mountain Cap' UnitLabel='%' Factor='1.5625' ValueType='Float'/> <Value ID='Cons_Assist_Mountain_Cap' Label='Mountain Cap' UnitLabel='%' Min="0" Max="100" Factor='1.5625' ValueType='Float'/>
</Device> </Device>
</Bike> </Bike>