mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 06:08:48 +03:00
Fix emoji picker appearing in wrong locations
This commit is contained in:
parent
e46ddbbb45
commit
0d4ddadb15
3 changed files with 17 additions and 22 deletions
|
@ -12,7 +12,6 @@ import QtQuick.Window 2.2
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
contentWidth: availableWidth
|
|
||||||
clip: false
|
clip: false
|
||||||
palette: colors
|
palette: colors
|
||||||
padding: 8
|
padding: 8
|
||||||
|
|
|
@ -35,8 +35,6 @@ Page {
|
||||||
EmojiPicker {
|
EmojiPicker {
|
||||||
id: emojiPopup
|
id: emojiPopup
|
||||||
|
|
||||||
width: 7 * 52 + 20
|
|
||||||
height: 6 * 52
|
|
||||||
colors: palette
|
colors: palette
|
||||||
|
|
||||||
model: EmojiProxyModel {
|
model: EmojiProxyModel {
|
||||||
|
@ -110,8 +108,9 @@ Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform.MenuItem {
|
Platform.MenuItem {
|
||||||
|
id: reactionOption
|
||||||
text: qsTr("React")
|
text: qsTr("React")
|
||||||
onTriggered: emojiPopup.show(messageContextMenu.parent, function(emoji) {
|
onTriggered: emojiPopup.show(null, function(emoji) {
|
||||||
TimelineManager.queueReactionMessage(messageContextMenu.eventId, emoji);
|
TimelineManager.queueReactionMessage(messageContextMenu.eventId, emoji);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import QtQuick.Layouts 1.3
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
import im.nheko.EmojiModel 1.0
|
import im.nheko.EmojiModel 1.0
|
||||||
|
|
||||||
Popup {
|
Menu {
|
||||||
id: emojiPopup
|
id: emojiPopup
|
||||||
|
|
||||||
property var callback
|
property var callback
|
||||||
|
@ -24,13 +24,8 @@ Popup {
|
||||||
|
|
||||||
function show(showAt, callback) {
|
function show(showAt, callback) {
|
||||||
console.debug("Showing emojiPicker");
|
console.debug("Showing emojiPicker");
|
||||||
if (showAt) {
|
|
||||||
parent = showAt;
|
|
||||||
x = Math.round((showAt.width - width) / 2);
|
|
||||||
y = showAt.height;
|
|
||||||
}
|
|
||||||
emojiPopup.callback = callback;
|
emojiPopup.callback = callback;
|
||||||
open();
|
popup(showAt ? showAt : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
margins: 0
|
margins: 0
|
||||||
|
@ -41,23 +36,25 @@ Popup {
|
||||||
focus: true
|
focus: true
|
||||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
||||||
|
|
||||||
|
height: columnView.implicitHeight + 4
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: columnView
|
id: columnView
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Layout.bottomMargin: 0
|
anchors.leftMargin: 3
|
||||||
Layout.leftMargin: 3
|
anchors.rightMargin: 3
|
||||||
Layout.rightMargin: 3
|
anchors.bottom: parent.bottom
|
||||||
Layout.topMargin: 2
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.topMargin: 2
|
||||||
|
|
||||||
// emoji grid
|
// emoji grid
|
||||||
GridView {
|
GridView {
|
||||||
id: gridView
|
id: gridView
|
||||||
|
|
||||||
Layout.preferredHeight: emojiPopup.height
|
Layout.preferredHeight: cellHeight * 5
|
||||||
Layout.fillWidth: true
|
Layout.preferredWidth: 7 * 52 + 20
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.leftMargin: 4
|
Layout.leftMargin: 4
|
||||||
cellWidth: 52
|
cellWidth: 52
|
||||||
cellHeight: 52
|
cellHeight: 52
|
||||||
|
|
Loading…
Reference in a new issue