mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-02 17:15:18 +00:00
Chatview and combobox UI fixes (#2489)
Chatview and combobox UI fixes (#2489) Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import QtQuick.Layouts
|
||||
import Qt5Compat.GraphicalEffects
|
||||
|
||||
ComboBox {
|
||||
id: comboBox
|
||||
@@ -8,15 +10,39 @@ ComboBox {
|
||||
spacing: 0
|
||||
padding: 10
|
||||
Accessible.role: Accessible.ComboBox
|
||||
contentItem: Text {
|
||||
id: text
|
||||
leftPadding: 10
|
||||
rightPadding: 20
|
||||
text: comboBox.displayText
|
||||
font: comboBox.font
|
||||
color: theme.textColor
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
contentItem: RowLayout {
|
||||
id: contentRow
|
||||
spacing: 0
|
||||
Text {
|
||||
id: text
|
||||
Layout.fillWidth: true
|
||||
leftPadding: 10
|
||||
rightPadding: 20
|
||||
text: comboBox.displayText
|
||||
font: comboBox.font
|
||||
color: theme.textColor
|
||||
verticalAlignment: Text.AlignLeft
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Item {
|
||||
Layout.preferredWidth: updown.width
|
||||
Layout.preferredHeight: updown.height
|
||||
Image {
|
||||
id: updown
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
sourceSize.width: comboBox.font.pixelSize
|
||||
sourceSize.height: comboBox.font.pixelSize
|
||||
mipmap: true
|
||||
visible: false
|
||||
source: "qrc:/gpt4all/icons/up_down.svg"
|
||||
}
|
||||
|
||||
ColorOverlay {
|
||||
anchors.fill: updown
|
||||
source: updown
|
||||
color: theme.textColor
|
||||
}
|
||||
}
|
||||
}
|
||||
delegate: ItemDelegate {
|
||||
width: comboBox.width
|
||||
@@ -53,33 +79,7 @@ ComboBox {
|
||||
color: theme.black
|
||||
}
|
||||
}
|
||||
indicator: Canvas {
|
||||
id: canvas
|
||||
x: comboBox.width - width - comboBox.rightPadding
|
||||
y: comboBox.topPadding + (comboBox.availableHeight - height) / 2
|
||||
width: 12
|
||||
height: 18
|
||||
contextType: "2d"
|
||||
|
||||
Connections {
|
||||
target: comboBox
|
||||
function onPressedChanged() { canvas.requestPaint(); }
|
||||
}
|
||||
|
||||
onPaint: {
|
||||
var context = getContext("2d");
|
||||
context.reset();
|
||||
context.lineWidth = 2;
|
||||
context.moveTo(0, height / 2 - 2);
|
||||
context.lineTo(width / 2, 0);
|
||||
context.lineTo(width, height / 2 - 2);
|
||||
context.moveTo(0, height / 2 + 2);
|
||||
context.lineTo(width / 2, height);
|
||||
context.lineTo(width, height / 2 + 2);
|
||||
context.strokeStyle = comboBox.pressed ? theme.mutedLightTextColor : theme.mutedLighterTextColor;
|
||||
context.stroke();
|
||||
|
||||
}
|
||||
indicator: Item {
|
||||
}
|
||||
background: Rectangle {
|
||||
color: theme.controlBackground
|
||||
|
Reference in New Issue
Block a user