mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-06-23 14:07:58 +00:00
Draw the indicator for combobox to ensure it looks the same on all platforms.
This commit is contained in:
parent
1370995b92
commit
220e5547db
@ -3,6 +3,7 @@ import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
|
||||
ComboBox {
|
||||
id: comboBox
|
||||
font.pixelSize: theme.fontSizeLarge
|
||||
spacing: 0
|
||||
padding: 10
|
||||
@ -50,6 +51,33 @@ ComboBox {
|
||||
color: theme.backgroundDark
|
||||
}
|
||||
}
|
||||
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: {
|
||||
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.textAccent : theme.mutedTextColor;
|
||||
context.stroke();
|
||||
|
||||
}
|
||||
}
|
||||
background: Rectangle {
|
||||
color: theme.backgroundDark
|
||||
radius: 10
|
||||
|
Loading…
Reference in New Issue
Block a user