widgets/qstatusbar.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qstatusbar.h" -
43#ifndef QT_NO_STATUSBAR -
44 -
45#include "qlist.h" -
46#include "qdebug.h" -
47#include "qevent.h" -
48#include "qlayout.h" -
49#include "qpainter.h" -
50#include "qtimer.h" -
51#include "qstyle.h" -
52#include "qstyleoption.h" -
53#include "qsizegrip.h" -
54#include "qmainwindow.h" -
55 -
56#ifndef QT_NO_ACCESSIBILITY -
57#include "qaccessible.h" -
58#endif -
59 -
60#include <private/qlayoutengine_p.h> -
61#include <private/qwidget_p.h> -
62 -
63QT_BEGIN_NAMESPACE -
64 -
65class QStatusBarPrivate : public QWidgetPrivate -
66{ -
67 Q_DECLARE_PUBLIC(QStatusBar) -
68public: -
69 QStatusBarPrivate() {} -
70 -
71 struct SBItem { -
72 SBItem(QWidget* widget, int stretch, bool permanent) -
73 : s(stretch), w(widget), p(permanent) {}
executed: }
Execution Count:20
20
74 int s; -
75 QWidget * w; -
76 bool p; -
77 }; -
78 -
79 QList<SBItem *> items; -
80 QString tempItem; -
81 -
82 QBoxLayout * box; -
83 QTimer * timer; -
84 -
85#ifndef QT_NO_SIZEGRIP -
86 QSizeGrip * resizer; -
87 bool showSizeGrip; -
88#endif -
89 -
90 int savedStrut; -
91 -
92#ifdef Q_WS_MAC -
93 QPoint dragStart; -
94#endif -
95 -
96 int indexToLastNonPermanentWidget() const -
97 { -
98 int i = items.size() - 1;
executed (the execution status of this line is deduced): int i = items.size() - 1;
-
99 for (; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:20
20-27
100 SBItem *item = items.at(i);
executed (the execution status of this line is deduced): SBItem *item = items.at(i);
-
101 if (!(item && item->p))
partially evaluated: item
TRUEFALSE
yes
Evaluation Count:27
no
Evaluation Count:0
evaluated: item->p
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:9
0-27
102 break;
executed: break;
Execution Count:9
9
103 }
executed: }
Execution Count:18
18
104 return i;
executed: return i;
Execution Count:29
29
105 } -
106 -
107#ifndef QT_NO_SIZEGRIP -
108 void tryToShowSizeGrip() -
109 { -
110 if (!showSizeGrip)
partially evaluated: !showSizeGrip
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
111 return;
never executed: return;
0
112 showSizeGrip = false;
executed (the execution status of this line is deduced): showSizeGrip = false;
-
113 if (!resizer || resizer->isVisible())
partially evaluated: !resizer
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
partially evaluated: resizer->isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
114 return;
never executed: return;
0
115 resizer->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
executed (the execution status of this line is deduced): resizer->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
-
116 QMetaObject::invokeMethod(resizer, "_q_showIfNotHidden", Qt::DirectConnection);
executed (the execution status of this line is deduced): QMetaObject::invokeMethod(resizer, "_q_showIfNotHidden", Qt::DirectConnection);
-
117 resizer->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
executed (the execution status of this line is deduced): resizer->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
-
118 }
executed: }
Execution Count:7
7
119#endif -
120 -
121 QRect messageRect() const; -
122}; -
123 -
124 -
125QRect QStatusBarPrivate::messageRect() const -
126{ -
127 Q_Q(const QStatusBar);
executed (the execution status of this line is deduced): const QStatusBar * const q = q_func();
-
128 bool rtl = q->layoutDirection() == Qt::RightToLeft;
executed (the execution status of this line is deduced): bool rtl = q->layoutDirection() == Qt::RightToLeft;
-
129 -
130 int left = 6;
executed (the execution status of this line is deduced): int left = 6;
-
131 int right = q->width() - 12;
executed (the execution status of this line is deduced): int right = q->width() - 12;
-
132 -
133#ifndef QT_NO_SIZEGRIP -
134 if (resizer && resizer->isVisible()) {
partially evaluated: resizer
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
evaluated: resizer->isVisible()
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:4
0-21
135 if (rtl)
partially evaluated: rtl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
136 left = resizer->x() + resizer->width();
never executed: left = resizer->x() + resizer->width();
0
137 else -
138 right = resizer->x();
executed: right = resizer->x();
Execution Count:17
17
139 } -
140#endif -
141 -
142 for (int i=0; i<items.size(); ++i) {
evaluated: i<items.size()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:21
18-21
143 QStatusBarPrivate::SBItem* item = items.at(i);
executed (the execution status of this line is deduced): QStatusBarPrivate::SBItem* item = items.at(i);
-
144 if (!item)
partially evaluated: !item
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
0-18
145 break;
never executed: break;
0
146 if (item->p && item->w->isVisible()) {
partially evaluated: item->p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:18
never evaluated: item->w->isVisible()
0-18
147 if (item->p) {
never evaluated: item->p
0
148 if (rtl)
never evaluated: rtl
0
149 left = qMax(left, item->w->x() + item->w->width() + 2);
never executed: left = qMax(left, item->w->x() + item->w->width() + 2);
0
150 else -
151 right = qMin(right, item->w->x() - 2);
never executed: right = qMin(right, item->w->x() - 2);
0
152 } -
153 break;
never executed: break;
0
154 } -
155 }
executed: }
Execution Count:18
18
156 return QRect(left, 0, right-left, q->height());
executed: return QRect(left, 0, right-left, q->height());
Execution Count:21
21
157} -
158 -
159 -
160/*! -
161 \class QStatusBar -
162 \brief The QStatusBar class provides a horizontal bar suitable for -
163 presenting status information. -
164 -
165 \ingroup mainwindow-classes -
166 \ingroup helpsystem -
167 \inmodule QtWidgets -
168 -
169 Each status indicator falls into one of three categories: -
170 -
171 \list -
172 \li \e Temporary - briefly occupies most of the status bar. Used -
173 to explain tool tip texts or menu entries, for example. -
174 \li \e Normal - occupies part of the status bar and may be hidden -
175 by temporary messages. Used to display the page and line -
176 number in a word processor, for example. -
177 \li \e Permanent - is never hidden. Used for important mode -
178 indications, for example, some applications put a Caps Lock -
179 indicator in the status bar. -
180 \endlist -
181 -
182 QStatusBar lets you display all three types of indicators. -
183 -
184 Typically, a request for the status bar functionality occurs in -
185 relation to a QMainWindow object. QMainWindow provides a main -
186 application window, with a menu bar, tool bars, dock widgets \e -
187 and a status bar around a large central widget. The status bar can -
188 be retrieved using the QMainWindow::statusBar() function, and -
189 replaced using the QMainWindow::setStatusBar() function. -
190 -
191 Use the showMessage() slot to display a \e temporary message: -
192 -
193 \snippet mainwindows/dockwidgets/mainwindow.cpp 8 -
194 -
195 To remove a temporary message, use the clearMessage() slot, or set -
196 a time limit when calling showMessage(). For example: -
197 -
198 \snippet mainwindows/dockwidgets/mainwindow.cpp 3 -
199 -
200 Use the currentMessage() function to retrieve the temporary -
201 message currently shown. The QStatusBar class also provide the -
202 messageChanged() signal which is emitted whenever the temporary -
203 status message changes. -
204 -
205 \target permanent message -
206 \e Normal and \e Permanent messages are displayed by creating a -
207 small widget (QLabel, QProgressBar or even QToolButton) and then -
208 adding it to the status bar using the addWidget() or the -
209 addPermanentWidget() function. Use the removeWidget() function to -
210 remove such messages from the status bar. -
211 -
212 \snippet code/src_gui_widgets_qstatusbar.cpp 0 -
213 -
214 By default QStatusBar provides a QSizeGrip in the lower-right -
215 corner. You can disable it using the setSizeGripEnabled() -
216 function. Use the isSizeGripEnabled() function to determine the -
217 current status of the size grip. -
218 -
219 \image fusion-statusbar-sizegrip.png A status bar shown in the Fusion widget style -
220 -
221 \sa QMainWindow, QStatusTipEvent, {fowler}{GUI Design Handbook: -
222 Status Bar}, {Application Example} -
223*/ -
224 -
225 -
226/*! -
227 Constructs a status bar with a size grip and the given \a parent. -
228 -
229 \sa setSizeGripEnabled() -
230*/ -
231QStatusBar::QStatusBar(QWidget * parent) -
232 : QWidget(*new QStatusBarPrivate, parent, 0) -
233{ -
234 Q_D(QStatusBar);
executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
235 d->box = 0;
executed (the execution status of this line is deduced): d->box = 0;
-
236 d->timer = 0;
executed (the execution status of this line is deduced): d->timer = 0;
-
237 -
238#ifndef QT_NO_SIZEGRIP -
239 d->resizer = 0;
executed (the execution status of this line is deduced): d->resizer = 0;
-
240 setSizeGripEnabled(true); // causes reformat()
executed (the execution status of this line is deduced): setSizeGripEnabled(true);
-
241#else -
242 reformat(); -
243#endif -
244}
executed: }
Execution Count:15
15
245 -
246/*! -
247 Destroys this status bar and frees any allocated resources and -
248 child widgets. -
249*/ -
250QStatusBar::~QStatusBar() -
251{ -
252 Q_D(QStatusBar);
executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
253 while (!d->items.isEmpty())
evaluated: !d->items.isEmpty()
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:15
15-20
254 delete d->items.takeFirst();
executed: delete d->items.takeFirst();
Execution Count:20
20
255}
executed: }
Execution Count:15
15
256 -
257 -
258/*! -
259 Adds the given \a widget to this status bar, reparenting the -
260 widget if it isn't already a child of this QStatusBar object. The -
261 \a stretch parameter is used to compute a suitable size for the -
262 given \a widget as the status bar grows and shrinks. The default -
263 stretch factor is 0, i.e giving the widget a minimum of space. -
264 -
265 The widget is located to the far left of the first permanent -
266 widget (see addPermanentWidget()) and may be obscured by temporary -
267 messages. -
268 -
269 \sa insertWidget(), removeWidget(), addPermanentWidget() -
270*/ -
271 -
272void QStatusBar::addWidget(QWidget * widget, int stretch) -
273{ -
274 if (!widget)
partially evaluated: !widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
275 return;
never executed: return;
0
276 insertWidget(d_func()->indexToLastNonPermanentWidget() + 1, widget, stretch);
executed (the execution status of this line is deduced): insertWidget(d_func()->indexToLastNonPermanentWidget() + 1, widget, stretch);
-
277}
executed: }
Execution Count:9
9
278 -
279/*! -
280 \since 4.2 -
281 -
282 Inserts the given \a widget at the given \a index to this status bar, -
283 reparenting the widget if it isn't already a child of this -
284 QStatusBar object. If \a index is out of range, the widget is appended -
285 (in which case it is the actual index of the widget that is returned). -
286 -
287 The \a stretch parameter is used to compute a suitable size for -
288 the given \a widget as the status bar grows and shrinks. The -
289 default stretch factor is 0, i.e giving the widget a minimum of -
290 space. -
291 -
292 The widget is located to the far left of the first permanent -
293 widget (see addPermanentWidget()) and may be obscured by temporary -
294 messages. -
295 -
296 \sa addWidget(), removeWidget(), addPermanentWidget() -
297*/ -
298int QStatusBar::insertWidget(int index, QWidget *widget, int stretch) -
299{ -
300 if (!widget)
partially evaluated: !widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
301 return -1;
never executed: return -1;
0
302 -
303 Q_D(QStatusBar);
executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
304 QStatusBarPrivate::SBItem* item = new QStatusBarPrivate::SBItem(widget, stretch, false);
executed (the execution status of this line is deduced): QStatusBarPrivate::SBItem* item = new QStatusBarPrivate::SBItem(widget, stretch, false);
-
305 -
306 int idx = d->indexToLastNonPermanentWidget();
executed (the execution status of this line is deduced): int idx = d->indexToLastNonPermanentWidget();
-
307 if (index < 0 || index > d->items.size() || (idx >= 0 && index > idx + 1)) {
evaluated: index < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13
partially evaluated: index > d->items.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
evaluated: idx >= 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:9
evaluated: index > idx + 1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
0-13
308 qWarning("QStatusBar::insertWidget: Index out of range (%d), appending widget", index);
executed (the execution status of this line is deduced): QMessageLogger("widgets/qstatusbar.cpp", 308, __PRETTY_FUNCTION__).warning("QStatusBar::insertWidget: Index out of range (%d), appending widget", index);
-
309 index = idx + 1;
executed (the execution status of this line is deduced): index = idx + 1;
-
310 }
executed: }
Execution Count:2
2
311 d->items.insert(index, item);
executed (the execution status of this line is deduced): d->items.insert(index, item);
-
312 -
313 if (!d->tempItem.isEmpty())
partially evaluated: !d->tempItem.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
314 widget->hide();
never executed: widget->hide();
0
315 -
316 reformat();
executed (the execution status of this line is deduced): reformat();
-
317 if (!widget->isHidden() || !widget->testAttribute(Qt::WA_WState_ExplicitShowHide))
partially evaluated: !widget->isHidden()
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
never evaluated: !widget->testAttribute(Qt::WA_WState_ExplicitShowHide)
0-14
318 widget->show();
executed: widget->show();
Execution Count:14
14
319 -
320 return index;
executed: return index;
Execution Count:14
14
321} -
322 -
323/*! -
324 Adds the given \a widget permanently to this status bar, -
325 reparenting the widget if it isn't already a child of this -
326 QStatusBar object. The \a stretch parameter is used to compute a -
327 suitable size for the given \a widget as the status bar grows and -
328 shrinks. The default stretch factor is 0, i.e giving the widget a -
329 minimum of space. -
330 -
331 Permanently means that the widget may not be obscured by temporary -
332 messages. It is is located at the far right of the status bar. -
333 -
334 \sa insertPermanentWidget(), removeWidget(), addWidget() -
335*/ -
336 -
337void QStatusBar::addPermanentWidget(QWidget * widget, int stretch) -
338{ -
339 if (!widget)
partially evaluated: !widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
340 return;
never executed: return;
0
341 insertPermanentWidget(d_func()->items.size(), widget, stretch);
executed (the execution status of this line is deduced): insertPermanentWidget(d_func()->items.size(), widget, stretch);
-
342}
executed: }
Execution Count:1
1
343 -
344 -
345/*! -
346 \since 4.2 -
347 -
348 Inserts the given \a widget at the given \a index permanently to this status bar, -
349 reparenting the widget if it isn't already a child of this -
350 QStatusBar object. If \a index is out of range, the widget is appended -
351 (in which case it is the actual index of the widget that is returned). -
352 -
353 The \a stretch parameter is used to compute a -
354 suitable size for the given \a widget as the status bar grows and -
355 shrinks. The default stretch factor is 0, i.e giving the widget a -
356 minimum of space. -
357 -
358 Permanently means that the widget may not be obscured by temporary -
359 messages. It is is located at the far right of the status bar. -
360 -
361 \sa addPermanentWidget(), removeWidget(), addWidget() -
362*/ -
363int QStatusBar::insertPermanentWidget(int index, QWidget *widget, int stretch) -
364{ -
365 if (!widget)
partially evaluated: !widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
366 return -1;
never executed: return -1;
0
367 -
368 Q_D(QStatusBar);
executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
369 QStatusBarPrivate::SBItem* item = new QStatusBarPrivate::SBItem(widget, stretch, true);
executed (the execution status of this line is deduced): QStatusBarPrivate::SBItem* item = new QStatusBarPrivate::SBItem(widget, stretch, true);
-
370 -
371 int idx = d->indexToLastNonPermanentWidget();
executed (the execution status of this line is deduced): int idx = d->indexToLastNonPermanentWidget();
-
372 if (index < 0 || index > d->items.size() || (idx >= 0 && index <= idx)) {
evaluated: index < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5
evaluated: index > d->items.size()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
evaluated: idx >= 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
evaluated: index <= idx
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-5
373 qWarning("QStatusBar::insertPermanentWidget: Index out of range (%d), appending widget", index);
executed (the execution status of this line is deduced): QMessageLogger("widgets/qstatusbar.cpp", 373, __PRETTY_FUNCTION__).warning("QStatusBar::insertPermanentWidget: Index out of range (%d), appending widget", index);
-
374 index = d->items.size();
executed (the execution status of this line is deduced): index = d->items.size();
-
375 }
executed: }
Execution Count:4
4
376 d->items.insert(index, item);
executed (the execution status of this line is deduced): d->items.insert(index, item);
-
377 -
378 reformat();
executed (the execution status of this line is deduced): reformat();
-
379 if (!widget->isHidden() || !widget->testAttribute(Qt::WA_WState_ExplicitShowHide))
partially evaluated: !widget->isHidden()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
never evaluated: !widget->testAttribute(Qt::WA_WState_ExplicitShowHide)
0-6
380 widget->show();
executed: widget->show();
Execution Count:6
6
381 -
382 return index;
executed: return index;
Execution Count:6
6
383} -
384 -
385/*! -
386 Removes the specified \a widget from the status bar. -
387 -
388 \note This function does not delete the widget but \e hides it. -
389 To add the widget again, you must call both the addWidget() and -
390 show() functions. -
391 -
392 \sa addWidget(), addPermanentWidget(), clearMessage() -
393*/ -
394 -
395void QStatusBar::removeWidget(QWidget *widget) -
396{ -
397 if (!widget)
never evaluated: !widget
0
398 return;
never executed: return;
0
399 -
400 Q_D(QStatusBar);
never executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
401 bool found = false;
never executed (the execution status of this line is deduced): bool found = false;
-
402 QStatusBarPrivate::SBItem* item;
never executed (the execution status of this line is deduced): QStatusBarPrivate::SBItem* item;
-
403 for (int i=0; i<d->items.size(); ++i) {
never evaluated: i<d->items.size()
0
404 item = d->items.at(i);
never executed (the execution status of this line is deduced): item = d->items.at(i);
-
405 if (!item)
never evaluated: !item
0
406 break;
never executed: break;
0
407 if (item->w == widget) {
never evaluated: item->w == widget
0
408 d->items.removeAt(i);
never executed (the execution status of this line is deduced): d->items.removeAt(i);
-
409 item->w->hide();
never executed (the execution status of this line is deduced): item->w->hide();
-
410 delete item;
never executed (the execution status of this line is deduced): delete item;
-
411 found = true;
never executed (the execution status of this line is deduced): found = true;
-
412 break;
never executed: break;
0
413 } -
414 }
never executed: }
0
415 -
416 if (found)
never evaluated: found
0
417 reformat();
never executed: reformat();
0
418#if defined(QT_DEBUG) -
419 else -
420 qDebug("QStatusBar::removeWidget(): Widget not found."); -
421#endif -
422}
never executed: }
0
423 -
424/*! -
425 \property QStatusBar::sizeGripEnabled -
426 -
427 \brief whether the QSizeGrip in the bottom-right corner of the -
428 status bar is enabled -
429 -
430 The size grip is enabled by default. -
431*/ -
432 -
433bool QStatusBar::isSizeGripEnabled() const -
434{ -
435#ifdef QT_NO_SIZEGRIP -
436 return false; -
437#else -
438 Q_D(const QStatusBar);
never executed (the execution status of this line is deduced): const QStatusBarPrivate * const d = d_func();
-
439 return !!d->resizer;
never executed: return !!d->resizer;
0
440#endif -
441} -
442 -
443void QStatusBar::setSizeGripEnabled(bool enabled) -
444{ -
445#ifdef QT_NO_SIZEGRIP -
446 Q_UNUSED(enabled); -
447#else -
448 Q_D(QStatusBar);
executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
449 if (!enabled != !d->resizer) {
evaluated: !enabled != !d->resizer
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:3
3-16
450 if (enabled) {
evaluated: enabled
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
1-15
451 d->resizer = new QSizeGrip(this);
executed (the execution status of this line is deduced): d->resizer = new QSizeGrip(this);
-
452 d->resizer->hide();
executed (the execution status of this line is deduced): d->resizer->hide();
-
453 d->resizer->installEventFilter(this);
executed (the execution status of this line is deduced): d->resizer->installEventFilter(this);
-
454 d->showSizeGrip = true;
executed (the execution status of this line is deduced): d->showSizeGrip = true;
-
455 } else {
executed: }
Execution Count:15
15
456 delete d->resizer;
executed (the execution status of this line is deduced): delete d->resizer;
-
457 d->resizer = 0;
executed (the execution status of this line is deduced): d->resizer = 0;
-
458 d->showSizeGrip = false;
executed (the execution status of this line is deduced): d->showSizeGrip = false;
-
459 }
executed: }
Execution Count:1
1
460 reformat();
executed (the execution status of this line is deduced): reformat();
-
461 if (d->resizer && isVisible())
evaluated: d->resizer
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
partially evaluated: isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
462 d->tryToShowSizeGrip();
never executed: d->tryToShowSizeGrip();
0
463 }
executed: }
Execution Count:16
16
464#endif -
465}
executed: }
Execution Count:19
19
466 -
467 -
468/*! -
469 Changes the status bar's appearance to account for item changes. -
470 -
471 Special subclasses may need this function, but geometry management -
472 will usually take care of any necessary rearrangements. -
473*/ -
474void QStatusBar::reformat() -
475{ -
476 Q_D(QStatusBar);
executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
477 if (d->box)
evaluated: d->box
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:15
15-21
478 delete d->box;
executed: delete d->box;
Execution Count:21
21
479 -
480 QBoxLayout *vbox;
executed (the execution status of this line is deduced): QBoxLayout *vbox;
-
481#ifndef QT_NO_SIZEGRIP -
482 if (d->resizer) {
evaluated: d->resizer
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:1
1-35
483 d->box = new QHBoxLayout(this);
executed (the execution status of this line is deduced): d->box = new QHBoxLayout(this);
-
484 d->box->setMargin(0);
executed (the execution status of this line is deduced): d->box->setMargin(0);
-
485 vbox = new QVBoxLayout;
executed (the execution status of this line is deduced): vbox = new QVBoxLayout;
-
486 d->box->addLayout(vbox);
executed (the execution status of this line is deduced): d->box->addLayout(vbox);
-
487 } else
executed: }
Execution Count:35
35
488#endif -
489 { -
490 vbox = d->box = new QVBoxLayout(this);
executed (the execution status of this line is deduced): vbox = d->box = new QVBoxLayout(this);
-
491 d->box->setMargin(0);
executed (the execution status of this line is deduced): d->box->setMargin(0);
-
492 }
executed: }
Execution Count:1
1
493 vbox->addSpacing(3);
executed (the execution status of this line is deduced): vbox->addSpacing(3);
-
494 QBoxLayout* l = new QHBoxLayout;
executed (the execution status of this line is deduced): QBoxLayout* l = new QHBoxLayout;
-
495 vbox->addLayout(l);
executed (the execution status of this line is deduced): vbox->addLayout(l);
-
496 l->addSpacing(2);
executed (the execution status of this line is deduced): l->addSpacing(2);
-
497 l->setSpacing(6);
executed (the execution status of this line is deduced): l->setSpacing(6);
-
498 -
499 int maxH = fontMetrics().height();
executed (the execution status of this line is deduced): int maxH = fontMetrics().height();
-
500 -
501 int i;
executed (the execution status of this line is deduced): int i;
-
502 QStatusBarPrivate::SBItem* item;
executed (the execution status of this line is deduced): QStatusBarPrivate::SBItem* item;
-
503 for (i=0,item=0; i<d->items.size(); ++i) {
evaluated: i<d->items.size()
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:25
25-38
504 item = d->items.at(i);
executed (the execution status of this line is deduced): item = d->items.at(i);
-
505 if (!item || item->p)
partially evaluated: !item
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:38
evaluated: item->p
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:27
0-38
506 break;
executed: break;
Execution Count:11
11
507 l->addWidget(item->w, item->s);
executed (the execution status of this line is deduced): l->addWidget(item->w, item->s);
-
508 int itemH = qMin(qSmartMinSize(item->w).height(), item->w->maximumHeight());
executed (the execution status of this line is deduced): int itemH = qMin(qSmartMinSize(item->w).height(), item->w->maximumHeight());
-
509 maxH = qMax(maxH, itemH);
executed (the execution status of this line is deduced): maxH = qMax(maxH, itemH);
-
510 }
executed: }
Execution Count:27
27
511 -
512 l->addStretch(0);
executed (the execution status of this line is deduced): l->addStretch(0);
-
513 -
514 for (item=0; i<d->items.size(); ++i) {
evaluated: i<d->items.size()
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:36
24-36
515 item = d->items.at(i);
executed (the execution status of this line is deduced): item = d->items.at(i);
-
516 if (!item)
partially evaluated: !item
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24
0-24
517 break;
never executed: break;
0
518 l->addWidget(item->w, item->s);
executed (the execution status of this line is deduced): l->addWidget(item->w, item->s);
-
519 int itemH = qMin(qSmartMinSize(item->w).height(), item->w->maximumHeight());
executed (the execution status of this line is deduced): int itemH = qMin(qSmartMinSize(item->w).height(), item->w->maximumHeight());
-
520 maxH = qMax(maxH, itemH);
executed (the execution status of this line is deduced): maxH = qMax(maxH, itemH);
-
521 }
executed: }
Execution Count:24
24
522#ifndef QT_NO_SIZEGRIP -
523 if (d->resizer) {
evaluated: d->resizer
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:1
1-35
524 maxH = qMax(maxH, d->resizer->sizeHint().height());
executed (the execution status of this line is deduced): maxH = qMax(maxH, d->resizer->sizeHint().height());
-
525 d->box->addSpacing(1);
executed (the execution status of this line is deduced): d->box->addSpacing(1);
-
526 d->box->addWidget(d->resizer, 0, Qt::AlignBottom);
executed (the execution status of this line is deduced): d->box->addWidget(d->resizer, 0, Qt::AlignBottom);
-
527 }
executed: }
Execution Count:35
35
528#endif -
529 l->addStrut(maxH);
executed (the execution status of this line is deduced): l->addStrut(maxH);
-
530 d->savedStrut = maxH;
executed (the execution status of this line is deduced): d->savedStrut = maxH;
-
531 vbox->addSpacing(2);
executed (the execution status of this line is deduced): vbox->addSpacing(2);
-
532 d->box->activate();
executed (the execution status of this line is deduced): d->box->activate();
-
533 update();
executed (the execution status of this line is deduced): update();
-
534}
executed: }
Execution Count:36
36
535 -
536/*! -
537 -
538 Hides the normal status indications and displays the given \a -
539 message for the specified number of milli-seconds (\a{timeout}). If -
540 \a{timeout} is 0 (default), the \a {message} remains displayed until -
541 the clearMessage() slot is called or until the showMessage() slot is -
542 called again to change the message. -
543 -
544 Note that showMessage() is called to show temporary explanations of -
545 tool tip texts, so passing a \a{timeout} of 0 is not sufficient to -
546 display a \l{permanent message}{permanent message}. -
547 -
548 \sa messageChanged(), currentMessage(), clearMessage() -
549*/ -
550void QStatusBar::showMessage(const QString &message, int timeout) -
551{ -
552 Q_D(QStatusBar);
executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
553 -
554 d->tempItem = message;
executed (the execution status of this line is deduced): d->tempItem = message;
-
555 -
556 if (timeout > 0) {
evaluated: timeout > 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:6
4-6
557 if (!d->timer) {
partially evaluated: !d->timer
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
558 d->timer = new QTimer(this);
executed (the execution status of this line is deduced): d->timer = new QTimer(this);
-
559 connect(d->timer, SIGNAL(timeout()), this, SLOT(clearMessage()));
executed (the execution status of this line is deduced): connect(d->timer, "2""timeout()", this, "1""clearMessage()");
-
560 }
executed: }
Execution Count:4
4
561 d->timer->start(timeout);
executed (the execution status of this line is deduced): d->timer->start(timeout);
-
562 } else if (d->timer) {
executed: }
Execution Count:4
evaluated: d->timer
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5
1-5
563 delete d->timer;
executed (the execution status of this line is deduced): delete d->timer;
-
564 d->timer = 0;
executed (the execution status of this line is deduced): d->timer = 0;
-
565 }
executed: }
Execution Count:1
1
566 -
567 hideOrShow();
executed (the execution status of this line is deduced): hideOrShow();
-
568}
executed: }
Execution Count:10
10
569 -
570/*! -
571 Removes any temporary message being shown. -
572 -
573 \sa currentMessage(), showMessage(), removeWidget() -
574*/ -
575 -
576void QStatusBar::clearMessage() -
577{ -
578 Q_D(QStatusBar);
executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
579 if (d->tempItem.isEmpty())
partially evaluated: d->tempItem.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
580 return;
never executed: return;
0
581 if (d->timer) {
evaluated: d->timer
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
582 qDeleteInEventHandler(d->timer);
executed (the execution status of this line is deduced): qDeleteInEventHandler(d->timer);
-
583 d->timer = 0;
executed (the execution status of this line is deduced): d->timer = 0;
-
584 }
executed: }
Execution Count:3
3
585 d->tempItem.clear();
executed (the execution status of this line is deduced): d->tempItem.clear();
-
586 hideOrShow();
executed (the execution status of this line is deduced): hideOrShow();
-
587}
executed: }
Execution Count:5
5
588 -
589/*! -
590 Returns the temporary message currently shown, -
591 or an empty string if there is no such message. -
592 -
593 \sa showMessage() -
594*/ -
595QString QStatusBar::currentMessage() const -
596{ -
597 Q_D(const QStatusBar);
executed (the execution status of this line is deduced): const QStatusBarPrivate * const d = d_func();
-
598 return d->tempItem;
executed: return d->tempItem;
Execution Count:19
19
599} -
600 -
601/*! -
602 \fn QStatusBar::messageChanged(const QString &message) -
603 -
604 This signal is emitted whenever the temporary status message -
605 changes. The new temporary message is passed in the \a message -
606 parameter which is a null-string when the message has been -
607 removed. -
608 -
609 \sa showMessage(), clearMessage() -
610*/ -
611 -
612/*! -
613 Ensures that the right widgets are visible. -
614 -
615 Used by the showMessage() and clearMessage() functions. -
616*/ -
617void QStatusBar::hideOrShow() -
618{ -
619 Q_D(QStatusBar);
executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
620 bool haveMessage = !d->tempItem.isEmpty();
executed (the execution status of this line is deduced): bool haveMessage = !d->tempItem.isEmpty();
-
621 -
622 QStatusBarPrivate::SBItem* item = 0;
executed (the execution status of this line is deduced): QStatusBarPrivate::SBItem* item = 0;
-
623 for (int i=0; i<d->items.size(); ++i) {
evaluated: i<d->items.size()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:15
13-15
624 item = d->items.at(i);
executed (the execution status of this line is deduced): item = d->items.at(i);
-
625 if (!item || item->p)
partially evaluated: !item
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: item->p
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
626 break;
never executed: break;
0
627 if (haveMessage && item->w->isVisible()) {
evaluated: haveMessage
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:5
evaluated: item->w->isVisible()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5
3-8
628 item->w->hide();
executed (the execution status of this line is deduced): item->w->hide();
-
629 item->w->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
executed (the execution status of this line is deduced): item->w->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
-
630 } else if (!haveMessage && !item->w->testAttribute(Qt::WA_WState_ExplicitShowHide)) {
executed: }
Execution Count:3
evaluated: !haveMessage
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:5
evaluated: !item->w->testAttribute(Qt::WA_WState_ExplicitShowHide)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-5
631 item->w->show();
executed (the execution status of this line is deduced): item->w->show();
-
632 }
executed: }
Execution Count:2
2
633 } -
634 -
635 emit messageChanged(d->tempItem);
executed (the execution status of this line is deduced): messageChanged(d->tempItem);
-
636 -
637#ifndef QT_NO_ACCESSIBILITY -
638 if (QAccessible::isActive()) {
partially evaluated: QAccessible::isActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
639 QAccessibleEvent event(this, QAccessible::NameChanged);
never executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::NameChanged);
-
640 QAccessible::updateAccessibility(&event);
never executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
641 }
never executed: }
0
642#endif -
643 -
644 repaint(d->messageRect());
executed (the execution status of this line is deduced): repaint(d->messageRect());
-
645}
executed: }
Execution Count:15
15
646 -
647/*! -
648 \reimp -
649 */ -
650void QStatusBar::showEvent(QShowEvent *) -
651{ -
652#ifndef QT_NO_SIZEGRIP -
653 Q_D(QStatusBar);
executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
654 if (d->resizer && d->showSizeGrip)
partially evaluated: d->resizer
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
evaluated: d->showSizeGrip
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:4
0-11
655 d->tryToShowSizeGrip();
executed: d->tryToShowSizeGrip();
Execution Count:7
7
656#endif -
657}
executed: }
Execution Count:11
11
658 -
659/*! -
660 \reimp -
661 \fn void QStatusBar::paintEvent(QPaintEvent *event) -
662 -
663 Shows the temporary message, if appropriate, in response to the -
664 paint \a event. -
665*/ -
666void QStatusBar::paintEvent(QPaintEvent *event) -
667{ -
668 Q_D(QStatusBar);
executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
669 bool haveMessage = !d->tempItem.isEmpty();
executed (the execution status of this line is deduced): bool haveMessage = !d->tempItem.isEmpty();
-
670 -
671 QPainter p(this);
executed (the execution status of this line is deduced): QPainter p(this);
-
672 QStyleOption opt;
executed (the execution status of this line is deduced): QStyleOption opt;
-
673 opt.initFrom(this);
executed (the execution status of this line is deduced): opt.initFrom(this);
-
674 style()->drawPrimitive(QStyle::PE_PanelStatusBar, &opt, &p, this);
executed (the execution status of this line is deduced): style()->drawPrimitive(QStyle::PE_PanelStatusBar, &opt, &p, this);
-
675 -
676 for (int i=0; i<d->items.size(); ++i) {
evaluated: i<d->items.size()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:19
7-19
677 QStatusBarPrivate::SBItem* item = d->items.at(i);
executed (the execution status of this line is deduced): QStatusBarPrivate::SBItem* item = d->items.at(i);
-
678 if (item && item->w->isVisible() && (!haveMessage || item->p)) {
partially evaluated: item
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
evaluated: item->w->isVisible()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
partially evaluated: !haveMessage
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
never evaluated: item->p
0-7
679 QRect ir = item->w->geometry().adjusted(-2, -1, 2, 1);
executed (the execution status of this line is deduced): QRect ir = item->w->geometry().adjusted(-2, -1, 2, 1);
-
680 if (event->rect().intersects(ir)) {
evaluated: event->rect().intersects(ir)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
681 QStyleOption opt(0);
executed (the execution status of this line is deduced): QStyleOption opt(0);
-
682 opt.rect = ir;
executed (the execution status of this line is deduced): opt.rect = ir;
-
683 opt.palette = palette();
executed (the execution status of this line is deduced): opt.palette = palette();
-
684 opt.state = QStyle::State_None;
executed (the execution status of this line is deduced): opt.state = QStyle::State_None;
-
685 style()->drawPrimitive(QStyle::PE_FrameStatusBarItem, &opt, &p, item->w);
executed (the execution status of this line is deduced): style()->drawPrimitive(QStyle::PE_FrameStatusBarItem, &opt, &p, item->w);
-
686 }
executed: }
Execution Count:1
1
687 }
executed: }
Execution Count:2
2
688 }
executed: }
Execution Count:7
7
689 if (haveMessage) {
evaluated: haveMessage
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:13
6-13
690 p.setPen(palette().foreground().color());
executed (the execution status of this line is deduced): p.setPen(palette().foreground().color());
-
691 p.drawText(d->messageRect(), Qt::AlignLeading | Qt::AlignVCenter | Qt::TextSingleLine, d->tempItem);
executed (the execution status of this line is deduced): p.drawText(d->messageRect(), Qt::AlignLeading | Qt::AlignVCenter | Qt::TextSingleLine, d->tempItem);
-
692 }
executed: }
Execution Count:6
6
693}
executed: }
Execution Count:19
19
694 -
695/*! -
696 \reimp -
697*/ -
698void QStatusBar::resizeEvent(QResizeEvent * e) -
699{ -
700 QWidget::resizeEvent(e);
executed (the execution status of this line is deduced): QWidget::resizeEvent(e);
-
701}
executed: }
Execution Count:11
11
702 -
703/*! -
704 \reimp -
705*/ -
706 -
707bool QStatusBar::event(QEvent *e) -
708{ -
709 Q_D(QStatusBar);
executed (the execution status of this line is deduced): QStatusBarPrivate * const d = d_func();
-
710 -
711 if (e->type() == QEvent::LayoutRequest
evaluated: e->type() == QEvent::LayoutRequest
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:273
14-273
712 ) { -
713 // Calculate new strut height and call reformat() if it has changed -
714 int maxH = fontMetrics().height();
executed (the execution status of this line is deduced): int maxH = fontMetrics().height();
-
715 -
716 QStatusBarPrivate::SBItem* item = 0;
executed (the execution status of this line is deduced): QStatusBarPrivate::SBItem* item = 0;
-
717 for (int i=0; i<d->items.size(); ++i) {
evaluated: i<d->items.size()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:14
6-14
718 item = d->items.at(i);
executed (the execution status of this line is deduced): item = d->items.at(i);
-
719 if (!item)
partially evaluated: !item
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
720 break;
never executed: break;
0
721 int itemH = qMin(qSmartMinSize(item->w).height(), item->w->maximumHeight());
executed (the execution status of this line is deduced): int itemH = qMin(qSmartMinSize(item->w).height(), item->w->maximumHeight());
-
722 maxH = qMax(maxH, itemH);
executed (the execution status of this line is deduced): maxH = qMax(maxH, itemH);
-
723 }
executed: }
Execution Count:6
6
724 -
725#ifndef QT_NO_SIZEGRIP -
726 if (d->resizer)
evaluated: d->resizer
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1
1-13
727 maxH = qMax(maxH, d->resizer->sizeHint().height());
executed: maxH = qMax(maxH, d->resizer->sizeHint().height());
Execution Count:13
13
728#endif -
729 -
730 if (maxH != d->savedStrut)
partially evaluated: maxH != d->savedStrut
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
731 reformat();
never executed: reformat();
0
732 else -
733 update();
executed: update();
Execution Count:14
14
734 } -
735 if (e->type() == QEvent::ChildRemoved) {
evaluated: e->type() == QEvent::ChildRemoved
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:261
26-261
736 QStatusBarPrivate::SBItem* item = 0;
executed (the execution status of this line is deduced): QStatusBarPrivate::SBItem* item = 0;
-
737 for (int i=0; i<d->items.size(); ++i) {
evaluated: i<d->items.size()
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:26
26-55
738 item = d->items.at(i);
executed (the execution status of this line is deduced): item = d->items.at(i);
-
739 if (!item)
partially evaluated: !item
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:55
0-55
740 break;
never executed: break;
0
741 if (item->w == ((QChildEvent*)e)->child()) {
partially evaluated: item->w == ((QChildEvent*)e)->child()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:55
0-55
742 d->items.removeAt(i);
never executed (the execution status of this line is deduced): d->items.removeAt(i);
-
743 delete item;
never executed (the execution status of this line is deduced): delete item;
-
744 }
never executed: }
0
745 }
executed: }
Execution Count:55
55
746 }
executed: }
Execution Count:26
26
747 -
748// On Mac OS X Leopard it is possible to drag the window by clicking -
749// on the tool bar on most applications. -
750#ifndef Q_WS_MAC -
751 return QWidget::event(e);
executed: return QWidget::event(e);
Execution Count:287
287
752#else -
753 if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4) -
754 return QWidget::event(e); -
755 -
756 // Enable drag-click only if the status bar is the status bar for a -
757 // QMainWindow with a unifed toolbar. -
758 if (parent() == 0 || qobject_cast<QMainWindow *>(parent()) == 0 || -
759 qobject_cast<QMainWindow *>(parent())->unifiedTitleAndToolBarOnMac() == false ) -
760 return QWidget::event(e); -
761 -
762 // Check for mouse events. -
763 QMouseEvent *mouseEvent; -
764 if (e->type() == QEvent::MouseButtonPress || -
765 e->type() == QEvent::MouseMove || -
766 e->type() == QEvent::MouseButtonRelease) { -
767 mouseEvent = static_cast <QMouseEvent*>(e); -
768 } else { -
769 return QWidget::event(e); -
770 } -
771 -
772 // The following is a standard mouse drag handler. -
773 if (e->type() == QEvent::MouseButtonPress && (mouseEvent->button() == Qt::LeftButton)) { -
774 d->dragStart = mouseEvent->pos(); -
775 } else if (e->type() == QEvent::MouseMove){ -
776 if (d->dragStart == QPoint()) -
777 return QWidget::event(e); -
778 QPoint pos = mouseEvent->pos(); -
779 QPoint delta = (pos - d->dragStart); -
780 window()->move(window()->pos() + delta); -
781 } else if (e->type() == QEvent::MouseButtonRelease && (mouseEvent->button() == Qt::LeftButton)){ -
782 d->dragStart = QPoint(); -
783 } else { -
784 return QWidget::event(e); -
785 } -
786 -
787 return true; -
788#endif -
789} -
790 -
791QT_END_NAMESPACE -
792 -
793#endif -
794 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial