Fix compose events with empty text (since text is in rich format then it was never really empty).

Move QApplication::setAttribute to beginning.
This commit is contained in:
Julien Wadel 2023-04-12 09:12:31 +02:00
parent 8e6880a334
commit 411f64e4c0
4 changed files with 10 additions and 7 deletions

View file

@ -43,6 +43,10 @@ AppController::AppController (int &argc, char *argv[]) {
Q_ASSERT(!mApp);
// Disable QML cache. Avoid malformed cache.
qputenv("QML_DISABLE_DISK_CACHE", "true");
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// Useful to share camera on Fullscreen (other context)
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
initQtAppDetails();
#ifdef ENABLE_APP_WEBVIEW
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
@ -121,10 +125,6 @@ void AppController::stopApp(){
}
void AppController::initQtAppDetails(){
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// Useful to share camera on Fullscreen (other context)
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
// Do not use APPLICATION_NAME here.
// The EXECUTABLE_NAME will be used in qt standard paths. It's our goal.
QCoreApplication::setApplicationName(EXECUTABLE_NAME);

View file

@ -101,7 +101,7 @@ CREATE_PARENT_MODEL_FUNCTION(deleteChatRoom)
void ChatRoomProxyModel::compose (const QString& text) {
if (mChatRoomModel)
if (mChatRoomModel && !text.isEmpty())
mChatRoomModel->compose();
gCachedText = text;
}

View file

@ -56,6 +56,9 @@ Item {
function insert(text){
textArea.insert(textArea.cursorPosition, text)
}
function getText(){
return textArea.getText(0, textArea.text.length)
}
Rectangle{
anchors.fill: parent

View file

@ -413,12 +413,12 @@ Rectangle {
emojiVisible: chatEmojis.visible
onDropped: Logic.handleFilesDropped(files)
onTextChanged: Logic.handleTextChanged(text)
onTextChanged: Logic.handleTextChanged(getText())
onValidText: {
textArea.text = ''
chat.bindToEnd = true
if(proxyModel.chatRoomModel) {
proxyModel.sendMessage(text)
proxyModel.sendMessage(text)//Note : 'text' is coming from validText. It's not the text member.
}else{
proxyModel.chatRoomModel = CallsListModel.createChat(proxyModel.peerAddress)
proxyModel.sendMessage(text)