Remove offset logic from BaseWindow::moveTo (#4798)

It's now up to each window to offset its coordinates themselves (which is good 👍 )
This commit is contained in:
nerix 2023-08-28 18:38:41 +02:00 committed by GitHub
parent 7cb04bf58b
commit af4233850d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 13 deletions

View file

@ -923,7 +923,7 @@ void CommandController::initialize(Settings &, Paths &paths)
static_cast<QWidget *>(&(getApp()->windows->getMainWindow())), static_cast<QWidget *>(&(getApp()->windows->getMainWindow())),
currentSplit); currentSplit);
userPopup->setData(userName, channel); userPopup->setData(userName, channel);
userPopup->moveTo(QCursor::pos(), false, userPopup->moveTo(QCursor::pos(),
BaseWindow::BoundsChecker::CursorPosition); BaseWindow::BoundsChecker::CursorPosition);
userPopup->show(); userPopup->show();
return ""; return "";

View file

@ -503,14 +503,8 @@ void BaseWindow::leaveEvent(QEvent *)
TooltipWidget::instance()->hide(); 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) switch (boundsChecker)
{ {
case BoundsChecker::Off: { case BoundsChecker::Off: {

View file

@ -65,7 +65,7 @@ public:
void setActionOnFocusLoss(ActionOnFocusLoss value); void setActionOnFocusLoss(ActionOnFocusLoss value);
ActionOnFocusLoss getActionOnFocusLoss() const; ActionOnFocusLoss getActionOnFocusLoss() const;
void moveTo(QPoint point, bool offset, BoundsChecker boundsChecker); void moveTo(QPoint point, BoundsChecker boundsChecker);
float scale() const override; float scale() const override;
float qtFontScale() const; float qtFontScale() const;

View file

@ -207,7 +207,7 @@ EmotePopup::EmotePopup(QWidget *parent)
, notebook_(new Notebook(this)) , notebook_(new Notebook(this))
{ {
// this->setStayInScreenRect(true); // this->setStayInScreenRect(true);
this->moveTo(getApp()->windows->emotePopupPos(), false, this->moveTo(getApp()->windows->emotePopupPos(),
BaseWindow::BoundsChecker::DesiredPosition); BaseWindow::BoundsChecker::DesiredPosition);
auto *layout = new QVBoxLayout(); auto *layout = new QVBoxLayout();

View file

@ -1810,7 +1810,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
} }
} }
tooltipWidget->moveTo(event->globalPos(), true, tooltipWidget->moveTo(event->globalPos() + QPoint(16, 16),
BaseWindow::BoundsChecker::CursorPosition); BaseWindow::BoundsChecker::CursorPosition);
tooltipWidget->setWordWrap(isLinkValid); tooltipWidget->setWordWrap(isLinkValid);
tooltipWidget->show(); tooltipWidget->show();
@ -2665,7 +2665,7 @@ void ChannelView::showUserInfoPopup(const QString &userName,
userPopup->setData(userName, contextChannel, openingChannel); userPopup->setData(userName, contextChannel, openingChannel);
QPoint offset(userPopup->width() / 3, userPopup->height() / 5); QPoint offset(userPopup->width() / 3, userPopup->height() / 5);
userPopup->moveTo(QCursor::pos() - offset, false, userPopup->moveTo(QCursor::pos() - offset,
BaseWindow::BoundsChecker::CursorPosition); BaseWindow::BoundsChecker::CursorPosition);
userPopup->show(); userPopup->show();
} }

View file

@ -955,7 +955,7 @@ void SplitHeader::enterEvent(QEvent *event)
auto pos = this->mapToGlobal(this->rect().bottomLeft()) + auto pos = this->mapToGlobal(this->rect().bottomLeft()) +
QPoint((this->width() - tooltip->width()) / 2, 1); QPoint((this->width() - tooltip->width()) / 2, 1);
tooltip->moveTo(pos, false, BaseWindow::BoundsChecker::CursorPosition); tooltip->moveTo(pos, BaseWindow::BoundsChecker::CursorPosition);
tooltip->show(); tooltip->show();
} }