made message backgrounds overflow into the scrollbar

This commit is contained in:
fourtf 2018-05-31 12:59:43 +02:00
parent 416b2d0d74
commit 4f35d8854a
5 changed files with 12 additions and 12 deletions

View file

@ -149,8 +149,8 @@ void MessageLayout::actuallyLayout(int width, MessageElement::Flags _flags)
} }
// Painting // Painting
void MessageLayout::paint(QPainter &painter, int y, int messageIndex, Selection &selection, void MessageLayout::paint(QPainter &painter, int width, int y, int messageIndex,
bool isLastReadMessage, bool isWindowFocused) Selection &selection, bool isLastReadMessage, bool isWindowFocused)
{ {
auto app = getApp(); auto app = getApp();
QPixmap *pixmap = this->m_buffer.get(); QPixmap *pixmap = this->m_buffer.get();
@ -158,13 +158,11 @@ void MessageLayout::paint(QPainter &painter, int y, int messageIndex, Selection
// create new buffer if required // create new buffer if required
if (!pixmap) { if (!pixmap) {
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
pixmap = pixmap = new QPixmap(int(width * painter.device()->devicePixelRatioF()),
new QPixmap(int(this->m_container.getWidth() * painter.device()->devicePixelRatioF()), int(width * painter.device()->devicePixelRatioF()));
int(this->m_container.getHeight() * painter.device()->devicePixelRatioF()));
pixmap->setDevicePixelRatio(painter.device()->devicePixelRatioF()); pixmap->setDevicePixelRatio(painter.device()->devicePixelRatioF());
#else #else
pixmap = pixmap = new QPixmap(width, std::max(16, this->m_container.getHeight()));
new QPixmap(this->m_container.getWidth(), std::max(16, this->m_container.getHeight()));
#endif #endif
this->m_buffer = std::shared_ptr<QPixmap>(pixmap); this->m_buffer = std::shared_ptr<QPixmap>(pixmap);

View file

@ -42,7 +42,7 @@ public:
bool layout(int width, float m_scale, MessageElement::Flags flags); bool layout(int width, float m_scale, MessageElement::Flags flags);
// Painting // Painting
void paint(QPainter &painter, int y, int messageIndex, Selection &selection, void paint(QPainter &painter, int width, int y, int messageIndex, Selection &selection,
bool isLastReadMessage, bool isWindowFocused); bool isLastReadMessage, bool isWindowFocused);
void invalidateBuffer(); void invalidateBuffer();
void deleteBuffer(); void deleteBuffer();

View file

@ -174,7 +174,8 @@ void ThemeManager::actuallyUpdate(double hue, double multiplier)
// this->messages.seperatorInner = // this->messages.seperatorInner =
// Scrollbar // Scrollbar
this->scrollbars.background = getColor(0, sat, 0.94); this->scrollbars.background = splits.background;
this->scrollbars.background.setAlphaF(qreal(0.4));
this->scrollbars.thumb = getColor(0, sat, 0.80); this->scrollbars.thumb = getColor(0, sat, 0.80);
this->scrollbars.thumbSelected = getColor(0, sat, 0.7); this->scrollbars.thumbSelected = getColor(0, sat, 0.7);

View file

@ -27,7 +27,8 @@
#include <functional> #include <functional>
#include <memory> #include <memory>
#define LAYOUT_WIDTH (this->width() - (this->scrollBar.isVisible() ? 16 : 4) * this->getScale()) #define LAYOUT_WIDTH (this->width() - (this->scrollBar.isVisible() ? 16 : 2) * this->getScale())
#define DRAW_WIDTH (this->width())
#define SELECTION_RESUME_SCROLLING_MSG_THRESHOLD 3 #define SELECTION_RESUME_SCROLLING_MSG_THRESHOLD 3
#define CHAT_HOVER_PAUSE_DURATION 400 #define CHAT_HOVER_PAUSE_DURATION 400
@ -617,7 +618,7 @@ void ChannelView::drawMessages(QPainter &painter)
isLastMessage = this->lastReadMessage.get() == layout; isLastMessage = this->lastReadMessage.get() == layout;
} }
layout->paint(painter, y, i, this->selection, isLastMessage, windowFocused); layout->paint(painter, DRAW_WIDTH, y, i, this->selection, isLastMessage, windowFocused);
y += layout->getHeight(); y += layout->getHeight();

View file

@ -202,7 +202,7 @@ void Scrollbar::paintEvent(QPaintEvent *)
int xOffset = mouseOver ? 0 : width() - int(4 * this->getScale()); int xOffset = mouseOver ? 0 : width() - int(4 * this->getScale());
QPainter painter(this); QPainter painter(this);
// painter.fillRect(rect(), this->themeManager->ScrollbarBG); painter.fillRect(rect(), this->themeManager->scrollbars.background);
// painter.fillRect(QRect(xOffset, 0, width(), this->buttonHeight), // painter.fillRect(QRect(xOffset, 0, width(), this->buttonHeight),
// this->themeManager->ScrollbarArrow); // this->themeManager->ScrollbarArrow);