Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | extern QString qt_setWindowTitle_helperHelper(const QString&, const QWidget*); | - |
14 | | - |
15 | | - |
16 | extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window); | - |
17 | | - |
18 | static inline bool hasFeature(const QDockWidgetPrivate *priv, QDockWidget::DockWidgetFeature feature) | - |
19 | { return (priv->features & feature) == feature; } executed: return (priv->features & feature) == feature; Execution Count:162 | 162 |
20 | | - |
21 | static inline bool hasFeature(const QDockWidget *dockwidget, QDockWidget::DockWidgetFeature feature) | - |
22 | { return (dockwidget->features() & feature) == feature; } executed: return (dockwidget->features() & feature) == feature; Execution Count:2007 | 2007 |
23 | class QDockWidgetTitleButton : public QAbstractButton | - |
24 | { | - |
25 | public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); struct QPrivateSignal {}; | - |
26 | | - |
27 | public: | - |
28 | QDockWidgetTitleButton(QDockWidget *dockWidget); | - |
29 | | - |
30 | QSize sizeHint() const; | - |
31 | inline QSize minimumSizeHint() const | - |
32 | { return sizeHint(); } executed: return sizeHint(); Execution Count:64 | 64 |
33 | | - |
34 | void enterEvent(QEvent *event); | - |
35 | void leaveEvent(QEvent *event); | - |
36 | void paintEvent(QPaintEvent *event); | - |
37 | }; | - |
38 | | - |
39 | | - |
40 | QDockWidgetTitleButton::QDockWidgetTitleButton(QDockWidget *dockWidget) | - |
41 | : QAbstractButton(dockWidget) | - |
42 | { | - |
43 | setFocusPolicy(Qt::NoFocus); | - |
44 | } executed: } Execution Count:54 | 54 |
45 | | - |
46 | QSize QDockWidgetTitleButton::sizeHint() const | - |
47 | { | - |
48 | ensurePolished(); | - |
49 | | - |
50 | int size = 2*style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, 0, this); | - |
51 | if (!icon().isNull()) { partially evaluated: !icon().isNull() yes Evaluation Count:4646 | no Evaluation Count:0 |
| 0-4646 |
52 | int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this); | - |
53 | QSize sz = icon().actualSize(QSize(iconSize, iconSize)); | - |
54 | size += qMax(sz.width(), sz.height()); | - |
55 | } executed: } Execution Count:4646 | 4646 |
56 | | - |
57 | return QSize(size, size); executed: return QSize(size, size); Execution Count:4646 | 4646 |
58 | } | - |
59 | | - |
60 | void QDockWidgetTitleButton::enterEvent(QEvent *event) | - |
61 | { | - |
62 | if (isEnabled()) update(); never evaluated: isEnabled() never executed: update(); | 0 |
63 | QAbstractButton::enterEvent(event); | - |
64 | } | 0 |
65 | | - |
66 | void QDockWidgetTitleButton::leaveEvent(QEvent *event) | - |
67 | { | - |
68 | if (isEnabled()) update(); never evaluated: isEnabled() never executed: update(); | 0 |
69 | QAbstractButton::leaveEvent(event); | - |
70 | } | 0 |
71 | | - |
72 | void QDockWidgetTitleButton::paintEvent(QPaintEvent *) | - |
73 | { | - |
74 | QPainter p(this); | - |
75 | | - |
76 | QStyleOptionToolButton opt; | - |
77 | opt.init(this); | - |
78 | opt.state |= QStyle::State_AutoRaise; | - |
79 | | - |
80 | if (style()->styleHint(QStyle::SH_DockWidget_ButtonsHaveFrame, 0, this)) partially evaluated: style()->styleHint(QStyle::SH_DockWidget_ButtonsHaveFrame, 0, this) yes Evaluation Count:58 | no Evaluation Count:0 |
| 0-58 |
81 | { | - |
82 | if (isEnabled() && underMouse() && !isChecked() && !isDown()) partially evaluated: isEnabled() yes Evaluation Count:58 | no Evaluation Count:0 |
partially evaluated: underMouse() no Evaluation Count:0 | yes Evaluation Count:58 |
never evaluated: !isChecked() never evaluated: !isDown() | 0-58 |
83 | opt.state |= QStyle::State_Raised; never executed: opt.state |= QStyle::State_Raised; | 0 |
84 | if (isChecked()) partially evaluated: isChecked() no Evaluation Count:0 | yes Evaluation Count:58 |
| 0-58 |
85 | opt.state |= QStyle::State_On; never executed: opt.state |= QStyle::State_On; | 0 |
86 | if (isDown()) partially evaluated: isDown() no Evaluation Count:0 | yes Evaluation Count:58 |
| 0-58 |
87 | opt.state |= QStyle::State_Sunken; never executed: opt.state |= QStyle::State_Sunken; | 0 |
88 | style()->drawPrimitive(QStyle::PE_PanelButtonTool, &opt, &p, this); | - |
89 | } executed: } Execution Count:58 | 58 |
90 | | - |
91 | opt.icon = icon(); | - |
92 | opt.subControls = 0; | - |
93 | opt.activeSubControls = 0; | - |
94 | opt.features = QStyleOptionToolButton::None; | - |
95 | opt.arrowType = Qt::NoArrow; | - |
96 | int size = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this); | - |
97 | opt.iconSize = QSize(size, size); | - |
98 | style()->drawComplexControl(QStyle::CC_ToolButton, &opt, &p, this); | - |
99 | } executed: } Execution Count:58 | 58 |
100 | | - |
101 | | - |
102 | | - |
103 | | - |
104 | | - |
105 | QDockWidgetLayout::QDockWidgetLayout(QWidget *parent) | - |
106 | : QLayout(parent), verticalTitleBar(false), item_list(RoleCount, 0) | - |
107 | { | - |
108 | } executed: } Execution Count:27 | 27 |
109 | | - |
110 | QDockWidgetLayout::~QDockWidgetLayout() | - |
111 | { | - |
112 | qDeleteAll(item_list); | - |
113 | } executed: } Execution Count:27 | 27 |
114 | | - |
115 | bool QDockWidgetLayout::nativeWindowDeco() const | - |
116 | { | - |
117 | return nativeWindowDeco(parentWidget()->isWindow()); executed: return nativeWindowDeco(parentWidget()->isWindow()); Execution Count:193 | 193 |
118 | } | - |
119 | | - |
120 | static bool isXcb() | - |
121 | { | - |
122 | static const bool xcb = !QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive); | - |
123 | return xcb; executed: return xcb; Execution Count:984 | 984 |
124 | } | - |
125 | | - |
126 | bool QDockWidgetLayout::nativeWindowDeco(bool floating) const | - |
127 | { | - |
128 | | - |
129 | | - |
130 | | - |
131 | return !isXcb() && (floating && item_list[QDockWidgetLayout::TitleBar] == 0); executed: return !isXcb() && (floating && item_list[QDockWidgetLayout::TitleBar] == 0); Execution Count:984 | 984 |
132 | | - |
133 | } | - |
134 | | - |
135 | | - |
136 | void QDockWidgetLayout::addItem(QLayoutItem*) | - |
137 | { | - |
138 | QMessageLogger("widgets/qdockwidget.cpp", 228, __PRETTY_FUNCTION__).warning() << "QDockWidgetLayout::addItem(): please use QDockWidgetLayout::setWidget()"; | - |
139 | return; | 0 |
140 | } | - |
141 | | - |
142 | QLayoutItem *QDockWidgetLayout::itemAt(int index) const | - |
143 | { | - |
144 | int cnt = 0; | - |
145 | for (int i = 0; i < item_list.count(); ++i) { evaluated: i < item_list.count() yes Evaluation Count:555 | yes Evaluation Count:56 |
| 56-555 |
146 | QLayoutItem *item = item_list.at(i); | - |
147 | if (item == 0) evaluated: item == 0 yes Evaluation Count:181 | yes Evaluation Count:374 |
| 181-374 |
148 | continue; executed: continue; Execution Count:181 | 181 |
149 | if (index == cnt++) evaluated: index == cnt++ yes Evaluation Count:145 | yes Evaluation Count:229 |
| 145-229 |
150 | return item; executed: return item; Execution Count:145 | 145 |
151 | } executed: } Execution Count:229 | 229 |
152 | return 0; executed: return 0; Execution Count:56 | 56 |
153 | } | - |
154 | | - |
155 | QLayoutItem *QDockWidgetLayout::takeAt(int index) | - |
156 | { | - |
157 | int j = 0; | - |
158 | for (int i = 0; i < item_list.count(); ++i) { partially evaluated: i < item_list.count() yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
159 | QLayoutItem *item = item_list.at(i); | - |
160 | if (item == 0) evaluated: item == 0 yes Evaluation Count:2 | yes Evaluation Count:18 |
| 2-18 |
161 | continue; executed: continue; Execution Count:2 | 2 |
162 | if (index == j) { evaluated: index == j yes Evaluation Count:14 | yes Evaluation Count:4 |
| 4-14 |
163 | item_list[i] = 0; | - |
164 | invalidate(); | - |
165 | return item; executed: return item; Execution Count:14 | 14 |
166 | } | - |
167 | ++j; | - |
168 | } executed: } Execution Count:4 | 4 |
169 | return 0; never executed: return 0; | 0 |
170 | } | - |
171 | | - |
172 | int QDockWidgetLayout::count() const | - |
173 | { | - |
174 | int result = 0; | - |
175 | for (int i = 0; i < item_list.count(); ++i) { never evaluated: i < item_list.count() | 0 |
176 | if (item_list.at(i)) never evaluated: item_list.at(i) | 0 |
177 | ++result; never executed: ++result; | 0 |
178 | } | 0 |
179 | return result; never executed: return result; | 0 |
180 | } | - |
181 | | - |
182 | QSize QDockWidgetLayout::sizeFromContent(const QSize &content, bool floating) const | - |
183 | { | - |
184 | QSize result = content; | - |
185 | | - |
186 | if (verticalTitleBar) { partially evaluated: verticalTitleBar no Evaluation Count:0 | yes Evaluation Count:735 |
| 0-735 |
187 | result.setHeight(qMax(result.height(), minimumTitleWidth())); | - |
188 | result.setWidth(qMax(content.width(), 0)); | - |
189 | } else { | 0 |
190 | result.setHeight(qMax(result.height(), 0)); | - |
191 | result.setWidth(qMax(content.width(), minimumTitleWidth())); | - |
192 | } executed: } Execution Count:735 | 735 |
193 | | - |
194 | QDockWidget *w = qobject_cast<QDockWidget*>(parentWidget()); | - |
195 | const bool nativeDeco = nativeWindowDeco(floating); | - |
196 | | - |
197 | int fw = floating && !nativeDeco evaluated: floating yes Evaluation Count:38 | yes Evaluation Count:697 |
partially evaluated: !nativeDeco yes Evaluation Count:38 | no Evaluation Count:0 |
| 0-697 |
198 | ? w->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, w) | - |
199 | : 0; | - |
200 | | - |
201 | const int th = titleHeight(); | - |
202 | if (!nativeDeco) { partially evaluated: !nativeDeco yes Evaluation Count:735 | no Evaluation Count:0 |
| 0-735 |
203 | if (verticalTitleBar) partially evaluated: verticalTitleBar no Evaluation Count:0 | yes Evaluation Count:735 |
| 0-735 |
204 | result += QSize(th + 2*fw, 2*fw); never executed: result += QSize(th + 2*fw, 2*fw); | 0 |
205 | else | - |
206 | result += QSize(2*fw, th + 2*fw); executed: result += QSize(2*fw, th + 2*fw); Execution Count:735 | 735 |
207 | } | - |
208 | | - |
209 | result.setHeight(qMin(result.height(), (int) ((1<<24)-1))); | - |
210 | result.setWidth(qMin(result.width(), (int) ((1<<24)-1))); | - |
211 | | - |
212 | if (content.width() < 0) evaluated: content.width() < 0 yes Evaluation Count:56 | yes Evaluation Count:679 |
| 56-679 |
213 | result.setWidth(-1); executed: result.setWidth(-1); Execution Count:56 | 56 |
214 | if (content.height() < 0) evaluated: content.height() < 0 yes Evaluation Count:56 | yes Evaluation Count:679 |
| 56-679 |
215 | result.setHeight(-1); executed: result.setHeight(-1); Execution Count:56 | 56 |
216 | | - |
217 | int left, top, right, bottom; | - |
218 | w->getContentsMargins(&left, &top, &right, &bottom); | - |
219 | | - |
220 | QSize min = w->minimumSize() - QSize(left + right, top + bottom); | - |
221 | QSize max = w->maximumSize() - QSize(left + right, top + bottom); | - |
222 | | - |
223 | | - |
224 | | - |
225 | | - |
226 | | - |
227 | | - |
228 | | - |
229 | uint explicitMin = 0; | - |
230 | uint explicitMax = 0; | - |
231 | if (w->d_func()->extra != 0) { evaluated: w->d_func()->extra != 0 yes Evaluation Count:522 | yes Evaluation Count:213 |
| 213-522 |
232 | explicitMin = w->d_func()->extra->explicitMinSize; | - |
233 | explicitMax = w->d_func()->extra->explicitMaxSize; | - |
234 | } executed: } Execution Count:522 | 522 |
235 | | - |
236 | if (!(explicitMin & Qt::Horizontal) || min.width() == 0) evaluated: !(explicitMin & Qt::Horizontal) yes Evaluation Count:719 | yes Evaluation Count:16 |
partially evaluated: min.width() == 0 no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-719 |
237 | min.setWidth(-1); executed: min.setWidth(-1); Execution Count:719 | 719 |
238 | if (!(explicitMin & Qt::Vertical) || min.height() == 0) evaluated: !(explicitMin & Qt::Vertical) yes Evaluation Count:719 | yes Evaluation Count:16 |
partially evaluated: min.height() == 0 no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-719 |
239 | min.setHeight(-1); executed: min.setHeight(-1); Execution Count:719 | 719 |
240 | | - |
241 | if (!(explicitMax & Qt::Horizontal)) partially evaluated: !(explicitMax & Qt::Horizontal) yes Evaluation Count:735 | no Evaluation Count:0 |
| 0-735 |
242 | max.setWidth(((1<<24)-1)); executed: max.setWidth(((1<<24)-1)); Execution Count:735 | 735 |
243 | if (!(explicitMax & Qt::Vertical)) partially evaluated: !(explicitMax & Qt::Vertical) yes Evaluation Count:735 | no Evaluation Count:0 |
| 0-735 |
244 | max.setHeight(((1<<24)-1)); executed: max.setHeight(((1<<24)-1)); Execution Count:735 | 735 |
245 | | - |
246 | return result.boundedTo(max).expandedTo(min); executed: return result.boundedTo(max).expandedTo(min); Execution Count:735 | 735 |
247 | } | - |
248 | | - |
249 | QSize QDockWidgetLayout::sizeHint() const | - |
250 | { | - |
251 | QDockWidget *w = qobject_cast<QDockWidget*>(parentWidget()); | - |
252 | | - |
253 | QSize content(-1, -1); | - |
254 | if (item_list[Content] != 0) evaluated: item_list[Content] != 0 yes Evaluation Count:2 | yes Evaluation Count:56 |
| 2-56 |
255 | content = item_list[Content]->sizeHint(); executed: content = item_list[Content]->sizeHint(); Execution Count:2 | 2 |
256 | | - |
257 | return sizeFromContent(content, w->isFloating()); executed: return sizeFromContent(content, w->isFloating()); Execution Count:58 | 58 |
258 | } | - |
259 | | - |
260 | QSize QDockWidgetLayout::maximumSize() const | - |
261 | { | - |
262 | if (item_list[Content] != 0) { evaluated: item_list[Content] != 0 yes Evaluation Count:14 | yes Evaluation Count:28 |
| 14-28 |
263 | const QSize content = item_list[Content]->maximumSize(); | - |
264 | return sizeFromContent(content, parentWidget()->isWindow()); executed: return sizeFromContent(content, parentWidget()->isWindow()); Execution Count:14 | 14 |
265 | } else { | - |
266 | return parentWidget()->maximumSize(); executed: return parentWidget()->maximumSize(); Execution Count:28 | 28 |
267 | } | - |
268 | | - |
269 | } | - |
270 | | - |
271 | QSize QDockWidgetLayout::minimumSize() const | - |
272 | { | - |
273 | QDockWidget *w = qobject_cast<QDockWidget*>(parentWidget()); | - |
274 | | - |
275 | QSize content(0, 0); | - |
276 | if (item_list[Content] != 0) evaluated: item_list[Content] != 0 yes Evaluation Count:14 | yes Evaluation Count:76 |
| 14-76 |
277 | content = item_list[Content]->minimumSize(); executed: content = item_list[Content]->minimumSize(); Execution Count:14 | 14 |
278 | | - |
279 | return sizeFromContent(content, w->isFloating()); executed: return sizeFromContent(content, w->isFloating()); Execution Count:90 | 90 |
280 | } | - |
281 | | - |
282 | QWidget *QDockWidgetLayout::widgetForRole(Role r) const | - |
283 | { | - |
284 | QLayoutItem *item = item_list.at(r); | - |
285 | return item == 0 ? 0 : item->widget(); executed: return item == 0 ? 0 : item->widget(); Execution Count:2657 | 2657 |
286 | } | - |
287 | | - |
288 | QLayoutItem *QDockWidgetLayout::itemForRole(Role r) const | - |
289 | { | - |
290 | return item_list.at(r); executed: return item_list.at(r); Execution Count:789 | 789 |
291 | } | - |
292 | | - |
293 | void QDockWidgetLayout::setWidgetForRole(Role r, QWidget *w) | - |
294 | { | - |
295 | QWidget *old = widgetForRole(r); | - |
296 | if (old != 0) { evaluated: old != 0 yes Evaluation Count:8 | yes Evaluation Count:68 |
| 8-68 |
297 | old->hide(); | - |
298 | removeWidget(old); | - |
299 | } executed: } Execution Count:8 | 8 |
300 | | - |
301 | if (w != 0) { evaluated: w != 0 yes Evaluation Count:71 | yes Evaluation Count:5 |
| 5-71 |
302 | addChildWidget(w); | - |
303 | item_list[r] = new QWidgetItemV2(w); | - |
304 | w->show(); | - |
305 | } else { executed: } Execution Count:71 | 71 |
306 | item_list[r] = 0; | - |
307 | } executed: } Execution Count:5 | 5 |
308 | | - |
309 | invalidate(); | - |
310 | } executed: } Execution Count:76 | 76 |
311 | | - |
312 | static inline int pick(bool vertical, const QSize &size) | - |
313 | { | - |
314 | return vertical ? size.height() : size.width(); executed: return vertical ? size.height() : size.width(); Execution Count:1464 | 1464 |
315 | } | - |
316 | | - |
317 | static inline int perp(bool vertical, const QSize &size) | - |
318 | { | - |
319 | return vertical ? size.width() : size.height(); executed: return vertical ? size.width() : size.height(); Execution Count:3070 | 3070 |
320 | } | - |
321 | | - |
322 | int QDockWidgetLayout::minimumTitleWidth() const | - |
323 | { | - |
324 | QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget()); | - |
325 | | - |
326 | if (QWidget *title = widgetForRole(TitleBar)) evaluated: QWidget *title = widgetForRole(TitleBar) yes Evaluation Count:6 | yes Evaluation Count:729 |
| 6-729 |
327 | return pick(verticalTitleBar, title->minimumSizeHint()); executed: return pick(verticalTitleBar, title->minimumSizeHint()); Execution Count:6 | 6 |
328 | | - |
329 | QSize closeSize(0, 0); | - |
330 | QSize floatSize(0, 0); | - |
331 | if (hasFeature(q, QDockWidget::DockWidgetClosable)) { partially evaluated: hasFeature(q, QDockWidget::DockWidgetClosable) yes Evaluation Count:729 | no Evaluation Count:0 |
| 0-729 |
332 | if (QLayoutItem *item = item_list[CloseButton]) partially evaluated: QLayoutItem *item = item_list[CloseButton] yes Evaluation Count:729 | no Evaluation Count:0 |
| 0-729 |
333 | closeSize = item->widget()->sizeHint(); executed: closeSize = item->widget()->sizeHint(); Execution Count:729 | 729 |
334 | } executed: } Execution Count:729 | 729 |
335 | if (hasFeature(q, QDockWidget::DockWidgetFloatable)) { partially evaluated: hasFeature(q, QDockWidget::DockWidgetFloatable) yes Evaluation Count:729 | no Evaluation Count:0 |
| 0-729 |
336 | if (QLayoutItem *item = item_list[FloatButton]) partially evaluated: QLayoutItem *item = item_list[FloatButton] yes Evaluation Count:729 | no Evaluation Count:0 |
| 0-729 |
337 | floatSize = item->widget()->sizeHint(); executed: floatSize = item->widget()->sizeHint(); Execution Count:729 | 729 |
338 | } executed: } Execution Count:729 | 729 |
339 | | - |
340 | int titleHeight = this->titleHeight(); | - |
341 | | - |
342 | int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q); | - |
343 | int fw = q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q); | - |
344 | | - |
345 | return pick(verticalTitleBar, closeSize) | 729 |
346 | + pick(verticalTitleBar, floatSize) | 729 |
347 | + titleHeight + 2*fw + 3*mw; executed: return pick(verticalTitleBar, closeSize) + pick(verticalTitleBar, floatSize) + titleHeight + 2*fw + 3*mw; Execution Count:729 | 729 |
348 | } | - |
349 | | - |
350 | int QDockWidgetLayout::titleHeight() const | - |
351 | { | - |
352 | QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget()); | - |
353 | | - |
354 | if (QWidget *title = widgetForRole(TitleBar)) evaluated: QWidget *title = widgetForRole(TitleBar) yes Evaluation Count:10 | yes Evaluation Count:1530 |
| 10-1530 |
355 | return perp(verticalTitleBar, title->sizeHint()); executed: return perp(verticalTitleBar, title->sizeHint()); Execution Count:10 | 10 |
356 | | - |
357 | QSize closeSize(0, 0); | - |
358 | QSize floatSize(0, 0); | - |
359 | if (QLayoutItem *item = item_list[CloseButton]) partially evaluated: QLayoutItem *item = item_list[CloseButton] yes Evaluation Count:1530 | no Evaluation Count:0 |
| 0-1530 |
360 | closeSize = item->widget()->sizeHint(); executed: closeSize = item->widget()->sizeHint(); Execution Count:1530 | 1530 |
361 | if (QLayoutItem *item = item_list[FloatButton]) partially evaluated: QLayoutItem *item = item_list[FloatButton] yes Evaluation Count:1530 | no Evaluation Count:0 |
| 0-1530 |
362 | floatSize = item->widget()->sizeHint(); executed: floatSize = item->widget()->sizeHint(); Execution Count:1530 | 1530 |
363 | | - |
364 | int buttonHeight = qMax(perp(verticalTitleBar, closeSize), | - |
365 | perp(verticalTitleBar, floatSize)); | - |
366 | | - |
367 | QFontMetrics titleFontMetrics = q->fontMetrics(); | - |
368 | int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q); | - |
369 | | - |
370 | return qMax(buttonHeight + 2, titleFontMetrics.height() + 2*mw); executed: return qMax(buttonHeight + 2, titleFontMetrics.height() + 2*mw); Execution Count:1530 | 1530 |
371 | } | - |
372 | | - |
373 | void QDockWidgetLayout::setGeometry(const QRect &geometry) | - |
374 | { | - |
375 | QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget()); | - |
376 | | - |
377 | bool nativeDeco = nativeWindowDeco(); | - |
378 | | - |
379 | int fw = q->isFloating() && !nativeDeco evaluated: q->isFloating() yes Evaluation Count:37 | yes Evaluation Count:39 |
partially evaluated: !nativeDeco yes Evaluation Count:37 | no Evaluation Count:0 |
| 0-39 |
380 | ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q) | - |
381 | : 0; | - |
382 | | - |
383 | if (nativeDeco) { partially evaluated: nativeDeco no Evaluation Count:0 | yes Evaluation Count:76 |
| 0-76 |
384 | if (QLayoutItem *item = item_list[Content]) never evaluated: QLayoutItem *item = item_list[Content] | 0 |
385 | item->setGeometry(geometry); never executed: item->setGeometry(geometry); | 0 |
386 | } else { | 0 |
387 | int titleHeight = this->titleHeight(); | - |
388 | | - |
389 | if (verticalTitleBar) { partially evaluated: verticalTitleBar no Evaluation Count:0 | yes Evaluation Count:76 |
| 0-76 |
390 | _titleArea = QRect(QPoint(fw, fw), | - |
391 | QSize(titleHeight, geometry.height() - (fw * 2))); | - |
392 | } else { | 0 |
393 | _titleArea = QRect(QPoint(fw, fw), | - |
394 | QSize(geometry.width() - (fw * 2), titleHeight)); | - |
395 | } executed: } Execution Count:76 | 76 |
396 | | - |
397 | if (QLayoutItem *item = item_list[TitleBar]) { evaluated: QLayoutItem *item = item_list[TitleBar] yes Evaluation Count:4 | yes Evaluation Count:72 |
| 4-72 |
398 | item->setGeometry(_titleArea); | - |
399 | } else { executed: } Execution Count:4 | 4 |
400 | QStyleOptionDockWidgetV2 opt; | - |
401 | q->initStyleOption(&opt); | - |
402 | | - |
403 | if (QLayoutItem *item = item_list[CloseButton]) { partially evaluated: QLayoutItem *item = item_list[CloseButton] yes Evaluation Count:72 | no Evaluation Count:0 |
| 0-72 |
404 | if (!item->isEmpty()) { evaluated: !item->isEmpty() yes Evaluation Count:71 | yes Evaluation Count:1 |
| 1-71 |
405 | QRect r = q->style() | - |
406 | ->subElementRect(QStyle::SE_DockWidgetCloseButton, | - |
407 | &opt, q); | - |
408 | if (!r.isNull()) partially evaluated: !r.isNull() yes Evaluation Count:71 | no Evaluation Count:0 |
| 0-71 |
409 | item->setGeometry(r); executed: item->setGeometry(r); Execution Count:71 | 71 |
410 | } executed: } Execution Count:71 | 71 |
411 | } executed: } Execution Count:72 | 72 |
412 | | - |
413 | if (QLayoutItem *item = item_list[FloatButton]) { partially evaluated: QLayoutItem *item = item_list[FloatButton] yes Evaluation Count:72 | no Evaluation Count:0 |
| 0-72 |
414 | if (!item->isEmpty()) { partially evaluated: !item->isEmpty() yes Evaluation Count:72 | no Evaluation Count:0 |
| 0-72 |
415 | QRect r = q->style() | - |
416 | ->subElementRect(QStyle::SE_DockWidgetFloatButton, | - |
417 | &opt, q); | - |
418 | if (!r.isNull()) partially evaluated: !r.isNull() yes Evaluation Count:72 | no Evaluation Count:0 |
| 0-72 |
419 | item->setGeometry(r); executed: item->setGeometry(r); Execution Count:72 | 72 |
420 | } executed: } Execution Count:72 | 72 |
421 | } executed: } Execution Count:72 | 72 |
422 | } executed: } Execution Count:72 | 72 |
423 | | - |
424 | if (QLayoutItem *item = item_list[Content]) { evaluated: QLayoutItem *item = item_list[Content] yes Evaluation Count:26 | yes Evaluation Count:50 |
| 26-50 |
425 | QRect r = geometry; | - |
426 | if (verticalTitleBar) { partially evaluated: verticalTitleBar no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
427 | r.setLeft(_titleArea.right() + 1); | - |
428 | r.adjust(0, fw, -fw, -fw); | - |
429 | } else { | 0 |
430 | r.setTop(_titleArea.bottom() + 1); | - |
431 | r.adjust(fw, 0, -fw, -fw); | - |
432 | } executed: } Execution Count:26 | 26 |
433 | item->setGeometry(r); | - |
434 | } executed: } Execution Count:26 | 26 |
435 | } executed: } Execution Count:76 | 76 |
436 | } | - |
437 | | - |
438 | void QDockWidgetLayout::setVerticalTitleBar(bool b) | - |
439 | { | - |
440 | if (b == verticalTitleBar) partially evaluated: b == verticalTitleBar yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
441 | return; executed: return; Execution Count:14 | 14 |
442 | verticalTitleBar = b; | - |
443 | invalidate(); | - |
444 | parentWidget()->update(); | - |
445 | } | 0 |
446 | | - |
447 | | - |
448 | | - |
449 | | - |
450 | | - |
451 | QDockWidgetItem::QDockWidgetItem(QDockWidget *dockWidget) | - |
452 | : QWidgetItem(dockWidget) | - |
453 | { | - |
454 | } executed: } Execution Count:29 | 29 |
455 | | - |
456 | QSize QDockWidgetItem::minimumSize() const | - |
457 | { | - |
458 | QSize widgetMin(0, 0); | - |
459 | if (QLayoutItem *item = dockWidgetChildItem()) evaluated: QLayoutItem *item = dockWidgetChildItem() yes Evaluation Count:141 | yes Evaluation Count:303 |
| 141-303 |
460 | widgetMin = item->minimumSize(); executed: widgetMin = item->minimumSize(); Execution Count:141 | 141 |
461 | return dockWidgetLayout()->sizeFromContent(widgetMin, false); executed: return dockWidgetLayout()->sizeFromContent(widgetMin, false); Execution Count:444 | 444 |
462 | } | - |
463 | | - |
464 | QSize QDockWidgetItem::maximumSize() const | - |
465 | { | - |
466 | if (QLayoutItem *item = dockWidgetChildItem()) { evaluated: QLayoutItem *item = dockWidgetChildItem() yes Evaluation Count:99 | yes Evaluation Count:168 |
| 99-168 |
467 | return dockWidgetLayout()->sizeFromContent(item->maximumSize(), false); executed: return dockWidgetLayout()->sizeFromContent(item->maximumSize(), false); Execution Count:99 | 99 |
468 | } else { | - |
469 | return QSize(((1<<24)-1), ((1<<24)-1)); executed: return QSize(((1<<24)-1), ((1<<24)-1)); Execution Count:168 | 168 |
470 | } | - |
471 | } | - |
472 | | - |
473 | | - |
474 | QSize QDockWidgetItem::sizeHint() const | - |
475 | { | - |
476 | if (QLayoutItem *item = dockWidgetChildItem()) { evaluated: QLayoutItem *item = dockWidgetChildItem() yes Evaluation Count:30 | yes Evaluation Count:48 |
| 30-48 |
477 | return dockWidgetLayout()->sizeFromContent(item->sizeHint(), false); executed: return dockWidgetLayout()->sizeFromContent(item->sizeHint(), false); Execution Count:30 | 30 |
478 | } else { | - |
479 | return QWidgetItem::sizeHint(); executed: return QWidgetItem::sizeHint(); Execution Count:48 | 48 |
480 | } | - |
481 | } | - |
482 | | - |
483 | | - |
484 | | - |
485 | | - |
486 | | - |
487 | void QDockWidgetPrivate::init() | - |
488 | { | - |
489 | QDockWidget * const q = q_func(); | - |
490 | | - |
491 | QDockWidgetLayout *layout = new QDockWidgetLayout(q); | - |
492 | layout->setSizeConstraint(QLayout::SetMinAndMaxSize); | - |
493 | | - |
494 | QAbstractButton *button = new QDockWidgetTitleButton(q); | - |
495 | button->setObjectName(QLatin1String("qt_dockwidget_floatbutton")); | - |
496 | QObject::connect(button, "2""clicked()", q, "1""_q_toggleTopLevel()"); | - |
497 | layout->setWidgetForRole(QDockWidgetLayout::FloatButton, button); | - |
498 | | - |
499 | button = new QDockWidgetTitleButton(q); | - |
500 | button->setObjectName(QLatin1String("qt_dockwidget_closebutton")); | - |
501 | QObject::connect(button, "2""clicked()", q, "1""close()"); | - |
502 | layout->setWidgetForRole(QDockWidgetLayout::CloseButton, button); | - |
503 | | - |
504 | resizer = new QWidgetResizeHandler(q); | - |
505 | resizer->setMovingEnabled(false); | - |
506 | resizer->setActive(false); | - |
507 | | - |
508 | | - |
509 | toggleViewAction = new QAction(q); | - |
510 | toggleViewAction->setCheckable(true); | - |
511 | fixedWindowTitle = qt_setWindowTitle_helperHelper(q->windowTitle(), q); | - |
512 | toggleViewAction->setText(fixedWindowTitle); | - |
513 | QObject::connect(toggleViewAction, "2""triggered(bool)", | - |
514 | q, "1""_q_toggleView(bool)"); | - |
515 | | - |
516 | | - |
517 | updateButtons(); | - |
518 | } executed: } Execution Count:27 | 27 |
519 | void QDockWidget::initStyleOption(QStyleOptionDockWidget *option) const | - |
520 | { | - |
521 | const QDockWidgetPrivate * const d = d_func(); | - |
522 | | - |
523 | if (!option) partially evaluated: !option no Evaluation Count:0 | yes Evaluation Count:183 |
| 0-183 |
524 | return; | 0 |
525 | QDockWidgetLayout *dwlayout = qobject_cast<QDockWidgetLayout*>(layout()); | - |
526 | | - |
527 | option->initFrom(this); | - |
528 | option->rect = dwlayout->titleArea(); | - |
529 | option->title = d->fixedWindowTitle; | - |
530 | option->closable = hasFeature(this, QDockWidget::DockWidgetClosable); | - |
531 | option->movable = hasFeature(this, QDockWidget::DockWidgetMovable); | - |
532 | option->floatable = hasFeature(this, QDockWidget::DockWidgetFloatable); | - |
533 | | - |
534 | QDockWidgetLayout *l = qobject_cast<QDockWidgetLayout*>(layout()); | - |
535 | QStyleOptionDockWidgetV2 *v2 | - |
536 | = qstyleoption_cast<QStyleOptionDockWidgetV2*>(option); | - |
537 | if (v2 != 0) partially evaluated: v2 != 0 yes Evaluation Count:183 | no Evaluation Count:0 |
| 0-183 |
538 | v2->verticalTitleBar = l->verticalTitleBar; executed: v2->verticalTitleBar = l->verticalTitleBar; Execution Count:183 | 183 |
539 | } executed: } Execution Count:183 | 183 |
540 | | - |
541 | void QDockWidgetPrivate::_q_toggleView(bool b) | - |
542 | { | - |
543 | QDockWidget * const q = q_func(); | - |
544 | if (b == q->isHidden()) { partially evaluated: b == q->isHidden() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
545 | if (b) evaluated: b yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
546 | q->show(); executed: q->show(); Execution Count:1 | 1 |
547 | else | - |
548 | q->close(); executed: q->close(); Execution Count:2 | 2 |
549 | } | - |
550 | } executed: } Execution Count:3 | 3 |
551 | | - |
552 | void QDockWidgetPrivate::updateButtons() | - |
553 | { | - |
554 | QDockWidget * const q = q_func(); | - |
555 | QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout); | - |
556 | | - |
557 | QStyleOptionDockWidget opt; | - |
558 | q->initStyleOption(&opt); | - |
559 | | - |
560 | bool customTitleBar = dwLayout->widgetForRole(QDockWidgetLayout::TitleBar) != 0; | - |
561 | bool nativeDeco = dwLayout->nativeWindowDeco(); | - |
562 | bool hideButtons = nativeDeco || customTitleBar; partially evaluated: nativeDeco no Evaluation Count:0 | yes Evaluation Count:81 |
evaluated: customTitleBar yes Evaluation Count:4 | yes Evaluation Count:77 |
| 0-81 |
563 | | - |
564 | bool canClose = hasFeature(this, QDockWidget::DockWidgetClosable); | - |
565 | bool canFloat = hasFeature(this, QDockWidget::DockWidgetFloatable); | - |
566 | | - |
567 | QAbstractButton *button | - |
568 | = qobject_cast<QAbstractButton*>(dwLayout->widgetForRole(QDockWidgetLayout::FloatButton)); | - |
569 | button->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarNormalButton, &opt, q)); | - |
570 | button->setVisible(canFloat && !hideButtons); | - |
571 | | - |
572 | button | - |
573 | = qobject_cast <QAbstractButton*>(dwLayout->widgetForRole(QDockWidgetLayout::CloseButton)); | - |
574 | button->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarCloseButton, &opt, q)); | - |
575 | button->setVisible(canClose && !hideButtons); | - |
576 | | - |
577 | q->setAttribute(Qt::WA_ContentsPropagated, | - |
578 | (canFloat || canClose) && !hideButtons); | - |
579 | | - |
580 | layout->invalidate(); | - |
581 | } executed: } Execution Count:81 | 81 |
582 | | - |
583 | void QDockWidgetPrivate::_q_toggleTopLevel() | - |
584 | { | - |
585 | QDockWidget * const q = q_func(); | - |
586 | q->setFloating(!q->isFloating()); | - |
587 | } executed: } Execution Count:2 | 2 |
588 | | - |
589 | void QDockWidgetPrivate::initDrag(const QPoint &pos, bool nca) | - |
590 | { | - |
591 | if (state != 0) never evaluated: state != 0 | 0 |
592 | return; | 0 |
593 | | - |
594 | QMainWindow *win = qobject_cast<QMainWindow*>(parent); | - |
595 | qt_noop(); | - |
596 | QMainWindowLayout *layout = qt_mainwindow_layout(win); | - |
597 | qt_noop(); | - |
598 | if (layout->pluggingWidget != 0) never evaluated: layout->pluggingWidget != 0 | 0 |
599 | return; | 0 |
600 | | - |
601 | state = new QDockWidgetPrivate::DragState; | - |
602 | state->pressPos = pos; | - |
603 | state->dragging = false; | - |
604 | state->widgetItem = 0; | - |
605 | state->ownWidgetItem = false; | - |
606 | state->nca = nca; | - |
607 | state->ctrlDrag = false; | - |
608 | } | 0 |
609 | | - |
610 | void QDockWidgetPrivate::startDrag() | - |
611 | { | - |
612 | QDockWidget * const q = q_func(); | - |
613 | | - |
614 | if (state == 0 || state->dragging) never evaluated: state == 0 never evaluated: state->dragging | 0 |
615 | return; | 0 |
616 | | - |
617 | QMainWindowLayout *layout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget())); | - |
618 | qt_noop(); | - |
619 | | - |
620 | state->widgetItem = layout->unplug(q); | - |
621 | if (state->widgetItem == 0) { never evaluated: state->widgetItem == 0 | 0 |
622 | | - |
623 | | - |
624 | | - |
625 | | - |
626 | state->widgetItem = new QDockWidgetItem(q); | - |
627 | state->ownWidgetItem = true; | - |
628 | } | 0 |
629 | | - |
630 | if (state->ctrlDrag) never evaluated: state->ctrlDrag | 0 |
631 | layout->restore(); never executed: layout->restore(); | 0 |
632 | | - |
633 | state->dragging = true; | - |
634 | } | 0 |
635 | | - |
636 | void QDockWidgetPrivate::endDrag(bool abort) | - |
637 | { | - |
638 | QDockWidget * const q = q_func(); | - |
639 | qt_noop(); | - |
640 | | - |
641 | q->releaseMouse(); | - |
642 | | - |
643 | if (state->dragging) { never evaluated: state->dragging | 0 |
644 | QMainWindowLayout *mwLayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget())); | - |
645 | qt_noop(); | - |
646 | | - |
647 | if (abort || !mwLayout->plug(state->widgetItem)) { never evaluated: !mwLayout->plug(state->widgetItem) | 0 |
648 | if (hasFeature(this, QDockWidget::DockWidgetFloatable)) { never evaluated: hasFeature(this, QDockWidget::DockWidgetFloatable) | 0 |
649 | if (state->ownWidgetItem) never evaluated: state->ownWidgetItem | 0 |
650 | delete state->widgetItem; never executed: delete state->widgetItem; | 0 |
651 | mwLayout->restore(); | - |
652 | if (isXcb()) { | 0 |
653 | | - |
654 | Qt::WindowFlags flags = q->windowFlags(); | - |
655 | flags &= ~Qt::X11BypassWindowManagerHint; | - |
656 | q->setWindowFlags(flags); | - |
657 | resizer->setActive(QWidgetResizeHandler::Resize, true); | - |
658 | q->show(); | - |
659 | } else { | 0 |
660 | QDockWidgetLayout *myLayout | - |
661 | = qobject_cast<QDockWidgetLayout*>(layout); | - |
662 | resizer->setActive(QWidgetResizeHandler::Resize, | - |
663 | myLayout->widgetForRole(QDockWidgetLayout::TitleBar) != 0); | - |
664 | } | 0 |
665 | undockedGeometry = q->geometry(); | - |
666 | q->activateWindow(); | - |
667 | } else { | 0 |
668 | mwLayout->revert(state->widgetItem); | - |
669 | } | 0 |
670 | } | - |
671 | } | 0 |
672 | delete state; | - |
673 | state = 0; | - |
674 | } | 0 |
675 | | - |
676 | bool QDockWidgetPrivate::isAnimating() const | - |
677 | { | - |
678 | const QDockWidget * const q = q_func(); | - |
679 | | - |
680 | QMainWindow *mainWin = qobject_cast<QMainWindow*>(parent); | - |
681 | if (mainWin == 0) never evaluated: mainWin == 0 | 0 |
682 | return false; never executed: return false; | 0 |
683 | | - |
684 | QMainWindowLayout *mainWinLayout = qt_mainwindow_layout(mainWin); | - |
685 | if (mainWinLayout == 0) never evaluated: mainWinLayout == 0 | 0 |
686 | return false; never executed: return false; | 0 |
687 | | - |
688 | return (void*)mainWinLayout->pluggingWidget == (void*)q; never executed: return (void*)mainWinLayout->pluggingWidget == (void*)q; | 0 |
689 | } | - |
690 | | - |
691 | bool QDockWidgetPrivate::mousePressEvent(QMouseEvent *event) | - |
692 | { | - |
693 | | - |
694 | QDockWidget * const q = q_func(); | - |
695 | | - |
696 | QDockWidgetLayout *dwLayout | - |
697 | = qobject_cast<QDockWidgetLayout*>(layout); | - |
698 | | - |
699 | if (!dwLayout->nativeWindowDeco()) { never evaluated: !dwLayout->nativeWindowDeco() | 0 |
700 | QRect titleArea = dwLayout->titleArea(); | - |
701 | | - |
702 | if (event->button() != Qt::LeftButton || never evaluated: event->button() != Qt::LeftButton | 0 |
703 | !titleArea.contains(event->pos()) || never evaluated: !titleArea.contains(event->pos()) | 0 |
704 | | - |
705 | | - |
706 | (!hasFeature(this, QDockWidget::DockWidgetMovable) && !q->isFloating()) || never evaluated: !hasFeature(this, QDockWidget::DockWidgetMovable) never evaluated: !q->isFloating() | 0 |
707 | qobject_cast<QMainWindow*>(parent) == 0 || never evaluated: qobject_cast<QMainWindow*>(parent) == 0 | 0 |
708 | isAnimating() || state != 0) { never evaluated: isAnimating() never evaluated: state != 0 | 0 |
709 | return false; never executed: return false; | 0 |
710 | } | - |
711 | | - |
712 | initDrag(event->pos(), false); | - |
713 | | - |
714 | if (state) | 0 |
715 | state->ctrlDrag = hasFeature(this, QDockWidget::DockWidgetFloatable) && event->modifiers() & Qt::ControlModifier; never executed: state->ctrlDrag = hasFeature(this, QDockWidget::DockWidgetFloatable) && event->modifiers() & Qt::ControlModifier; never evaluated: hasFeature(this, QDockWidget::DockWidgetFloatable) never evaluated: event->modifiers() & Qt::ControlModifier | 0 |
716 | | - |
717 | return true; never executed: return true; | 0 |
718 | } | - |
719 | | - |
720 | | - |
721 | return false; never executed: return false; | 0 |
722 | } | - |
723 | | - |
724 | bool QDockWidgetPrivate::mouseDoubleClickEvent(QMouseEvent *event) | - |
725 | { | - |
726 | QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout); | - |
727 | | - |
728 | if (!dwLayout->nativeWindowDeco()) { never evaluated: !dwLayout->nativeWindowDeco() | 0 |
729 | QRect titleArea = dwLayout->titleArea(); | - |
730 | | - |
731 | if (event->button() == Qt::LeftButton && titleArea.contains(event->pos()) && never evaluated: event->button() == Qt::LeftButton never evaluated: titleArea.contains(event->pos()) | 0 |
732 | hasFeature(this, QDockWidget::DockWidgetFloatable)) { never evaluated: hasFeature(this, QDockWidget::DockWidgetFloatable) | 0 |
733 | _q_toggleTopLevel(); | - |
734 | return true; never executed: return true; | 0 |
735 | } | - |
736 | } | 0 |
737 | return false; never executed: return false; | 0 |
738 | } | - |
739 | | - |
740 | bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event) | - |
741 | { | - |
742 | bool ret = false; | - |
743 | | - |
744 | QDockWidget * const q = q_func(); | - |
745 | | - |
746 | if (!state) | 0 |
747 | return ret; never executed: return ret; | 0 |
748 | | - |
749 | QDockWidgetLayout *dwlayout | - |
750 | = qobject_cast<QDockWidgetLayout *>(layout); | - |
751 | QMainWindowLayout *mwlayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget())); | - |
752 | if (!dwlayout->nativeWindowDeco()) { never evaluated: !dwlayout->nativeWindowDeco() | 0 |
753 | if (!state->dragging never evaluated: !state->dragging | 0 |
754 | && mwlayout->pluggingWidget == 0 never evaluated: mwlayout->pluggingWidget == 0 | 0 |
755 | && (event->pos() - state->pressPos).manhattanLength() | 0 |
756 | > QApplication::startDragDistance()) { never evaluated: (event->pos() - state->pressPos).manhattanLength() > QApplication::startDragDistance() | 0 |
757 | startDrag(); | - |
758 | | - |
759 | | - |
760 | | - |
761 | q->grabMouse(); | - |
762 | | - |
763 | ret = true; | - |
764 | } | 0 |
765 | } | 0 |
766 | | - |
767 | if (state->dragging && !state->nca) { never evaluated: state->dragging never evaluated: !state->nca | 0 |
768 | QPoint pos = event->globalPos() - state->pressPos; | - |
769 | q->move(pos); | - |
770 | | - |
771 | if (!state->ctrlDrag) never evaluated: !state->ctrlDrag | 0 |
772 | mwlayout->hover(state->widgetItem, event->globalPos()); never executed: mwlayout->hover(state->widgetItem, event->globalPos()); | 0 |
773 | | - |
774 | ret = true; | - |
775 | } | 0 |
776 | | - |
777 | | - |
778 | return ret; never executed: return ret; | 0 |
779 | } | - |
780 | | - |
781 | bool QDockWidgetPrivate::mouseReleaseEvent(QMouseEvent *event) | - |
782 | { | - |
783 | | - |
784 | | - |
785 | if (event->button() == Qt::LeftButton && state && !state->nca) { never evaluated: event->button() == Qt::LeftButton never evaluated: !state->nca | 0 |
786 | endDrag(); | - |
787 | return true; never executed: return true; | 0 |
788 | } | - |
789 | | - |
790 | | - |
791 | return false; never executed: return false; | 0 |
792 | } | - |
793 | | - |
794 | void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event) | - |
795 | { | - |
796 | QDockWidget * const q = q_func(); | - |
797 | | - |
798 | int fw = q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q); | - |
799 | | - |
800 | QRect geo = q->geometry(); | - |
801 | QRect titleRect = q->frameGeometry(); | - |
802 | | - |
803 | | - |
804 | | - |
805 | | - |
806 | | - |
807 | | - |
808 | | - |
809 | { | - |
810 | titleRect.setLeft(geo.left()); | - |
811 | titleRect.setRight(geo.right()); | - |
812 | titleRect.setBottom(geo.top() - 1); | - |
813 | titleRect.adjust(0, fw, 0, 0); | - |
814 | } | - |
815 | | - |
816 | switch (event->type()) { | - |
817 | case QEvent::NonClientAreaMouseButtonPress: | - |
818 | if (!titleRect.contains(event->globalPos())) never evaluated: !titleRect.contains(event->globalPos()) | 0 |
819 | break; | 0 |
820 | if (state != 0) never evaluated: state != 0 | 0 |
821 | break; | 0 |
822 | if (qobject_cast<QMainWindow*>(parent) == 0) never evaluated: qobject_cast<QMainWindow*>(parent) == 0 | 0 |
823 | break; | 0 |
824 | if (isAnimating()) never evaluated: isAnimating() | 0 |
825 | break; | 0 |
826 | initDrag(event->pos(), true); | - |
827 | if (state == 0) never evaluated: state == 0 | 0 |
828 | break; | 0 |
829 | | - |
830 | | - |
831 | | - |
832 | | - |
833 | state->ctrlDrag = event->modifiers() & Qt::ControlModifier; | - |
834 | | - |
835 | startDrag(); | - |
836 | break; | 0 |
837 | case QEvent::NonClientAreaMouseMove: | - |
838 | if (state == 0 || !state->dragging) never evaluated: state == 0 never evaluated: !state->dragging | 0 |
839 | break; | 0 |
840 | | - |
841 | | - |
842 | if (state->nca) { never evaluated: state->nca | 0 |
843 | endDrag(); | - |
844 | } | 0 |
845 | | - |
846 | break; | 0 |
847 | case QEvent::NonClientAreaMouseButtonRelease: | - |
848 | | - |
849 | | - |
850 | | - |
851 | | - |
852 | break; | 0 |
853 | case QEvent::NonClientAreaMouseButtonDblClick: | - |
854 | _q_toggleTopLevel(); | - |
855 | break; executed: break; Execution Count:2 | 2 |
856 | default: | - |
857 | break; | 0 |
858 | } | - |
859 | } executed: } Execution Count:2 | 2 |
860 | | - |
861 | void QDockWidgetPrivate::moveEvent(QMoveEvent *event) | - |
862 | { | - |
863 | QDockWidget * const q = q_func(); | - |
864 | | - |
865 | if (state == 0 || !state->dragging || !state->nca || !q->isWindow()) partially evaluated: state == 0 yes Evaluation Count:37 | no Evaluation Count:0 |
never evaluated: !state->dragging never evaluated: !state->nca never evaluated: !q->isWindow() | 0-37 |
866 | return; executed: return; Execution Count:37 | 37 |
867 | | - |
868 | | - |
869 | | - |
870 | | - |
871 | if (state->ctrlDrag) never evaluated: state->ctrlDrag | 0 |
872 | return; | 0 |
873 | | - |
874 | QMainWindowLayout *layout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget())); | - |
875 | qt_noop(); | - |
876 | | - |
877 | QPoint globalMousePos = event->pos() + state->pressPos; | - |
878 | layout->hover(state->widgetItem, globalMousePos); | - |
879 | } | 0 |
880 | | - |
881 | void QDockWidgetPrivate::unplug(const QRect &rect) | - |
882 | { | - |
883 | QDockWidget * const q = q_func(); | - |
884 | QRect r = rect; | - |
885 | r.moveTopLeft(q->mapToGlobal(QPoint(0, 0))); | - |
886 | QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout); | - |
887 | if (dwLayout->nativeWindowDeco(true)) never evaluated: dwLayout->nativeWindowDeco(true) | 0 |
888 | r.adjust(0, dwLayout->titleHeight(), 0, 0); never executed: r.adjust(0, dwLayout->titleHeight(), 0, 0); | 0 |
889 | setWindowState(true, true, r); | - |
890 | } | 0 |
891 | | - |
892 | void QDockWidgetPrivate::plug(const QRect &rect) | - |
893 | { | - |
894 | setWindowState(false, false, rect); | - |
895 | } | 0 |
896 | | - |
897 | static void setFrameStrutEventsEnabled(const QWidget *w, bool enabled) | - |
898 | { | - |
899 | if (const QWindow *window = w->windowHandle()) never evaluated: const QWindow *window = w->windowHandle() | 0 |
900 | if (QPlatformWindow *platformWindow = window->handle()) never evaluated: QPlatformWindow *platformWindow = window->handle() | 0 |
901 | if (platformWindow->frameStrutEventsEnabled() != enabled) never evaluated: platformWindow->frameStrutEventsEnabled() != enabled | 0 |
902 | platformWindow->setFrameStrutEventsEnabled(enabled); never executed: platformWindow->setFrameStrutEventsEnabled(enabled); | 0 |
903 | } | 0 |
904 | | - |
905 | void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect &rect) | - |
906 | { | - |
907 | QDockWidget * const q = q_func(); | - |
908 | | - |
909 | if (!floating && parent) { evaluated: !floating yes Evaluation Count:10 | yes Evaluation Count:13 |
evaluated: parent yes Evaluation Count:9 | yes Evaluation Count:1 |
| 1-13 |
910 | QMainWindowLayout *mwlayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget())); | - |
911 | if (mwlayout && mwlayout->dockWidgetArea(q) == Qt::NoDockWidgetArea) partially evaluated: mwlayout yes Evaluation Count:9 | no Evaluation Count:0 |
evaluated: mwlayout->dockWidgetArea(q) == Qt::NoDockWidgetArea yes Evaluation Count:1 | yes Evaluation Count:8 |
| 0-9 |
912 | return; executed: return; Execution Count:1 | 1 |
913 | } executed: } Execution Count:8 | 8 |
914 | | - |
915 | bool wasFloating = q->isFloating(); | - |
916 | bool hidden = q->isHidden(); | - |
917 | | - |
918 | if (q->isVisible()) evaluated: q->isVisible() yes Evaluation Count:14 | yes Evaluation Count:8 |
| 8-14 |
919 | q->hide(); executed: q->hide(); Execution Count:14 | 14 |
920 | | - |
921 | Qt::WindowFlags flags = floating ? Qt::Tool : Qt::Widget; evaluated: floating yes Evaluation Count:13 | yes Evaluation Count:9 |
| 9-13 |
922 | | - |
923 | QDockWidgetLayout *dwLayout = qobject_cast<QDockWidgetLayout*>(layout); | - |
924 | const bool nativeDeco = dwLayout->nativeWindowDeco(floating); | - |
925 | | - |
926 | if (nativeDeco) { partially evaluated: nativeDeco no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
927 | flags |= Qt::CustomizeWindowHint | Qt::WindowTitleHint; | - |
928 | if (hasFeature(this, QDockWidget::DockWidgetClosable)) never evaluated: hasFeature(this, QDockWidget::DockWidgetClosable) | 0 |
929 | flags |= Qt::WindowCloseButtonHint; never executed: flags |= Qt::WindowCloseButtonHint; | 0 |
930 | } else { | 0 |
931 | flags |= Qt::FramelessWindowHint; | - |
932 | } executed: } Execution Count:22 | 22 |
933 | | - |
934 | if (unplug) evaluated: unplug yes Evaluation Count:3 | yes Evaluation Count:19 |
| 3-19 |
935 | flags |= Qt::X11BypassWindowManagerHint; executed: flags |= Qt::X11BypassWindowManagerHint; Execution Count:3 | 3 |
936 | | - |
937 | q->setWindowFlags(flags); | - |
938 | | - |
939 | | - |
940 | if (!rect.isNull()) evaluated: !rect.isNull() yes Evaluation Count:1 | yes Evaluation Count:21 |
| 1-21 |
941 | q->setGeometry(rect); executed: q->setGeometry(rect); Execution Count:1 | 1 |
942 | | - |
943 | updateButtons(); | - |
944 | | - |
945 | if (!hidden) evaluated: !hidden yes Evaluation Count:17 | yes Evaluation Count:5 |
| 5-17 |
946 | q->show(); executed: q->show(); Execution Count:17 | 17 |
947 | | - |
948 | if (floating != wasFloating) { evaluated: floating != wasFloating yes Evaluation Count:14 | yes Evaluation Count:8 |
| 8-14 |
949 | q->topLevelChanged(floating); | - |
950 | if (!floating && parent) { evaluated: !floating yes Evaluation Count:6 | yes Evaluation Count:8 |
evaluated: parent yes Evaluation Count:5 | yes Evaluation Count:1 |
| 1-8 |
951 | QMainWindowLayout *mwlayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget())); | - |
952 | if (mwlayout) partially evaluated: mwlayout yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
953 | q->dockLocationChanged(mwlayout->dockWidgetArea(q)); executed: q->dockLocationChanged(mwlayout->dockWidgetArea(q)); Execution Count:5 | 5 |
954 | } executed: } Execution Count:5 | 5 |
955 | } executed: } Execution Count:14 | 14 |
956 | | - |
957 | if (floating && nativeDeco) evaluated: floating yes Evaluation Count:13 | yes Evaluation Count:9 |
partially evaluated: nativeDeco no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
958 | setFrameStrutEventsEnabled(q, true); never executed: setFrameStrutEventsEnabled(q, true); | 0 |
959 | | - |
960 | resizer->setActive(QWidgetResizeHandler::Resize, !unplug && floating && !nativeDeco); | - |
961 | } executed: } Execution Count:22 | 22 |
962 | QDockWidget::QDockWidget(QWidget *parent, Qt::WindowFlags flags) | - |
963 | : QWidget(*new QDockWidgetPrivate, parent, flags) | - |
964 | { | - |
965 | QDockWidgetPrivate * const d = d_func(); | - |
966 | d->init(); | - |
967 | } executed: } Execution Count:25 | 25 |
968 | QDockWidget::QDockWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags) | - |
969 | : QWidget(*new QDockWidgetPrivate, parent, flags) | - |
970 | { | - |
971 | QDockWidgetPrivate * const d = d_func(); | - |
972 | d->init(); | - |
973 | setWindowTitle(title); | - |
974 | } executed: } Execution Count:2 | 2 |
975 | | - |
976 | | - |
977 | | - |
978 | | - |
979 | QDockWidget::~QDockWidget() | - |
980 | { } | - |
981 | | - |
982 | | - |
983 | | - |
984 | | - |
985 | | - |
986 | | - |
987 | | - |
988 | QWidget *QDockWidget::widget() const | - |
989 | { | - |
990 | QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(this->layout()); | - |
991 | return layout->widgetForRole(QDockWidgetLayout::Content); executed: return layout->widgetForRole(QDockWidgetLayout::Content); Execution Count:33 | 33 |
992 | } | - |
993 | void QDockWidget::setWidget(QWidget *widget) | - |
994 | { | - |
995 | QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(this->layout()); | - |
996 | layout->setWidgetForRole(QDockWidgetLayout::Content, widget); | - |
997 | } executed: } Execution Count:19 | 19 |
998 | void QDockWidget::setFeatures(QDockWidget::DockWidgetFeatures features) | - |
999 | { | - |
1000 | QDockWidgetPrivate * const d = d_func(); | - |
1001 | features &= DockWidgetFeatureMask; | - |
1002 | if (d->features == features) evaluated: d->features == features yes Evaluation Count:9 | yes Evaluation Count:14 |
| 9-14 |
1003 | return; executed: return; Execution Count:9 | 9 |
1004 | const bool closableChanged = (d->features ^ features) & DockWidgetClosable; | - |
1005 | d->features = features; | - |
1006 | QDockWidgetLayout *layout | - |
1007 | = qobject_cast<QDockWidgetLayout*>(this->layout()); | - |
1008 | layout->setVerticalTitleBar(features & DockWidgetVerticalTitleBar); | - |
1009 | d->updateButtons(); | - |
1010 | d->toggleViewAction->setEnabled((d->features & DockWidgetClosable) == DockWidgetClosable); | - |
1011 | featuresChanged(d->features); | - |
1012 | update(); | - |
1013 | if (closableChanged && layout->nativeWindowDeco()) { evaluated: closableChanged yes Evaluation Count:5 | yes Evaluation Count:9 |
partially evaluated: layout->nativeWindowDeco() no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-9 |
1014 | | - |
1015 | d->setWindowState(true , true ); | - |
1016 | } | 0 |
1017 | } executed: } Execution Count:14 | 14 |
1018 | | - |
1019 | QDockWidget::DockWidgetFeatures QDockWidget::features() const | - |
1020 | { | - |
1021 | const QDockWidgetPrivate * const d = d_func(); | - |
1022 | return d->features; executed: return d->features; Execution Count:2076 | 2076 |
1023 | } | - |
1024 | void QDockWidget::setFloating(bool floating) | - |
1025 | { | - |
1026 | QDockWidgetPrivate * const d = d_func(); | - |
1027 | | - |
1028 | | - |
1029 | if (d->state != 0) partially evaluated: d->state != 0 no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
1030 | d->endDrag(true); never executed: d->endDrag(true); | 0 |
1031 | | - |
1032 | QRect r = d->undockedGeometry; | - |
1033 | | - |
1034 | d->setWindowState(floating, false, floating ? r : QRect()); | - |
1035 | | - |
1036 | if (floating && r.isNull()) { evaluated: floating yes Evaluation Count:10 | yes Evaluation Count:10 |
evaluated: r.isNull() yes Evaluation Count:9 | yes Evaluation Count:1 |
| 1-10 |
1037 | if (x() < 0 || y() < 0) evaluated: x() < 0 yes Evaluation Count:1 | yes Evaluation Count:8 |
partially evaluated: y() < 0 no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1038 | move(QPoint()); executed: move(QPoint()); Execution Count:1 | 1 |
1039 | setAttribute(Qt::WA_Moved, false); | - |
1040 | } executed: } Execution Count:9 | 9 |
1041 | } executed: } Execution Count:20 | 20 |
1042 | void QDockWidget::setAllowedAreas(Qt::DockWidgetAreas areas) | - |
1043 | { | - |
1044 | QDockWidgetPrivate * const d = d_func(); | - |
1045 | areas &= Qt::DockWidgetArea_Mask; | - |
1046 | if (areas == d->allowedAreas) evaluated: areas == d->allowedAreas yes Evaluation Count:8 | yes Evaluation Count:8 |
| 8 |
1047 | return; executed: return; Execution Count:8 | 8 |
1048 | d->allowedAreas = areas; | - |
1049 | allowedAreasChanged(d->allowedAreas); | - |
1050 | } executed: } Execution Count:8 | 8 |
1051 | | - |
1052 | Qt::DockWidgetAreas QDockWidget::allowedAreas() const | - |
1053 | { | - |
1054 | const QDockWidgetPrivate * const d = d_func(); | - |
1055 | return d->allowedAreas; executed: return d->allowedAreas; Execution Count:61 | 61 |
1056 | } | - |
1057 | void QDockWidget::changeEvent(QEvent *event) | - |
1058 | { | - |
1059 | QDockWidgetPrivate * const d = d_func(); | - |
1060 | QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(this->layout()); | - |
1061 | | - |
1062 | switch (event->type()) { | - |
1063 | case QEvent::ModifiedChange: | - |
1064 | case QEvent::WindowTitleChange: | - |
1065 | update(layout->titleArea()); | - |
1066 | | - |
1067 | d->fixedWindowTitle = qt_setWindowTitle_helperHelper(windowTitle(), this); | - |
1068 | d->toggleViewAction->setText(d->fixedWindowTitle); | - |
1069 | | - |
1070 | | - |
1071 | { | - |
1072 | QMainWindow *win = qobject_cast<QMainWindow*>(parentWidget()); | - |
1073 | if (QMainWindowLayout *winLayout = qt_mainwindow_layout(win)) { evaluated: QMainWindowLayout *winLayout = qt_mainwindow_layout(win) yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
1074 | if (QDockAreaLayoutInfo *info = winLayout->layoutState.dockAreaLayout.info(this)) partially evaluated: QDockAreaLayoutInfo *info = winLayout->layoutState.dockAreaLayout.info(this) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1075 | info->updateTabBar(); never executed: info->updateTabBar(); | 0 |
1076 | } executed: } Execution Count:1 | 1 |
1077 | } | - |
1078 | | - |
1079 | break; executed: break; Execution Count:2 | 2 |
1080 | default: | - |
1081 | break; executed: break; Execution Count:52 | 52 |
1082 | } | - |
1083 | QWidget::changeEvent(event); | - |
1084 | } executed: } Execution Count:54 | 54 |
1085 | | - |
1086 | | - |
1087 | void QDockWidget::closeEvent(QCloseEvent *event) | - |
1088 | { | - |
1089 | QDockWidgetPrivate * const d = d_func(); | - |
1090 | if (d->state) partially evaluated: d->state no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
1091 | d->endDrag(true); never executed: d->endDrag(true); | 0 |
1092 | QWidget::closeEvent(event); | - |
1093 | } executed: } Execution Count:2 | 2 |
1094 | | - |
1095 | | - |
1096 | void QDockWidget::paintEvent(QPaintEvent *event) | - |
1097 | { | - |
1098 | (void)event; | - |
1099 | | - |
1100 | QDockWidgetLayout *layout | - |
1101 | = qobject_cast<QDockWidgetLayout*>(this->layout()); | - |
1102 | bool customTitleBar = layout->widgetForRole(QDockWidgetLayout::TitleBar) != 0; | - |
1103 | bool nativeDeco = layout->nativeWindowDeco(); | - |
1104 | | - |
1105 | if (!nativeDeco && !customTitleBar) { partially evaluated: !nativeDeco yes Evaluation Count:30 | no Evaluation Count:0 |
partially evaluated: !customTitleBar yes Evaluation Count:30 | no Evaluation Count:0 |
| 0-30 |
1106 | QStylePainter p(this); | - |
1107 | | - |
1108 | | - |
1109 | if (isFloating()) { evaluated: isFloating() yes Evaluation Count:12 | yes Evaluation Count:18 |
| 12-18 |
1110 | QStyleOptionFrame framOpt; | - |
1111 | framOpt.init(this); | - |
1112 | p.drawPrimitive(QStyle::PE_FrameDockWidget, framOpt); | - |
1113 | } executed: } Execution Count:12 | 12 |
1114 | | - |
1115 | | - |
1116 | | - |
1117 | QStyleOptionDockWidgetV2 titleOpt; | - |
1118 | initStyleOption(&titleOpt); | - |
1119 | p.drawControl(QStyle::CE_DockWidgetTitle, titleOpt); | - |
1120 | } executed: } Execution Count:30 | 30 |
1121 | } executed: } Execution Count:30 | 30 |
1122 | | - |
1123 | | - |
1124 | bool QDockWidget::event(QEvent *event) | - |
1125 | { | - |
1126 | QDockWidgetPrivate * const d = d_func(); | - |
1127 | | - |
1128 | QMainWindow *win = qobject_cast<QMainWindow*>(parentWidget()); | - |
1129 | QMainWindowLayout *layout = qt_mainwindow_layout(win); | - |
1130 | | - |
1131 | switch (event->type()) { | - |
1132 | | - |
1133 | case QEvent::Hide: | - |
1134 | if (layout != 0) evaluated: layout != 0 yes Evaluation Count:15 | yes Evaluation Count:4 |
| 4-15 |
1135 | layout->keepSize(this); executed: layout->keepSize(this); Execution Count:15 | 15 |
1136 | d->toggleViewAction->setChecked(false); | - |
1137 | visibilityChanged(false); | - |
1138 | break; executed: break; Execution Count:19 | 19 |
1139 | case QEvent::Show: | - |
1140 | if (static_cast<QDockWidgetLayout *>(QDockWidget::layout())->nativeWindowDeco(isFloating())) partially evaluated: static_cast<QDockWidgetLayout *>(QDockWidget::layout())->nativeWindowDeco(isFloating()) no Evaluation Count:0 | yes Evaluation Count:34 |
| 0-34 |
1141 | setFrameStrutEventsEnabled(this, true); never executed: setFrameStrutEventsEnabled(this, true); | 0 |
1142 | d->toggleViewAction->setChecked(true); | - |
1143 | visibilityChanged(geometry().right() >= 0 && geometry().bottom() >= 0); | - |
1144 | break; executed: break; Execution Count:34 | 34 |
1145 | | - |
1146 | case QEvent::ApplicationLayoutDirectionChange: | - |
1147 | case QEvent::LayoutDirectionChange: | - |
1148 | case QEvent::StyleChange: | - |
1149 | case QEvent::ParentChange: | - |
1150 | d->updateButtons(); | - |
1151 | break; executed: break; Execution Count:15 | 15 |
1152 | case QEvent::ZOrderChange: { | - |
1153 | bool onTop = false; | - |
1154 | if (win != 0) { evaluated: win != 0 yes Evaluation Count:18 | yes Evaluation Count:3 |
| 3-18 |
1155 | const QObjectList &siblings = win->children(); | - |
1156 | onTop = siblings.count() > 0 && siblings.last() == (QObject*)this; partially evaluated: siblings.count() > 0 yes Evaluation Count:18 | no Evaluation Count:0 |
evaluated: siblings.last() == (QObject*)this yes Evaluation Count:11 | yes Evaluation Count:7 |
| 0-18 |
1157 | } executed: } Execution Count:18 | 18 |
1158 | if (!isFloating() && layout != 0 && onTop) evaluated: !isFloating() yes Evaluation Count:9 | yes Evaluation Count:12 |
partially evaluated: layout != 0 yes Evaluation Count:9 | no Evaluation Count:0 |
evaluated: onTop yes Evaluation Count:4 | yes Evaluation Count:5 |
| 0-12 |
1159 | layout->raise(this); executed: layout->raise(this); Execution Count:4 | 4 |
1160 | break; executed: break; Execution Count:21 | 21 |
1161 | } | - |
1162 | case QEvent::WindowActivate: | - |
1163 | case QEvent::WindowDeactivate: | - |
1164 | update(qobject_cast<QDockWidgetLayout *>(this->layout())->titleArea()); | - |
1165 | break; executed: break; Execution Count:18 | 18 |
1166 | case QEvent::ContextMenu: | - |
1167 | if (d->state) { never evaluated: d->state | 0 |
1168 | event->accept(); | - |
1169 | return true; never executed: return true; | 0 |
1170 | } | - |
1171 | break; | 0 |
1172 | | - |
1173 | | - |
1174 | case QEvent::MouseButtonPress: | - |
1175 | if (d->mousePressEvent(static_cast<QMouseEvent *>(event))) never evaluated: d->mousePressEvent(static_cast<QMouseEvent *>(event)) | 0 |
1176 | return true; never executed: return true; | 0 |
1177 | break; | 0 |
1178 | case QEvent::MouseButtonDblClick: | - |
1179 | if (d->mouseDoubleClickEvent(static_cast<QMouseEvent *>(event))) never evaluated: d->mouseDoubleClickEvent(static_cast<QMouseEvent *>(event)) | 0 |
1180 | return true; never executed: return true; | 0 |
1181 | break; | 0 |
1182 | case QEvent::MouseMove: | - |
1183 | if (d->mouseMoveEvent(static_cast<QMouseEvent *>(event))) never evaluated: d->mouseMoveEvent(static_cast<QMouseEvent *>(event)) | 0 |
1184 | return true; never executed: return true; | 0 |
1185 | break; | 0 |
1186 | case QEvent::MouseButtonRelease: | - |
1187 | if (d->mouseReleaseEvent(static_cast<QMouseEvent *>(event))) never evaluated: d->mouseReleaseEvent(static_cast<QMouseEvent *>(event)) | 0 |
1188 | return true; never executed: return true; | 0 |
1189 | break; | 0 |
1190 | case QEvent::NonClientAreaMouseMove: | - |
1191 | case QEvent::NonClientAreaMouseButtonPress: | - |
1192 | case QEvent::NonClientAreaMouseButtonRelease: | - |
1193 | case QEvent::NonClientAreaMouseButtonDblClick: | - |
1194 | d->nonClientAreaMouseEvent(static_cast<QMouseEvent*>(event)); | - |
1195 | return true; executed: return true; Execution Count:2 | 2 |
1196 | case QEvent::Move: | - |
1197 | d->moveEvent(static_cast<QMoveEvent*>(event)); | - |
1198 | break; executed: break; Execution Count:37 | 37 |
1199 | case QEvent::Resize: | - |
1200 | | - |
1201 | if (isFloating() && layout != 0 && layout->pluggingWidget != this) evaluated: isFloating() yes Evaluation Count:15 | yes Evaluation Count:20 |
evaluated: layout != 0 yes Evaluation Count:8 | yes Evaluation Count:7 |
partially evaluated: layout->pluggingWidget != this yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-20 |
1202 | d->undockedGeometry = geometry(); executed: d->undockedGeometry = geometry(); Execution Count:8 | 8 |
1203 | break; executed: break; Execution Count:35 | 35 |
1204 | default: | - |
1205 | break; executed: break; Execution Count:671 | 671 |
1206 | } | - |
1207 | return QWidget::event(event); executed: return QWidget::event(event); Execution Count:850 | 850 |
1208 | } | - |
1209 | QAction * QDockWidget::toggleViewAction() const | - |
1210 | { | - |
1211 | const QDockWidgetPrivate * const d = d_func(); | - |
1212 | return d->toggleViewAction; executed: return d->toggleViewAction; Execution Count:1 | 1 |
1213 | } | - |
1214 | void QDockWidget::setTitleBarWidget(QWidget *widget) | - |
1215 | { | - |
1216 | QDockWidgetPrivate * const d = d_func(); | - |
1217 | QDockWidgetLayout *layout | - |
1218 | = qobject_cast<QDockWidgetLayout*>(this->layout()); | - |
1219 | layout->setWidgetForRole(QDockWidgetLayout::TitleBar, widget); | - |
1220 | d->updateButtons(); | - |
1221 | if (isWindow()) { partially evaluated: isWindow() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1222 | | - |
1223 | d->setWindowState(true , true ); | - |
1224 | } executed: } Execution Count:3 | 3 |
1225 | } executed: } Execution Count:3 | 3 |
1226 | QWidget *QDockWidget::titleBarWidget() const | - |
1227 | { | - |
1228 | QDockWidgetLayout *layout | - |
1229 | = qobject_cast<QDockWidgetLayout*>(this->layout()); | - |
1230 | return layout->widgetForRole(QDockWidgetLayout::TitleBar); never executed: return layout->widgetForRole(QDockWidgetLayout::TitleBar); | 0 |
1231 | } | - |
1232 | | - |
1233 | | - |
1234 | | - |
1235 | | - |
| | |