2025-12-26 14:07:55 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
|
|
BionxControl
|
2026-01-03 23:51:14 +01:00
|
|
|
© 2025 -2026 christoph holzheuer
|
2025-12-26 14:07:55 +01:00
|
|
|
christoph.holzheuer@gmail.com
|
|
|
|
|
|
|
|
|
|
Using:
|
|
|
|
|
|
|
|
|
|
mhs_can_drv.c
|
|
|
|
|
© 2011 - 2023 by MHS-Elektronik GmbH & Co. KG, Germany
|
|
|
|
|
Klaus Demlehner, klaus@mhs-elektronik.de
|
|
|
|
|
@see www.mhs-elektronik.de
|
|
|
|
|
|
|
|
|
|
Based on Bionx data type descriptions from:
|
|
|
|
|
|
|
|
|
|
BigXionFlasher USB V 0.2.4 rev. 97
|
|
|
|
|
© 2011-2013 by Thomas Koenig <info@bigxionflasher.org>
|
|
|
|
|
@see www.bigxionflasher.org
|
|
|
|
|
|
|
|
|
|
Bionx Bike Info
|
|
|
|
|
© 2018 Thorsten Schmidt (tschmidt@ts-soft.de)
|
|
|
|
|
@see www.ts-soft.de
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
@see https://github.com/bikemike/bionx-bikeinfo
|
|
|
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
2025-12-24 14:44:54 +01:00
|
|
|
|
2026-02-09 16:03:09 +01:00
|
|
|
#ifndef BC_VALUEDELEGATE_H
|
|
|
|
|
#define BC_VALUEDELEGATE_H
|
2025-12-17 16:26:22 +01:00
|
|
|
|
|
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
|
|
2026-01-02 01:43:49 +01:00
|
|
|
#include <bcvalue.h>
|
|
|
|
|
|
2025-12-19 21:20:14 +01:00
|
|
|
class QPropertyAnimation;
|
|
|
|
|
class QVariantAnimation;
|
2026-01-18 18:52:30 +01:00
|
|
|
class BCDeviceView;
|
2026-01-02 01:43:49 +01:00
|
|
|
|
2025-12-19 17:37:24 +01:00
|
|
|
|
2026-01-10 22:18:54 +01:00
|
|
|
class BCValueDelegate : public QStyledItemDelegate
|
2025-12-17 16:26:22 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2025-12-18 18:39:52 +01:00
|
|
|
|
2026-01-18 18:52:30 +01:00
|
|
|
explicit BCValueDelegate(const BCValueList& valueList, BCDeviceView* view );
|
2025-12-17 16:26:22 +01:00
|
|
|
|
|
|
|
|
// Zuständig für den Edit-Modus (Doppelklick)
|
2025-12-23 11:09:26 +01:00
|
|
|
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex& index) const override;
|
|
|
|
|
void setEditorData(QWidget *editor, const QModelIndex& index) const override;
|
|
|
|
|
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex& index) const override;
|
|
|
|
|
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex& index) const override;
|
|
|
|
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex& index) const override;
|
2025-12-19 17:37:24 +01:00
|
|
|
|
2025-12-19 21:20:14 +01:00
|
|
|
void clearAllHighlights();
|
|
|
|
|
|
2026-01-18 22:47:26 +01:00
|
|
|
signals:
|
|
|
|
|
|
2025-12-19 17:37:24 +01:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
|
|
void onHighlightRow(int row);
|
2025-12-18 18:39:52 +01:00
|
|
|
|
2026-01-07 17:13:35 +01:00
|
|
|
protected:
|
2025-12-19 17:37:24 +01:00
|
|
|
|
2025-12-19 21:20:14 +01:00
|
|
|
void updateRow(int row);
|
2026-01-08 14:55:47 +01:00
|
|
|
void paintHighlightRow(QPainter* painter, const QStyleOptionViewItem& option, int row) const;
|
2026-02-10 14:25:06 +01:00
|
|
|
void paintPlainToggleSwitch(QPainter* painter, const QStyleOptionViewItem& option, const BCValue& bcValue) const;
|
|
|
|
|
void paintPlainSliderIndicator(QPainter* painter, const QRect& rect, double ratio ) const;
|
2026-01-08 00:25:36 +01:00
|
|
|
// Das ist ein Quickhack, der Delegate sollte
|
|
|
|
|
// nichts über die Originaldaten wissen. Die
|
|
|
|
|
// Datenbeschaffung ist alleine Sache des Models.
|
|
|
|
|
|
2025-12-29 15:44:06 +01:00
|
|
|
const BCValueList& _valueList;
|
2026-01-18 18:52:30 +01:00
|
|
|
BCDeviceView* _view{};
|
2025-12-29 15:44:06 +01:00
|
|
|
|
2025-12-29 13:05:35 +01:00
|
|
|
QPropertyAnimation* _animation{};
|
2025-12-19 21:20:14 +01:00
|
|
|
|
2026-01-18 18:52:30 +01:00
|
|
|
QHash<int, qreal> _rowOpacities;
|
2026-01-08 00:25:36 +01:00
|
|
|
QHash<int, QVariantAnimation*> _rowAnimations;
|
2025-12-21 23:20:22 +01:00
|
|
|
|
2026-01-11 14:48:51 +01:00
|
|
|
|
2025-12-17 16:26:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2026-02-09 16:03:09 +01:00
|
|
|
#endif // BC_VALUEDELEGATE_H
|