itemviews/qcolumnviewgrip.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3QColumnViewGrip::QColumnViewGrip(QWidget *parent) -
4: QWidget(*new QColumnViewGripPrivate, parent, 0) -
5{ -
6 -
7 setCursor(Qt::SplitHCursor); -
8 -
9}
never executed: }
0
10 -
11 -
12 -
13 -
14QColumnViewGrip::QColumnViewGrip(QColumnViewGripPrivate & dd, QWidget *parent, Qt::WindowFlags f) -
15: QWidget(dd, parent, f) -
16{ -
17}
never executed: }
0
18 -
19 -
20 -
21 -
22QColumnViewGrip::~QColumnViewGrip() -
23{ -
24} -
25 -
26 -
27 -
28 -
29 -
30int QColumnViewGrip::moveGrip(int offset) -
31{ -
32 QWidget *parentWidget = (QWidget*)parent(); -
33 -
34 -
35 int oldWidth = parentWidget->width(); -
36 int newWidth = oldWidth; -
37 if (isRightToLeft())
never evaluated: 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)
never evaluated: realOffset != 0
0
48 gripMoved(realOffset);
never executed: gripMoved(realOffset);
0
49 if (isRightToLeft())
never evaluated: isRightToLeft()
0
50 realOffset = -1 * (oldX - parentWidget->x());
never executed: realOffset = -1 * (oldX - parentWidget->x());
0
51 return realOffset;
never executed: return realOffset;
0
52} -
53 -
54 -
55 -
56 -
57void 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: }
0
65 -
66 -
67 -
68 -
69 -
70void QColumnViewGrip::mouseDoubleClickEvent(QMouseEvent *event) -
71{ -
72 (void)event;; -
73 QWidget *parentWidget = (QWidget*)parent(); -
74 int offset = parentWidget->sizeHint().width() - parentWidget->width(); -
75 if (isRightToLeft())
never evaluated: isRightToLeft()
0
76 offset *= -1;
never executed: offset *= -1;
0
77 moveGrip(offset); -
78 event->accept(); -
79}
never executed: }
0
80 -
81 -
82 -
83 -
84 -
85void QColumnViewGrip::mousePressEvent(QMouseEvent *event) -
86{ -
87 QColumnViewGripPrivate * const d = d_func(); -
88 d->originalXLocation = event->globalX(); -
89 event->accept(); -
90}
never executed: }
0
91 -
92 -
93 -
94 -
95 -
96void 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: }
0
103 -
104 -
105 -
106 -
107 -
108void QColumnViewGrip::mouseReleaseEvent(QMouseEvent *event) -
109{ -
110 QColumnViewGripPrivate * const d = d_func(); -
111 d->originalXLocation = -1; -
112 event->accept(); -
113}
never executed: }
0
114 -
115 -
116 -
117 -
118QColumnViewGripPrivate::QColumnViewGripPrivate() -
119: QWidgetPrivate(), -
120originalXLocation(-1) -
121{ -
122}
never executed: }
0
123 -
124 -
125 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial