Created new Layout prototype.

This commit is contained in:
2025-12-26 12:04:02 +01:00
parent 0bec8dfeb7
commit 3ff995d547
5 changed files with 191 additions and 94 deletions

View File

@@ -29,8 +29,10 @@ SOURCES += \
bcdatamanager.cpp \ bcdatamanager.cpp \
bcdatamodel.cpp \ bcdatamodel.cpp \
bcdatavalue.cpp \ bcdatavalue.cpp \
bcdevicepanel.cpp \
bcitemdelegate.cpp \ bcitemdelegate.cpp \
bclegacy.cpp \ bclegacy.cpp \
bctoolbutton.cpp \
bctransmitter.cpp \ bctransmitter.cpp \
bcvaluetype.cpp \ bcvaluetype.cpp \
lib/can_drv_win.c \ lib/can_drv_win.c \
@@ -46,12 +48,15 @@ HEADERS += \
bcdatamanager.h \ bcdatamanager.h \
bcdatamodel.h \ bcdatamodel.h \
bcdatavalue.h \ bcdatavalue.h \
bcdevicepanel.h \
bcitemdelegate.h \ bcitemdelegate.h \
bcmainwindow.h \ bcmainwindow.h \
bctoolbutton.h \
bctransmitter.h \ bctransmitter.h \
bcvaluetype.h bcvaluetype.h
FORMS += \ FORMS += \
bcdevicepanel.ui \
bcmainwindow.ui bcmainwindow.ui
# Default rules for deployment. # Default rules for deployment.

View File

@@ -38,10 +38,14 @@ BCMainWindow::BCMainWindow(QWidget *parent)
{ {
setupUi(this); setupUi(this);
_motorlButton->setDefaultAction( _actionMotor); _motorButton->setDefaultAction( _motorAction);
_consoleButton->setDefaultAction( _consoleAction );
_batteryButton->setDefaultAction( _batteryAction );
_pimpButton->setDefaultAction( _pimpAction);
_valueManager.loadXmlBikeData(); _valueManager.loadXmlBikeData();
auto model = _valueManager.getModel( BCDevice::ID::Console ); auto model = _valueManager.getModel( BCDevice::ID::Console );
/*
if( model) if( model)
{ {
_valueView->setModel( *model ); _valueView->setModel( *model );
@@ -59,6 +63,7 @@ BCMainWindow::BCMainWindow(QWidget *parent)
connect(_delegate, &BCItemDelegate::viewUpdateNeeded, _valueView->viewport(), QOverload<>::of(&QWidget::update)); connect(_delegate, &BCItemDelegate::viewUpdateNeeded, _valueView->viewport(), QOverload<>::of(&QWidget::update));
//_valueView->setItemDelegate(_delegate); //_valueView->setItemDelegate(_delegate);
// Highlight mit Fade-Out: // Highlight mit Fade-Out:
@@ -70,7 +75,7 @@ BCMainWindow::BCMainWindow(QWidget *parent)
connect( &_valueManager, &BCDataManager::valueTouched, _delegate, &BCItemDelegate::onHighlightRow ); connect( &_valueManager, &BCDataManager::valueTouched, _delegate, &BCItemDelegate::onHighlightRow );
connect( _connectButton, &QPushButton::clicked, transmitter, &BCTransmitter::onToggleConnectionState ); connect( _connectButton, &QPushButton::clicked, transmitter, &BCTransmitter::onToggleConnectionState );
connect( _syncButton, &QPushButton::clicked, &_valueManager, &BCDataManager::onSyncFromDevice ); connect( _syncButton, &QPushButton::clicked, &_valueManager, &BCDataManager::onSyncFromDevice );
*/
} }

View File

