fix: improve qml bottlenecks
This commit is contained in:
parent
367afb70a2
commit
608455f563
|
@ -193,16 +193,23 @@ StackLayout {
|
|||
target: chatsModel
|
||||
onActiveChannelChanged: {
|
||||
stackLayoutChatMessages.currentIndex = chatsModel.getMessageListIndex(chatsModel.activeChannelIndex)
|
||||
if(stackLayoutChatMessages.currentIndex > -1 && !stackLayoutChatMessages.children[stackLayoutChatMessages.currentIndex].active){
|
||||
stackLayoutChatMessages.children[stackLayoutChatMessages.currentIndex].active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StackLayout {
|
||||
id: stackLayoutChatMessages
|
||||
Repeater {
|
||||
model: chatsModel
|
||||
ChatMessages {
|
||||
id: chatMessages
|
||||
messageList: model.messages
|
||||
Loader {
|
||||
active: false
|
||||
sourceComponent: ChatMessages {
|
||||
id: chatMessages
|
||||
messageList: model.messages
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -315,10 +322,9 @@ StackLayout {
|
|||
if (msg.length > 0){
|
||||
msg = chatInput.interpretMessage(msg)
|
||||
chatsModel.sendMessage(msg, chatInput.isReply ? SelectedMessage.messageId : "", Utils.isOnlyEmoji(msg) ? Constants.emojiType : Constants.messageType, false);
|
||||
|
||||
if (event) event.accepted = true
|
||||
chatInput.messageSound.stop()
|
||||
Qt.callLater(chatInput.messageSound.play);
|
||||
if(event) event.accepted = true
|
||||
sendMessageSound.stop();
|
||||
Qt.callLater(sendMessageSound.play);
|
||||
|
||||
chatInput.textInput.clear();
|
||||
chatInput.textInput.textFormat = TextEdit.PlainText;
|
||||
|
|
|
@ -40,7 +40,6 @@ Rectangle {
|
|||
property bool isStatusUpdateInput: chatType === Constants.chatTypeStatusUpdate
|
||||
|
||||
property var fileUrls: []
|
||||
property alias messageSound: sendMessageSound
|
||||
|
||||
property alias suggestionsList: suggestions
|
||||
property alias suggestions: suggestionsBox
|
||||
|
@ -62,13 +61,6 @@ Rectangle {
|
|||
|
||||
color: Style.current.background
|
||||
|
||||
Audio {
|
||||
id: sendMessageSound
|
||||
source: "../../sounds/send_message.wav"
|
||||
volume: appSettings.volume
|
||||
muted: !appSettings.notificationSoundsEnabled
|
||||
}
|
||||
|
||||
function calculateExtraHeightFactor() {
|
||||
const factor = (messageInputField.length / 500) + 1;
|
||||
return (factor > 5) ? 5 : factor;
|
||||
|
|
|
@ -67,7 +67,7 @@ Popup {
|
|||
popup.close()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
function populateCategories() {
|
||||
var categoryNames = {"recent": 0}
|
||||
var newCategories = [[]]
|
||||
|
||||
|
@ -105,6 +105,7 @@ Popup {
|
|||
onOpened: {
|
||||
searchBox.text = ""
|
||||
searchBox.forceActiveFocus(Qt.MouseFocusReason)
|
||||
Qt.callLater(populateCategories);
|
||||
}
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
|
|
Loading…
Reference in New Issue