mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix(preview): hovering preview picture size adjust
Change-Id: Ia01bc9bc73a2bac53a911effa3095f826d8472be
This commit is contained in:
parent
b1333a2795
commit
6417a6255c
@ -55,6 +55,11 @@ WId FloatingPreview::trackedWid() const
|
|||||||
return m_tracked->wid();
|
return m_tracked->wid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AppSnapshot *FloatingPreview::trackedWindow()
|
||||||
|
{
|
||||||
|
return m_tracked;
|
||||||
|
}
|
||||||
|
|
||||||
void FloatingPreview::trackWindow(AppSnapshot * const snap)
|
void FloatingPreview::trackWindow(AppSnapshot * const snap)
|
||||||
{
|
{
|
||||||
if (!m_tracked.isNull())
|
if (!m_tracked.isNull())
|
||||||
@ -134,6 +139,13 @@ bool FloatingPreview::eventFilter(QObject *watched, QEvent *event)
|
|||||||
return QWidget::eventFilter(watched, event);
|
return QWidget::eventFilter(watched, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FloatingPreview::hideEvent(QHideEvent *event)
|
||||||
|
{
|
||||||
|
m_tracked->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
QWidget::hideEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void FloatingPreview::onCloseBtnClicked()
|
void FloatingPreview::onCloseBtnClicked()
|
||||||
{
|
{
|
||||||
Q_ASSERT(!m_tracked.isNull());
|
Q_ASSERT(!m_tracked.isNull());
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
explicit FloatingPreview(QWidget *parent = 0);
|
explicit FloatingPreview(QWidget *parent = 0);
|
||||||
|
|
||||||
WId trackedWid() const;
|
WId trackedWid() const;
|
||||||
|
AppSnapshot *trackedWindow();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestMove(const QPoint &p) const;
|
void requestMove(const QPoint &p) const;
|
||||||
@ -46,9 +47,10 @@ public slots:
|
|||||||
void trackWindow(AppSnapshot * const snap);
|
void trackWindow(AppSnapshot * const snap);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *e);
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
|
void hideEvent(QHideEvent *event) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onCloseBtnClicked();
|
void onCloseBtnClicked();
|
||||||
|
@ -185,6 +185,7 @@ void PreviewContainer::leaveEvent(QEvent *e)
|
|||||||
{
|
{
|
||||||
QWidget::leaveEvent(e);
|
QWidget::leaveEvent(e);
|
||||||
|
|
||||||
|
m_floatingPreview->setVisible(false);
|
||||||
m_mouseLeaveTimer->start();
|
m_mouseLeaveTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,10 +214,21 @@ void PreviewContainer::previewEntered(const WId wid)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
AppSnapshot *snap = static_cast<AppSnapshot *>(sender());
|
AppSnapshot *snap = static_cast<AppSnapshot *>(sender());
|
||||||
|
if (!snap) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
snap->setContentsMargins(100, 0, 100, 0);
|
||||||
|
|
||||||
m_floatingPreview->trackWindow(snap);
|
AppSnapshot *preSnap = m_floatingPreview->trackedWindow();
|
||||||
m_floatingPreview->setVisible(true);
|
if (preSnap && preSnap != snap) {
|
||||||
m_floatingPreview->raise();
|
preSnap->setContentsMargins(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTimer::singleShot(0, [=] {
|
||||||
|
m_floatingPreview->trackWindow(snap);
|
||||||
|
m_floatingPreview->setVisible(true);
|
||||||
|
m_floatingPreview->raise();
|
||||||
|
});
|
||||||
|
|
||||||
emit requestPreviewWindow(wid);
|
emit requestPreviewWindow(wid);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user