@@ -14,45 +14,113 @@
<string>BCMainWindow</string> <string>BCMainWindow</string>
</property> </property>
<widget class="QWidget" name="_centralwidget"> <widget class="QWidget" name="_centralwidget">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <widget class="QWidget" name="_buttonWidget" native="true">
<item> <property name="styleSheet">
<widget class="QFrame" name="_controlFrame"> <string notr="true">background-color: grey;</string>
<property name="minimumSize"> </property>
<size> <layout class="QVBoxLayout" name="verticalLayout_2">
<width>200</width> <item>
<height>0</height> <widget class="QWidget" name="widget" native="true">
</size> <property name="styleSheet">
</property> <string notr="true">background-color: #aaaaaa;</string>
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<widget class="QPushButton" name="_syncButton">
<property name="geometry">
<rect>
<x>30</x>
<y>50</y>
<width>171</width>
<height>51</height>
</rect>
</property>
<property name="text">
<string>Sync</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="BCToolButton" name="_pimpButton">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="BCToolButton" name="_batteryButton">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="BCToolButton" name="_motorButton">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="BCToolButton" name="_consoleButton">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
</layout>
</widget> </widget>
<widget class="QPushButton" name="_connectButton"> </item>
<property name="geometry"> <item>
<rect> <spacer name="verticalSpacer">
<x>10</x> <property name="orientation">
<y>180</y> <enum>Qt::Orientation::Vertical</enum>
<width>171</width>
<height>51</height>
</rect>
</property> </property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>227</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="_connectButton">
<property name="text"> <property name="text">
<string>Connect</string> <string>Connect</string>
</property> </property>
@@ -60,58 +128,38 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QToolButton" name="_motorlButton"> </item>
<property name="geometry"> <item>
<rect> <widget class="QPushButton" name="_syncButton">
<x>70</x>
<y>240</y>
<width>71</width>
<height>71</height>
</rect>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>Sync</string>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property> </property>
</widget> </widget>
</widget> </item>
</item> </layout>
<item> </widget>
<widget class="QTableView" name="_valueView"> </item>
<property name="frameShape"> <item>
<enum>QFrame::Shape::NoFrame</enum> <widget class="QStackedWidget" name="_controlWidget">
</property> <property name="minimumSize">
<property name="frameShadow"> <size>
<enum>QFrame::Shadow::Plain</enum> <width>200</width>
</property> <height>0</height>
<property name="alternatingRowColors"> </size>
<bool>false</bool> </property>
</property> <property name="currentIndex">
<property name="showGrid"> <number>3</number>
<bool>false</bool> </property>
</property> <widget class="BCDevicePanel" name="_consolePanel"/>
<property name="gridStyle"> <widget class="BCDevicePanel" name="_motorPanel"/>
<enum>Qt::PenStyle::NoPen</enum> <widget class="BCDevicePanel" name="_batteryPanel"/>
</property> <widget class="BCDevicePanel" name="_pimpPanel"/>
<attribute name="horizontalHeaderStretchLastSection"> </widget>
<bool>true</bool>
</attribute>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QStatusBar" name="_statusbar"/> <widget class="QStatusBar" name="_statusbar"/>
<action name="_actionPimp"> <action name="_pimpAction">
<property name="icon"> <property name="icon">
<iconset> <iconset>
<normaloff>:restart.png</normaloff>:restart.png</iconset> <normaloff>:restart.png</normaloff>:restart.png</iconset>
@@ -123,7 +171,7 @@
<string>Pimp my Ride</string> <string>Pimp my Ride</string>
</property> </property>
</action> </action>
<action name="_actionMotor"> <action name="_motorAction">
<property name="icon"> <property name="icon">
<iconset> <iconset>
<normaloff>:bionx_motor.png</normaloff>:bionx_motor.png</iconset> <normaloff>:bionx_motor.png</normaloff>:bionx_motor.png</iconset>
@@ -135,7 +183,7 @@
<string>Show motor settings</string> <string>Show motor settings</string>
</property> </property>
</action> </action>
<action name="_actionBattery"> <action name="_batteryAction">
<property name="icon"> <property name="icon">
<iconset> <iconset>
<normaloff>:bionx_akku.png</normaloff>:bionx_akku.png</iconset> <normaloff>:bionx_akku.png</normaloff>:bionx_akku.png</iconset>
@@ -147,7 +195,7 @@
<string>Show battery settings</string> <string>Show battery settings</string>
</property> </property>
</action> </action>
<action name="_actionConsole"> <action name="_consoleAction">
<property name="icon"> <property name="icon">
<iconset> <iconset>
<normaloff>:bionx_console.png</normaloff>:bionx_console.png</iconset> <normaloff>:bionx_console.png</normaloff>:bionx_console.png</iconset>
@@ -159,7 +207,7 @@
<string>Show console settings</string> <string>Show console settings</string>
</property> </property>
</action> </action>
<action name="_actionExit"> <action name="_exitAction">
<property name="icon"> <property name="icon">
<iconset> <iconset>
<normaloff>:exit.png</normaloff>:exit.png</iconset> <normaloff>:exit.png</normaloff>:exit.png</iconset>
@@ -171,7 +219,7 @@
<string>Exit</string> <string>Exit</string>
</property> </property>
</action> </action>
<action name="_actionConnect"> <action name="_connectAction">
<property name="icon"> <property name="icon">
<iconset resource="bionxcontrol.qrc"> <iconset resource="bionxcontrol.qrc">
<normaloff>:/connected.png</normaloff>:/connected.png</iconset> <normaloff>:/connected.png</normaloff>:/connected.png</iconset>
@@ -187,6 +235,19 @@
</property> </property>
</action> </action>
</widget> </widget>
<customwidgets>
<customwidget>
<class>BCDevicePanel</class>
<extends>QWidget</extends>
<header location="global">bcdevicepanel.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BCToolButton</class>
<extends>QToolButton</extends>
<header location="global">bctoolbutton.h</header>
</customwidget>
</customwidgets>
<resources> <resources>
<include location="bionxcontrol.qrc"/> <include location="bionxcontrol.qrc"/>
</resources> </resources>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 18.0.1, 2025-12-22T19:04:55. --> <!-- Written by QtCreator 18.0.1, 2025-12-26T11:01:19. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
@@ -62,6 +62,30 @@
<data> <data>
<variable>ProjectExplorer.Project.PluginSettings</variable> <variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<value type="bool" key="AutoTest.ApplyFilter">false</value>
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
<valuelist type="QVariantList" key="AutoTest.PathFilters"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">16</value>
<value type="bool" key="ClangTools.PreferConfigFile">true</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
<value type="int" key="RcSync">0</value> <value type="int" key="RcSync">0</value>
</valuemap> </valuemap>
</data> </data>
@@ -84,7 +108,7 @@
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/> <valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
@@ -140,11 +164,12 @@
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value> <value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph &quot;dwarf,4096&quot; -F 250</value> <value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph &quot;dwarf,4096&quot; -F 250</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value> <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/syncMePlease/projects.now/BionxControl/doc/material_dummy/material_dummy.pro</value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value> <value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.UniqueId"></value> <value type="QString" key="ProjectExplorer.RunConfiguration.UniqueId"></value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">%{RunConfig:Executable:Path}</value> <value type="QString" key="RunConfiguration.WorkingDirectory.default">%{RunConfig:Executable:Path}</value>
</valuemap> </valuemap>
@@ -176,11 +201,12 @@
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value> <value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph &quot;dwarf,4096&quot; -F 250</value> <value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph &quot;dwarf,4096&quot; -F 250</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value> <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/syncMePlease/projects.now/BionxControl/doc/material_dummy/material_dummy.pro</value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value> <value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.UniqueId"></value> <value type="QString" key="ProjectExplorer.RunConfiguration.UniqueId"></value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">%{RunConfig:Executable:Path}</value> <value type="QString" key="RunConfiguration.WorkingDirectory.default">%{RunConfig:Executable:Path}</value>
</valuemap> </valuemap>

View File

@@ -145,7 +145,7 @@ struct mookoo2 : public mookoo
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
setApplicationStyleSheet( ":/bionxcontrol.qss"_L1 ); //setApplicationStyleSheet( ":/bionxcontrol.qss"_L1 );
mookoo myMookoo{"",1,1.0}; mookoo myMookoo{"",1,1.0};
mookoo myMooko2{"",1}; mookoo myMooko2{"",1};