File indexing completed on 2024-12-01 04:37:02
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "libruqolawidgets_private_export.h" 0010 #include <QColor> 0011 #include <QObject> 0012 #include <QPersistentModelIndex> 0013 class MessagesModel; 0014 class LIBRUQOLAWIDGETS_TESTS_EXPORT SelectedMessageBackgroundAnimation : public QObject 0015 { 0016 Q_OBJECT 0017 Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) 0018 public: 0019 explicit SelectedMessageBackgroundAnimation(MessagesModel *model, QObject *parent = nullptr); 0020 ~SelectedMessageBackgroundAnimation() override; 0021 0022 [[nodiscard]] QColor backgroundColor() const; 0023 void setBackgroundColor(const QColor &newBackgroundColor); 0024 0025 void start(); 0026 0027 [[nodiscard]] MessagesModel *messageModel() const; 0028 0029 [[nodiscard]] QPersistentModelIndex modelIndex() const; 0030 void setModelIndex(const QPersistentModelIndex &newModelIndex); 0031 0032 Q_SIGNALS: 0033 void backgroundColorChanged(); 0034 0035 private: 0036 LIBRUQOLAWIDGETS_NO_EXPORT void slotBackgroundColorChanged(); 0037 QColor m_backgroundColor; 0038 QPersistentModelIndex mModelIndex; 0039 MessagesModel *const mModel; 0040 };