mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fixed ocd inducing 1 pixel offsets
This commit is contained in:
parent
81f2f8781a
commit
cb235ef532
2 changed files with 28 additions and 25 deletions
|
@ -40,12 +40,12 @@ SplitContainer::SplitContainer(Notebook *parent)
|
|||
this->layout();
|
||||
|
||||
if (modifiers == showResizeHandlesModifiers) {
|
||||
for (std::unique_ptr<ResizeHandle> &handle : this->resizeHandles_) {
|
||||
for (auto &handle : this->resizeHandles_) {
|
||||
handle->show();
|
||||
handle->raise();
|
||||
}
|
||||
} else {
|
||||
for (std::unique_ptr<ResizeHandle> &handle : this->resizeHandles_) {
|
||||
for (auto &handle : this->resizeHandles_) {
|
||||
handle->hide();
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ void SplitContainer::hideResizeHandles()
|
|||
{
|
||||
this->overlay_.hide();
|
||||
|
||||
for (std::unique_ptr<ResizeHandle> &handle : this->resizeHandles_) {
|
||||
for (auto &handle : this->resizeHandles_) {
|
||||
handle->hide();
|
||||
}
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ void SplitContainer::focusSplitRecursive(Node *node, Direction direction)
|
|||
|
||||
void SplitContainer::layout()
|
||||
{
|
||||
this->baseNode_.geometry_ = this->rect();
|
||||
this->baseNode_.geometry_ = this->rect().adjusted(0, 0, -1, -1);
|
||||
|
||||
std::vector<DropRect> _dropRects;
|
||||
std::vector<ResizeRect> _resizeRects;
|
||||
|
@ -904,7 +904,7 @@ void SplitContainer::Node::layout(bool addSpacing, float _scale,
|
|||
case Node::_Split: {
|
||||
QRect rect = this->geometry_.toRect();
|
||||
this->split_->setGeometry(
|
||||
rect.marginsRemoved(QMargins(1, 1, 1, 1)));
|
||||
rect.marginsRemoved(QMargins(1, 1, 0, 0)));
|
||||
} break;
|
||||
case Node::VerticalContainer:
|
||||
case Node::HorizontalContainer: {
|
||||
|
@ -968,10 +968,10 @@ void SplitContainer::Node::layout(bool addSpacing, float _scale,
|
|||
}
|
||||
|
||||
// iterate children
|
||||
qreal pos = isVertical ? childRect.top() : childRect.left();
|
||||
auto pos = int(isVertical ? childRect.top() : childRect.left());
|
||||
for (std::unique_ptr<Node> &child : this->children_) {
|
||||
// set rect
|
||||
QRectF rect = childRect;
|
||||
QRect rect = childRect.toRect();
|
||||
if (isVertical) {
|
||||
rect.setTop(pos);
|
||||
rect.setHeight(
|
||||
|
@ -987,6 +987,11 @@ void SplitContainer::Node::layout(bool addSpacing, float _scale,
|
|||
sizeMultiplier);
|
||||
}
|
||||
|
||||
if (child == this->children_.back()) {
|
||||
rect.setRight(childRect.right() - 1);
|
||||
rect.setBottom(childRect.bottom() - 1);
|
||||
}
|
||||
|
||||
child->geometry_ = rect;
|
||||
child->layout(addSpacing, _scale, dropRects, resizeRects);
|
||||
|
||||
|
|
|
@ -78,23 +78,21 @@ void SplitInput::initLayout()
|
|||
}));
|
||||
|
||||
// open emote popup
|
||||
QObject::connect(
|
||||
this->ui_.emoteButton, &EffectLabel::clicked, [this] {
|
||||
if (!this->emotePopup_) {
|
||||
this->emotePopup_ = std::make_unique<EmotePopup>();
|
||||
this->emotePopup_->linkClicked.connect(
|
||||
[this](const Link &link) {
|
||||
if (link.type == Link::InsertText) {
|
||||
this->insertText(link.value + " ");
|
||||
}
|
||||
});
|
||||
}
|
||||
QObject::connect(this->ui_.emoteButton, &EffectLabel::clicked, [this] {
|
||||
if (!this->emotePopup_) {
|
||||
this->emotePopup_ = std::make_unique<EmotePopup>();
|
||||
this->emotePopup_->linkClicked.connect([this](const Link &link) {
|
||||
if (link.type == Link::InsertText) {
|
||||
this->insertText(link.value + " ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this->emotePopup_->resize(int(300 * this->emotePopup_->getScale()),
|
||||
int(500 * this->emotePopup_->getScale()));
|
||||
this->emotePopup_->loadChannel(this->split_->getChannel());
|
||||
this->emotePopup_->show();
|
||||
});
|
||||
this->emotePopup_->resize(int(300 * this->emotePopup_->getScale()),
|
||||
int(500 * this->emotePopup_->getScale()));
|
||||
this->emotePopup_->loadChannel(this->split_->getChannel());
|
||||
this->emotePopup_->show();
|
||||
});
|
||||
|
||||
// clear channelview selection when selecting in the input
|
||||
QObject::connect(this->ui_.textEdit, &QTextEdit::copyAvailable,
|
||||
|
@ -346,7 +344,7 @@ void SplitInput::paintEvent(QPaintEvent *)
|
|||
|
||||
if (this->theme->isLightTheme()) {
|
||||
int s = int(3 * this->getScale());
|
||||
QRect rect = this->rect().marginsRemoved(QMargins(s, s, s, s));
|
||||
QRect rect = this->rect().marginsRemoved(QMargins(s - 1, s - 1, s, s));
|
||||
|
||||
painter.fillRect(rect, this->theme->splits.input.background);
|
||||
|
||||
|
@ -354,7 +352,7 @@ void SplitInput::paintEvent(QPaintEvent *)
|
|||
painter.drawRect(rect);
|
||||
} else {
|
||||
int s = int(1 * this->getScale());
|
||||
QRect rect = this->rect().marginsRemoved(QMargins(s, s, s, s));
|
||||
QRect rect = this->rect().marginsRemoved(QMargins(s - 1, s - 1, s, s));
|
||||
|
||||
painter.fillRect(rect, this->theme->splits.input.background);
|
||||
|
||||
|
|
Loading…
Reference in a new issue