Spectral/qml/component/EmojiPicker.qml

70 lines
1.8 KiB
QML
Raw Normal View History

2018-08-11 04:42:13 +00:00
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
2018-08-11 05:07:44 +00:00
import QtQuick.Controls.Material 2.2
import Matrique 0.1
2018-08-11 04:42:13 +00:00
Popup {
property var textArea
property string emojiCategory: "people"
EmojiModel {
id: emojiModel
category: emojiCategory
}
2018-08-11 04:42:13 +00:00
ColumnLayout {
anchors.fill: parent
GridView {
Layout.fillWidth: true
Layout.fillHeight: true
cellWidth: 36
cellHeight: 36
boundsBehavior: Flickable.DragOverBounds
clip: true
model: emojiModel.model
2018-08-11 04:42:13 +00:00
delegate: Text {
2018-08-11 04:42:13 +00:00
width: 36
height: 36
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pointSize: 20
font.family: "Noto Color Emoji"
text: modelData
2018-08-11 04:42:13 +00:00
MouseArea {
anchors.fill: parent
onClicked: textArea.insert(textArea.cursorPosition, modelData)
2018-08-11 04:42:13 +00:00
}
}
ScrollBar.vertical: ScrollBar {}
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 2
2018-08-11 05:07:44 +00:00
color: Material.theme == Material.Dark ? "white" : "black"
2018-08-11 04:42:13 +00:00
}
Row {
EmojiButton { text: "😏"; category: "people" }
EmojiButton { text: "🌲"; category: "nature" }
EmojiButton { text: "🍛"; category: "food"}
EmojiButton { text: "🚁"; category: "activity" }
EmojiButton { text: "🚅"; category: "travel" }
EmojiButton { text: "💡"; category: "objects" }
EmojiButton { text: "🔣"; category: "symbols" }
EmojiButton { text: "🏁"; category: "flags" }
2018-08-11 04:42:13 +00:00
}
}
}