| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/itemviews/qcolumnviewgrip.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | QColumnViewGrip::QColumnViewGrip(QWidget *parent) | - | ||||||
| 4 | : QWidget(*new QColumnViewGripPrivate, parent, 0) | - | ||||||
| 5 | { | - | ||||||
| 6 | - | |||||||
| 7 | setCursor(Qt::SplitHCursor); | - | ||||||
| 8 | - | |||||||
| 9 | } never executed: end of block | 0 | ||||||
| 10 | - | |||||||
| 11 | - | |||||||
| 12 | - | |||||||
| 13 | - | |||||||
| 14 | QColumnViewGrip::QColumnViewGrip(QColumnViewGripPrivate & dd, QWidget *parent, Qt::WindowFlags f) | - | ||||||
| 15 | : QWidget(dd, parent, f) | - | ||||||
| 16 | { | - | ||||||
| 17 | } never executed: end of block | 0 | ||||||
| 18 | - | |||||||
| 19 | - | |||||||
| 20 | - | |||||||
| 21 | - | |||||||
| 22 | QColumnViewGrip::~QColumnViewGrip() | - | ||||||
| 23 | { | - | ||||||
| 24 | } | - | ||||||
| 25 | - | |||||||
| 26 | - | |||||||
| 27 | - | |||||||
| 28 | - | |||||||
| 29 | - | |||||||
| 30 | int QColumnViewGrip::moveGrip(int offset) | - | ||||||
| 31 | { | - | ||||||
| 32 | QWidget *parentWidget = (QWidget*)parent(); | - | ||||||
| 33 | - | |||||||
| 34 | - | |||||||
| 35 | int oldWidth = parentWidget->width(); | - | ||||||
| 36 | int newWidth = oldWidth; | - | ||||||
| 37 | if (isRightToLeft()
| 0 | ||||||
| 38 | newWidth -= offset; never executed: newWidth -= offset; | 0 | ||||||
| 39 | else | - | ||||||
| 40 | newWidth += offset; never executed: newWidth += offset; | 0 | ||||||
| 41 | newWidth = qMax(parentWidget->minimumWidth(), newWidth); | - | ||||||
| 42 | parentWidget->resize(newWidth, parentWidget->height()); | - | ||||||
| 43 | - | |||||||
| 44 | - | |||||||
| 45 | int realOffset = parentWidget->width() - oldWidth; | - | ||||||
| 46 | int oldX = parentWidget->x(); | - | ||||||
| 47 | if (realOffset != 0
| 0 | ||||||
| 48 | gripMoved(realOffset); never executed: gripMoved(realOffset); | 0 | ||||||
| 49 | if (isRightToLeft()
| 0 | ||||||
| 50 | realOffset = -1 * (oldX - parentWidget->x()); never executed: realOffset = -1 * (oldX - parentWidget->x()); | 0 | ||||||
| 51 | return never executed: realOffset;return realOffset;never executed: return realOffset; | 0 | ||||||
| 52 | } | - | ||||||
| 53 | - | |||||||
| 54 | - | |||||||
| 55 | - | |||||||
| 56 | - | |||||||
| 57 | void QColumnViewGrip::paintEvent(QPaintEvent *event) | - | ||||||
| 58 | { | - | ||||||
| 59 | QPainter painter(this); | - | ||||||
| 60 | QStyleOption opt; | - | ||||||
| 61 | opt.initFrom(this); | - | ||||||
| 62 | style()->drawControl(QStyle::CE_ColumnViewGrip, &opt, &painter, this); | - | ||||||
| 63 | event->accept(); | - | ||||||
| 64 | } never executed: end of block | 0 | ||||||
| 65 | - | |||||||
| 66 | - | |||||||
| 67 | - | |||||||
| 68 | - | |||||||
| 69 | - | |||||||
| 70 | void QColumnViewGrip::mouseDoubleClickEvent(QMouseEvent *event) | - | ||||||
| 71 | { | - | ||||||
| 72 | (void)event;; | - | ||||||
| 73 | QWidget *parentWidget = (QWidget*)parent(); | - | ||||||
| 74 | int offset = parentWidget->sizeHint().width() - parentWidget->width(); | - | ||||||
| 75 | if (isRightToLeft()
| 0 | ||||||
| 76 | offset *= -1; never executed: offset *= -1; | 0 | ||||||
| 77 | moveGrip(offset); | - | ||||||
| 78 | event->accept(); | - | ||||||
| 79 | } never executed: end of block | 0 | ||||||
| 80 | - | |||||||
| 81 | - | |||||||
| 82 | - | |||||||
| 83 | - | |||||||
| 84 | - | |||||||
| 85 | void QColumnViewGrip::mousePressEvent(QMouseEvent *event) | - | ||||||
| 86 | { | - | ||||||
| 87 | QColumnViewGripPrivate * const d = d_func(); | - | ||||||
| 88 | d->originalXLocation = event->globalX(); | - | ||||||
| 89 | event->accept(); | - | ||||||
| 90 | } never executed: end of block | 0 | ||||||
| 91 | - | |||||||
| 92 | - | |||||||
| 93 | - | |||||||
| 94 | - | |||||||
| 95 | - | |||||||
| 96 | void QColumnViewGrip::mouseMoveEvent(QMouseEvent *event) | - | ||||||
| 97 | { | - | ||||||
| 98 | QColumnViewGripPrivate * const d = d_func(); | - | ||||||
| 99 | int offset = event->globalX() - d->originalXLocation; | - | ||||||
| 100 | d->originalXLocation = moveGrip(offset) + d->originalXLocation; | - | ||||||
| 101 | event->accept(); | - | ||||||
| 102 | } never executed: end of block | 0 | ||||||
| 103 | - | |||||||
| 104 | - | |||||||
| 105 | - | |||||||
| 106 | - | |||||||
| 107 | - | |||||||
| 108 | void QColumnViewGrip::mouseReleaseEvent(QMouseEvent *event) | - | ||||||
| 109 | { | - | ||||||
| 110 | QColumnViewGripPrivate * const d = d_func(); | - | ||||||
| 111 | d->originalXLocation = -1; | - | ||||||
| 112 | event->accept(); | - | ||||||
| 113 | } never executed: end of block | 0 | ||||||
| 114 | - | |||||||
| 115 | - | |||||||
| 116 | - | |||||||
| 117 | - | |||||||
| 118 | QColumnViewGripPrivate::QColumnViewGripPrivate() | - | ||||||
| 119 | : QWidgetPrivate(), | - | ||||||
| 120 | originalXLocation(-1) | - | ||||||
| 121 | { | - | ||||||
| 122 | } never executed: end of block | 0 | ||||||
| 123 | - | |||||||
| 124 | - | |||||||
| 125 | - | |||||||
| Switch to Source code | Preprocessed file |