hide preview if all window destoryed

Change-Id: I4216ded4a83c965dba36dd73ad06a78ac55a7ac4
This commit is contained in:
石博文 2017-05-24 11:20:53 +08:00
parent e8a560faee
commit a993d0454e
Notes: Deepin Code Review 2017-05-24 11:24:46 +08:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Wed, 24 May 2017 11:24:42 +0800
Reviewed-on: https://cr.deepin.io/23370
Project: dde/dde-dock
Branch: refs/heads/master
2 changed files with 7 additions and 10 deletions

View File

@ -52,7 +52,13 @@ void _PreviewContainer::setWindowInfos(const WindowDict &infos)
m_snapshots[it.key()]->setWindowTitle(it.value());
}
adjustSize();
if (m_snapshots.isEmpty())
{
emit requestCancelPreview();
emit requestHidePreview();
} else {
adjustSize();
}
}
void _PreviewContainer::updateLayoutDirection(const Dock::Position dockPos)

View File

@ -84,10 +84,6 @@ void AppSnapshot::fetchSnapshot()
m_snapshot = qimage.copy();
}
// const int w = width();
// const int h = height();
// m_snapshot = m_snapshot.scaled(w, h, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
// m_snapshot = m_snapshot.copy((m_snapshot.width() - w) / 2, (m_snapshot.height() - h) / 2, w, h);
XDestroyImage(ximage);
XFree(prop_to_return);
@ -113,11 +109,6 @@ void AppSnapshot::paintEvent(QPaintEvent *e)
const QRect r = rect().marginsRemoved(QMargins(8, 8, 8, 8));
// draw image
// const QPoint offset = r.center() - ir.center();
// painter.fillRect(offset.x(), offset.y(), ir.width(), ir.height(), Qt::white);
// painter.drawImage(offset.x(), offset.y(), m_snapshot);
// painter.fillRect(r, Qt::white);
const QImage im = m_snapshot.scaled(r.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
const QRect ir = im.rect();
const QPoint offset = r.center() - ir.center();