Skip to content

Commit

Permalink
fix(2d): Clicking on the preview will crash
Browse files Browse the repository at this point in the history
  • Loading branch information
justforlxz committed Jun 19, 2019
1 parent 05da78a commit 4bb03fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions frame/item/components/floatingpreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ void FloatingPreview::mouseReleaseEvent(QMouseEvent *e)
{
QWidget::mouseReleaseEvent(e);

emit m_tracked->clicked(m_tracked->wid());
if (m_tracked) {
emit m_tracked->clicked(m_tracked->wid());
}
}

bool FloatingPreview::eventFilter(QObject *watched, QEvent *event)
Expand All @@ -139,7 +141,9 @@ bool FloatingPreview::eventFilter(QObject *watched, QEvent *event)

void FloatingPreview::hideEvent(QHideEvent *event)
{
m_tracked->setContentsMargins(0, 0, 0, 0);
if (m_tracked) {
m_tracked->setContentsMargins(0, 0, 0, 0);
}

QWidget::hideEvent(event);
}
Expand Down
5 changes: 4 additions & 1 deletion frame/item/components/previewcontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ void PreviewContainer::enterEvent(QEvent *e)

m_needActivate = false;
m_mouseLeaveTimer->stop();
m_waitForShowPreviewTimer->start();

if (m_wmHelper->hasComposite()) {
m_waitForShowPreviewTimer->start();
}
}

void PreviewContainer::leaveEvent(QEvent *e)
Expand Down

0 comments on commit 4bb03fa

Please sign in to comment.