fix(2d): Clicking on the preview will crash

This commit is contained in:
justforlxz.com 2019-06-19 16:38:48 +08:00
parent 05da78a491
commit 4bb03fa9ae
2 changed files with 10 additions and 3 deletions

View File

@ -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)
@ -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);
}

View File

@ -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)