mirror of https://github.com/nomic-ai/gpt4all
Customize the menu to fit our style (#2535)
* Style and align with a rounded border for combobox popups. * Convert this menu to use the new style as well. Signed-off-by: Adam Treat <treat.adam@gmail.com>fix-blank-cloned-model
parent
1ce65e8ef2
commit
45aa141189
@ -0,0 +1,60 @@
|
||||
import QtCore
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
|
||||
Menu {
|
||||
id: menu
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
contentWidth + leftPadding + rightPadding + 20)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
contentHeight + topPadding + bottomPadding + 20)
|
||||
|
||||
background: Rectangle {
|
||||
implicitWidth: 220
|
||||
implicitHeight: 40
|
||||
color: theme.controlBackground
|
||||
radius: 10
|
||||
}
|
||||
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: myListView.contentWidth
|
||||
implicitHeight: myListView.contentHeight
|
||||
color: "transparent"
|
||||
ListView {
|
||||
id: myListView
|
||||
anchors.margins: 10
|
||||
anchors.fill: parent
|
||||
implicitHeight: contentHeight
|
||||
model: menu.contentModel
|
||||
interactive: Window.window
|
||||
? contentHeight + menu.topPadding + menu.bottomPadding > menu.height
|
||||
: false
|
||||
clip: true
|
||||
currentIndex: menu.currentIndex
|
||||
|
||||
ScrollIndicator.vertical: ScrollIndicator {}
|
||||
}
|
||||
}
|
||||
|
||||
enter: Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 1
|
||||
easing.type: Easing.InOutQuad
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
|
||||
exit: Transition {
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from: 1
|
||||
to: 0
|
||||
easing.type: Easing.InOutQuad
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
import QtCore
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
|
||||
MenuItem {
|
||||
id: item
|
||||
background: Rectangle {
|
||||
color: item.highlighted ? theme.lightContrast : theme.darkContrast
|
||||
}
|
||||
|
||||
contentItem: Text {
|
||||
leftPadding: 10
|
||||
rightPadding: 10
|
||||
padding: 5
|
||||
text: item.text
|
||||
color: theme.textColor
|
||||
font.pixelSize: theme.fontSizeLarge
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue