mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
Changes:
1,show preview interval change to 800 ms 2,hide preview immediately when clicked item 3,hide preview when the last preview-window was closed Change-Id: I5823ec84aab3151dd1b5d33e0c158a57ae7aa776
This commit is contained in:
parent
787c259f20
commit
a0e2337616
Notes:
Deepin Code Review
2016-06-14 07:19:47 +00:00
Verified+1: Anonymous Coward #1000004 Code-Review+2: Hualet Wang <mr.asianwang@gmail.com> Submitted-by: Hualet Wang <mr.asianwang@gmail.com> Submitted-at: Wed, 26 Aug 2015 18:44:04 +0800 Reviewed-on: https://cr.deepin.io/6601 Project: dde/dde-dock Branch: refs/heads/master
@ -84,7 +84,7 @@ void AppItem::slotMousePress(QMouseEvent *event)
|
||||
{
|
||||
//qWarning() << "mouse press...";
|
||||
emit mousePress(event);
|
||||
hidePreview();
|
||||
hidePreview(0);
|
||||
}
|
||||
|
||||
void AppItem::slotMouseRelease(QMouseEvent *event)
|
||||
@ -299,7 +299,8 @@ void AppItem::initMenu()
|
||||
void AppItem::initPreview()
|
||||
{
|
||||
m_preview = new AppPreviews();
|
||||
connect(m_preview,&AppPreviews::sizeChanged,this,&AppItem::resizePreview);
|
||||
connect(m_preview,&AppPreviews::requestHide, [=]{hidePreview();});
|
||||
connect(m_preview,&AppPreviews::sizeChanged, this, &AppItem::resizePreview);
|
||||
connect(this, &AppItem::previewHidden, m_preview, &AppPreviews::clearUpPreview);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ void AppPreviewFrame::leaveEvent(QEvent *)
|
||||
void AppPreviewFrame::addCloseButton()
|
||||
{
|
||||
m_cb = new CloseButton(this);
|
||||
connect(m_cb,&CloseButton::clicked,[=](){close(this->xidValue);});
|
||||
connect(m_cb,&CloseButton::clicked,[=]{close(this->xidValue);});
|
||||
m_cb->resize(BUTTON_SIZE, BUTTON_SIZE);
|
||||
|
||||
m_cb->move(width() - m_cb->width()/* / 2*/,0/*- m_cb->width() / 2*/);
|
||||
@ -95,19 +95,10 @@ void AppPreviews::addItem(const QString &title, int xid)
|
||||
resize(contentWidth,f->height() + Dock::APP_PREVIEW_MARGIN*2);
|
||||
}
|
||||
|
||||
void AppPreviews::enterEvent(QEvent *)
|
||||
{
|
||||
emit mouseEntered();
|
||||
}
|
||||
|
||||
void AppPreviews::leaveEvent(QEvent *)
|
||||
{
|
||||
if (m_isClosing)
|
||||
{
|
||||
m_isClosing = false;
|
||||
return;
|
||||
}
|
||||
emit mouseExited();
|
||||
}
|
||||
|
||||
void AppPreviews::removePreview(int xid)
|
||||
@ -118,7 +109,7 @@ void AppPreviews::removePreview(int xid)
|
||||
m_clientManager->CloseWindow(xid);
|
||||
if (m_mainLayout->count() <= 0)
|
||||
{
|
||||
emit mouseExited();
|
||||
emit requestHide();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -51,12 +51,10 @@ public:
|
||||
void addItem(const QString &title,int xid);
|
||||
|
||||
protected:
|
||||
void enterEvent(QEvent *);
|
||||
void leaveEvent(QEvent *);
|
||||
|
||||
signals:
|
||||
void mouseEntered();
|
||||
void mouseExited();
|
||||
void requestHide();
|
||||
void sizeChanged();
|
||||
|
||||
public slots:
|
||||
|
@ -107,7 +107,11 @@ void PreviewArrowRectangle::hidePreview(int interval)
|
||||
cancelShow();
|
||||
if (m_delayHideTimer->isActive() || isHidden())
|
||||
return;
|
||||
m_delayHideTimer->start(interval);
|
||||
|
||||
if (interval <= 0)
|
||||
ArrowRectangle::hide();
|
||||
else
|
||||
m_delayHideTimer->start(interval);
|
||||
}
|
||||
|
||||
void PreviewArrowRectangle::cancelHide()
|
||||
|
@ -48,7 +48,7 @@ class PreviewArrowRectangle : public ArrowRectangle
|
||||
public:
|
||||
PreviewArrowRectangle(QWidget *parent = 0);
|
||||
|
||||
void showPreview(ArrowDirection direction, int x, int y, int interval = 200);
|
||||
void showPreview(ArrowDirection direction, int x, int y, int interval = 800);
|
||||
void hidePreview(int interval);
|
||||
void cancelHide();
|
||||
void cancelShow();
|
||||
|
Loading…
x
Reference in New Issue
Block a user