From 5f6691067a18e503caf84122d59b59409bfbb5b4 Mon Sep 17 00:00:00 2001 From: blue Date: Tue, 29 Mar 2022 19:05:24 +0300 Subject: [PATCH] minor bugfixes about message body, automatic focus and that quirk with font becomming bigger --- CHANGELOG.md | 3 +++ ui/widgets/conversation.cpp | 9 ++++++++- ui/widgets/conversation.h | 1 + ui/widgets/conversation.ui | 6 +++++- ui/widgets/messageline/messagedelegate.cpp | 1 + 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efb159c..83c759e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,12 @@ - build in release mode now no longer spams warnings - build now correctly installs all build plugin libs - a bug where the correction message was received, the indication was on but the text didn't actually change +- message body now doesn't intecept context menu from the whole message +- message input now doesn't increase font when you remove everything from it ### Improvements - reduced amount of places where platform specific path separator is used +- now message input is automatically focused when you open a dialog or a room ### New features - the settings are here! You con config different stuff from there diff --git a/ui/widgets/conversation.cpp b/ui/widgets/conversation.cpp index 02aefb4..da3d187 100644 --- a/ui/widgets/conversation.cpp +++ b/ui/widgets/conversation.cpp @@ -94,7 +94,6 @@ Conversation::Conversation(bool muc, Models::Account* acc, Models::Element* el, this, &Conversation::onTextEditDocSizeChanged); m_ui->messageEditor->installEventFilter(&ker); - m_ui->messageEditor->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_ui->messageEditor, &QTextEdit::customContextMenuRequested, this, &Conversation::onMessageEditorContext); connect(pasteImageAction, &QAction::triggered, this, &Conversation::onImagePasted); @@ -555,3 +554,11 @@ void Conversation::onMessageEditRequested(const QString& id) qDebug() << "Ignoring"; } } + +void Conversation::showEvent(QShowEvent* event) +{ + QWidget::showEvent(event); + + emit shown(); + m_ui->messageEditor->setFocus(); +} diff --git a/ui/widgets/conversation.h b/ui/widgets/conversation.h index 743df71..0c44bd9 100644 --- a/ui/widgets/conversation.h +++ b/ui/widgets/conversation.h @@ -103,6 +103,7 @@ protected: void dropEvent(QDropEvent* event) override; void initializeOverlay(); virtual void onMessage(const Shared::Message& msg); + virtual void showEvent(QShowEvent * event) override; protected slots: void initiateMessageSending(); diff --git a/ui/widgets/conversation.ui b/ui/widgets/conversation.ui index ce9ad66..1f8b483 100644 --- a/ui/widgets/conversation.ui +++ b/ui/widgets/conversation.ui @@ -402,6 +402,9 @@ 30 + + Qt::CustomContextMenu + false @@ -424,7 +427,7 @@ background-color: transparent <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Liberation Sans'; font-size:10pt;"><br /></p></body></html> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> false @@ -447,6 +450,7 @@ p, li { white-space: pre-wrap; } Badge QFrame
ui/utils/badge.h
+ 1 diff --git a/ui/widgets/messageline/messagedelegate.cpp b/ui/widgets/messageline/messagedelegate.cpp index 22e8dcb..15a5e46 100644 --- a/ui/widgets/messageline/messagedelegate.cpp +++ b/ui/widgets/messageline/messagedelegate.cpp @@ -582,6 +582,7 @@ QLabel * MessageDelegate::getBody(const Models::FeedItem& data) const } else { result = new QLabel(); result->setFont(bodyFont); + result->setContextMenuPolicy(Qt::NoContextMenu); result->setWordWrap(true); result->setOpenExternalLinks(true); result->setTextInteractionFlags(result->textInteractionFlags() | Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);