added margins and ui changes for quickswitcher and completer

This commit is contained in:
Jedi18 2021-02-24 19:32:13 +05:30
parent 096f37df1f
commit 0ce7f78446
2 changed files with 19 additions and 11 deletions

View file

@ -15,6 +15,8 @@ Popup {
property bool centerRowContent: true property bool centerRowContent: true
property int avatarHeight: 24 property int avatarHeight: 24
property int avatarWidth: 24 property int avatarWidth: 24
property int rowMargin: 0
property int rowSpacing: 5
property alias count: listView.count property alias count: listView.count
signal completionClicked(string completion) signal completionClicked(string completion)
@ -89,10 +91,11 @@ Popup {
implicitWidth: fullWidth ? parent.width : contentItem.childrenRect.width implicitWidth: fullWidth ? parent.width : contentItem.childrenRect.width
model: completer model: completer
verticalLayoutDirection: popup.bottomToTop ? ListView.BottomToTop : ListView.TopToBottom verticalLayoutDirection: popup.bottomToTop ? ListView.BottomToTop : ListView.TopToBottom
spacing: rowSpacing
delegate: Rectangle { delegate: Rectangle {
color: model.index == popup.currentIndex ? colors.highlight : colors.base color: model.index == popup.currentIndex ? colors.highlight : colors.base
height: chooser.childrenRect.height + 4 height: chooser.childrenRect.height + 2 * popup.rowMargin
implicitWidth: fullWidth ? popup.width : chooser.childrenRect.width + 4 implicitWidth: fullWidth ? popup.width : chooser.childrenRect.width + 4
property variant modelData: model property variant modelData: model
@ -120,11 +123,8 @@ Popup {
id: chooser id: chooser
roleValue: popup.completerName roleValue: popup.completerName
anchors.left: parent.left anchors.fill: parent
anchors.top: parent.top anchors.margins: popup.rowMargin
anchors.bottom: parent.bottom
anchors.right: centerRowContent ? parent : null
anchors.centerIn: centerRowContent ? parent : null
DelegateChoice { DelegateChoice {
roleValue: "user" roleValue: "user"
@ -132,7 +132,8 @@ Popup {
RowLayout { RowLayout {
id: del id: del
anchors.centerIn: centerRowContent ? parent : null anchors.centerIn: parent
spacing: rowSpacing
Avatar { Avatar {
height: popup.avatarHeight height: popup.avatarHeight
@ -162,7 +163,8 @@ Popup {
RowLayout { RowLayout {
id: del id: del
anchors.centerIn: centerRowContent ? parent : null anchors.centerIn: parent
spacing: rowSpacing
Label { Label {
text: model.unicode text: model.unicode
@ -185,7 +187,8 @@ Popup {
RowLayout { RowLayout {
id: del id: del
anchors.centerIn: centerRowContent ? parent : null anchors.centerIn: centerRowContent ? parent : undefined
spacing: rowSpacing
Avatar { Avatar {
height: popup.avatarHeight height: popup.avatarHeight
@ -212,7 +215,8 @@ Popup {
RowLayout { RowLayout {
id: del id: del
anchors.centerIn: centerRowContent ? parent : null anchors.centerIn: parent
spacing: rowSpacing
Avatar { Avatar {
height: popup.avatarHeight height: popup.avatarHeight

View file

@ -6,6 +6,7 @@ Popup {
id: quickSwitcher id: quickSwitcher
property int textWidth: 48 property int textWidth: 48
property int textMargin: 8
x: parent.width / 2 - width / 2 x: parent.width / 2 - width / 2
y: parent.height / 4 - height / 2 y: parent.height / 4 - height / 2
@ -23,7 +24,8 @@ Popup {
id: roomTextInput id: roomTextInput
anchors.fill: parent anchors.fill: parent
font.pixelSize: quickSwitcher.textWidth - 24 font.pixelSize: quickSwitcher.textWidth - 18
padding: textMargin
color: colors.text color: colors.text
onTextEdited: { onTextEdited: {
@ -56,6 +58,8 @@ Popup {
avatarHeight: textWidth avatarHeight: textWidth
avatarWidth: textWidth avatarWidth: textWidth
centerRowContent: false centerRowContent: false
rowMargin: 8
rowSpacing: 6
closePolicy: Popup.NoAutoClose closePolicy: Popup.NoAutoClose
} }