mirror of
https://github.com/nomic-ai/gpt4all
synced 2024-11-04 12:00:10 +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
|
import QtQuick.Controls.Basic
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
|
id: comboBox
|
||||||
font.pixelSize: theme.fontSizeLarge
|
font.pixelSize: theme.fontSizeLarge
|
||||||
spacing: 0
|
spacing: 0
|
||||||
padding: 10
|
padding: 10
|
||||||
@ -50,6 +51,33 @@ ComboBox {
|
|||||||
color: theme.backgroundDark
|
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 {
|
background: Rectangle {
|
||||||
color: theme.backgroundDark
|
color: theme.backgroundDark
|
||||||
radius: 10
|
radius: 10
|
||||||
|
Loading…
Reference in New Issue
Block a user