diff --git a/BionxControl.pro b/BionxControl.pro index 3706654..e9fbbca 100644 --- a/BionxControl.pro +++ b/BionxControl.pro @@ -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 \ diff --git a/bcanimateddelegate.cpp b/bcanimateddelegate.cpp index 17ab2c3..824ba4c 100644 --- a/bcanimateddelegate.cpp +++ b/bcanimateddelegate.cpp @@ -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) { diff --git a/bcanimateddelegate.h b/bcanimateddelegate.h index 3c66fe8..4b81d9e 100644 --- a/bcanimateddelegate.h +++ b/bcanimateddelegate.h @@ -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: diff --git a/bctransmitter.cpp b/bctransmitter.cpp index 8614c85..d8d83b9 100644 --- a/bctransmitter.cpp +++ b/bctransmitter.cpp @@ -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 diff --git a/bcvalue.cpp b/bcvalue.cpp index e8e6075..12bcb4a 100644 --- a/bcvalue.cpp +++ b/bcvalue.cpp @@ -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 ); diff --git a/bcvalue.h b/bcvalue.h index 1fb293b..118f563 100644 --- a/bcvalue.h +++ b/bcvalue.h @@ -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}; diff --git a/bcvaluemodel.cpp b/bcvaluemodel.cpp index 5079ce9..5afcc59 100644 --- a/bcvaluemodel.cpp +++ b/bcvaluemodel.cpp @@ -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; } diff --git a/bionxcontrol.qrc b/bionxcontrol.qrc index 21cd50f..758bfc4 100644 --- a/bionxcontrol.qrc +++ b/bionxcontrol.qrc @@ -12,7 +12,6 @@ resources/exit_red.svg resources/sync_green.svg resources/sync_yellow.svg - resources/alt.qss resources/connect_white.svg resources/sync.svg diff --git a/doc/Challenges.docx b/doc/Challenges.docx deleted file mode 100644 index eface7b..0000000 Binary files a/doc/Challenges.docx and /dev/null differ diff --git a/doc/bewerb/Anschreiben.Weining.docx b/doc/bewerb/Anschreiben.Weining.docx deleted file mode 100644 index e481afc..0000000 Binary files a/doc/bewerb/Anschreiben.Weining.docx and /dev/null differ diff --git a/doc/bewerb/Anschreiben.alt.docx b/doc/bewerb/Anschreiben.alt.docx deleted file mode 100644 index 19fce40..0000000 Binary files a/doc/bewerb/Anschreiben.alt.docx and /dev/null differ diff --git a/doc/bewerb/Anschreiben.txt b/doc/bewerb/Anschreiben.txt deleted file mode 100644 index 46ca802..0000000 --- a/doc/bewerb/Anschreiben.txt +++ /dev/null @@ -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 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 - -// ---------- diff --git a/doc/bewerb/CV_C_Holzheuer.docx b/doc/bewerb/CV_C_Holzheuer.docx deleted file mode 100644 index 23163f5..0000000 Binary files a/doc/bewerb/CV_C_Holzheuer.docx and /dev/null differ diff --git a/doc/bewerb/CV_C_Holzheuer.pdf b/doc/bewerb/CV_C_Holzheuer.pdf deleted file mode 100644 index 7dd9428..0000000 Binary files a/doc/bewerb/CV_C_Holzheuer.pdf and /dev/null differ diff --git a/doc/bewerb/Diplom_Holzheuer.pdf b/doc/bewerb/Diplom_Holzheuer.pdf deleted file mode 100644 index 045de55..0000000 Binary files a/doc/bewerb/Diplom_Holzheuer.pdf and /dev/null differ diff --git a/doc/bewerb/Foto_C_Holzheuer.jpg b/doc/bewerb/Foto_C_Holzheuer.jpg deleted file mode 100644 index 6d1ff68..0000000 Binary files a/doc/bewerb/Foto_C_Holzheuer.jpg and /dev/null differ diff --git a/doc/bewerb/Profil_C_Holzheuer.docx b/doc/bewerb/Profil_C_Holzheuer.docx deleted file mode 100644 index 8764225..0000000 Binary files a/doc/bewerb/Profil_C_Holzheuer.docx and /dev/null differ diff --git a/doc/bewerb/Profil_C_Holzheuer.pdf b/doc/bewerb/Profil_C_Holzheuer.pdf deleted file mode 100644 index 8cd069a..0000000 Binary files a/doc/bewerb/Profil_C_Holzheuer.pdf and /dev/null differ diff --git a/doc/challenges.txt b/doc/challenges.txt deleted file mode 100644 index 4728ed1..0000000 --- a/doc/challenges.txt +++ /dev/null @@ -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: - -------------------------------------------------------------------------------------------------- diff --git a/resources/alt.qss b/resources/alt.qss deleted file mode 100644 index 490dfd4..0000000 --- a/resources/alt.qss +++ /dev/null @@ -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; -}