mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-17 11:58:27 +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 color backgroundColor: checked ? pressedColor : hovered || mainItem.activeFocus ? hoveredColor : color
|
||||
property string popUpTitle: ""
|
||||
property int popupY: height
|
||||
Accessible.name: popup.visible ?
|
||||
//: "Close %1 popup"
|
||||
qsTr("close_popup_panel_accessible_name").arg(popUpTitle) :
|
||||
|
|
@ -135,7 +136,7 @@ Button {
|
|||
Control.Popup {
|
||||
id: popup
|
||||
x: 0
|
||||
y: mainItem.height
|
||||
y: mainItem.popupY
|
||||
visible: false
|
||||
closePolicy: Popup.CloseOnPressOutsideParent | Popup.CloseOnPressOutside | Popup.CloseOnEscape
|
||||
padding: Utils.getSizeWithScreenRatio(10)
|
||||
|
|
@ -150,7 +151,7 @@ Button {
|
|||
"y": 0
|
||||
};
|
||||
// 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);
|
||||
// Avoid overlapping with popup button by going to the right (todo: check if left is better?)
|
||||
if (y < mainItem.height && y + popupHeight > 0) {
|
||||
|
|
|
|||
|
|
@ -62,6 +62,21 @@ ColumnLayout {
|
|||
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 {
|
||||
id: categoriesRow
|
||||
Layout.preferredWidth: parent.width - Utils.getSizeWithScreenRatio(15)
|
||||
|
|
@ -95,10 +110,7 @@ ColumnLayout {
|
|||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
mainItem.searchMode = false
|
||||
searchField.widthSize = 0
|
||||
list.model = mainItem.categories
|
||||
searchField.clear()
|
||||
mainItem.clearSearchField()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,11 +85,23 @@ Control.Control {
|
|||
visible: !mainItem.isEditing
|
||||
style: ButtonStyle.noBackground
|
||||
icon.source: checked ? AppIcons.closeX : AppIcons.smiley
|
||||
popupY: - popup.height
|
||||
popup.width: Utils.getSizeWithScreenRatio(393)
|
||||
popup.height: Utils.getSizeWithScreenRatio(291)
|
||||
popup.contentItem: EmojiPicker {
|
||||
id: emojiPicker
|
||||
editor: sendingTextArea
|
||||
}
|
||||
Connections {
|
||||
target: emojiPickerButton.popup
|
||||
function onOpened() {
|
||||
emojiPicker.forceActiveFocus()
|
||||
}
|
||||
function onClosed() {
|
||||
emojiPicker.clearSearchField()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
BigButton {
|
||||
style: ButtonStyle.noBackground
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue