新增对话历史面板
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ai/LLMTypes.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QPoint>
|
||||
#include <QRect>
|
||||
#include <QVector>
|
||||
|
||||
class QEvent;
|
||||
class QTextEdit;
|
||||
|
||||
class ChatHistoryPanel : public QDialog
|
||||
{
|
||||
public:
|
||||
explicit ChatHistoryPanel(QWidget *parent = nullptr);
|
||||
~ChatHistoryPanel() override;
|
||||
|
||||
void setMessages(const QVector<ChatMessage> &messages);
|
||||
void showAt(const QPoint &anchorPosition);
|
||||
void showNear(const QRect &avoidRect);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event) override;
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
private:
|
||||
bool isOwnObject(QObject *object) const;
|
||||
QRect availableGeometryForPoint(const QPoint &point) const;
|
||||
QRect availableGeometryForRect(const QRect &rect) const;
|
||||
QPoint constrainedTopLeft(const QPoint &preferredTopLeft, const QRect &availableGeometry) const;
|
||||
QPoint smartTopLeftNear(const QRect &avoidRect) const;
|
||||
void updateContent();
|
||||
|
||||
QTextEdit *m_textEdit;
|
||||
QVector<ChatMessage> m_messages;
|
||||
};
|
||||
Reference in New Issue
Block a user