mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-05-30 02:49:12 -04:00
fix: Copy button can flow in expanded codeblock
This commit is contained in:
@@ -272,6 +272,7 @@ ChatRootView {
|
|||||||
id: chatItemInstance
|
id: chatItemInstance
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
chatViewport: chatListView
|
||||||
msgModel: root.chatModel.processMessageContent(model.content)
|
msgModel: root.chatModel.processMessageContent(model.content)
|
||||||
messageAttachments: model.attachments
|
messageAttachments: model.attachments
|
||||||
messageImages: model.images
|
messageImages: model.images
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ Rectangle {
|
|||||||
property int textFontSize: Qt.application.font.pointSize
|
property int textFontSize: Qt.application.font.pointSize
|
||||||
property int codeFontSize: Qt.application.font.pointSize
|
property int codeFontSize: Qt.application.font.pointSize
|
||||||
property int textFormat: 0
|
property int textFormat: 0
|
||||||
|
property Flickable chatViewport: null
|
||||||
|
|
||||||
property bool isUserMessage: false
|
property bool isUserMessage: false
|
||||||
property int messageIndex: -1
|
property int messageIndex: -1
|
||||||
@@ -259,6 +260,7 @@ Rectangle {
|
|||||||
language: itemData.language
|
language: itemData.language
|
||||||
codeFontFamily: root.codeFontFamily
|
codeFontFamily: root.codeFontFamily
|
||||||
codeFontSize: root.codeFontSize
|
codeFontSize: root.codeFontSize
|
||||||
|
viewport: root.chatViewport
|
||||||
}
|
}
|
||||||
|
|
||||||
component AttachmentComponent : Rectangle {
|
component AttachmentComponent : Rectangle {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ Rectangle {
|
|||||||
property string code: ""
|
property string code: ""
|
||||||
property string language: ""
|
property string language: ""
|
||||||
property bool expanded: false
|
property bool expanded: false
|
||||||
|
property Flickable viewport: null
|
||||||
|
|
||||||
property alias codeFontFamily: codeText.font.family
|
property alias codeFontFamily: codeText.font.family
|
||||||
property alias codeFontSize: codeText.font.pointSize
|
property alias codeFontSize: codeText.font.pointSize
|
||||||
@@ -122,7 +123,16 @@ Rectangle {
|
|||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 5
|
anchors.rightMargin: 5
|
||||||
|
|
||||||
y: 5
|
y: {
|
||||||
|
if (!root.expanded || !root.viewport)
|
||||||
|
return 5
|
||||||
|
const flick = root.viewport
|
||||||
|
const topInContent = root.mapToItem(flick.contentItem, 0, 0).y
|
||||||
|
const topInView = topInContent - flick.contentY
|
||||||
|
const desired = topInView < 0 ? (-topInView + 5) : 5
|
||||||
|
const maxY = Math.max(5, root.height - copyButton.height - 5)
|
||||||
|
return Math.max(5, Math.min(desired, maxY))
|
||||||
|
}
|
||||||
text: qsTr("Copy")
|
text: qsTr("Copy")
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ QVector<AIConfiguration> ConfigurationManager::getPredefinedConfigurations(
|
|||||||
|
|
||||||
AIConfiguration claudeOpus;
|
AIConfiguration claudeOpus;
|
||||||
claudeOpus.id = "preset_claude_opus";
|
claudeOpus.id = "preset_claude_opus";
|
||||||
claudeOpus.name = "Claude Opus 4.6";
|
claudeOpus.name = "Claude Opus 4.7";
|
||||||
claudeOpus.provider = "Claude";
|
claudeOpus.provider = "Claude";
|
||||||
claudeOpus.model = "claude-opus-4-6";
|
claudeOpus.model = "claude-opus-4-7";
|
||||||
claudeOpus.url = "https://api.anthropic.com";
|
claudeOpus.url = "https://api.anthropic.com";
|
||||||
claudeOpus.customEndpoint = "";
|
claudeOpus.customEndpoint = "";
|
||||||
claudeOpus.templateName = "Claude";
|
claudeOpus.templateName = "Claude";
|
||||||
@@ -101,9 +101,9 @@ QVector<AIConfiguration> ConfigurationManager::getPredefinedConfigurations(
|
|||||||
|
|
||||||
AIConfiguration gpt;
|
AIConfiguration gpt;
|
||||||
gpt.id = "preset_gpt";
|
gpt.id = "preset_gpt";
|
||||||
gpt.name = "gpt-5.4";
|
gpt.name = "gpt-5.5";
|
||||||
gpt.provider = "OpenAI (Responses API)";
|
gpt.provider = "OpenAI (Responses API)";
|
||||||
gpt.model = "gpt-5.4";
|
gpt.model = "gpt-5.5";
|
||||||
gpt.url = "https://api.openai.com/v1";
|
gpt.url = "https://api.openai.com/v1";
|
||||||
gpt.customEndpoint = "";
|
gpt.customEndpoint = "";
|
||||||
gpt.templateName = "OpenAI Responses";
|
gpt.templateName = "OpenAI Responses";
|
||||||
|
|||||||
Reference in New Issue
Block a user