Mini-Breakthrough: Animantion works.

This commit is contained in:
2025-12-29 20:10:05 +01:00
parent 4491e6fe57
commit 60be19a6ae
11 changed files with 282 additions and 284 deletions

View File

@@ -30,8 +30,8 @@
***************************************************************************/
#ifndef BCDELEGATE_H
#define BCDELEGATE_H
#ifndef BCITEMDELEGATE_H
#define BCITEMDELEGATE_H
#include <QStyledItemDelegate>
@@ -40,16 +40,15 @@ class QVariantAnimation;
class QTableView;
class BCValueList;
class BCDelegate : public QStyledItemDelegate
class BCItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
Q_PROPERTY(qreal highlightOpacity READ highlightOpacity WRITE setHighlightOpacity)
public:
explicit BCDelegate(const BCValueList& valueList, QTableView* view );
explicit BCItemDelegate(const BCValueList& valueList, QTableView* view );
QString displayText(const QVariant& dataValue, const QLocale& locale) const override;
// QString displayText(const QVariant& dataValue, const QLocale& locale) const override;
// Zuständig für den Edit-Modus (Doppelklick)
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex& index) const override;
@@ -60,6 +59,7 @@ 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;
@@ -72,6 +72,7 @@ public:
// __fix! unsinn!
emit viewUpdateNeeded();
}
*/
void clearAllHighlights();
@@ -82,19 +83,18 @@ public slots:
signals:
void viewUpdateNeeded();
//void viewUpdateNeeded();
private:
void updateRow(int row);
QString formatDisplayString(const QModelIndex& index) const;
void paintHighlightRow(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
const BCValueList& _valueList;
QTableView* _view{};
int _highlightedRow{-1};
qreal _opacity{1.0};
//int _highlightedRow{-1};
//qreal _opacity{1.0};
QPropertyAnimation* _animation{};
@@ -106,4 +106,4 @@ private:
};
#endif // BCDELEGATE_H
#endif // BCITEMDELEGATE_H