From 93f999620776f177a844b7e21e83c4d9e92ff564 Mon Sep 17 00:00:00 2001 From: fourtf Date: Tue, 10 Apr 2018 02:42:41 +0200 Subject: [PATCH] Fixes #291 links clickable area --- src/messages/layouts/messagelayout.cpp | 2 +- src/messages/layouts/messagelayoutcontainer.cpp | 5 +++++ src/messages/messageelement.cpp | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/messages/layouts/messagelayout.cpp b/src/messages/layouts/messagelayout.cpp index 48bac932e..3e6cc521e 100644 --- a/src/messages/layouts/messagelayout.cpp +++ b/src/messages/layouts/messagelayout.cpp @@ -210,7 +210,7 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int messageIndex, Selection &s QTextOption option; option.setAlignment(Qt::AlignRight | Qt::AlignTop); - painter.drawText(QRectF(1, 1, this->container.width - 3, 1000), + painter.drawText(QRectF(1, 1, this->container.getWidth() - 3, 1000), QString::number(++this->bufferUpdatedCount), option); #endif } diff --git a/src/messages/layouts/messagelayoutcontainer.cpp b/src/messages/layouts/messagelayoutcontainer.cpp index c592b2386..1ced1263e 100644 --- a/src/messages/layouts/messagelayoutcontainer.cpp +++ b/src/messages/layouts/messagelayoutcontainer.cpp @@ -179,6 +179,11 @@ MessageLayoutElement *MessageLayoutContainer::getElementAt(QPoint point) void MessageLayoutContainer::paintElements(QPainter &painter) { for (const std::unique_ptr &element : this->elements) { +#ifdef OHHEYITSFOURTF + painter.setPen(QColor(0, 255, 0)); + painter.drawRect(element->getRect()); +#endif + element->paint(painter); } } diff --git a/src/messages/messageelement.cpp b/src/messages/messageelement.cpp index faf3c00bf..46d8cb63e 100644 --- a/src/messages/messageelement.cpp +++ b/src/messages/messageelement.cpp @@ -186,8 +186,8 @@ void TextElement::addToContainer(MessageLayoutContainer &container, MessageEleme int charWidth = metrics.width(text[i]); if (!container.fitsInLine(width + charWidth)) { - container.addElementNoLineBreak(getTextLayoutElement( - text.mid(wordStart, i - wordStart), width - lastWidth, false)); + container.addElementNoLineBreak( + getTextLayoutElement(text.mid(wordStart, i - wordStart), width, false)); container.breakLine(); wordStart = i;