| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qrubberband.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | - | |||||||
| 6 | - | |||||||
| 7 | - | |||||||
| 8 | - | |||||||
| 9 | - | |||||||
| 10 | - | |||||||
| 11 | - | |||||||
| 12 | - | |||||||
| 13 | - | |||||||
| 14 | - | |||||||
| 15 | - | |||||||
| 16 | class QRubberBandPrivate : public QWidgetPrivate | - | ||||||
| 17 | { | - | ||||||
| 18 | inline QRubberBand* q_func() { return static_cast<QRubberBand *>(q_ptr); } inline const QRubberBand* q_func() const { return static_cast<const QRubberBand *>(q_ptr); } friend class QRubberBand; | - | ||||||
| 19 | public: | - | ||||||
| 20 | QRect rect; | - | ||||||
| 21 | QRubberBand::Shape shape; | - | ||||||
| 22 | QRegion clipping; | - | ||||||
| 23 | void updateMask(); | - | ||||||
| 24 | }; | - | ||||||
| 25 | void QRubberBand::initStyleOption(QStyleOptionRubberBand *option) const | - | ||||||
| 26 | { | - | ||||||
| 27 | if (!option
| 0 | ||||||
| 28 | return; never executed: return; | 0 | ||||||
| 29 | option->initFrom(this); | - | ||||||
| 30 | option->shape = d_func()->shape; | - | ||||||
| 31 | - | |||||||
| 32 | option->opaque = true; | - | ||||||
| 33 | - | |||||||
| 34 | - | |||||||
| 35 | - | |||||||
| 36 | } never executed: end of block | 0 | ||||||
| 37 | QRubberBand::QRubberBand(Shape s, QWidget *p) | - | ||||||
| 38 | : QWidget(*new QRubberBandPrivate, p, (p && p->windowType() != Qt::Desktop) ? Qt::Widget : Qt::ToolTip) | - | ||||||
| 39 | { | - | ||||||
| 40 | QRubberBandPrivate * const d = d_func(); | - | ||||||
| 41 | d->shape = s; | - | ||||||
| 42 | setAttribute(Qt::WA_TransparentForMouseEvents); | - | ||||||
| 43 | - | |||||||
| 44 | setAttribute(Qt::WA_NoSystemBackground); | - | ||||||
| 45 | - | |||||||
| 46 | setAttribute(Qt::WA_WState_ExplicitShowHide); | - | ||||||
| 47 | setVisible(false); | - | ||||||
| 48 | - | |||||||
| 49 | - | |||||||
| 50 | - | |||||||
| 51 | - | |||||||
| 52 | - | |||||||
| 53 | - | |||||||
| 54 | - | |||||||
| 55 | } never executed: end of block | 0 | ||||||
| 56 | - | |||||||
| 57 | - | |||||||
| 58 | - | |||||||
| 59 | - | |||||||
| 60 | QRubberBand::~QRubberBand() | - | ||||||
| 61 | { | - | ||||||
| 62 | } | - | ||||||
| 63 | QRubberBand::Shape QRubberBand::shape() const | - | ||||||
| 64 | { | - | ||||||
| 65 | const QRubberBandPrivate * const d = d_func(); | - | ||||||
| 66 | return never executed: d->shape;return d->shape;never executed: return d->shape; | 0 | ||||||
| 67 | } | - | ||||||
| 68 | - | |||||||
| 69 | - | |||||||
| 70 | - | |||||||
| 71 | - | |||||||
| 72 | void QRubberBandPrivate::updateMask() | - | ||||||
| 73 | { | - | ||||||
| 74 | QRubberBand * const q = q_func(); | - | ||||||
| 75 | QStyleHintReturnMask mask; | - | ||||||
| 76 | QStyleOptionRubberBand opt; | - | ||||||
| 77 | q->initStyleOption(&opt); | - | ||||||
| 78 | if (q->style()->styleHint(QStyle::SH_RubberBand_Mask, &opt, q, &mask)
| 0 | ||||||
| 79 | q->setMask(mask.region); | - | ||||||
| 80 | } never executed: else {end of block | 0 | ||||||
| 81 | q->clearMask(); | - | ||||||
| 82 | } never executed: end of block | 0 | ||||||
| 83 | } | - | ||||||
| 84 | - | |||||||
| 85 | - | |||||||
| 86 | - | |||||||
| 87 | - | |||||||
| 88 | void QRubberBand::paintEvent(QPaintEvent *) | - | ||||||
| 89 | { | - | ||||||
| 90 | QStylePainter painter(this); | - | ||||||
| 91 | QStyleOptionRubberBand option; | - | ||||||
| 92 | initStyleOption(&option); | - | ||||||
| 93 | painter.drawControl(QStyle::CE_RubberBand, option); | - | ||||||
| 94 | } never executed: end of block | 0 | ||||||
| 95 | - | |||||||
| 96 | - | |||||||
| 97 | - | |||||||
| 98 | - | |||||||
| 99 | void QRubberBand::changeEvent(QEvent *e) | - | ||||||
| 100 | { | - | ||||||
| 101 | QWidget::changeEvent(e); | - | ||||||
| 102 | switch (e->type()) { | - | ||||||
| 103 | case never executed: QEvent::ParentChange:case QEvent::ParentChange:never executed: case QEvent::ParentChange: | 0 | ||||||
| 104 | if (parent()
| 0 | ||||||
| 105 | setWindowFlags(windowFlags() & ~Qt::ToolTip); | - | ||||||
| 106 | } never executed: else {end of block | 0 | ||||||
| 107 | setWindowFlags(windowFlags() | Qt::ToolTip); | - | ||||||
| 108 | } never executed: end of block | 0 | ||||||
| 109 | break; never executed: break; | 0 | ||||||
| 110 | default never executed: :default:never executed: default: | 0 | ||||||
| 111 | break; never executed: break; | 0 | ||||||
| 112 | } | - | ||||||
| 113 | - | |||||||
| 114 | if (e->type() == QEvent::ZOrderChange
| 0 | ||||||
| 115 | raise(); never executed: raise(); | 0 | ||||||
| 116 | } never executed: end of block | 0 | ||||||
| 117 | - | |||||||
| 118 | - | |||||||
| 119 | - | |||||||
| 120 | - | |||||||
| 121 | void QRubberBand::showEvent(QShowEvent *e) | - | ||||||
| 122 | { | - | ||||||
| 123 | raise(); | - | ||||||
| 124 | e->ignore(); | - | ||||||
| 125 | } never executed: end of block | 0 | ||||||
| 126 | - | |||||||
| 127 | - | |||||||
| 128 | - | |||||||
| 129 | - | |||||||
| 130 | void QRubberBand::resizeEvent(QResizeEvent *) | - | ||||||
| 131 | { | - | ||||||
| 132 | QRubberBandPrivate * const d = d_func(); | - | ||||||
| 133 | d->updateMask(); | - | ||||||
| 134 | } never executed: end of block | 0 | ||||||
| 135 | - | |||||||
| 136 | - | |||||||
| 137 | - | |||||||
| 138 | - | |||||||
| 139 | void QRubberBand::moveEvent(QMoveEvent *) | - | ||||||
| 140 | { | - | ||||||
| 141 | QRubberBandPrivate * const d = d_func(); | - | ||||||
| 142 | d->updateMask(); | - | ||||||
| 143 | } never executed: end of block | 0 | ||||||
| 144 | void QRubberBand::setGeometry(const QRect &geom) | - | ||||||
| 145 | { | - | ||||||
| 146 | QWidget::setGeometry(geom); | - | ||||||
| 147 | } never executed: end of block | 0 | ||||||
| 148 | bool QRubberBand::event(QEvent *e) | - | ||||||
| 149 | { | - | ||||||
| 150 | return never executed: QWidget::event(e);return QWidget::event(e);never executed: return QWidget::event(e); | 0 | ||||||
| 151 | } | - | ||||||
| 152 | - | |||||||
| 153 | - | |||||||
| 154 | - | |||||||
| Switch to Source code | Preprocessed file |