mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-17 20:08:28 +00:00
focus emoji picker search field on opened #LINQT-2445
This commit is contained in:
parent
22ca1cec23
commit
809f7b8b67
3 changed files with 31 additions and 6 deletions
|
|
@ -12,6 +12,7 @@ Button {
|
||||||
property alias popupBackgroundColor: popupBackground.color
|
property alias popupBackgroundColor: popupBackground.color
|
||||||
property color backgroundColor: checked ? pressedColor : hovered || mainItem.activeFocus ? hoveredColor : color
|
property color backgroundColor: checked ? pressedColor : hovered || mainItem.activeFocus ? hoveredColor : color
|
||||||
property string popUpTitle: ""
|
property string popUpTitle: ""
|
||||||
|
property int popupY: height
|
||||||
Accessible.name: popup.visible ?
|
Accessible.name: popup.visible ?
|
||||||
//: "Close %1 popup"
|
//: "Close %1 popup"
|
||||||
qsTr("close_popup_panel_accessible_name").arg(popUpTitle) :
|
qsTr("close_popup_panel_accessible_name").arg(popUpTitle) :
|
||||||
|
|
@ -135,7 +136,7 @@ Button {
|
||||||
Control.Popup {
|
Control.Popup {
|
||||||
id: popup
|
id: popup
|
||||||
x: 0
|
x: 0
|
||||||
y: mainItem.height
|
y: mainItem.popupY
|
||||||
visible: false
|
visible: false
|
||||||
closePolicy: Popup.CloseOnPressOutsideParent | Popup.CloseOnPressOutside | Popup.CloseOnEscape
|
closePolicy: Popup.CloseOnPressOutsideParent | Popup.CloseOnPressOutside | Popup.CloseOnEscape
|
||||||
padding: Utils.getSizeWithScreenRatio(10)
|
padding: Utils.getSizeWithScreenRatio(10)
|
||||||
|
|
@ -150,7 +151,7 @@ Button {
|
||||||
"y": 0
|
"y": 0
|
||||||
};
|
};
|
||||||
// Stay inside main window
|
// Stay inside main window
|
||||||
y = Math.max(Math.min(winPosition.y + mainItem.Window.height - popupHeight, mainItem.height), winPosition.y);
|
y = Math.max(Math.min(winPosition.y + mainItem.Window.height - popupHeight, mainItem.popupY), winPosition.y);
|
||||||
x = Math.max(Math.min(winPosition.x + mainItem.Window.width - popupWidth, 0), winPosition.x);
|
x = Math.max(Math.min(winPosition.x + mainItem.Window.width - popupWidth, 0), winPosition.x);
|
||||||
// Avoid overlapping with popup button by going to the right (todo: check if left is better?)
|
// Avoid overlapping with popup button by going to the right (todo: check if left is better?)
|
||||||
if (y < mainItem.height && y + popupHeight > 0) {
|
if (y < mainItem.height && y + popupHeight > 0) {
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,21 @@ ColumnLayout {
|
||||||
searchModel.append({path: searchResult[i]})
|
searchModel.append({path: searchResult[i]})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function clearSearchField() {
|
||||||
|
mainItem.searchMode = false
|
||||||
|
searchField.widthSize = 0
|
||||||
|
list.model = mainItem.categories
|
||||||
|
searchField.clear()
|
||||||
|
}
|
||||||
|
Keys.onPressed: event => {
|
||||||
|
if (event.text && (mainItem.activeFocus || mainItem.focus)) {
|
||||||
|
mainItem.searchMode = true
|
||||||
|
searchField.widthSize = categoriesRow.width - Utils.getSizeWithScreenRatio(25)
|
||||||
|
list.model = 1
|
||||||
|
searchField.focus = true
|
||||||
|
searchField.text = event.text
|
||||||
|
}
|
||||||
|
}
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: categoriesRow
|
id: categoriesRow
|
||||||
Layout.preferredWidth: parent.width - Utils.getSizeWithScreenRatio(15)
|
Layout.preferredWidth: parent.width - Utils.getSizeWithScreenRatio(15)
|
||||||
|
|
@ -95,10 +110,7 @@ ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
mainItem.searchMode = false
|
mainItem.clearSearchField()
|
||||||
searchField.widthSize = 0
|
|
||||||
list.model = mainItem.categories
|
|
||||||
searchField.clear()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,11 +85,23 @@ Control.Control {
|
||||||
visible: !mainItem.isEditing
|
visible: !mainItem.isEditing
|
||||||
style: ButtonStyle.noBackground
|
style: ButtonStyle.noBackground
|
||||||
icon.source: checked ? AppIcons.closeX : AppIcons.smiley
|
icon.source: checked ? AppIcons.closeX : AppIcons.smiley
|
||||||
|
popupY: - popup.height
|
||||||
popup.width: Utils.getSizeWithScreenRatio(393)
|
popup.width: Utils.getSizeWithScreenRatio(393)
|
||||||
popup.height: Utils.getSizeWithScreenRatio(291)
|
popup.height: Utils.getSizeWithScreenRatio(291)
|
||||||
popup.contentItem: EmojiPicker {
|
popup.contentItem: EmojiPicker {
|
||||||
|
id: emojiPicker
|
||||||
editor: sendingTextArea
|
editor: sendingTextArea
|
||||||
}
|
}
|
||||||
|
Connections {
|
||||||
|
target: emojiPickerButton.popup
|
||||||
|
function onOpened() {
|
||||||
|
emojiPicker.forceActiveFocus()
|
||||||
|
}
|
||||||
|
function onClosed() {
|
||||||
|
emojiPicker.clearSearchField()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
BigButton {
|
BigButton {
|
||||||
style: ButtonStyle.noBackground
|
style: ButtonStyle.noBackground
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue