mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Fix tooltips appearing too large and/or away from the cursor (#4920)
This commit is contained in:
parent
879a63e6f3
commit
5325c7b826
|
@ -25,6 +25,7 @@
|
|||
- Bugfix: Fixed the input completion popup from disappearing when clicking on it on Windows and macOS. (#4876)
|
||||
- Bugfix: Fixed double-click text selection moving its position with each new message. (#4898)
|
||||
- Bugfix: Fixed an issue where notifications on Windows would contain no or an old avatar. (#4899)
|
||||
- Bugfix: Fixed tooltips appearing too large and/or away from the cursor. (#4920)
|
||||
- Bugfix: Fixed a crash when clicking `More messages below` button in a usercard and closing it quickly. (#4933)
|
||||
- Dev: Change clang-format from v14 to v16. (#4929)
|
||||
- Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791)
|
||||
|
|
|
@ -125,12 +125,6 @@ WindowManager::WindowManager()
|
|||
QObject::connect(this->saveTimer, &QTimer::timeout, [] {
|
||||
getApp()->windows->save();
|
||||
});
|
||||
|
||||
this->miscUpdateTimer_.start(100);
|
||||
|
||||
QObject::connect(&this->miscUpdateTimer_, &QTimer::timeout, [this] {
|
||||
this->miscUpdate.invoke();
|
||||
});
|
||||
}
|
||||
|
||||
WindowManager::~WindowManager() = default;
|
||||
|
|
|
@ -122,10 +122,6 @@ public:
|
|||
|
||||
pajlada::Signals::NoArgSignal wordFlagsChanged;
|
||||
|
||||
// This signal fires every 100ms and can be used to trigger random things that require a recheck.
|
||||
// It is currently being used by the "Tooltip Preview Image" system to recheck if an image is ready to be rendered.
|
||||
pajlada::Signals::NoArgSignal miscUpdate;
|
||||
|
||||
pajlada::Signals::Signal<Split *> selectSplit;
|
||||
pajlada::Signals::Signal<SplitContainer *> selectSplitContainer;
|
||||
pajlada::Signals::Signal<const MessagePtr &> scrollToMessageSignal;
|
||||
|
@ -159,7 +155,6 @@ private:
|
|||
pajlada::SettingListener wordFlagsListener_;
|
||||
|
||||
QTimer *saveTimer;
|
||||
QTimer miscUpdateTimer_;
|
||||
|
||||
friend class Window; // this is for selectedWindow_
|
||||
};
|
||||
|
|
|
@ -91,6 +91,11 @@ bool TooltipEntryWidget::refreshPixmap()
|
|||
this->displayImage_->setPixmap(pixmap->scaled(this->customImgWidth_,
|
||||
this->customImgHeight_,
|
||||
Qt::KeepAspectRatio));
|
||||
if (this->displayImage_->size() !=
|
||||
QSize{this->customImgWidth_, this->customImgHeight_})
|
||||
{
|
||||
this->adjustSize();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -37,11 +37,16 @@ TooltipWidget::TooltipWidget(BaseWidget *parent)
|
|||
});
|
||||
this->updateFont();
|
||||
|
||||
auto windows = getApp()->windows;
|
||||
auto *windows = getApp()->windows;
|
||||
this->connections_.managedConnect(windows->gifRepaintRequested, [this] {
|
||||
if (!this->isVisible())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->visibleEntries_; ++i)
|
||||
{
|
||||
auto entry = this->entryAt(i);
|
||||
auto *entry = this->entryAt(i);
|
||||
if (entry && entry->animated())
|
||||
{
|
||||
entry->refreshPixmap();
|
||||
|
@ -49,23 +54,29 @@ TooltipWidget::TooltipWidget(BaseWidget *parent)
|
|||
}
|
||||
});
|
||||
|
||||
this->connections_.managedConnect(windows->miscUpdate, [this] {
|
||||
bool needSizeAdjustment = false;
|
||||
for (int i = 0; i < this->visibleEntries_; ++i)
|
||||
{
|
||||
auto entry = this->entryAt(i);
|
||||
if (entry->hasImage() && entry->attemptRefresh())
|
||||
this->connections_.managedConnect(
|
||||
windows->layoutRequested, [this](auto *chan) {
|
||||
if (chan != nullptr || !this->isVisible())
|
||||
{
|
||||
bool successfullyUpdated = entry->refreshPixmap();
|
||||
needSizeAdjustment |= successfullyUpdated;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (needSizeAdjustment)
|
||||
{
|
||||
this->adjustSize();
|
||||
}
|
||||
});
|
||||
bool needSizeAdjustment = false;
|
||||
for (int i = 0; i < this->visibleEntries_; ++i)
|
||||
{
|
||||
auto *entry = this->entryAt(i);
|
||||
if (entry->hasImage() && entry->attemptRefresh())
|
||||
{
|
||||
bool successfullyUpdated = entry->refreshPixmap();
|
||||
needSizeAdjustment |= successfullyUpdated;
|
||||
}
|
||||
}
|
||||
|
||||
if (needSizeAdjustment)
|
||||
{
|
||||
this->adjustSize();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void TooltipWidget::setOne(const TooltipEntry &entry, TooltipStyle style)
|
||||
|
@ -101,6 +112,7 @@ void TooltipWidget::set(const std::vector<TooltipEntry> &entries,
|
|||
entryWidget->setImageScale(entry.customWidth, entry.customHeight);
|
||||
}
|
||||
}
|
||||
this->adjustSize();
|
||||
}
|
||||
|
||||
void TooltipWidget::setVisibleEntries(int n)
|
||||
|
|
Loading…
Reference in a new issue