Cleanups.
This commit is contained in:
@@ -51,6 +51,7 @@ SOURCES += \
|
|||||||
bcdriver.cpp \
|
bcdriver.cpp \
|
||||||
bcdrivertinycan.cpp \
|
bcdrivertinycan.cpp \
|
||||||
bcguihelpers.cpp \
|
bcguihelpers.cpp \
|
||||||
|
bcsliderstyle.cpp \
|
||||||
bctransmitter.cpp \
|
bctransmitter.cpp \
|
||||||
bcvalue.cpp \
|
bcvalue.cpp \
|
||||||
bcvaluemodel.cpp \
|
bcvaluemodel.cpp \
|
||||||
@@ -68,6 +69,7 @@ HEADERS += \
|
|||||||
bcdrivertinycan.h \
|
bcdrivertinycan.h \
|
||||||
bcguihelpers.h \
|
bcguihelpers.h \
|
||||||
bcmainwindow.h \
|
bcmainwindow.h \
|
||||||
|
bcsliderstyle.h \
|
||||||
bctransmitter.h \
|
bctransmitter.h \
|
||||||
bcvalue.h \
|
bcvalue.h \
|
||||||
bcvaluemodel.h \
|
bcvaluemodel.h \
|
||||||
|
|||||||
@@ -181,54 +181,31 @@ QSize BCAnimatedDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo
|
|||||||
void BCAnimatedDelegate::paint(QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
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);
|
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();
|
int row = index.row();
|
||||||
if (index.column() == 1 )
|
int col = index.column();
|
||||||
|
|
||||||
|
switch (col)
|
||||||
{
|
{
|
||||||
if( m_rowOpacities.contains(row))
|
case 1:
|
||||||
{
|
|
||||||
paintHighlightRow(painter,option,index);
|
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
|
void BCAnimatedDelegate::paintHighlightRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
@@ -239,33 +216,61 @@ void BCAnimatedDelegate::paintHighlightRow(QPainter* painter, const QStyleOption
|
|||||||
// Margin von 4px
|
// Margin von 4px
|
||||||
QRect itemRect = option.rect.adjusted(3, 3, -3, -3);
|
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)
|
// Border (2px solid #2196F3)
|
||||||
QPen borderPen( Qt::red, 1);
|
QPen borderPen( Qt::red, 1);
|
||||||
painter->setPen(borderPen);
|
painter->setPen(borderPen);
|
||||||
painter->setBrush(Qt::NoBrush);
|
painter->setBrush(Qt::NoBrush);
|
||||||
painter->drawRoundedRect(itemRect, 2, 2);
|
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();
|
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)
|
void BCAnimatedDelegate::onHighlightRow(int row)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,21 +61,6 @@ public:
|
|||||||
QSize sizeHint(const QStyleOptionViewItem &option,const QModelIndex& index) const override;
|
QSize sizeHint(const QStyleOptionViewItem &option,const QModelIndex& index) const override;
|
||||||
void paint(QPainter *painter, 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();
|
void clearAllHighlights();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@@ -91,13 +76,11 @@ private:
|
|||||||
|
|
||||||
void updateRow(int row);
|
void updateRow(int row);
|
||||||
void paintHighlightRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
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;
|
const BCValueList& _valueList;
|
||||||
QTableView* _view{};
|
QTableView* _view{};
|
||||||
|
|
||||||
//int _highlightedRow{-1};
|
|
||||||
//qreal _opacity{1.0};
|
|
||||||
|
|
||||||
QPropertyAnimation* _animation{};
|
QPropertyAnimation* _animation{};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -169,7 +169,8 @@ void BCTransmitter::onUpdateValue( BCValuePtrConst valuePtr)
|
|||||||
TransmitResult result = value.isWord ? readWordValue( devID, regID ) : readByteValue( devID, regID );
|
TransmitResult result = value.isWord ? readWordValue( devID, regID ) : readByteValue( devID, regID );
|
||||||
if( result.has_value() )
|
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;
|
newState = BCValue::State::InSync;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ BCValue::BCValue( BCDevice::ID deviceID_, BC::ID registerID_)
|
|||||||
visibleValue = "--";
|
visibleValue = "--";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BCValue::formatValue( uint32_t value ) const
|
QString BCValue::formatValues( uint32_t value ) const
|
||||||
{
|
{
|
||||||
if( factor == 1 )
|
if( factor == 1 )
|
||||||
return QString::number( value );
|
return QString::number( value );
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public:
|
|||||||
|
|
||||||
BCValue( BCDevice::ID deviceID_, BC::ID registerID_ );
|
BCValue( BCDevice::ID deviceID_, BC::ID registerID_ );
|
||||||
|
|
||||||
QString formatValue( uint32_t value ) const;
|
QString formatValues( uint32_t value ) const;
|
||||||
void dumpValue() const;
|
void dumpValue() const;
|
||||||
|
|
||||||
mutable States state{BCValue::State::ReadOnly};
|
mutable States state{BCValue::State::ReadOnly};
|
||||||
@@ -103,6 +103,7 @@ public:
|
|||||||
int indexRow{-1};
|
int indexRow{-1};
|
||||||
QString label;
|
QString label;
|
||||||
mutable QString visibleValue;
|
mutable QString visibleValue;
|
||||||
|
mutable double rawValue;
|
||||||
bool isWord{false};
|
bool isWord{false};
|
||||||
QString unitLabel;
|
QString unitLabel;
|
||||||
double factor{1};
|
double factor{1};
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void BCValueModel::onValueUpdated( int row, BCValue::State state, const QString&
|
|||||||
{
|
{
|
||||||
if( row > -1 && row < _valueList.size() )
|
if( row > -1 && row < _valueList.size() )
|
||||||
{
|
{
|
||||||
BCValue& value = *(_valueList[row].get());
|
const BCValue& value = *(_valueList[row].get());
|
||||||
QModelIndex idx = index(row,1);
|
QModelIndex idx = index(row,1);
|
||||||
|
|
||||||
//qDebug();
|
//qDebug();
|
||||||
@@ -132,7 +132,7 @@ int BCValueModel::columnCount(const QModelIndex& parent) const
|
|||||||
{
|
{
|
||||||
if (parent.isValid())
|
if (parent.isValid())
|
||||||
return 0;
|
return 0;
|
||||||
return 2;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
<file alias="exit_red.svg">resources/exit_red.svg</file>
|
<file alias="exit_red.svg">resources/exit_red.svg</file>
|
||||||
<file alias="sync_green.svg">resources/sync_green.svg</file>
|
<file alias="sync_green.svg">resources/sync_green.svg</file>
|
||||||
<file alias="sync_yellow.svg">resources/sync_yellow.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="connect_white.svg">resources/connect_white.svg</file>
|
||||||
<file alias="sync.svg">resources/sync.svg</file>
|
<file alias="sync.svg">resources/sync.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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.
@@ -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:
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user