More fancyfications.
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include <QHeaderView>
|
||||
|
||||
#include <bcdeviceview.h>
|
||||
#include <bcanimateddelegate.h>
|
||||
|
||||
@@ -44,18 +46,13 @@ BCDeviceView::BCDeviceView(QWidget *parent)
|
||||
// __fix! ziemlich wildes ge-pointere, hier
|
||||
_itemDelegate = new BCAnimatedDelegate( _valueModel.getValueList(), this);
|
||||
setItemDelegate( _itemDelegate );
|
||||
|
||||
qDebug() << " --- View size I: " << this->size();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BCDeviceView::setDeviceID( BCDevice::ID deviceID )
|
||||
{
|
||||
qDebug() << " --- View size II: " << this->size();
|
||||
|
||||
_devideID = deviceID;
|
||||
_devideID = deviceID;
|
||||
}
|
||||
|
||||
BCDevice::ID BCDeviceView::getDeviceID() const
|
||||
@@ -64,7 +61,9 @@ BCDevice::ID BCDeviceView::getDeviceID() const
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Gibt eine Referenz auf der ValueList zurück.
|
||||
*/
|
||||
|
||||
const BCValueList& BCDeviceView::getValueListX()
|
||||
{
|
||||
@@ -72,8 +71,10 @@ const BCValueList& BCDeviceView::getValueListX()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// __FIX ist das ok so?
|
||||
/**
|
||||
* @brief SLOT, der aufgerufen wird, wenn die ValueList vom XML-Lader fertig geladen wurde.
|
||||
* Die DeviceView nimmt die ValueList dann in Besitz.
|
||||
*/
|
||||
void BCDeviceView::onValueListReady( BCDevice::ID deviceID, BCValueList valueList )
|
||||
{
|
||||
qDebug() << " --- onValueListReady: " << deviceID << ": " << valueList.size();
|
||||
@@ -81,11 +82,28 @@ void BCDeviceView::onValueListReady( BCDevice::ID deviceID, BCValueList valueLis
|
||||
_valueModel.takeValueList( valueList );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief SLOT, der aufgerufen wird, wenn ein Value geändert wurde. Gibt dem ItemDelegate Bescheid.
|
||||
*/
|
||||
|
||||
void BCDeviceView::onValueUpdated(int index, BCValue::State state, const QString& newVisibleValue )
|
||||
{
|
||||
_valueModel.onValueUpdated( index, state, newVisibleValue);
|
||||
_itemDelegate->onHighlightRow( index );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void BCDeviceView::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
// Zuerst die Basisklasse aufrufen (Wichtig für Layouts!)
|
||||
QWidget::resizeEvent(event);
|
||||
|
||||
// Berechnung: 40% der aktuellen Breite
|
||||
// Tipp: viewport()->width() ist genauer als width(), da es Scrollbars rausrechnet!
|
||||
int totalWidth = viewport()->width();
|
||||
int col0Width = static_cast<int>(totalWidth * 0.60);
|
||||
|
||||
// Setzen der Breite
|
||||
horizontalHeader()->resizeSection(0, col0Width);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ public slots:
|
||||
|
||||
protected:
|
||||
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
BCDevice::ID _devideID{BCDevice::ID::Invalid};
|
||||
BCValueModel _valueModel;
|
||||
BCAnimatedDelegate* _itemDelegate{};
|
||||
|
||||
@@ -71,9 +71,15 @@
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">_buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignmentFlag::AlignHCenter">
|
||||
@@ -93,9 +99,15 @@
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">_buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignmentFlag::AlignHCenter">
|
||||
@@ -115,9 +127,18 @@
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">_buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -229,7 +250,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="BCDeviceView" name="_consolePanel">
|
||||
<property name="frameShape">
|
||||
@@ -388,4 +409,7 @@
|
||||
<include location="bionxcontrol.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="_buttonGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
||||
@@ -59,11 +59,7 @@ void BCXmlLoader::loadXmlBikeData( const QString& fileName )
|
||||
}
|
||||
qDebug().noquote() << parts.join(" ");
|
||||
};
|
||||
/*
|
||||
QString fileName = QFileDialog::getOpenFileName(this, "XML öffnen", "", "XML Files (*.xml)");
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
*/
|
||||
|
||||
|
||||
QMetaEnum bcDeviceEnum{QMetaEnum::fromType<BCDevice::ID>()};
|
||||
|
||||
@@ -92,7 +88,7 @@ void BCXmlLoader::loadXmlBikeData( const QString& fileName )
|
||||
if (token == QXmlStreamReader::StartElement)
|
||||
{
|
||||
QString deviceType = _xml.attributes().value("Type"_L1).toString();
|
||||
printAttrs (_xml);
|
||||
//printAttrs (_xml);
|
||||
// Wir wollen die Device-ID aus dem XML Tag ermitteln
|
||||
const char* deviceKey = _xml.attributes().value("Type"_L1).toLatin1().constData();
|
||||
bool ok;
|
||||
@@ -109,22 +105,13 @@ void BCXmlLoader::loadXmlBikeData( const QString& fileName )
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if (xml.hasError())
|
||||
{
|
||||
QMessageBox::critical(nullptr, "Parsing Fehler", xml.errorString());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_model->setDevices(parsedValues);
|
||||
}
|
||||
*/
|
||||
|
||||
// create & add new model to the model map
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Lädt deie Daten des BionX eBikes
|
||||
* @param deviceID
|
||||
*/
|
||||
|
||||
void BCXmlLoader::loadXmlBikeDeviceData(BCDevice::ID deviceID)
|
||||
{
|
||||
auto printAttrs = [](const QXmlStreamReader& xml)
|
||||
@@ -138,7 +125,7 @@ void BCXmlLoader::loadXmlBikeDeviceData(BCDevice::ID deviceID)
|
||||
|
||||
printAttrs (_xml);
|
||||
Q_ASSERT(_xml.isStartElement() && _xml.name() == "Device"_L1);
|
||||
qDebug() << " XXX ---------------";
|
||||
|
||||
|
||||
// temporäre Wertliste für neues Device
|
||||
BCValueList currentValues;
|
||||
|
||||
@@ -27,6 +27,43 @@ sudo apt purge modemmanager
|
||||
|
||||
// ---
|
||||
|
||||
sudo apt install \
|
||||
qt6-declarative-dev \
|
||||
qt6-tools-dev \
|
||||
qt6-tools-dev-tools \
|
||||
qt6-l10n-tools \
|
||||
qt6-scxml-dev \
|
||||
qt6-serialport-dev \
|
||||
qt6-serialbus-dev \
|
||||
qt6-connectivity-dev \
|
||||
qt6-sensors-dev \
|
||||
qt6-websockets-dev \
|
||||
qt6-webchannel-dev \
|
||||
qt6-svg-dev \
|
||||
qt6-multimedia-dev \
|
||||
qt6-charts-dev \
|
||||
qt6-wayland \
|
||||
qml6-module-qtquick-controls \
|
||||
qml6-module-qtquick-layouts \
|
||||
qml6-module-qtquick-templates \
|
||||
qml6-module-qtquick-window \
|
||||
qml6-module-qtqml-workerscript \
|
||||
qml6-module-qtcharts \
|
||||
qml6-module-qt-labs-platform \
|
||||
libqt6sql6-mysql libqt6sql6-psql libqt6sql6-sqlite \
|
||||
libqt6opengl6-dev
|
||||
|
||||
sudo apt update
|
||||
sudo apt install \
|
||||
qtcreator \
|
||||
qtcreator-doc \
|
||||
cmake \
|
||||
ninja-build \
|
||||
gdb \
|
||||
clang \
|
||||
clang-format
|
||||
|
||||
|
||||
https://github.com/MHS-Elektronik/OBD-Display
|
||||
|
||||
sudo chgrp pi /opt
|
||||
@@ -36,6 +73,7 @@ https://github.com/MHS-Elektronik/OBD-Display
|
||||
tar -xzvf tiny_can_raspberry_790.tar.gz
|
||||
rm tiny_can_raspberry_790.tar.gz
|
||||
|
||||
sudo apt install fonts-open-sans
|
||||
|
||||
|
||||
RANT
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<Value ID='Cons_Assist_Mountain_Cap' Label='Mountain Cap' UnitLabel='%' Factor='1.5625' />
|
||||
</Device>
|
||||
|
||||
<!--
|
||||
|
||||
<Device Type="Motor">
|
||||
<Value ID='Motor_Rev_Hw' Label='Hardware Version' />
|
||||
<Value ID='Motor_Rev_Sw' Label='Software Version' />
|
||||
@@ -46,7 +46,7 @@
|
||||
<Value ID='Battery_Rev_Hw' Label='Hardware Version' />
|
||||
<Value ID='Battery_Rev_Sw' Label='Software Version' />
|
||||
</Device>
|
||||
-->
|
||||
|
||||
</Bike>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -4,11 +4,17 @@
|
||||
QWidget
|
||||
{
|
||||
font-family: "Calibri", "Carlito", "Open Sans", sans-serif;
|
||||
font-size: 6pt;
|
||||
font-size: 10pt;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
QLabel#_headerLabel
|
||||
{
|
||||
font-size: 14pt;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*
|
||||
QToolButton
|
||||
{
|
||||
@@ -47,7 +53,7 @@ QToolButton:disabled
|
||||
|
||||
/* === QToolButton === */
|
||||
QToolButton
|
||||
{
|
||||
{
|
||||
background-color: transparent;
|
||||
color: #000000;
|
||||
border: none;
|
||||
@@ -61,7 +67,7 @@ QToolButton
|
||||
}
|
||||
|
||||
QToolButton:hover
|
||||
{
|
||||
{
|
||||
background-color: #F9F9F9;
|
||||
border: 1px solid #DDDDDD;
|
||||
}
|
||||
@@ -73,11 +79,89 @@ QToolButton:pressed
|
||||
|
||||
QToolButton:checked
|
||||
{
|
||||
background-color: #0078D4;
|
||||
background-color: green;/*#0078D4;*/
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
QToolButton:disabled
|
||||
{
|
||||
{
|
||||
color: #A19F9D;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* === QTableView & QTableWidget === */
|
||||
|
||||
QTableView, QTableWidget
|
||||
{
|
||||
background-color: #FFFFFF;
|
||||
color: #000000;
|
||||
gridline-color: #E1DFDD;
|
||||
border: 1px solid #E1DFDD;
|
||||
border-radius: 4px;
|
||||
selection-background-color: #0078D4;
|
||||
}
|
||||
|
||||
QTableView::item:hover
|
||||
{
|
||||
background-color: #e8f4f8;
|
||||
}
|
||||
|
||||
|
||||
QScrollBar::handle:horizontal {
|
||||
background-color: #C8C6C4;
|
||||
min-width: 40px;
|
||||
border-radius: 6px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
QScrollBar::handle:horizontal:hover {
|
||||
background-color: #A19F9D;
|
||||
}
|
||||
|
||||
QScrollBar::handle:horizontal:pressed {
|
||||
background-color: #8A8886;
|
||||
}
|
||||
|
||||
QScrollBar::add-line:horizontal,
|
||||
QScrollBar::sub-line:horizontal {
|
||||
width: 0px;
|
||||
}
|
||||
|
||||
QScrollBar::add-page:horizontal,
|
||||
QScrollBar::sub-page:horizontal {
|
||||
background: none;
|
||||
}
|
||||
|
||||
QScrollBar:vertical {
|
||||
background-color: transparent;
|
||||
width: 12px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
QScrollBar::handle:vertical {
|
||||
background-color: #C8C6C4;
|
||||
min-height: 40px;
|
||||
border-radius: 6px;
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
QScrollBar::handle:vertical:hover {
|
||||
background-color: #A19F9D;
|
||||
}
|
||||
|
||||
QScrollBar::handle:vertical:pressed {
|
||||
background-color: #8A8886;
|
||||
}
|
||||
|
||||
QScrollBar::add-line:vertical,
|
||||
QScrollBar::sub-line:vertical {
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
QScrollBar::add-page:vertical,
|
||||
QScrollBar::sub-page:vertical {
|
||||
background: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user