mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
preview: change border color
Change-Id: I98d4c6867f0b971e3a4d4d2b5e52dd75e21a7dd2
This commit is contained in:
parent
7f184d41af
commit
7c15931dff
Notes:
Deepin Code Review
2017-05-16 15:14:11 +08:00
Verified+1: Anonymous Coward #1000004 Code-Review+1: 石博文 <sbw@sbw.so> Verified+1: <yefei@linuxdeepin.com> Code-Review+2: kirigaya <kirigaya@mkacg.com> Submitted-by: kirigaya <kirigaya@mkacg.com> Submitted-at: Tue, 16 May 2017 15:14:08 +0800 Reviewed-on: https://cr.deepin.io/23091 Project: dde/dde-dock Branch: refs/heads/master
@ -147,9 +147,6 @@ void PreviewWidget::paintEvent(QPaintEvent *e)
|
|||||||
if (m_hovered)
|
if (m_hovered)
|
||||||
{
|
{
|
||||||
const QRect br = r.marginsAdded(QMargins(1, 1, 1, 1));
|
const QRect br = r.marginsAdded(QMargins(1, 1, 1, 1));
|
||||||
QPen p;
|
|
||||||
p.setBrush(Qt::white);
|
|
||||||
p.setWidth(4);
|
|
||||||
painter.setBrush(Qt::transparent);
|
painter.setBrush(Qt::transparent);
|
||||||
painter.setRenderHint(QPainter::Antialiasing);
|
painter.setRenderHint(QPainter::Antialiasing);
|
||||||
painter.drawRoundedRect(br, 3, 3);
|
painter.drawRoundedRect(br, 3, 3);
|
||||||
|
@ -20,13 +20,17 @@ DockPopupWindow::DockPopupWindow(QWidget *parent)
|
|||||||
m_acceptDelayTimer->setSingleShot(true);
|
m_acceptDelayTimer->setSingleShot(true);
|
||||||
m_acceptDelayTimer->setInterval(100);
|
m_acceptDelayTimer->setInterval(100);
|
||||||
|
|
||||||
|
m_wmHelper = DWindowManagerHelper::instance();
|
||||||
|
|
||||||
|
compositeChanged();
|
||||||
|
|
||||||
setBackgroundColor(DBlurEffectWidget::DarkColor);
|
setBackgroundColor(DBlurEffectWidget::DarkColor);
|
||||||
setBorderColor(QColor(255, 255, 255, 255 * 0.05));
|
|
||||||
setWindowFlags(Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint);
|
setWindowFlags(Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint);
|
||||||
setAttribute(Qt::WA_InputMethodEnabled, false);
|
setAttribute(Qt::WA_InputMethodEnabled, false);
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
|
|
||||||
connect(m_acceptDelayTimer, &QTimer::timeout, this, &DockPopupWindow::accept);
|
connect(m_acceptDelayTimer, &QTimer::timeout, this, &DockPopupWindow::accept);
|
||||||
|
connect(m_wmHelper, &DWindowManagerHelper::hasCompositeChanged, this, &DockPopupWindow::compositeChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
DockPopupWindow::~DockPopupWindow()
|
DockPopupWindow::~DockPopupWindow()
|
||||||
@ -170,3 +174,11 @@ void DockPopupWindow::unRegisterMouseEvent()
|
|||||||
m_mouseInter->UnregisterArea(m_mouseAreaKey);
|
m_mouseInter->UnregisterArea(m_mouseAreaKey);
|
||||||
m_mouseAreaKey.clear();
|
m_mouseAreaKey.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DockPopupWindow::compositeChanged()
|
||||||
|
{
|
||||||
|
if (m_wmHelper->hasComposite())
|
||||||
|
setBorderColor(QColor(255, 255, 255, 255 * 0.05));
|
||||||
|
else
|
||||||
|
setBorderColor(QColor("#2C3238"));
|
||||||
|
}
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
#include "dbus/dbusdisplay.h"
|
#include "dbus/dbusdisplay.h"
|
||||||
|
|
||||||
#include <darrowrectangle.h>
|
#include <darrowrectangle.h>
|
||||||
|
#include <DWindowManagerHelper>
|
||||||
|
|
||||||
|
DWIDGET_USE_NAMESPACE
|
||||||
|
|
||||||
class DockPopupWindow : public Dtk::Widget::DArrowRectangle
|
class DockPopupWindow : public Dtk::Widget::DArrowRectangle
|
||||||
{
|
{
|
||||||
@ -36,6 +39,7 @@ private slots:
|
|||||||
void globalMouseRelease(int button, int x, int y, const QString &id);
|
void globalMouseRelease(int button, int x, int y, const QString &id);
|
||||||
void registerMouseEvent();
|
void registerMouseEvent();
|
||||||
void unRegisterMouseEvent();
|
void unRegisterMouseEvent();
|
||||||
|
void compositeChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_model;
|
bool m_model;
|
||||||
@ -46,6 +50,7 @@ private:
|
|||||||
|
|
||||||
DBusXMouseArea *m_mouseInter;
|
DBusXMouseArea *m_mouseInter;
|
||||||
DBusDisplay *m_displayInter;
|
DBusDisplay *m_displayInter;
|
||||||
|
DWindowManagerHelper *m_wmHelper;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DOCKPOPUPWINDOW_H
|
#endif // DOCKPOPUPWINDOW_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user