fixed rectangle being off by 1 pixel in split container

This commit is contained in:
fourtf 2018-08-08 19:42:14 +02:00
parent 5957b87298
commit bdfe24035b
3 changed files with 14 additions and 11 deletions

View file

@ -140,7 +140,7 @@ ImagePtr Image::fromUrl(const Url &url, qreal scale)
if (!shared) { if (!shared) {
cache[url] = shared = ImagePtr(new Image(url, scale)); cache[url] = shared = ImagePtr(new Image(url, scale));
} else { } else {
Warn("same image loaded multiple times: {}", url.string); // Warn("same image loaded multiple times: {}", url.string);
} }
return shared; return shared;

View file

@ -31,8 +31,7 @@ TwitchMessageBuilder::TwitchMessageBuilder(
, originalMessage_(_ircMessage->content()) , originalMessage_(_ircMessage->content())
, action_(_ircMessage->isAction()) , action_(_ircMessage->isAction())
{ {
auto app = getApp(); this->usernameColor_ = getApp()->themes->messages.textColors.system;
this->usernameColor_ = app->themes->messages.textColors.system;
} }
TwitchMessageBuilder::TwitchMessageBuilder( TwitchMessageBuilder::TwitchMessageBuilder(
@ -46,8 +45,7 @@ TwitchMessageBuilder::TwitchMessageBuilder(
, originalMessage_(content) , originalMessage_(content)
, action_(isAction) , action_(isAction)
{ {
auto app = getApp(); this->usernameColor_ = getApp()->themes->messages.textColors.system;
this->usernameColor_ = app->themes->messages.textColors.system;
} }
bool TwitchMessageBuilder::isIgnored() const bool TwitchMessageBuilder::isIgnored() const

View file

@ -326,25 +326,30 @@ void SplitContainer::layout()
Node *node = this->baseNode_.findNodeContainingSplit(split); Node *node = this->baseNode_.findNodeContainingSplit(split);
// left
_dropRects.push_back( _dropRects.push_back(
DropRect(QRect(g.left(), g.top(), g.width() / 3, g.height()), DropRect(QRect(g.left(), g.top(), g.width() / 3, g.height()),
Position(node, Direction::Left))); Position(node, Direction::Left)));
_dropRects.push_back(DropRect(QRect(g.left() + g.width() / 3 * 2, // right
g.top(), g.width() / 3, g.height()), _dropRects.push_back(DropRect(QRect(g.right() - g.width() / 3, g.top(),
g.width() / 3, g.height()),
Position(node, Direction::Right))); Position(node, Direction::Right)));
// top
_dropRects.push_back( _dropRects.push_back(
DropRect(QRect(g.left(), g.top(), g.width(), g.height() / 2), DropRect(QRect(g.left(), g.top(), g.width(), g.height() / 2),
Position(node, Direction::Above))); Position(node, Direction::Above)));
_dropRects.push_back(DropRect(QRect(g.left(), g.top() + g.height() / 2, // bottom
g.width(), g.height() / 2), _dropRects.push_back(
DropRect(QRect(g.left(), g.bottom() - g.height() / 2, g.width(),
g.height() / 2),
Position(node, Direction::Below))); Position(node, Direction::Below)));
} }
if (this->splits_.empty()) { if (this->splits_.empty()) {
QRect g = this->rect(); QRect g = this->rect();
_dropRects.push_back( _dropRects.push_back(
DropRect(QRect(g.left(), g.top(), g.width(), g.height()), DropRect(QRect(g.left(), g.top(), g.width() - 1, g.height() - 1),
Position(nullptr, Direction::Below))); Position(nullptr, Direction::Below)));
} }