| 28 | namespace pv { |
| 29 | |
| 30 | WinShadow::WinShadow(HWND hwnd, QWidget *parent) |
| 31 | : QWidget(parent) |
| 32 | { |
| 33 | |
| 34 | m_hwnd = HWND(hwnd); |
| 35 | m_parent = parent; |
| 36 | m_scale = 1; |
| 37 | m_bActived = false; |
| 38 | m_callback = NULL; |
| 39 | |
| 40 | setWindowFlags(Qt::Window | Qt::FramelessWindowHint | |
| 41 | (!m_parent ? Qt::Tool : Qt::WindowFlags(0))); |
| 42 | |
| 43 | setAttribute(Qt::WA_NoSystemBackground); |
| 44 | setAttribute(Qt::WA_TranslucentBackground); |
| 45 | |
| 46 | m_timer = new QTimer(this); |
| 47 | m_timer->setInterval(100); |
| 48 | m_timer->setSingleShot(true); |
| 49 | |
| 50 | m_checkTimer = new QTimer(this); |
| 51 | m_checkTimer->setInterval(300); |
| 52 | m_checkTimer->start(); |
| 53 | |
| 54 | connect(m_timer, &QTimer::timeout, this, &WinShadow::showShadow); |
| 55 | connect(this, &WinShadow::showSignal, this, &WinShadow::onMoveSelf); |
| 56 | connect(m_checkTimer, &QTimer::timeout, this, &WinShadow::onCheckForeWindow); |
| 57 | } |
| 58 | |
| 59 | void WinShadow::onMoveSelf() |
| 60 | { |