-- fy
This commit is contained in:
@@ -201,7 +201,7 @@ void BCAnimatedDelegate::paint(QPainter *painter, const QStyleOptionViewItem& op
|
||||
{
|
||||
case 1:
|
||||
|
||||
if( m_rowOpacities.contains(row))
|
||||
if(_rowOpacities.contains(row))
|
||||
paintHighlightRow(painter,option,index);
|
||||
break;
|
||||
|
||||
@@ -221,7 +221,7 @@ void BCAnimatedDelegate::paintHighlightRow(QPainter* painter, const QStyleOption
|
||||
painter->save();
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
int row = index.row();
|
||||
qreal opacity = m_rowOpacities.value(row);
|
||||
qreal opacity =_rowOpacities.value(row);
|
||||
painter->setOpacity(opacity);
|
||||
// Margin von 4px
|
||||
QRect itemRect = option.rect.adjusted(3, 3, -3, -3);
|
||||
@@ -238,21 +238,6 @@ void BCAnimatedDelegate::paintHighlightRow(QPainter* painter, const QStyleOption
|
||||
|
||||
void BCAnimatedDelegate::paintSliderIndicator(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
{
|
||||
|
||||
/*
|
||||
if (option.state & QStyle::State_Selected)
|
||||
{
|
||||
// 1. Die originale Highlight-Farbe holen (z.B. das Blau aus dem CSS)
|
||||
QColor highlightColor = option.palette.highlight().color();
|
||||
|
||||
// 2. Transparenz setzen (z.B. nur 30% Deckkraft für "Glass"-Effekt)
|
||||
highlightColor.setAlphaF(0.3); // 0.0 bis 1.0 (float ist oft lesbarer)
|
||||
|
||||
// 3. Zeichnen (Brush setzt die Füllfarbe)
|
||||
painter->fillRect(option.rect, highlightColor);
|
||||
}
|
||||
*/
|
||||
|
||||
const BCValue& bcValue = *(_valueList[ index.row()].get());
|
||||
|
||||
qDebug() << " --- paintSLider: " << bcValue.label << ": " << (int)bcValue.valueType;
|
||||
@@ -303,10 +288,10 @@ void BCAnimatedDelegate::paintSliderIndicator(QPainter* painter, const QStyleOpt
|
||||
void BCAnimatedDelegate::onHighlightRow(int row)
|
||||
{
|
||||
// Alte Animation für diese Zeile stoppen falls vorhanden
|
||||
if (m_rowAnimations.contains(row))
|
||||
if (_rowAnimations.contains(row))
|
||||
{
|
||||
m_rowAnimations[row]->stop();
|
||||
m_rowAnimations[row]->deleteLater();
|
||||
_rowAnimations[row]->stop();
|
||||
_rowAnimations[row]->deleteLater();
|
||||
}
|
||||
|
||||
// QVariantAnimation ist flexibler als QPropertyAnimation
|
||||
@@ -330,32 +315,32 @@ void BCAnimatedDelegate::onHighlightRow(int row)
|
||||
opacity = 1.0 - ((progress - 0.2) / 0.8); // 1->0 in 80%
|
||||
}
|
||||
|
||||
m_rowOpacities[row] = opacity;
|
||||
_rowOpacities[row] = opacity;
|
||||
updateRow(row);
|
||||
});
|
||||
|
||||
connect(anim, &QVariantAnimation::finished, this, [this, row, anim]()
|
||||
{
|
||||
m_rowOpacities.remove(row);
|
||||
m_rowAnimations.remove(row);
|
||||
_rowOpacities.remove(row);
|
||||
_rowAnimations.remove(row);
|
||||
updateRow(row);
|
||||
anim->deleteLater();
|
||||
});
|
||||
|
||||
m_rowAnimations[row] = anim;
|
||||
_rowAnimations[row] = anim;
|
||||
anim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
}
|
||||
|
||||
// Optional: alle Highlights sofort clearen
|
||||
void BCAnimatedDelegate::clearAllHighlights()
|
||||
{
|
||||
for(auto* anim : std::as_const(m_rowAnimations))
|
||||
for(auto* anim : std::as_const(_rowAnimations))
|
||||
{
|
||||
anim->stop();
|
||||
anim->deleteLater();
|
||||
}
|
||||
m_rowAnimations.clear();
|
||||
m_rowOpacities.clear();
|
||||
_rowAnimations.clear();
|
||||
_rowOpacities.clear();
|
||||
|
||||
if (_view)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user