Cleanups.

This commit is contained in:
2026-01-06 15:59:57 +01:00
parent 6c15d99119
commit 1a2d815634
20 changed files with 73 additions and 295 deletions

View File

@@ -51,6 +51,7 @@ SOURCES += \
bcdriver.cpp \
bcdrivertinycan.cpp \
bcguihelpers.cpp \
bcsliderstyle.cpp \
bctransmitter.cpp \
bcvalue.cpp \
bcvaluemodel.cpp \
@@ -68,6 +69,7 @@ HEADERS += \
bcdrivertinycan.h \
bcguihelpers.h \
bcmainwindow.h \
bcsliderstyle.h \
bctransmitter.h \
bcvalue.h \
bcvaluemodel.h \

View File

@@ -181,54 +181,31 @@ QSize BCAnimatedDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo
void BCAnimatedDelegate::paint(QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
// 1. Standard-Zeichnen (Text, Hintergrund, Selection) durchführen
// Standard-Zeichnen (Text, Hintergrund, Selection) durchführen
QStyledItemDelegate::paint(painter, option, index);
//QPen pen(QColor(255, 165, 0)); // Orange
/*
if (index.row() == _highlightedRow && _opacity > 0.0)
{
painter->save();
qDebug() << " --- is highlight: " << index.row();
QColor highlightColor( 0xFF9800 );
highlightColor.setAlphaF(_opacity);
QPen pen(highlightColor, 3);
painter->setPen(pen);
painter->setBrush(Qt::NoBrush);
painter->drawRoundedRect(option.rect.adjusted(2, 2, -2, -2), 8, 8);
painter->restore();
}
*/
int row = index.row();
if (index.column() == 1 )
int col = index.column();
switch (col)
{
if( m_rowOpacities.contains(row))
{
paintHighlightRow(painter,option,index);
}
case 1:
if( m_rowOpacities.contains(row))
paintHighlightRow(painter,option,index);
break;
case 2:
if( row>-1 && row <= _valueList.size() )
paintSliderIndicator(painter,option,index);
default:
break;
}
}
/*
qreal opacity = m_rowOpacities.value(row);
if (opacity > 0.01)
{
painter->save();
painter->setOpacity(opacity);
painter->fillRect(option.rect, QColor(255, 140, 0, 120));
painter->restore();
}
*/
void BCAnimatedDelegate::paintHighlightRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
painter->save();
@@ -239,33 +216,61 @@ void BCAnimatedDelegate::paintHighlightRow(QPainter* painter, const QStyleOption
// Margin von 4px
QRect itemRect = option.rect.adjusted(3, 3, -3, -3);
// Border von 2px berücksichtigen (nach innen)
//QRect contentRect = itemRect.adjusted(2, 2, -2, -2);
// painter->fillRect(contentRect,Qt::green);
/*
// Hintergrund (weiß)
painter->setBrush(Qt::white);
painter->setPen(Qt::NoPen);
painter->drawRoundedRect(itemRect, 8, 8);
*/
// Border (2px solid #2196F3)
QPen borderPen( Qt::red, 1);
painter->setPen(borderPen);
painter->setBrush(Qt::NoBrush);
painter->drawRoundedRect(itemRect, 2, 2);
// Padding von 8px für den Content
//QRect textRect = contentRect.adjusted(8, 8, -8, -8);
/*
// Text zeichnen
painter->setPen(Qt::black); // oder option.palette.color(QPalette::Text)
QString text = index.data(Qt::DisplayRole).toString();
painter->drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text);
*/
painter->restore();
}
void BCAnimatedDelegate::paintSliderIndicator(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
const BCValue& valueX = *(_valueList[ index.row()].get());
int value = index.model()->data(index, Qt::DisplayRole).toInt();
// Hintergrund
if (option.state & QStyle::State_Selected) {
painter->fillRect(option.rect, option.palette.highlight());
} else if (index.row() % 2 == 1) {
painter->fillRect(option.rect, QColor(0xFAFAFA));
} else {
painter->fillRect(option.rect, Qt::white);
}
// Text und kleiner Slider-Indikator zeichnen
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
QRect textRect = option.rect.adjusted(8, 0, -120, 0);
QRect barRect = option.rect.adjusted(option.rect.width() - 115,
option.rect.height() / 2 - 2,
-8,
-option.rect.height() / 2 + 2);
// Text
painter->setPen(option.state & QStyle::State_Selected ?
option.palette.highlightedText().color() : Qt::black);
painter->drawText(textRect, Qt::AlignVCenter | Qt::AlignLeft,
QString::number(value));
// Mini Progress Bar
painter->setPen(Qt::NoPen);
painter->setBrush(QColor(0xE0E0E0));
painter->drawRoundedRect(barRect, 2, 2);
QRect fillRect = barRect;
fillRect.setWidth(barRect.width() * value / 100);
painter->setBrush(QColor(0x0078D4));
painter->drawRoundedRect(fillRect, 2, 2);
painter->restore();
}
void BCAnimatedDelegate::onHighlightRow(int row)
{

View File

@@ -61,21 +61,6 @@ public:
QSize sizeHint(const QStyleOptionViewItem &option,const QModelIndex& index) const override;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex& index) const override;
/*
qreal highlightOpacity() const
{
return _opacity;
}
void setHighlightOpacity(qreal opacity)
{
_opacity = opacity;
//qDebug() << " --- opa: " << opacity;
// __fix! unsinn!
emit viewUpdateNeeded();
}
*/
void clearAllHighlights();
public slots:
@@ -91,13 +76,11 @@ private:
void updateRow(int row);
void paintHighlightRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
void paintSliderIndicator(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
const BCValueList& _valueList;
QTableView* _view{};
//int _highlightedRow{-1};
//qreal _opacity{1.0};
QPropertyAnimation* _animation{};
private:

View File

@@ -169,7 +169,8 @@ void BCTransmitter::onUpdateValue( BCValuePtrConst valuePtr)
TransmitResult result = value.isWord ? readWordValue( devID, regID ) : readByteValue( devID, regID );
if( result.has_value() )
{
newVisibleValue = value.formatValue( result.value() );
// quark! das gehört hier nicht hin!
newVisibleValue = value.formatValues( result.value() );
newState = BCValue::State::InSync;
}
else

View File

@@ -44,7 +44,7 @@ BCValue::BCValue( BCDevice::ID deviceID_, BC::ID registerID_)
visibleValue = "--";
}
QString BCValue::formatValue( uint32_t value ) const
QString BCValue::formatValues( uint32_t value ) const
{
if( factor == 1 )
return QString::number( value );

View File

@@ -93,7 +93,7 @@ public:
BCValue( BCDevice::ID deviceID_, BC::ID registerID_ );
QString formatValue( uint32_t value ) const;
QString formatValues( uint32_t value ) const;
void dumpValue() const;
mutable States state{BCValue::State::ReadOnly};
@@ -103,6 +103,7 @@ public:
int indexRow{-1};
QString label;
mutable QString visibleValue;
mutable double rawValue;
bool isWord{false};
QString unitLabel;
double factor{1};

View File

@@ -85,7 +85,7 @@ void BCValueModel::onValueUpdated( int row, BCValue::State state, const QString&
{
if( row > -1 && row < _valueList.size() )
{
BCValue& value = *(_valueList[row].get());
const BCValue& value = *(_valueList[row].get());
QModelIndex idx = index(row,1);
//qDebug();
@@ -132,7 +132,7 @@ int BCValueModel::columnCount(const QModelIndex& parent) const
{
if (parent.isValid())
return 0;
return 2;
return 3;
}

View File

@@ -12,7 +12,6 @@
<file alias="exit_red.svg">resources/exit_red.svg</file>
<file alias="sync_green.svg">resources/sync_green.svg</file>
<file alias="sync_yellow.svg">resources/sync_yellow.svg</file>
<file alias="alt.qss">resources/alt.qss</file>
<file alias="connect_white.svg">resources/connect_white.svg</file>
<file alias="sync.svg">resources/sync.svg</file>
</qresource>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,30 +0,0 @@
Sehr geehrte Frau Spaag,
Aktuell bin ich als Softwareentwickler im Bereich C++/Qt fest angestellt, suche jedoch
nach neuen Entwicklungsmöglichkeiten.
Ihre Stellenanzeige hat mich sofort angesprochen, denn das beschriebene Anforderungsprofil
harmonisiert sehr gut mit meiner derzeitigen Tätigkeit im Bereich Datenvisualisierung und
blub
Ich freu mich wie woschd und verbeibe mit freundlichen Grüßen
Christoph Holzheuer
// ----------
znode<T> ist eine header-only Klasse in modern c++ für generische Baumstrukturen
In der derzeitigen Ausführung dient sie mit Hilfe des pugixml Parser zur Verwaltung
von XML Daten innerhalb des xtree-Projekts.
Die Knoten sind std::c++, die Verwaltung der Attribs ist drangeebrt und somit variable.
Besonderheit ist die Übergabe das String types als template parameter: In Xtree instanzierung durch QString,
andere durch std::string bzw. std::w_string ohne Dependencies zur Qt-Lib eingehen zu müssen.
bridge-code
// ----------

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -1,63 +0,0 @@
Challenges
-------------------------------------------------------------------------------------------------
BionxControl
Aufgabe:
Ansatz:
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
xtree
Aufgabe:
Ansatz:
-------------------------------------------------------------------------------------------------
znode
Aufgabe:
Ansatz:
-------------------------------------------------------------------------------------------------
libPigPio
Aufgabe:
Ansatz:
-------------------------------------------------------------------------------------------------
supportware
Aufgabe:
Ansatz:
-------------------------------------------------------------------------------------------------
raDIYo
Aufgabe:
Ansatz:
-------------------------------------------------------------------------------------------------
miniCash.connect
Aufgabe:
Ansatz:
-------------------------------------------------------------------------------------------------

View File

@@ -1,120 +0,0 @@
/* appqss */
/* Alle QWidgets bekommen diesen Font */
QWidget
{
font-size: 14px;
font-family: Segoe UI, sans-serif;
}
/*
QMainWindow
{
background-color: #272727;
}
*/
/* Spezifisches Styling für Buttons */
QPushButton
{
background-color: #0078d7;
color: white;
border-radius: 4px;
padding: 6px;
}
QPushButton:hover
{
background-color: #1084e3;
}
QPushButton:pressed
{
background-color: #005a9e;
}
/* Normal */
QToolButton {
background-color: transparent;
border: 1px solid transparent;
border-radius: 4px;
padding: 4px;
}
/* Hover */
QToolButton:hover {
background-color: #E3F2FD;
border: 1px solid #2196F3;
}
/* Pressed/Clicked */
QToolButton:pressed {
background-color: #BBDEFB;
}
/* Checked (bei checkable buttons) */
QToolButton:checked {
background-color: #2196F3;
color: white;
}
/* Checked + Hover */
QToolButton:checked:hover {
background-color: #1976D2;
}
/* Disabled */
QToolButton:disabled {
color: #BDBDBD;
background-color: transparent;
}
/*
QTableView
{
background-color: #404142;
border-radius: 8px;
outline: none;
show-decoration-selected: 0;
}
QTableView::item
{
border: 2px solid #2196F3;
border-radius: 8px;
padding: 8px;
margin: 4px;
background-color: white;
}
*/
QTableView::item:hover
{
border-color: #FF9800;
background-color: #fff8f0;
}
QTableView::item:selected
{
border-color: #F44336; /* Roter Rahmen */
background-color: #ffebee;
}
QTableView::item:selected:hover
{
border-color: #FF9800;
background-color: #ffe0b2;
}
*/
QTableView::item:focus
{
/*
// outline: none; Entfernt das Focus-Rectangle
// border-color: green;
// background-color: #ffe0b2;
*/
border: 2px solid gray;
border-style: inset;
background-color: white;
color: black;
}