UI: Fix source tree hovering being inconsistent

When hovering over the source tree items, sometimes the preview
would show the item hovered, sometimes not. This is caused by
the SourceTree mouseMoveEvent/leaveEvent calling the same functions
as the SourceTreeItem enterEvent/leaveEvent, therefore competing
with each other, causing some jankiness.
master
cg2121 2022-08-30 00:45:59 -05:00 committed by Matt Gajownik
parent 247b688dea
commit 5e67d96996
2 changed files with 0 additions and 29 deletions

View File

@ -1082,8 +1082,6 @@ SourceTree::SourceTree(QWidget *parent_) : QListView(parent_)
"*[bgColor=\"7\"]{background-color:rgba(68,68,68,33%);}"
"*[bgColor=\"8\"]{background-color:rgba(255,255,255,33%);}"));
setMouseTracking(true);
UpdateNoSourcesMessage();
connect(App(), &OBSApp::StyleChanged, this,
&SourceTree::UpdateNoSourcesMessage);
@ -1491,31 +1489,6 @@ void SourceTree::dropEvent(QDropEvent *event)
QListView::dropEvent(event);
}
void SourceTree::mouseMoveEvent(QMouseEvent *event)
{
QPoint pos = event->pos();
SourceTreeItem *item = qobject_cast<SourceTreeItem *>(childAt(pos));
OBSBasicPreview *preview = OBSBasicPreview::Get();
QListView::mouseMoveEvent(event);
std::lock_guard<std::mutex> lock(preview->selectMutex);
preview->hoveredPreviewItems.clear();
if (item)
preview->hoveredPreviewItems.push_back(item->sceneitem);
}
void SourceTree::leaveEvent(QEvent *event)
{
OBSBasicPreview *preview = OBSBasicPreview::Get();
QListView::leaveEvent(event);
std::lock_guard<std::mutex> lock(preview->selectMutex);
preview->hoveredPreviewItems.clear();
}
void SourceTree::selectionChanged(const QItemSelection &selected,
const QItemSelection &deselected)
{

View File

@ -211,8 +211,6 @@ public slots:
protected:
virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
virtual void dropEvent(QDropEvent *event) override;
virtual void mouseMoveEvent(QMouseEvent *event) override;
virtual void leaveEvent(QEvent *event) override;
virtual void paintEvent(QPaintEvent *event) override;
virtual void