KTextAddons

textautogeneratelistview.h
1/*
2 SPDX-FileCopyrightText: 2025 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6#pragma once
7#include "textautogeneratetext_private_export.h"
8#include <QListView>
9namespace TextAutogenerateText
10{
12class TextAutogenerateListViewDelegate;
13class TEXTAUTOGENERATETEXT_TESTS_EXPORT TextAutogenerateListView : public QListView
14{
15 Q_OBJECT
16public:
17 explicit TextAutogenerateListView(QWidget *parent = nullptr);
18 ~TextAutogenerateListView() override;
19
20 void setMessages(const QList<TextAutoGenerateMessage> &msg);
21
22 void handleKeyPressEvent(QKeyEvent *ev);
23
24 void slotGoToDiscussion(const QByteArray &uuid);
25
26 void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override;
27
28 void editingFinished(const QByteArray &uuid);
29
30protected:
31 void resizeEvent(QResizeEvent *ev) override;
32
33 void mouseReleaseEvent(QMouseEvent *event) override;
34 void mouseDoubleClickEvent(QMouseEvent *event) override;
35
36 void mousePressEvent(QMouseEvent *event) override;
37 void mouseMoveEvent(QMouseEvent *event) override;
38 void contextMenuEvent(QContextMenuEvent *event) override;
39 void leaveEvent(QEvent *event) override;
40
41Q_SIGNALS:
42 void editMessage(const QModelIndex &index);
43 void cancelRequest(const QByteArray &uuid);
44 void waitingAnswerDone(const QModelIndex &index);
45
46private:
47 [[nodiscard]] TEXTAUTOGENERATETEXT_NO_EXPORT QStyleOptionViewItem listViewOptions() const;
48 TEXTAUTOGENERATETEXT_NO_EXPORT void checkIfAtBottom();
49 TEXTAUTOGENERATETEXT_NO_EXPORT void maybeScrollToBottom();
50 TEXTAUTOGENERATETEXT_NO_EXPORT void updateVerticalPageStep();
51 TEXTAUTOGENERATETEXT_NO_EXPORT void handleMouseEvent(QMouseEvent *event);
52 TEXTAUTOGENERATETEXT_NO_EXPORT void slotSelectAll(const QModelIndex &index);
53 TEXTAUTOGENERATETEXT_NO_EXPORT virtual bool maybeStartDrag(QMouseEvent *event, const QStyleOptionViewItem &option, const QModelIndex &index);
54 TEXTAUTOGENERATETEXT_NO_EXPORT virtual bool mouseEvent(QMouseEvent *event, const QStyleOptionViewItem &option, const QModelIndex &index);
55 TEXTAUTOGENERATETEXT_NO_EXPORT void slotRemoveMessage(const QModelIndex &index);
56 TEXTAUTOGENERATETEXT_NO_EXPORT void slotCopyMessage(const QModelIndex &index);
57 TEXTAUTOGENERATETEXT_NO_EXPORT void addSelectedMessageBackgroundAnimation(const QModelIndex &index);
58 TEXTAUTOGENERATETEXT_NO_EXPORT void slotCancelRequest(const QModelIndex &index);
59 TEXTAUTOGENERATETEXT_NO_EXPORT void slotEditMessage(const QModelIndex &index);
60 TEXTAUTOGENERATETEXT_NO_EXPORT void addWaitingAnswerAnimation(const QModelIndex &index);
61
62 bool mAtBottom = true;
63 QPoint mPressedPosition;
64 QPersistentModelIndex mCurrentIndex = {};
65 TextAutogenerateListViewDelegate *const mDelegate;
66};
67}
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri May 2 2025 12:06:03 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.