fix: tooltips showing out-of-bounds after loading images (#5186)

This commit is contained in:
nerix
2024-02-24 12:52:16 +01:00
committed by GitHub
parent dcd6179434
commit dd61482046
5 changed files with 32 additions and 0 deletions
+1
View File
@@ -86,6 +86,7 @@
- Bugfix: Reply contexts now use the color of the replied-to message. (#5145) - Bugfix: Reply contexts now use the color of the replied-to message. (#5145)
- Bugfix: Fixed top-level window getting stuck after opening settings. (#5161, #5166) - Bugfix: Fixed top-level window getting stuck after opening settings. (#5161, #5166)
- Bugfix: Fixed link info not updating without moving the cursor. (#5178) - Bugfix: Fixed link info not updating without moving the cursor. (#5178)
- Bugfix: Fixed tooltips getting out of bounds when loading images. (#5186)
- Dev: Run miniaudio in a separate thread, and simplify it to not manage the device ourselves. There's a chance the simplification is a bad idea. (#4978) - Dev: Run miniaudio in a separate thread, and simplify it to not manage the device ourselves. There's a chance the simplification is a bad idea. (#4978)
- Dev: Change clang-format from v14 to v16. (#4929) - Dev: Change clang-format from v14 to v16. (#4929)
- Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791) - Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791)
+15
View File
@@ -531,14 +531,29 @@ void BaseWindow::leaveEvent(QEvent *)
void BaseWindow::moveTo(QPoint point, widgets::BoundsChecking mode) void BaseWindow::moveTo(QPoint point, widgets::BoundsChecking mode)
{ {
this->lastBoundsCheckPosition_ = point;
this->lastBoundsCheckMode_ = mode;
widgets::moveWindowTo(this, point, mode); widgets::moveWindowTo(this, point, mode);
} }
void BaseWindow::showAndMoveTo(QPoint point, widgets::BoundsChecking mode) void BaseWindow::showAndMoveTo(QPoint point, widgets::BoundsChecking mode)
{ {
this->lastBoundsCheckPosition_ = point;
this->lastBoundsCheckMode_ = mode;
widgets::showAndMoveWindowTo(this, point, mode); widgets::showAndMoveWindowTo(this, point, mode);
} }
bool BaseWindow::applyLastBoundsCheck()
{
if (this->lastBoundsCheckMode_ == widgets::BoundsChecking::Off)
{
return false;
}
this->moveTo(this->lastBoundsCheckPosition_, this->lastBoundsCheckMode_);
return true;
}
void BaseWindow::resizeEvent(QResizeEvent *) void BaseWindow::resizeEvent(QResizeEvent *)
{ {
// Queue up save because: Window resized // Queue up save because: Window resized
+14
View File
@@ -65,6 +65,15 @@ public:
**/ **/
void showAndMoveTo(QPoint point, widgets::BoundsChecking mode); void showAndMoveTo(QPoint point, widgets::BoundsChecking mode);
/// @brief Applies the last moveTo operation if that one was bounds-checked
///
/// If there was a previous moveTo or showAndMoveTo operation with a mode
/// other than `Off`, a moveTo is repeated with the last supplied @a point
/// and @a mode. Note that in the case of showAndMoveTo, moveTo is run.
///
/// @returns true if there was a previous bounds-checked moveTo operation
bool applyLastBoundsCheck();
float scale() const override; float scale() const override;
float qtFontScale() const; float qtFontScale() const;
@@ -152,6 +161,11 @@ private:
std::vector<Button *> buttons; std::vector<Button *> buttons;
} ui_; } ui_;
/// The last @a pos from moveTo and showAndMoveTo
QPoint lastBoundsCheckPosition_;
/// The last @a mode from moveTo and showAndMoveTo
widgets::BoundsChecking lastBoundsCheckMode_ = widgets::BoundsChecking::Off;
#ifdef USEWINSDK #ifdef USEWINSDK
/// @brief Returns the HWND of this window if it has one /// @brief Returns the HWND of this window if it has one
/// ///
+1
View File
@@ -90,6 +90,7 @@ TooltipWidget::TooltipWidget(BaseWidget *parent)
if (needSizeAdjustment) if (needSizeAdjustment)
{ {
this->adjustSize(); this->adjustSize();
this->applyLastBoundsCheck();
} }
}); });
} }
+1
View File
@@ -3121,6 +3121,7 @@ void ChannelView::pendingLinkInfoStateChanged()
return; return;
} }
this->setLinkInfoTooltip(this->pendingLinkInfo_.data()); this->setLinkInfoTooltip(this->pendingLinkInfo_.data());
this->tooltipWidget_->applyLastBoundsCheck();
} }
} // namespace chatterino } // namespace chatterino