Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove offset logic from BaseWindow::moveTo #4798

Merged
merged 2 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/controllers/commands/CommandController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ void CommandController::initialize(Settings &, Paths &paths)
static_cast<QWidget *>(&(getApp()->windows->getMainWindow())),
currentSplit);
userPopup->setData(userName, channel);
userPopup->moveTo(QCursor::pos(), false,
userPopup->moveTo(QCursor::pos(),
BaseWindow::BoundsChecker::CursorPosition);
userPopup->show();
return "";
Expand Down
8 changes: 1 addition & 7 deletions src/widgets/BaseWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,14 +503,8 @@ void BaseWindow::leaveEvent(QEvent *)
TooltipWidget::instance()->hide();
}

void BaseWindow::moveTo(QPoint point, bool offset, BoundsChecker boundsChecker)
void BaseWindow::moveTo(QPoint point, BoundsChecker boundsChecker)
{
if (offset)
{
point.rx() += 16;
point.ry() += 16;
}

switch (boundsChecker)
{
case BoundsChecker::Off: {
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/BaseWindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class BaseWindow : public BaseWidget
void setActionOnFocusLoss(ActionOnFocusLoss value);
ActionOnFocusLoss getActionOnFocusLoss() const;

void moveTo(QPoint point, bool offset, BoundsChecker boundsChecker);
void moveTo(QPoint point, BoundsChecker boundsChecker);

float scale() const override;
float qtFontScale() const;
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/dialogs/EmotePopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ EmotePopup::EmotePopup(QWidget *parent)
, notebook_(new Notebook(this))
{
// this->setStayInScreenRect(true);
this->moveTo(getApp()->windows->emotePopupPos(), false,
this->moveTo(getApp()->windows->emotePopupPos(),
BaseWindow::BoundsChecker::DesiredPosition);

auto *layout = new QVBoxLayout();
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/helper/ChannelView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
}
}

tooltipWidget->moveTo(event->globalPos(), true,
tooltipWidget->moveTo(event->globalPos() + QPoint(16, 16),
BaseWindow::BoundsChecker::CursorPosition);
tooltipWidget->setWordWrap(isLinkValid);
tooltipWidget->show();
Expand Down Expand Up @@ -2665,7 +2665,7 @@ void ChannelView::showUserInfoPopup(const QString &userName,
userPopup->setData(userName, contextChannel, openingChannel);

QPoint offset(userPopup->width() / 3, userPopup->height() / 5);
userPopup->moveTo(QCursor::pos() - offset, false,
userPopup->moveTo(QCursor::pos() - offset,
BaseWindow::BoundsChecker::CursorPosition);
userPopup->show();
}
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/splits/SplitHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ void SplitHeader::enterEvent(QEvent *event)
auto pos = this->mapToGlobal(this->rect().bottomLeft()) +
QPoint((this->width() - tooltip->width()) / 2, 1);

tooltip->moveTo(pos, false, BaseWindow::BoundsChecker::CursorPosition);
tooltip->moveTo(pos, BaseWindow::BoundsChecker::CursorPosition);
tooltip->show();
}

Expand Down