Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qshapedpixmapdndwindow.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | QShapedPixmapWindow::QShapedPixmapWindow(QScreen *screen) | - | ||||||
6 | : m_useCompositing(true) | - | ||||||
7 | { | - | ||||||
8 | setScreen(screen); | - | ||||||
9 | QSurfaceFormat format; | - | ||||||
10 | format.setAlphaBufferSize(8); | - | ||||||
11 | setFormat(format); | - | ||||||
12 | setFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint | - | ||||||
13 | | Qt::WindowTransparentForInput | Qt::WindowDoesNotAcceptFocus); | - | ||||||
14 | } never executed: end of block | 0 | ||||||
15 | - | |||||||
16 | QShapedPixmapWindow::~QShapedPixmapWindow() | - | ||||||
17 | { | - | ||||||
18 | } | - | ||||||
19 | - | |||||||
20 | void QShapedPixmapWindow::setPixmap(const QPixmap &pixmap) | - | ||||||
21 | { | - | ||||||
22 | m_pixmap = pixmap; | - | ||||||
23 | if (!m_useCompositing
| 0 | ||||||
24 | const QBitmap mask = m_pixmap.mask(); | - | ||||||
25 | if (!mask.isNull()
| 0 | ||||||
26 | if (!handle()
| 0 | ||||||
27 | create(); never executed: create(); | 0 | ||||||
28 | setMask(mask); | - | ||||||
29 | } never executed: end of block | 0 | ||||||
30 | } never executed: end of block | 0 | ||||||
31 | } never executed: end of block | 0 | ||||||
32 | - | |||||||
33 | void QShapedPixmapWindow::setHotspot(const QPoint &hotspot) | - | ||||||
34 | { | - | ||||||
35 | m_hotSpot = hotspot; | - | ||||||
36 | } never executed: end of block | 0 | ||||||
37 | - | |||||||
38 | void QShapedPixmapWindow::paintEvent(QPaintEvent *) | - | ||||||
39 | { | - | ||||||
40 | if (!m_pixmap.isNull()
| 0 | ||||||
41 | const QRect rect(QPoint(0, 0), size()); | - | ||||||
42 | QPainter painter(this); | - | ||||||
43 | if (m_useCompositing
| 0 | ||||||
44 | painter.setCompositionMode(QPainter::CompositionMode_Source); never executed: painter.setCompositionMode(QPainter::CompositionMode_Source); | 0 | ||||||
45 | else | - | ||||||
46 | painter.fillRect(rect, QGuiApplication::palette().base()); never executed: painter.fillRect(rect, QGuiApplication::palette().base()); | 0 | ||||||
47 | painter.drawPixmap(rect, m_pixmap); | - | ||||||
48 | } never executed: end of block | 0 | ||||||
49 | } never executed: end of block | 0 | ||||||
50 | - | |||||||
51 | void QShapedPixmapWindow::updateGeometry(const QPoint &pos) | - | ||||||
52 | { | - | ||||||
53 | QSize size(1, 1); | - | ||||||
54 | if (!m_pixmap.isNull()
| 0 | ||||||
55 | size = qFuzzyCompare(m_pixmap.devicePixelRatio(), qreal(1.0))
| 0 | ||||||
56 | ? m_pixmap.size() | - | ||||||
57 | : (QSizeF(m_pixmap.size()) / m_pixmap.devicePixelRatio()).toSize(); | - | ||||||
58 | } never executed: end of block | 0 | ||||||
59 | setGeometry(QRect(pos - m_hotSpot, size)); | - | ||||||
60 | } never executed: end of block | 0 | ||||||
61 | - | |||||||
62 | - | |||||||
Switch to Source code | Preprocessed file |