石博文 327984199c optimize item paint
Change-Id: Iad05a1967417cf6a3dc4f2ab47e8de0f0d1d5e50
2016-08-19 10:19:38 +08:00

44 lines
871 B
C++

#ifndef TRAYWIDGET_H
#define TRAYWIDGET_H
#include <QWidget>
#include <QTimer>
class TrayWidget : public QWidget
{
Q_OBJECT
public:
explicit TrayWidget(quint32 winId, QWidget *parent = 0);
~TrayWidget();
const QImage trayImage() const;
void sendClick(uint8_t mouseButton, int x, int y);
private:
QSize sizeHint() const;
void showEvent(QShowEvent *e);
void hideEvent(QHideEvent *e);
void paintEvent(QPaintEvent *e);
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void wrapWindow();
void updateIcon();
// void hideIcon();
QImage getImageNonComposite() const;
private slots:
void setX11PassMouseEvent(const bool pass);
private:
WId m_windowId;
WId m_containerWid;
QImage m_image;
QTimer *m_updateTimer;
QPoint m_pressPoint;
};
#endif // TRAYWIDGET_H