-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
EmojiDialog.qml
49 lines (40 loc) · 1.15 KB
/
EmojiDialog.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// SPDX-FileCopyrightText: 2020 Carl Schwan <[email protected]>
// SPDX-License-Identifier: LGPL-2.1-or-later
import QtQuick
import QtQuick.Controls 2 as QQC2
import org.kde.kirigami 2 as Kirigami
import "../Components/Emoji"
import "../Components"
QQC2.Popup {
id: emojiPopup
property bool closeOnChosen: true
signal chosen(string emoji)
onVisibleChanged: {
if (!visible) {
return
}
emojiPicker.forceActiveFocus()
}
background: PopupShadow {
Kirigami.Theme.colorSet: Kirigami.Theme.View
}
modal: true
focus: true
clip: false
closePolicy: QQC2.Popup.CloseOnEscape | QQC2.Popup.CloseOnPressOutsideParent
margins: 0
padding: 2
implicitHeight: Kirigami.Units.gridUnit * 20 + 2 * padding
width: Math.min(contentItem.categoryIconSize * 11 + 2 * padding, applicationWindow().width)
contentItem: EmojiPicker {
id: emojiPicker
height: 400
onChosen: {
emojiPopup.chosen(emoji)
if (emojiPopup.closeOnChosen) {
emojiPicker.clearSearchField()
emojiPopup.close()
}
}
}
}