Line | Source Code | Coverage |
---|
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 "qabstractbutton.h" | - |
43 | #include "qabstractitemview.h" | - |
44 | #include "qbuttongroup.h" | - |
45 | #include "qabstractbutton_p.h" | - |
46 | #include "qevent.h" | - |
47 | #include "qpainter.h" | - |
48 | #include "qapplication.h" | - |
49 | #include "qstyle.h" | - |
50 | #include "qaction.h" | - |
51 | #ifndef QT_NO_ACCESSIBILITY | - |
52 | #include "qaccessible.h" | - |
53 | #endif | - |
54 | | - |
55 | QT_BEGIN_NAMESPACE | - |
56 | | - |
57 | #define AUTO_REPEAT_DELAY 300 | - |
58 | #define AUTO_REPEAT_INTERVAL 100 | - |
59 | | - |
60 | Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets(); | - |
61 | | - |
62 | /*! | - |
63 | \class QAbstractButton | - |
64 | | - |
65 | \brief The QAbstractButton class is the abstract base class of | - |
66 | button widgets, providing functionality common to buttons. | - |
67 | | - |
68 | \ingroup abstractwidgets | - |
69 | \inmodule QtWidgets | - |
70 | | - |
71 | This class implements an \e abstract button. | - |
72 | Subclasses of this class handle user actions, and specify how the button | - |
73 | is drawn. | - |
74 | | - |
75 | QAbstractButton provides support for both push buttons and checkable | - |
76 | (toggle) buttons. Checkable buttons are implemented in the QRadioButton | - |
77 | and QCheckBox classes. Push buttons are implemented in the | - |
78 | QPushButton and QToolButton classes; these also provide toggle | - |
79 | behavior if required. | - |
80 | | - |
81 | Any button can display a label containing text and an icon. setText() | - |
82 | sets the text; setIcon() sets the icon. If a button is disabled, its label | - |
83 | is changed to give the button a "disabled" appearance. | - |
84 | | - |
85 | If the button is a text button with a string containing an | - |
86 | ampersand ('&'), QAbstractButton automatically creates a shortcut | - |
87 | key. For example: | - |
88 | | - |
89 | \snippet code/src_gui_widgets_qabstractbutton.cpp 0 | - |
90 | | - |
91 | The \uicontrol Alt+C shortcut is assigned to the button, i.e., when the | - |
92 | user presses \uicontrol Alt+C the button will call animateClick(). See | - |
93 | the \l {QShortcut#mnemonic}{QShortcut} documentation for details. To | - |
94 | display an actual ampersand, use '&&'. | - |
95 | | - |
96 | You can also set a custom shortcut key using the setShortcut() | - |
97 | function. This is useful mostly for buttons that do not have any | - |
98 | text, and therefore can't have any automatic shortcut. | - |
99 | | - |
100 | \snippet code/src_gui_widgets_qabstractbutton.cpp 1 | - |
101 | | - |
102 | All the buttons provided by Qt (QPushButton, QToolButton, | - |
103 | QCheckBox, and QRadioButton) can display both \l text and \l{icon}{icons}. | - |
104 | | - |
105 | A button can be made the default button in a dialog by means of | - |
106 | QPushButton::setDefault() and QPushButton::setAutoDefault(). | - |
107 | | - |
108 | QAbstractButton provides most of the states used for buttons: | - |
109 | | - |
110 | \list | - |
111 | | - |
112 | \li isDown() indicates whether the button is \e pressed down. | - |
113 | | - |
114 | \li isChecked() indicates whether the button is \e checked. Only | - |
115 | checkable buttons can be checked and unchecked (see below). | - |
116 | | - |
117 | \li isEnabled() indicates whether the button can be pressed by the | - |
118 | user. \note As opposed to other widgets, buttons derived from | - |
119 | QAbstractButton accept mouse and context menu events | - |
120 | when disabled. | - |
121 | | - |
122 | \li setAutoRepeat() sets whether the button will auto-repeat if the | - |
123 | user holds it down. \l autoRepeatDelay and \l autoRepeatInterval | - |
124 | define how auto-repetition is done. | - |
125 | | - |
126 | \li setCheckable() sets whether the button is a toggle button or not. | - |
127 | | - |
128 | \endlist | - |
129 | | - |
130 | The difference between isDown() and isChecked() is as follows. | - |
131 | When the user clicks a toggle button to check it, the button is first | - |
132 | \e pressed then released into the \e checked state. When the user | - |
133 | clicks it again (to uncheck it), the button moves first to the | - |
134 | \e pressed state, then to the \e unchecked state (isChecked() and | - |
135 | isDown() are both false). | - |
136 | | - |
137 | QAbstractButton provides four signals: | - |
138 | | - |
139 | \list 1 | - |
140 | | - |
141 | \li pressed() is emitted when the left mouse button is pressed while | - |
142 | the mouse cursor is inside the button. | - |
143 | | - |
144 | \li released() is emitted when the left mouse button is released. | - |
145 | | - |
146 | \li clicked() is emitted when the button is first pressed and then | - |
147 | released, when the shortcut key is typed, or when click() or | - |
148 | animateClick() is called. | - |
149 | | - |
150 | \li toggled() is emitted when the state of a toggle button changes. | - |
151 | | - |
152 | \endlist | - |
153 | | - |
154 | To subclass QAbstractButton, you must reimplement at least | - |
155 | paintEvent() to draw the button's outline and its text or pixmap. It | - |
156 | is generally advisable to reimplement sizeHint() as well, and | - |
157 | sometimes hitButton() (to determine whether a button press is within | - |
158 | the button). For buttons with more than two states (like tri-state | - |
159 | buttons), you will also have to reimplement checkStateSet() and | - |
160 | nextCheckState(). | - |
161 | | - |
162 | \sa QButtonGroup | - |
163 | */ | - |
164 | | - |
165 | QAbstractButtonPrivate::QAbstractButtonPrivate(QSizePolicy::ControlType type) | - |
166 | : | - |
167 | #ifndef QT_NO_SHORTCUT | - |
168 | shortcutId(0), | - |
169 | #endif | - |
170 | checkable(false), checked(false), autoRepeat(false), autoExclusive(false), | - |
171 | down(false), blockRefresh(false), pressed(false), | - |
172 | #ifndef QT_NO_BUTTONGROUP | - |
173 | group(0), | - |
174 | #endif | - |
175 | autoRepeatDelay(AUTO_REPEAT_DELAY), | - |
176 | autoRepeatInterval(AUTO_REPEAT_INTERVAL), | - |
177 | controlType(type) | - |
178 | {} executed: } Execution Count:3970 | 3970 |
179 | | - |
180 | #ifndef QT_NO_BUTTONGROUP | - |
181 | | - |
182 | class QButtonGroupPrivate: public QObjectPrivate | - |
183 | { | - |
184 | Q_DECLARE_PUBLIC(QButtonGroup) | - |
185 | | - |
186 | public: | - |
187 | QButtonGroupPrivate():exclusive(true){} executed: } Execution Count:9 | 9 |
188 | QList<QAbstractButton *> buttonList; | - |
189 | QPointer<QAbstractButton> checkedButton; | - |
190 | void detectCheckedButton(); | - |
191 | void notifyChecked(QAbstractButton *button); | - |
192 | bool exclusive; | - |
193 | QHash<QAbstractButton*, int> mapping; | - |
194 | }; | - |
195 | | - |
196 | QButtonGroup::QButtonGroup(QObject *parent) | - |
197 | : QObject(*new QButtonGroupPrivate, parent) | - |
198 | { | - |
199 | } executed: } Execution Count:9 | 9 |
200 | | - |
201 | QButtonGroup::~QButtonGroup() | - |
202 | { | - |
203 | Q_D(QButtonGroup); executed (the execution status of this line is deduced): QButtonGroupPrivate * const d = d_func(); | - |
204 | for (int i = 0; i < d->buttonList.count(); ++i) evaluated: i < d->buttonList.count() yes Evaluation Count:10 | yes Evaluation Count:9 |
| 9-10 |
205 | d->buttonList.at(i)->d_func()->group = 0; executed: d->buttonList.at(i)->d_func()->group = 0; Execution Count:10 | 10 |
206 | } executed: } Execution Count:9 | 9 |
207 | | - |
208 | | - |
209 | bool QButtonGroup::exclusive() const | - |
210 | { | - |
211 | Q_D(const QButtonGroup); never executed (the execution status of this line is deduced): const QButtonGroupPrivate * const d = d_func(); | - |
212 | return d->exclusive; never executed: return d->exclusive; | 0 |
213 | } | - |
214 | | - |
215 | void QButtonGroup::setExclusive(bool exclusive) | - |
216 | { | - |
217 | Q_D(QButtonGroup); executed (the execution status of this line is deduced): QButtonGroupPrivate * const d = d_func(); | - |
218 | d->exclusive = exclusive; executed (the execution status of this line is deduced): d->exclusive = exclusive; | - |
219 | } executed: } Execution Count:4 | 4 |
220 | | - |
221 | | - |
222 | void QButtonGroup::addButton(QAbstractButton *button, int id) | - |
223 | { | - |
224 | Q_D(QButtonGroup); executed (the execution status of this line is deduced): QButtonGroupPrivate * const d = d_func(); | - |
225 | if (QButtonGroup *previous = button->d_func()->group) partially evaluated: QButtonGroup *previous = button->d_func()->group no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
226 | previous->removeButton(button); never executed: previous->removeButton(button); | 0 |
227 | button->d_func()->group = this; executed (the execution status of this line is deduced): button->d_func()->group = this; | - |
228 | d->buttonList.append(button); executed (the execution status of this line is deduced): d->buttonList.append(button); | - |
229 | if (id == -1) { evaluated: id == -1 yes Evaluation Count:11 | yes Evaluation Count:11 |
| 11 |
230 | QList<int> ids = d->mapping.values(); executed (the execution status of this line is deduced): QList<int> ids = d->mapping.values(); | - |
231 | if (ids.isEmpty()) evaluated: ids.isEmpty() yes Evaluation Count:6 | yes Evaluation Count:5 |
| 5-6 |
232 | d->mapping[button] = -2; executed: d->mapping[button] = -2; Execution Count:6 | 6 |
233 | else { | - |
234 | qSort(ids); executed (the execution status of this line is deduced): qSort(ids); | - |
235 | d->mapping[button] = ids.first()-1; executed (the execution status of this line is deduced): d->mapping[button] = ids.first()-1; | - |
236 | } executed: } Execution Count:5 | 5 |
237 | } else { | - |
238 | d->mapping[button] = id; executed (the execution status of this line is deduced): d->mapping[button] = id; | - |
239 | } executed: } Execution Count:11 | 11 |
240 | | - |
241 | if (d->exclusive && button->isChecked()) evaluated: d->exclusive yes Evaluation Count:20 | yes Evaluation Count:2 |
partially evaluated: button->isChecked() no Evaluation Count:0 | yes Evaluation Count:20 |
| 0-20 |
242 | button->d_func()->notifyChecked(); never executed: button->d_func()->notifyChecked(); | 0 |
243 | } executed: } Execution Count:22 | 22 |
244 | | - |
245 | void QButtonGroup::removeButton(QAbstractButton *button) | - |
246 | { | - |
247 | Q_D(QButtonGroup); executed (the execution status of this line is deduced): QButtonGroupPrivate * const d = d_func(); | - |
248 | if (d->checkedButton == button) { evaluated: d->checkedButton == button yes Evaluation Count:3 | yes Evaluation Count:9 |
| 3-9 |
249 | d->detectCheckedButton(); executed (the execution status of this line is deduced): d->detectCheckedButton(); | - |
250 | } executed: } Execution Count:3 | 3 |
251 | if (button->d_func()->group == this) { partially evaluated: button->d_func()->group == this yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
252 | button->d_func()->group = 0; executed (the execution status of this line is deduced): button->d_func()->group = 0; | - |
253 | d->buttonList.removeAll(button); executed (the execution status of this line is deduced): d->buttonList.removeAll(button); | - |
254 | d->mapping.remove(button); executed (the execution status of this line is deduced): d->mapping.remove(button); | - |
255 | } executed: } Execution Count:12 | 12 |
256 | } executed: } Execution Count:12 | 12 |
257 | | - |
258 | QList<QAbstractButton*> QButtonGroup::buttons() const | - |
259 | { | - |
260 | Q_D(const QButtonGroup); executed (the execution status of this line is deduced): const QButtonGroupPrivate * const d = d_func(); | - |
261 | return d->buttonList; executed: return d->buttonList; Execution Count:1 | 1 |
262 | } | - |
263 | | - |
264 | QAbstractButton *QButtonGroup::checkedButton() const | - |
265 | { | - |
266 | Q_D(const QButtonGroup); executed (the execution status of this line is deduced): const QButtonGroupPrivate * const d = d_func(); | - |
267 | return d->checkedButton; executed: return d->checkedButton; Execution Count:9 | 9 |
268 | } | - |
269 | | - |
270 | QAbstractButton *QButtonGroup::button(int id) const | - |
271 | { | - |
272 | Q_D(const QButtonGroup); never executed (the execution status of this line is deduced): const QButtonGroupPrivate * const d = d_func(); | - |
273 | return d->mapping.key(id); never executed: return d->mapping.key(id); | 0 |
274 | } | - |
275 | | - |
276 | void QButtonGroup::setId(QAbstractButton *button, int id) | - |
277 | { | - |
278 | Q_D(QButtonGroup); never executed (the execution status of this line is deduced): QButtonGroupPrivate * const d = d_func(); | - |
279 | if (button && id != -1) never evaluated: button never evaluated: id != -1 | 0 |
280 | d->mapping[button] = id; never executed: d->mapping[button] = id; | 0 |
281 | } | 0 |
282 | | - |
283 | int QButtonGroup::id(QAbstractButton *button) const | - |
284 | { | - |
285 | Q_D(const QButtonGroup); executed (the execution status of this line is deduced): const QButtonGroupPrivate * const d = d_func(); | - |
286 | return d->mapping.value(button, -1); executed: return d->mapping.value(button, -1); Execution Count:45 | 45 |
287 | } | - |
288 | | - |
289 | int QButtonGroup::checkedId() const | - |
290 | { | - |
291 | Q_D(const QButtonGroup); never executed (the execution status of this line is deduced): const QButtonGroupPrivate * const d = d_func(); | - |
292 | return d->mapping.value(d->checkedButton, -1); never executed: return d->mapping.value(d->checkedButton, -1); | 0 |
293 | } | - |
294 | | - |
295 | // detect a checked button other than the current one | - |
296 | void QButtonGroupPrivate::detectCheckedButton() | - |
297 | { | - |
298 | QAbstractButton *previous = checkedButton; executed (the execution status of this line is deduced): QAbstractButton *previous = checkedButton; | - |
299 | checkedButton = 0; executed (the execution status of this line is deduced): checkedButton = 0; | - |
300 | if (exclusive) evaluated: exclusive yes Evaluation Count:3 | yes Evaluation Count:2 |
| 2-3 |
301 | return; executed: return; Execution Count:3 | 3 |
302 | for (int i = 0; i < buttonList.count(); i++) { evaluated: i < buttonList.count() yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
303 | if (buttonList.at(i) != previous && buttonList.at(i)->isChecked()) { evaluated: buttonList.at(i) != previous yes Evaluation Count:2 | yes Evaluation Count:1 |
evaluated: buttonList.at(i)->isChecked() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1-2 |
304 | checkedButton = buttonList.at(i); executed (the execution status of this line is deduced): checkedButton = buttonList.at(i); | - |
305 | return; executed: return; Execution Count:1 | 1 |
306 | } | - |
307 | } executed: } Execution Count:2 | 2 |
308 | } executed: } Execution Count:1 | 1 |
309 | | - |
310 | #endif // QT_NO_BUTTONGROUP | - |
311 | | - |
312 | QList<QAbstractButton *>QAbstractButtonPrivate::queryButtonList() const | - |
313 | { | - |
314 | #ifndef QT_NO_BUTTONGROUP | - |
315 | if (group) evaluated: group yes Evaluation Count:18 | yes Evaluation Count:38 |
| 18-38 |
316 | return group->d_func()->buttonList; executed: return group->d_func()->buttonList; Execution Count:18 | 18 |
317 | #endif | - |
318 | | - |
319 | QList<QAbstractButton*>candidates = parent->findChildren<QAbstractButton *>(); executed (the execution status of this line is deduced): QList<QAbstractButton*>candidates = parent->findChildren<QAbstractButton *>(); | - |
320 | if (autoExclusive) { evaluated: autoExclusive yes Evaluation Count:22 | yes Evaluation Count:16 |
| 16-22 |
321 | for (int i = candidates.count() - 1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:47 | yes Evaluation Count:22 |
| 22-47 |
322 | QAbstractButton *candidate = candidates.at(i); executed (the execution status of this line is deduced): QAbstractButton *candidate = candidates.at(i); | - |
323 | if (!candidate->autoExclusive() evaluated: !candidate->autoExclusive() yes Evaluation Count:10 | yes Evaluation Count:37 |
| 10-37 |
324 | #ifndef QT_NO_BUTTONGROUP executed (the execution status of this line is deduced):
| - |
325 | || candidate->group() partially evaluated: candidate->group() no Evaluation Count:0 | yes Evaluation Count:37 |
| 0-37 |
326 | #endif | - |
327 | ) | - |
328 | candidates.removeAt(i); executed: candidates.removeAt(i); Execution Count:10 | 10 |
329 | } executed: } Execution Count:47 | 47 |
330 | } executed: } Execution Count:22 | 22 |
331 | return candidates; executed: return candidates; Execution Count:38 | 38 |
332 | } | - |
333 | | - |
334 | QAbstractButton *QAbstractButtonPrivate::queryCheckedButton() const | - |
335 | { | - |
336 | #ifndef QT_NO_BUTTONGROUP | - |
337 | if (group) evaluated: group yes Evaluation Count:12 | yes Evaluation Count:30 |
| 12-30 |
338 | return group->d_func()->checkedButton; executed: return group->d_func()->checkedButton; Execution Count:12 | 12 |
339 | #endif | - |
340 | | - |
341 | Q_Q(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButton * const q = q_func(); | - |
342 | QList<QAbstractButton *> buttonList = queryButtonList(); executed (the execution status of this line is deduced): QList<QAbstractButton *> buttonList = queryButtonList(); | - |
343 | if (!autoExclusive || buttonList.count() == 1) // no group evaluated: !autoExclusive yes Evaluation Count:16 | yes Evaluation Count:14 |
evaluated: buttonList.count() == 1 yes Evaluation Count:8 | yes Evaluation Count:6 |
| 6-16 |
344 | return 0; executed: return 0; Execution Count:24 | 24 |
345 | | - |
346 | for (int i = 0; i < buttonList.count(); ++i) { evaluated: i < buttonList.count() yes Evaluation Count:12 | yes Evaluation Count:6 |
| 6-12 |
347 | QAbstractButton *b = buttonList.at(i); executed (the execution status of this line is deduced): QAbstractButton *b = buttonList.at(i); | - |
348 | if (b->d_func()->checked && b != q) evaluated: b->d_func()->checked yes Evaluation Count:6 | yes Evaluation Count:6 |
partially evaluated: b != q no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
349 | return b; never executed: return b; | 0 |
350 | } executed: } Execution Count:12 | 12 |
351 | return checked ? const_cast<QAbstractButton *>(q) : 0; executed: return checked ? const_cast<QAbstractButton *>(q) : 0; Execution Count:6 | 6 |
352 | } | - |
353 | | - |
354 | void QAbstractButtonPrivate::notifyChecked() | - |
355 | { | - |
356 | #ifndef QT_NO_BUTTONGROUP | - |
357 | Q_Q(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButton * const q = q_func(); | - |
358 | if (group) { evaluated: group yes Evaluation Count:16 | yes Evaluation Count:27 |
| 16-27 |
359 | QAbstractButton *previous = group->d_func()->checkedButton; executed (the execution status of this line is deduced): QAbstractButton *previous = group->d_func()->checkedButton; | - |
360 | group->d_func()->checkedButton = q; executed (the execution status of this line is deduced): group->d_func()->checkedButton = q; | - |
361 | if (group->d_func()->exclusive && previous && previous != q) evaluated: group->d_func()->exclusive yes Evaluation Count:14 | yes Evaluation Count:2 |
evaluated: previous yes Evaluation Count:9 | yes Evaluation Count:5 |
partially evaluated: previous != q yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-14 |
362 | previous->nextCheckState(); executed: previous->nextCheckState(); Execution Count:9 | 9 |
363 | } else executed: } Execution Count:16 | 16 |
364 | #endif | - |
365 | if (autoExclusive) { evaluated: autoExclusive yes Evaluation Count:11 | yes Evaluation Count:16 |
| 11-16 |
366 | if (QAbstractButton *b = queryCheckedButton()) evaluated: QAbstractButton *b = queryCheckedButton() yes Evaluation Count:3 | yes Evaluation Count:8 |
| 3-8 |
367 | b->setChecked(false); executed: b->setChecked(false); Execution Count:3 | 3 |
368 | } executed: } Execution Count:11 | 11 |
369 | } | - |
370 | | - |
371 | void QAbstractButtonPrivate::moveFocus(int key) | - |
372 | { | - |
373 | QList<QAbstractButton *> buttonList = queryButtonList();; executed (the execution status of this line is deduced): QList<QAbstractButton *> buttonList = queryButtonList();; | - |
374 | #ifndef QT_NO_BUTTONGROUP | - |
375 | bool exclusive = group ? group->d_func()->exclusive : autoExclusive; evaluated: group yes Evaluation Count:9 | yes Evaluation Count:4 |
| 4-9 |
376 | #else | - |
377 | bool exclusive = autoExclusive; | - |
378 | #endif | - |
379 | QWidget *f = QApplication::focusWidget(); executed (the execution status of this line is deduced): QWidget *f = QApplication::focusWidget(); | - |
380 | QAbstractButton *fb = qobject_cast<QAbstractButton *>(f); executed (the execution status of this line is deduced): QAbstractButton *fb = qobject_cast<QAbstractButton *>(f); | - |
381 | if (!fb || !buttonList.contains(fb)) partially evaluated: !fb no Evaluation Count:0 | yes Evaluation Count:13 |
partially evaluated: !buttonList.contains(fb) no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
382 | return; | 0 |
383 | | - |
384 | QAbstractButton *candidate = 0; executed (the execution status of this line is deduced): QAbstractButton *candidate = 0; | - |
385 | int bestScore = -1; executed (the execution status of this line is deduced): int bestScore = -1; | - |
386 | QRect target = f->rect().translated(f->mapToGlobal(QPoint(0,0))); executed (the execution status of this line is deduced): QRect target = f->rect().translated(f->mapToGlobal(QPoint(0,0))); | - |
387 | QPoint goal = target.center(); executed (the execution status of this line is deduced): QPoint goal = target.center(); | - |
388 | uint focus_flag = qt_tab_all_widgets() ? Qt::TabFocus : Qt::StrongFocus; partially evaluated: qt_tab_all_widgets() yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
389 | | - |
390 | for (int i = 0; i < buttonList.count(); ++i) { evaluated: i < buttonList.count() yes Evaluation Count:35 | yes Evaluation Count:13 |
| 13-35 |
391 | QAbstractButton *button = buttonList.at(i); executed (the execution status of this line is deduced): QAbstractButton *button = buttonList.at(i); | - |
392 | if (button != f && button->window() == f->window() && button->isEnabled() && !button->isHidden() && evaluated: button != f yes Evaluation Count:22 | yes Evaluation Count:13 |
partially evaluated: button->window() == f->window() yes Evaluation Count:22 | no Evaluation Count:0 |
partially evaluated: button->isEnabled() yes Evaluation Count:22 | no Evaluation Count:0 |
partially evaluated: !button->isHidden() yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-22 |
393 | (autoExclusive || (button->focusPolicy() & focus_flag) == focus_flag)) { evaluated: autoExclusive yes Evaluation Count:18 | yes Evaluation Count:4 |
partially evaluated: (button->focusPolicy() & focus_flag) == focus_flag yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-18 |
394 | QRect buttonRect = button->rect().translated(button->mapToGlobal(QPoint(0,0))); executed (the execution status of this line is deduced): QRect buttonRect = button->rect().translated(button->mapToGlobal(QPoint(0,0))); | - |
395 | QPoint p = buttonRect.center(); executed (the execution status of this line is deduced): QPoint p = buttonRect.center(); | - |
396 | | - |
397 | //Priority to widgets that overlap on the same coordinate. | - |
398 | //In that case, the distance in the direction will be used as significant score, | - |
399 | //take also in account orthogonal distance in case two widget are in the same distance. | - |
400 | int score; executed (the execution status of this line is deduced): int score; | - |
401 | if ((buttonRect.x() < target.right() && target.x() < buttonRect.right()) evaluated: buttonRect.x() < target.right() yes Evaluation Count:18 | yes Evaluation Count:4 |
evaluated: target.x() < buttonRect.right() yes Evaluation Count:12 | yes Evaluation Count:6 |
| 4-18 |
402 | && (key == Qt::Key_Up || key == Qt::Key_Down)) { evaluated: key == Qt::Key_Up yes Evaluation Count:2 | yes Evaluation Count:10 |
partially evaluated: key == Qt::Key_Down yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
403 | //one item's is at the vertical of the other | - |
404 | score = (qAbs(p.y() - goal.y()) << 16) + qAbs(p.x() - goal.x()); executed (the execution status of this line is deduced): score = (qAbs(p.y() - goal.y()) << 16) + qAbs(p.x() - goal.x()); | - |
405 | } else if ((buttonRect.y() < target.bottom() && target.y() < buttonRect.bottom()) executed: } Execution Count:12 partially evaluated: buttonRect.y() < target.bottom() yes Evaluation Count:10 | no Evaluation Count:0 |
partially evaluated: target.y() < buttonRect.bottom() yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-12 |
406 | && (key == Qt::Key_Left || key == Qt::Key_Right) ) { evaluated: key == Qt::Key_Left yes Evaluation Count:4 | yes Evaluation Count:6 |
partially evaluated: key == Qt::Key_Right yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
407 | //one item's is at the horizontal of the other | - |
408 | score = (qAbs(p.x() - goal.x()) << 16) + qAbs(p.y() - goal.y()); executed (the execution status of this line is deduced): score = (qAbs(p.x() - goal.x()) << 16) + qAbs(p.y() - goal.y()); | - |
409 | } else { executed: } Execution Count:10 | 10 |
410 | score = (1 << 30) + (p.y() - goal.y()) * (p.y() - goal.y()) + (p.x() - goal.x()) * (p.x() - goal.x()); never executed (the execution status of this line is deduced): score = (1 << 30) + (p.y() - goal.y()) * (p.y() - goal.y()) + (p.x() - goal.x()) * (p.x() - goal.x()); | - |
411 | } | 0 |
412 | | - |
413 | if (score > bestScore && candidate) evaluated: score > bestScore yes Evaluation Count:21 | yes Evaluation Count:1 |
evaluated: candidate yes Evaluation Count:4 | yes Evaluation Count:17 |
| 1-21 |
414 | continue; executed: continue; Execution Count:4 | 4 |
415 | | - |
416 | switch(key) { | - |
417 | case Qt::Key_Up: | - |
418 | if (p.y() < goal.y()) { evaluated: p.y() < goal.y() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
419 | candidate = button; executed (the execution status of this line is deduced): candidate = button; | - |
420 | bestScore = score; executed (the execution status of this line is deduced): bestScore = score; | - |
421 | } executed: } Execution Count:1 | 1 |
422 | break; executed: break; Execution Count:2 | 2 |
423 | case Qt::Key_Down: | - |
424 | if (p.y() > goal.y()) { evaluated: p.y() > goal.y() yes Evaluation Count:5 | yes Evaluation Count:3 |
| 3-5 |
425 | candidate = button; executed (the execution status of this line is deduced): candidate = button; | - |
426 | bestScore = score; executed (the execution status of this line is deduced): bestScore = score; | - |
427 | } executed: } Execution Count:5 | 5 |
428 | break; executed: break; Execution Count:8 | 8 |
429 | case Qt::Key_Left: | - |
430 | if (p.x() < goal.x()) { partially evaluated: p.x() < goal.x() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
431 | candidate = button; executed (the execution status of this line is deduced): candidate = button; | - |
432 | bestScore = score; executed (the execution status of this line is deduced): bestScore = score; | - |
433 | } executed: } Execution Count:3 | 3 |
434 | break; executed: break; Execution Count:3 | 3 |
435 | case Qt::Key_Right: | - |
436 | if (p.x() > goal.x()) { evaluated: p.x() > goal.x() yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
437 | candidate = button; executed (the execution status of this line is deduced): candidate = button; | - |
438 | bestScore = score; executed (the execution status of this line is deduced): bestScore = score; | - |
439 | } executed: } Execution Count:2 | 2 |
440 | break; executed: break; Execution Count:5 | 5 |
441 | } | - |
442 | } executed: } Execution Count:18 | 18 |
443 | } executed: } Execution Count:31 | 31 |
444 | | - |
445 | if (exclusive partially evaluated: exclusive yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
446 | #ifdef QT_KEYPAD_NAVIGATION executed (the execution status of this line is deduced):
| - |
447 | && !QApplication::keypadNavigationEnabled() executed (the execution status of this line is deduced):
| - |
448 | #endif executed (the execution status of this line is deduced):
| - |
449 | && candidate evaluated: candidate yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
450 | && fb->d_func()->checked evaluated: fb->d_func()->checked yes Evaluation Count:2 | yes Evaluation Count:8 |
| 2-8 |
451 | && candidate->d_func()->checkable) partially evaluated: candidate->d_func()->checkable yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
452 | candidate->click(); executed: candidate->click(); Execution Count:2 | 2 |
453 | | - |
454 | if (candidate) { evaluated: candidate yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
455 | if (key == Qt::Key_Up || key == Qt::Key_Left) evaluated: key == Qt::Key_Up yes Evaluation Count:1 | yes Evaluation Count:9 |
evaluated: key == Qt::Key_Left yes Evaluation Count:2 | yes Evaluation Count:7 |
| 1-9 |
456 | candidate->setFocus(Qt::BacktabFocusReason); executed: candidate->setFocus(Qt::BacktabFocusReason); Execution Count:3 | 3 |
457 | else | - |
458 | candidate->setFocus(Qt::TabFocusReason); executed: candidate->setFocus(Qt::TabFocusReason); Execution Count:7 | 7 |
459 | } | - |
460 | } executed: } Execution Count:13 | 13 |
461 | | - |
462 | void QAbstractButtonPrivate::fixFocusPolicy() | - |
463 | { | - |
464 | Q_Q(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButton * const q = q_func(); | - |
465 | #ifndef QT_NO_BUTTONGROUP | - |
466 | if (!group && !autoExclusive) evaluated: !group yes Evaluation Count:231 | yes Evaluation Count:9 |
evaluated: !autoExclusive yes Evaluation Count:227 | yes Evaluation Count:4 |
| 4-231 |
467 | #else | - |
468 | if (!autoExclusive) | - |
469 | #endif | - |
470 | return; executed: return; Execution Count:227 | 227 |
471 | | - |
472 | QList<QAbstractButton *> buttonList = queryButtonList(); executed (the execution status of this line is deduced): QList<QAbstractButton *> buttonList = queryButtonList(); | - |
473 | for (int i = 0; i < buttonList.count(); ++i) { evaluated: i < buttonList.count() yes Evaluation Count:36 | yes Evaluation Count:13 |
| 13-36 |
474 | QAbstractButton *b = buttonList.at(i); executed (the execution status of this line is deduced): QAbstractButton *b = buttonList.at(i); | - |
475 | if (!b->isCheckable()) evaluated: !b->isCheckable() yes Evaluation Count:7 | yes Evaluation Count:29 |
| 7-29 |
476 | continue; executed: continue; Execution Count:7 | 7 |
477 | b->setFocusPolicy((Qt::FocusPolicy) ((b == q || !q->isCheckable()) executed (the execution status of this line is deduced): b->setFocusPolicy((Qt::FocusPolicy) ((b == q || !q->isCheckable()) | - |
478 | ? (b->focusPolicy() | Qt::TabFocus) executed (the execution status of this line is deduced): ? (b->focusPolicy() | Qt::TabFocus) | - |
479 | : (b->focusPolicy() & ~Qt::TabFocus))); executed (the execution status of this line is deduced): : (b->focusPolicy() & ~Qt::TabFocus))); | - |
480 | } executed: } Execution Count:29 | 29 |
481 | } executed: } Execution Count:13 | 13 |
482 | | - |
483 | void QAbstractButtonPrivate::init() | - |
484 | { | - |
485 | Q_Q(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButton * const q = q_func(); | - |
486 | | - |
487 | q->setFocusPolicy(Qt::FocusPolicy(q->style()->styleHint(QStyle::SH_Button_FocusPolicy))); executed (the execution status of this line is deduced): q->setFocusPolicy(Qt::FocusPolicy(q->style()->styleHint(QStyle::SH_Button_FocusPolicy))); | - |
488 | q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, controlType)); executed (the execution status of this line is deduced): q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, controlType)); | - |
489 | q->setAttribute(Qt::WA_WState_OwnSizePolicy, false); executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_WState_OwnSizePolicy, false); | - |
490 | q->setForegroundRole(QPalette::ButtonText); executed (the execution status of this line is deduced): q->setForegroundRole(QPalette::ButtonText); | - |
491 | q->setBackgroundRole(QPalette::Button); executed (the execution status of this line is deduced): q->setBackgroundRole(QPalette::Button); | - |
492 | } executed: } Execution Count:3970 | 3970 |
493 | | - |
494 | void QAbstractButtonPrivate::refresh() | - |
495 | { | - |
496 | Q_Q(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButton * const q = q_func(); | - |
497 | | - |
498 | if (blockRefresh) evaluated: blockRefresh yes Evaluation Count:15 | yes Evaluation Count:534 |
| 15-534 |
499 | return; executed: return; Execution Count:15 | 15 |
500 | q->update(); executed (the execution status of this line is deduced): q->update(); | - |
501 | } executed: } Execution Count:534 | 534 |
502 | | - |
503 | void QAbstractButtonPrivate::click() | - |
504 | { | - |
505 | Q_Q(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButton * const q = q_func(); | - |
506 | | - |
507 | down = false; executed (the execution status of this line is deduced): down = false; | - |
508 | blockRefresh = true; executed (the execution status of this line is deduced): blockRefresh = true; | - |
509 | bool changeState = true; executed (the execution status of this line is deduced): bool changeState = true; | - |
510 | if (checked && queryCheckedButton() == q) { evaluated: checked yes Evaluation Count:1 | yes Evaluation Count:125 |
partially evaluated: queryCheckedButton() == q no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-125 |
511 | // the checked button of an exclusive or autoexclusive group cannot be unchecked | - |
512 | #ifndef QT_NO_BUTTONGROUP | - |
513 | if (group ? group->d_func()->exclusive : autoExclusive) | 0 |
514 | #else | - |
515 | if (autoExclusive) | - |
516 | #endif | - |
517 | changeState = false; never executed: changeState = false; | 0 |
518 | } | 0 |
519 | | - |
520 | QPointer<QAbstractButton> guard(q); executed (the execution status of this line is deduced): QPointer<QAbstractButton> guard(q); | - |
521 | if (changeState) { partially evaluated: changeState yes Evaluation Count:126 | no Evaluation Count:0 |
| 0-126 |
522 | q->nextCheckState(); executed (the execution status of this line is deduced): q->nextCheckState(); | - |
523 | if (!guard) partially evaluated: !guard no Evaluation Count:0 | yes Evaluation Count:126 |
| 0-126 |
524 | return; | 0 |
525 | } executed: } Execution Count:126 | 126 |
526 | blockRefresh = false; executed (the execution status of this line is deduced): blockRefresh = false; | - |
527 | refresh(); executed (the execution status of this line is deduced): refresh(); | - |
528 | q->repaint(); //flush paint event before invoking potentially expensive operation executed (the execution status of this line is deduced): q->repaint(); | - |
529 | QApplication::flush(); executed (the execution status of this line is deduced): QApplication::flush(); | - |
530 | if (guard) partially evaluated: guard yes Evaluation Count:126 | no Evaluation Count:0 |
| 0-126 |
531 | emitReleased(); executed: emitReleased(); Execution Count:126 | 126 |
532 | if (guard) partially evaluated: guard yes Evaluation Count:126 | no Evaluation Count:0 |
| 0-126 |
533 | emitClicked(); executed: emitClicked(); Execution Count:126 | 126 |
534 | } executed: } Execution Count:126 | 126 |
535 | | - |
536 | void QAbstractButtonPrivate::emitClicked() | - |
537 | { | - |
538 | Q_Q(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButton * const q = q_func(); | - |
539 | QPointer<QAbstractButton> guard(q); executed (the execution status of this line is deduced): QPointer<QAbstractButton> guard(q); | - |
540 | emit q->clicked(checked); executed (the execution status of this line is deduced): q->clicked(checked); | - |
541 | #ifndef QT_NO_BUTTONGROUP | - |
542 | if (guard && group) { partially evaluated: guard yes Evaluation Count:246 | no Evaluation Count:0 |
evaluated: group yes Evaluation Count:14 | yes Evaluation Count:232 |
| 0-246 |
543 | emit group->buttonClicked(group->id(q)); executed (the execution status of this line is deduced): group->buttonClicked(group->id(q)); | - |
544 | if (guard && group) partially evaluated: guard yes Evaluation Count:14 | no Evaluation Count:0 |
evaluated: group yes Evaluation Count:13 | yes Evaluation Count:1 |
| 0-14 |
545 | emit group->buttonClicked(q); executed: group->buttonClicked(q); Execution Count:13 | 13 |
546 | } executed: } Execution Count:14 | 14 |
547 | #endif | - |
548 | } executed: } Execution Count:246 | 246 |
549 | | - |
550 | void QAbstractButtonPrivate::emitPressed() | - |
551 | { | - |
552 | Q_Q(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButton * const q = q_func(); | - |
553 | QPointer<QAbstractButton> guard(q); executed (the execution status of this line is deduced): QPointer<QAbstractButton> guard(q); | - |
554 | emit q->pressed(); executed (the execution status of this line is deduced): q->pressed(); | - |
555 | #ifndef QT_NO_BUTTONGROUP | - |
556 | if (guard && group) { evaluated: guard yes Evaluation Count:261 | yes Evaluation Count:2 |
evaluated: group yes Evaluation Count:14 | yes Evaluation Count:247 |
| 2-261 |
557 | emit group->buttonPressed(group->id(q)); executed (the execution status of this line is deduced): group->buttonPressed(group->id(q)); | - |
558 | if (guard && group) partially evaluated: guard yes Evaluation Count:14 | no Evaluation Count:0 |
partially evaluated: group yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
559 | emit group->buttonPressed(q); executed: group->buttonPressed(q); Execution Count:14 | 14 |
560 | } executed: } Execution Count:14 | 14 |
561 | #endif | - |
562 | } executed: } Execution Count:263 | 263 |
563 | | - |
564 | void QAbstractButtonPrivate::emitReleased() | - |
565 | { | - |
566 | Q_Q(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButton * const q = q_func(); | - |
567 | QPointer<QAbstractButton> guard(q); executed (the execution status of this line is deduced): QPointer<QAbstractButton> guard(q); | - |
568 | emit q->released(); executed (the execution status of this line is deduced): q->released(); | - |
569 | #ifndef QT_NO_BUTTONGROUP | - |
570 | if (guard && group) { partially evaluated: guard yes Evaluation Count:249 | no Evaluation Count:0 |
evaluated: group yes Evaluation Count:14 | yes Evaluation Count:235 |
| 0-249 |
571 | emit group->buttonReleased(group->id(q)); executed (the execution status of this line is deduced): group->buttonReleased(group->id(q)); | - |
572 | if (guard && group) partially evaluated: guard yes Evaluation Count:14 | no Evaluation Count:0 |
partially evaluated: group yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
573 | emit group->buttonReleased(q); executed: group->buttonReleased(q); Execution Count:14 | 14 |
574 | } executed: } Execution Count:14 | 14 |
575 | #endif | - |
576 | } executed: } Execution Count:249 | 249 |
577 | | - |
578 | /*! | - |
579 | Constructs an abstract button with a \a parent. | - |
580 | */ | - |
581 | QAbstractButton::QAbstractButton(QWidget *parent) | - |
582 | : QWidget(*new QAbstractButtonPrivate, parent, 0) | - |
583 | { | - |
584 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
585 | d->init(); executed (the execution status of this line is deduced): d->init(); | - |
586 | } executed: } Execution Count:563 | 563 |
587 | | - |
588 | /*! | - |
589 | Destroys the button. | - |
590 | */ | - |
591 | QAbstractButton::~QAbstractButton() | - |
592 | { | - |
593 | #ifndef QT_NO_BUTTONGROUP | - |
594 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
595 | if (d->group) evaluated: d->group yes Evaluation Count:11 | yes Evaluation Count:3841 |
| 11-3841 |
596 | d->group->removeButton(this); executed: d->group->removeButton(this); Execution Count:11 | 11 |
597 | #endif | - |
598 | } executed: } Execution Count:3852 | 3852 |
599 | | - |
600 | | - |
601 | /*! \internal | - |
602 | */ | - |
603 | QAbstractButton::QAbstractButton(QAbstractButtonPrivate &dd, QWidget *parent) | - |
604 | : QWidget(dd, parent, 0) | - |
605 | { | - |
606 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
607 | d->init(); executed (the execution status of this line is deduced): d->init(); | - |
608 | } executed: } Execution Count:3407 | 3407 |
609 | | - |
610 | /*! | - |
611 | \property QAbstractButton::text | - |
612 | \brief the text shown on the button | - |
613 | | - |
614 | If the button has no text, the text() function will return an empty | - |
615 | string. | - |
616 | | - |
617 | If the text contains an ampersand character ('&'), a shortcut is | - |
618 | automatically created for it. The character that follows the '&' will | - |
619 | be used as the shortcut key. Any previous shortcut will be | - |
620 | overwritten or cleared if no shortcut is defined by the text. See the | - |
621 | \l {QShortcut#mnemonic}{QShortcut} documentation for details. To | - |
622 | display an actual ampersand, use '&&'. | - |
623 | | - |
624 | There is no default text. | - |
625 | */ | - |
626 | | - |
627 | void QAbstractButton::setText(const QString &text) | - |
628 | { | - |
629 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
630 | if (d->text == text) evaluated: d->text == text yes Evaluation Count:2931 | yes Evaluation Count:2660 |
| 2660-2931 |
631 | return; executed: return; Execution Count:2931 | 2931 |
632 | d->text = text; executed (the execution status of this line is deduced): d->text = text; | - |
633 | #ifndef QT_NO_SHORTCUT | - |
634 | QKeySequence newMnemonic = QKeySequence::mnemonic(text); executed (the execution status of this line is deduced): QKeySequence newMnemonic = QKeySequence::mnemonic(text); | - |
635 | setShortcut(newMnemonic); executed (the execution status of this line is deduced): setShortcut(newMnemonic); | - |
636 | #endif | - |
637 | d->sizeHint = QSize(); executed (the execution status of this line is deduced): d->sizeHint = QSize(); | - |
638 | update(); executed (the execution status of this line is deduced): update(); | - |
639 | updateGeometry(); executed (the execution status of this line is deduced): updateGeometry(); | - |
640 | #ifndef QT_NO_ACCESSIBILITY | - |
641 | QAccessibleEvent event(this, QAccessible::NameChanged); executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::NameChanged); | - |
642 | QAccessible::updateAccessibility(&event); executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event); | - |
643 | #endif | - |
644 | } executed: } Execution Count:2660 | 2660 |
645 | | - |
646 | QString QAbstractButton::text() const | - |
647 | { | - |
648 | Q_D(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButtonPrivate * const d = d_func(); | - |
649 | return d->text; executed: return d->text; Execution Count:1417 | 1417 |
650 | } | - |
651 | | - |
652 | | - |
653 | /*! | - |
654 | \property QAbstractButton::icon | - |
655 | \brief the icon shown on the button | - |
656 | | - |
657 | The icon's default size is defined by the GUI style, but can be | - |
658 | adjusted by setting the \l iconSize property. | - |
659 | */ | - |
660 | void QAbstractButton::setIcon(const QIcon &icon) | - |
661 | { | - |
662 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
663 | d->icon = icon; executed (the execution status of this line is deduced): d->icon = icon; | - |
664 | d->sizeHint = QSize(); executed (the execution status of this line is deduced): d->sizeHint = QSize(); | - |
665 | update(); executed (the execution status of this line is deduced): update(); | - |
666 | updateGeometry(); executed (the execution status of this line is deduced): updateGeometry(); | - |
667 | } executed: } Execution Count:1462 | 1462 |
668 | | - |
669 | QIcon QAbstractButton::icon() const | - |
670 | { | - |
671 | Q_D(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButtonPrivate * const d = d_func(); | - |
672 | return d->icon; executed: return d->icon; Execution Count:10731 | 10731 |
673 | } | - |
674 | | - |
675 | #ifndef QT_NO_SHORTCUT | - |
676 | /*! | - |
677 | \property QAbstractButton::shortcut | - |
678 | \brief the mnemonic associated with the button | - |
679 | */ | - |
680 | | - |
681 | void QAbstractButton::setShortcut(const QKeySequence &key) | - |
682 | { | - |
683 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
684 | if (d->shortcutId != 0) evaluated: d->shortcutId != 0 yes Evaluation Count:51 | yes Evaluation Count:2666 |
| 51-2666 |
685 | releaseShortcut(d->shortcutId); executed: releaseShortcut(d->shortcutId); Execution Count:51 | 51 |
686 | d->shortcut = key; executed (the execution status of this line is deduced): d->shortcut = key; | - |
687 | d->shortcutId = grabShortcut(key); executed (the execution status of this line is deduced): d->shortcutId = grabShortcut(key); | - |
688 | } executed: } Execution Count:2717 | 2717 |
689 | | - |
690 | QKeySequence QAbstractButton::shortcut() const | - |
691 | { | - |
692 | Q_D(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButtonPrivate * const d = d_func(); | - |
693 | return d->shortcut; executed: return d->shortcut; Execution Count:54 | 54 |
694 | } | - |
695 | #endif // QT_NO_SHORTCUT | - |
696 | | - |
697 | /*! | - |
698 | \property QAbstractButton::checkable | - |
699 | \brief whether the button is checkable | - |
700 | | - |
701 | By default, the button is not checkable. | - |
702 | | - |
703 | \sa checked | - |
704 | */ | - |
705 | void QAbstractButton::setCheckable(bool checkable) | - |
706 | { | - |
707 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
708 | if (d->checkable == checkable) evaluated: d->checkable == checkable yes Evaluation Count:15 | yes Evaluation Count:109 |
| 15-109 |
709 | return; executed: return; Execution Count:15 | 15 |
710 | | - |
711 | d->checkable = checkable; executed (the execution status of this line is deduced): d->checkable = checkable; | - |
712 | d->checked = false; executed (the execution status of this line is deduced): d->checked = false; | - |
713 | } executed: } Execution Count:109 | 109 |
714 | | - |
715 | bool QAbstractButton::isCheckable() const | - |
716 | { | - |
717 | Q_D(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButtonPrivate * const d = d_func(); | - |
718 | return d->checkable; executed: return d->checkable; Execution Count:344 | 344 |
719 | } | - |
720 | | - |
721 | /*! | - |
722 | \property QAbstractButton::checked | - |
723 | \brief whether the button is checked | - |
724 | | - |
725 | Only checkable buttons can be checked. By default, the button is unchecked. | - |
726 | | - |
727 | \sa checkable | - |
728 | */ | - |
729 | void QAbstractButton::setChecked(bool checked) | - |
730 | { | - |
731 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
732 | if (!d->checkable || d->checked == checked) { evaluated: !d->checkable yes Evaluation Count:18 | yes Evaluation Count:114 |
evaluated: d->checked == checked yes Evaluation Count:41 | yes Evaluation Count:73 |
| 18-114 |
733 | if (!d->blockRefresh) evaluated: !d->blockRefresh yes Evaluation Count:57 | yes Evaluation Count:2 |
| 2-57 |
734 | checkStateSet(); executed: checkStateSet(); Execution Count:57 | 57 |
735 | return; executed: return; Execution Count:59 | 59 |
736 | } | - |
737 | | - |
738 | if (!checked && d->queryCheckedButton() == this) { evaluated: !checked yes Evaluation Count:30 | yes Evaluation Count:43 |
evaluated: d->queryCheckedButton() == this yes Evaluation Count:6 | yes Evaluation Count:24 |
| 6-43 |
739 | // the checked button of an exclusive or autoexclusive group cannot be unchecked | - |
740 | #ifndef QT_NO_BUTTONGROUP | - |
741 | if (d->group ? d->group->d_func()->exclusive : d->autoExclusive) evaluated: d->group yes Evaluation Count:3 | yes Evaluation Count:3 |
| 3 |
742 | return; executed: return; Execution Count:4 | 4 |
743 | if (d->group) partially evaluated: d->group yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
744 | d->group->d_func()->detectCheckedButton(); executed: d->group->d_func()->detectCheckedButton(); Execution Count:2 | 2 |
745 | #else | - |
746 | if (d->autoExclusive) | - |
747 | return; | - |
748 | #endif | - |
749 | } executed: } Execution Count:2 | 2 |
750 | | - |
751 | QPointer<QAbstractButton> guard(this); executed (the execution status of this line is deduced): QPointer<QAbstractButton> guard(this); | - |
752 | | - |
753 | d->checked = checked; executed (the execution status of this line is deduced): d->checked = checked; | - |
754 | if (!d->blockRefresh) evaluated: !d->blockRefresh yes Evaluation Count:54 | yes Evaluation Count:15 |
| 15-54 |
755 | checkStateSet(); executed: checkStateSet(); Execution Count:54 | 54 |
756 | d->refresh(); executed (the execution status of this line is deduced): d->refresh(); | - |
757 | | - |
758 | if (guard && checked) partially evaluated: guard yes Evaluation Count:69 | no Evaluation Count:0 |
evaluated: checked yes Evaluation Count:43 | yes Evaluation Count:26 |
| 0-69 |
759 | d->notifyChecked(); executed: d->notifyChecked(); Execution Count:43 | 43 |
760 | if (guard) partially evaluated: guard yes Evaluation Count:69 | no Evaluation Count:0 |
| 0-69 |
761 | emit toggled(checked); executed: toggled(checked); Execution Count:69 | 69 |
762 | | - |
763 | | - |
764 | #ifndef QT_NO_ACCESSIBILITY | - |
765 | QAccessible::State s; executed (the execution status of this line is deduced): QAccessible::State s; | - |
766 | s.checked = true; executed (the execution status of this line is deduced): s.checked = true; | - |
767 | QAccessibleStateChangeEvent event(this, s); executed (the execution status of this line is deduced): QAccessibleStateChangeEvent event(this, s); | - |
768 | QAccessible::updateAccessibility(&event); executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event); | - |
769 | #endif | - |
770 | } executed: } Execution Count:69 | 69 |
771 | | - |
772 | bool QAbstractButton::isChecked() const | - |
773 | { | - |
774 | Q_D(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButtonPrivate * const d = d_func(); | - |
775 | return d->checked; executed: return d->checked; Execution Count:1065 | 1065 |
776 | } | - |
777 | | - |
778 | /*! | - |
779 | \property QAbstractButton::down | - |
780 | \brief whether the button is pressed down | - |
781 | | - |
782 | If this property is true, the button is pressed down. The signals | - |
783 | pressed() and clicked() are not emitted if you set this property | - |
784 | to true. The default is false. | - |
785 | */ | - |
786 | | - |
787 | void QAbstractButton::setDown(bool down) | - |
788 | { | - |
789 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
790 | if (d->down == down) evaluated: d->down == down yes Evaluation Count:2037 | yes Evaluation Count:347 |
| 347-2037 |
791 | return; executed: return; Execution Count:2037 | 2037 |
792 | d->down = down; executed (the execution status of this line is deduced): d->down = down; | - |
793 | d->refresh(); executed (the execution status of this line is deduced): d->refresh(); | - |
794 | if (d->autoRepeat && d->down) evaluated: d->autoRepeat yes Evaluation Count:22 | yes Evaluation Count:325 |
partially evaluated: d->down yes Evaluation Count:22 | no Evaluation Count:0 |
| 0-325 |
795 | d->repeatTimer.start(d->autoRepeatDelay, this); executed: d->repeatTimer.start(d->autoRepeatDelay, this); Execution Count:22 | 22 |
796 | else | - |
797 | d->repeatTimer.stop(); executed: d->repeatTimer.stop(); Execution Count:325 | 325 |
798 | } | - |
799 | | - |
800 | bool QAbstractButton::isDown() const | - |
801 | { | - |
802 | Q_D(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButtonPrivate * const d = d_func(); | - |
803 | return d->down; executed: return d->down; Execution Count:418 | 418 |
804 | } | - |
805 | | - |
806 | /*! | - |
807 | \property QAbstractButton::autoRepeat | - |
808 | \brief whether autoRepeat is enabled | - |
809 | | - |
810 | If autoRepeat is enabled, then the pressed(), released(), and clicked() signals are emitted at | - |
811 | regular intervals when the button is down. autoRepeat is off by default. | - |
812 | The initial delay and the repetition interval are defined in milliseconds by \l | - |
813 | autoRepeatDelay and \l autoRepeatInterval. | - |
814 | | - |
815 | Note: If a button is pressed down by a shortcut key, then auto-repeat is enabled and timed by the | - |
816 | system and not by this class. The pressed(), released(), and clicked() signals will be emitted | - |
817 | like in the normal case. | - |
818 | */ | - |
819 | | - |
820 | void QAbstractButton::setAutoRepeat(bool autoRepeat) | - |
821 | { | - |
822 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
823 | if (d->autoRepeat == autoRepeat) evaluated: d->autoRepeat == autoRepeat yes Evaluation Count:68 | yes Evaluation Count:304 |
| 68-304 |
824 | return; executed: return; Execution Count:68 | 68 |
825 | d->autoRepeat = autoRepeat; executed (the execution status of this line is deduced): d->autoRepeat = autoRepeat; | - |
826 | if (d->autoRepeat && d->down) evaluated: d->autoRepeat yes Evaluation Count:295 | yes Evaluation Count:9 |
partially evaluated: d->down no Evaluation Count:0 | yes Evaluation Count:295 |
| 0-295 |
827 | d->repeatTimer.start(d->autoRepeatDelay, this); never executed: d->repeatTimer.start(d->autoRepeatDelay, this); | 0 |
828 | else | - |
829 | d->repeatTimer.stop(); executed: d->repeatTimer.stop(); Execution Count:304 | 304 |
830 | } | - |
831 | | - |
832 | bool QAbstractButton::autoRepeat() const | - |
833 | { | - |
834 | Q_D(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButtonPrivate * const d = d_func(); | - |
835 | return d->autoRepeat; executed: return d->autoRepeat; Execution Count:11 | 11 |
836 | } | - |
837 | | - |
838 | /*! | - |
839 | \property QAbstractButton::autoRepeatDelay | - |
840 | \brief the initial delay of auto-repetition | - |
841 | \since 4.2 | - |
842 | | - |
843 | If \l autoRepeat is enabled, then autoRepeatDelay defines the initial | - |
844 | delay in milliseconds before auto-repetition kicks in. | - |
845 | | - |
846 | \sa autoRepeat, autoRepeatInterval | - |
847 | */ | - |
848 | | - |
849 | void QAbstractButton::setAutoRepeatDelay(int autoRepeatDelay) | - |
850 | { | - |
851 | Q_D(QAbstractButton); never executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
852 | d->autoRepeatDelay = autoRepeatDelay; never executed (the execution status of this line is deduced): d->autoRepeatDelay = autoRepeatDelay; | - |
853 | } | 0 |
854 | | - |
855 | int QAbstractButton::autoRepeatDelay() const | - |
856 | { | - |
857 | Q_D(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButtonPrivate * const d = d_func(); | - |
858 | return d->autoRepeatDelay; executed: return d->autoRepeatDelay; Execution Count:1 | 1 |
859 | } | - |
860 | | - |
861 | /*! | - |
862 | \property QAbstractButton::autoRepeatInterval | - |
863 | \brief the interval of auto-repetition | - |
864 | \since 4.2 | - |
865 | | - |
866 | If \l autoRepeat is enabled, then autoRepeatInterval defines the | - |
867 | length of the auto-repetition interval in millisecons. | - |
868 | | - |
869 | \sa autoRepeat, autoRepeatDelay | - |
870 | */ | - |
871 | | - |
872 | void QAbstractButton::setAutoRepeatInterval(int autoRepeatInterval) | - |
873 | { | - |
874 | Q_D(QAbstractButton); never executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
875 | d->autoRepeatInterval = autoRepeatInterval; never executed (the execution status of this line is deduced): d->autoRepeatInterval = autoRepeatInterval; | - |
876 | } | 0 |
877 | | - |
878 | int QAbstractButton::autoRepeatInterval() const | - |
879 | { | - |
880 | Q_D(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButtonPrivate * const d = d_func(); | - |
881 | return d->autoRepeatInterval; executed: return d->autoRepeatInterval; Execution Count:1 | 1 |
882 | } | - |
883 | | - |
884 | | - |
885 | | - |
886 | /*! | - |
887 | \property QAbstractButton::autoExclusive | - |
888 | \brief whether auto-exclusivity is enabled | - |
889 | | - |
890 | If auto-exclusivity is enabled, checkable buttons that belong to the | - |
891 | same parent widget behave as if they were part of the same | - |
892 | exclusive button group. In an exclusive button group, only one button | - |
893 | can be checked at any time; checking another button automatically | - |
894 | unchecks the previously checked one. | - |
895 | | - |
896 | The property has no effect on buttons that belong to a button | - |
897 | group. | - |
898 | | - |
899 | autoExclusive is off by default, except for radio buttons. | - |
900 | | - |
901 | \sa QRadioButton | - |
902 | */ | - |
903 | void QAbstractButton::setAutoExclusive(bool autoExclusive) | - |
904 | { | - |
905 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
906 | d->autoExclusive = autoExclusive; executed (the execution status of this line is deduced): d->autoExclusive = autoExclusive; | - |
907 | } executed: } Execution Count:51 | 51 |
908 | | - |
909 | bool QAbstractButton::autoExclusive() const | - |
910 | { | - |
911 | Q_D(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButtonPrivate * const d = d_func(); | - |
912 | return d->autoExclusive; executed: return d->autoExclusive; Execution Count:47 | 47 |
913 | } | - |
914 | | - |
915 | #ifndef QT_NO_BUTTONGROUP | - |
916 | /*! | - |
917 | Returns the group that this button belongs to. | - |
918 | | - |
919 | If the button is not a member of any QButtonGroup, this function | - |
920 | returns 0. | - |
921 | | - |
922 | \sa QButtonGroup | - |
923 | */ | - |
924 | QButtonGroup *QAbstractButton::group() const | - |
925 | { | - |
926 | Q_D(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButtonPrivate * const d = d_func(); | - |
927 | return d->group; executed: return d->group; Execution Count:37 | 37 |
928 | } | - |
929 | #endif // QT_NO_BUTTONGROUP | - |
930 | | - |
931 | /*! | - |
932 | Performs an animated click: the button is pressed immediately, and | - |
933 | released \a msec milliseconds later (the default is 100 ms). | - |
934 | | - |
935 | Calling this function again before the button is released resets | - |
936 | the release timer. | - |
937 | | - |
938 | All signals associated with a click are emitted as appropriate. | - |
939 | | - |
940 | This function does nothing if the button is \l{setEnabled()}{disabled.} | - |
941 | | - |
942 | \sa click() | - |
943 | */ | - |
944 | void QAbstractButton::animateClick(int msec) | - |
945 | { | - |
946 | if (!isEnabled()) partially evaluated: !isEnabled() no Evaluation Count:0 | yes Evaluation Count:38 |
| 0-38 |
947 | return; | 0 |
948 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
949 | if (d->checkable && focusPolicy() & Qt::ClickFocus) evaluated: d->checkable yes Evaluation Count:1 | yes Evaluation Count:37 |
partially evaluated: focusPolicy() & Qt::ClickFocus no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-37 |
950 | setFocus(); never executed: setFocus(); | 0 |
951 | setDown(true); executed (the execution status of this line is deduced): setDown(true); | - |
952 | repaint(); //flush paint event before invoking potentially expensive operation executed (the execution status of this line is deduced): repaint(); | - |
953 | QApplication::flush(); executed (the execution status of this line is deduced): QApplication::flush(); | - |
954 | if (!d->animateTimer.isActive()) partially evaluated: !d->animateTimer.isActive() yes Evaluation Count:38 | no Evaluation Count:0 |
| 0-38 |
955 | d->emitPressed(); executed: d->emitPressed(); Execution Count:38 | 38 |
956 | d->animateTimer.start(msec, this); executed (the execution status of this line is deduced): d->animateTimer.start(msec, this); | - |
957 | } executed: } Execution Count:38 | 38 |
958 | | - |
959 | /*! | - |
960 | Performs a click. | - |
961 | | - |
962 | All the usual signals associated with a click are emitted as | - |
963 | appropriate. If the button is checkable, the state of the button is | - |
964 | toggled. | - |
965 | | - |
966 | This function does nothing if the button is \l{setEnabled()}{disabled.} | - |
967 | | - |
968 | \sa animateClick() | - |
969 | */ | - |
970 | void QAbstractButton::click() | - |
971 | { | - |
972 | if (!isEnabled()) evaluated: !isEnabled() yes Evaluation Count:1 | yes Evaluation Count:59 |
| 1-59 |
973 | return; executed: return; Execution Count:1 | 1 |
974 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
975 | QPointer<QAbstractButton> guard(this); executed (the execution status of this line is deduced): QPointer<QAbstractButton> guard(this); | - |
976 | d->down = true; executed (the execution status of this line is deduced): d->down = true; | - |
977 | d->emitPressed(); executed (the execution status of this line is deduced): d->emitPressed(); | - |
978 | if (guard) { evaluated: guard yes Evaluation Count:57 | yes Evaluation Count:2 |
| 2-57 |
979 | d->down = false; executed (the execution status of this line is deduced): d->down = false; | - |
980 | nextCheckState(); executed (the execution status of this line is deduced): nextCheckState(); | - |
981 | if (guard) partially evaluated: guard yes Evaluation Count:57 | no Evaluation Count:0 |
| 0-57 |
982 | d->emitReleased(); executed: d->emitReleased(); Execution Count:57 | 57 |
983 | if (guard) partially evaluated: guard yes Evaluation Count:57 | no Evaluation Count:0 |
| 0-57 |
984 | d->emitClicked(); executed: d->emitClicked(); Execution Count:57 | 57 |
985 | } executed: } Execution Count:57 | 57 |
986 | } executed: } Execution Count:59 | 59 |
987 | | - |
988 | /*! \fn void QAbstractButton::toggle() | - |
989 | | - |
990 | Toggles the state of a checkable button. | - |
991 | | - |
992 | \sa checked | - |
993 | */ | - |
994 | void QAbstractButton::toggle() | - |
995 | { | - |
996 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
997 | setChecked(!d->checked); executed (the execution status of this line is deduced): setChecked(!d->checked); | - |
998 | } executed: } Execution Count:19 | 19 |
999 | | - |
1000 | | - |
1001 | /*! This virtual handler is called when setChecked() is used, | - |
1002 | unless it is called from within nextCheckState(). It allows | - |
1003 | subclasses to reset their intermediate button states. | - |
1004 | | - |
1005 | \sa nextCheckState() | - |
1006 | */ | - |
1007 | void QAbstractButton::checkStateSet() | - |
1008 | { | - |
1009 | } | - |
1010 | | - |
1011 | /*! This virtual handler is called when a button is clicked. The | - |
1012 | default implementation calls setChecked(!isChecked()) if the button | - |
1013 | isCheckable(). It allows subclasses to implement intermediate button | - |
1014 | states. | - |
1015 | | - |
1016 | \sa checkStateSet() | - |
1017 | */ | - |
1018 | void QAbstractButton::nextCheckState() | - |
1019 | { | - |
1020 | if (isCheckable()) evaluated: isCheckable() yes Evaluation Count:16 | yes Evaluation Count:203 |
| 16-203 |
1021 | setChecked(!isChecked()); executed: setChecked(!isChecked()); Execution Count:16 | 16 |
1022 | } executed: } Execution Count:219 | 219 |
1023 | | - |
1024 | /*! | - |
1025 | Returns true if \a pos is inside the clickable button rectangle; | - |
1026 | otherwise returns false. | - |
1027 | | - |
1028 | By default, the clickable area is the entire widget. Subclasses | - |
1029 | may reimplement this function to provide support for clickable | - |
1030 | areas of different shapes and sizes. | - |
1031 | */ | - |
1032 | bool QAbstractButton::hitButton(const QPoint &pos) const | - |
1033 | { | - |
1034 | return rect().contains(pos); executed: return rect().contains(pos); Execution Count:164 | 164 |
1035 | } | - |
1036 | | - |
1037 | /*! \reimp */ | - |
1038 | bool QAbstractButton::event(QEvent *e) | - |
1039 | { | - |
1040 | // as opposed to other widgets, disabled buttons accept mouse | - |
1041 | // events. This avoids surprising click-through scenarios | - |
1042 | if (!isEnabled()) { evaluated: !isEnabled() yes Evaluation Count:5151 | yes Evaluation Count:34164 |
| 5151-34164 |
1043 | switch(e->type()) { | - |
1044 | case QEvent::TabletPress: | - |
1045 | case QEvent::TabletRelease: | - |
1046 | case QEvent::TabletMove: | - |
1047 | case QEvent::MouseButtonPress: | - |
1048 | case QEvent::MouseButtonRelease: | - |
1049 | case QEvent::MouseButtonDblClick: | - |
1050 | case QEvent::MouseMove: | - |
1051 | case QEvent::HoverMove: | - |
1052 | case QEvent::HoverEnter: | - |
1053 | case QEvent::HoverLeave: | - |
1054 | case QEvent::ContextMenu: | - |
1055 | #ifndef QT_NO_WHEELEVENT | - |
1056 | case QEvent::Wheel: | - |
1057 | #endif | - |
1058 | return true; executed: return true; Execution Count:8 | 8 |
1059 | default: | - |
1060 | break; executed: break; Execution Count:5143 | 5143 |
1061 | } | - |
1062 | } executed: } Execution Count:5143 | 5143 |
1063 | | - |
1064 | #ifndef QT_NO_SHORTCUT | - |
1065 | if (e->type() == QEvent::Shortcut) { evaluated: e->type() == QEvent::Shortcut yes Evaluation Count:15 | yes Evaluation Count:39292 |
| 15-39292 |
1066 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
1067 | QShortcutEvent *se = static_cast<QShortcutEvent *>(e); executed (the execution status of this line is deduced): QShortcutEvent *se = static_cast<QShortcutEvent *>(e); | - |
1068 | if (d->shortcutId != se->shortcutId()) partially evaluated: d->shortcutId != se->shortcutId() no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
1069 | return false; never executed: return false; | 0 |
1070 | if (!se->isAmbiguous()) { partially evaluated: !se->isAmbiguous() yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
1071 | if (!d->animateTimer.isActive()) evaluated: !d->animateTimer.isActive() yes Evaluation Count:14 | yes Evaluation Count:1 |
| 1-14 |
1072 | animateClick(); executed: animateClick(); Execution Count:14 | 14 |
1073 | } else { executed: } Execution Count:15 | 15 |
1074 | if (focusPolicy() != Qt::NoFocus) never evaluated: focusPolicy() != Qt::NoFocus | 0 |
1075 | setFocus(Qt::ShortcutFocusReason); never executed: setFocus(Qt::ShortcutFocusReason); | 0 |
1076 | window()->setAttribute(Qt::WA_KeyboardFocusChange); never executed (the execution status of this line is deduced): window()->setAttribute(Qt::WA_KeyboardFocusChange); | - |
1077 | } | 0 |
1078 | return true; executed: return true; Execution Count:15 | 15 |
1079 | } | - |
1080 | #endif | - |
1081 | return QWidget::event(e); executed: return QWidget::event(e); Execution Count:39292 | 39292 |
1082 | } | - |
1083 | | - |
1084 | /*! \reimp */ | - |
1085 | void QAbstractButton::mousePressEvent(QMouseEvent *e) | - |
1086 | { | - |
1087 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
1088 | if (e->button() != Qt::LeftButton) { partially evaluated: e->button() != Qt::LeftButton no Evaluation Count:0 | yes Evaluation Count:89 |
| 0-89 |
1089 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
1090 | return; | 0 |
1091 | } | - |
1092 | if (hitButton(e->pos())) { partially evaluated: hitButton(e->pos()) yes Evaluation Count:89 | no Evaluation Count:0 |
| 0-89 |
1093 | setDown(true); executed (the execution status of this line is deduced): setDown(true); | - |
1094 | d->pressed = true; executed (the execution status of this line is deduced): d->pressed = true; | - |
1095 | repaint(); //flush paint event before invoking potentially expensive operation executed (the execution status of this line is deduced): repaint(); | - |
1096 | QApplication::flush(); executed (the execution status of this line is deduced): QApplication::flush(); | - |
1097 | d->emitPressed(); executed (the execution status of this line is deduced): d->emitPressed(); | - |
1098 | e->accept(); executed (the execution status of this line is deduced): e->accept(); | - |
1099 | } else { executed: } Execution Count:89 | 89 |
1100 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
1101 | } | 0 |
1102 | } | - |
1103 | | - |
1104 | /*! \reimp */ | - |
1105 | void QAbstractButton::mouseReleaseEvent(QMouseEvent *e) | - |
1106 | { | - |
1107 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
1108 | d->pressed = false; executed (the execution status of this line is deduced): d->pressed = false; | - |
1109 | | - |
1110 | if (e->button() != Qt::LeftButton) { partially evaluated: e->button() != Qt::LeftButton no Evaluation Count:0 | yes Evaluation Count:77 |
| 0-77 |
1111 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
1112 | return; | 0 |
1113 | } | - |
1114 | | - |
1115 | if (!d->down) { evaluated: !d->down yes Evaluation Count:2 | yes Evaluation Count:75 |
| 2-75 |
1116 | // refresh is required by QMacStyle to resume the default button animation | - |
1117 | d->refresh(); executed (the execution status of this line is deduced): d->refresh(); | - |
1118 | e->ignore(); executed (the execution status of this line is deduced): e->ignore(); | - |
1119 | return; executed: return; Execution Count:2 | 2 |
1120 | } | - |
1121 | | - |
1122 | if (hitButton(e->pos())) { partially evaluated: hitButton(e->pos()) yes Evaluation Count:75 | no Evaluation Count:0 |
| 0-75 |
1123 | d->repeatTimer.stop(); executed (the execution status of this line is deduced): d->repeatTimer.stop(); | - |
1124 | d->click(); executed (the execution status of this line is deduced): d->click(); | - |
1125 | e->accept(); executed (the execution status of this line is deduced): e->accept(); | - |
1126 | } else { executed: } Execution Count:75 | 75 |
1127 | setDown(false); never executed (the execution status of this line is deduced): setDown(false); | - |
1128 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
1129 | } | 0 |
1130 | } | - |
1131 | | - |
1132 | /*! \reimp */ | - |
1133 | void QAbstractButton::mouseMoveEvent(QMouseEvent *e) | - |
1134 | { | - |
1135 | Q_D(QAbstractButton); never executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
1136 | if (!(e->buttons() & Qt::LeftButton) || !d->pressed) { never evaluated: !(e->buttons() & Qt::LeftButton) never evaluated: !d->pressed | 0 |
1137 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
1138 | return; | 0 |
1139 | } | - |
1140 | | - |
1141 | if (hitButton(e->pos()) != d->down) { never evaluated: hitButton(e->pos()) != d->down | 0 |
1142 | setDown(!d->down); never executed (the execution status of this line is deduced): setDown(!d->down); | - |
1143 | repaint(); //flush paint event before invoking potentially expensive operation never executed (the execution status of this line is deduced): repaint(); | - |
1144 | QApplication::flush(); never executed (the execution status of this line is deduced): QApplication::flush(); | - |
1145 | if (d->down) | 0 |
1146 | d->emitPressed(); never executed: d->emitPressed(); | 0 |
1147 | else | - |
1148 | d->emitReleased(); never executed: d->emitReleased(); | 0 |
1149 | e->accept(); never executed (the execution status of this line is deduced): e->accept(); | - |
1150 | } else if (!hitButton(e->pos())) { never executed: } never evaluated: !hitButton(e->pos()) | 0 |
1151 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
1152 | } | 0 |
1153 | } | - |
1154 | | - |
1155 | /*! \reimp */ | - |
1156 | void QAbstractButton::keyPressEvent(QKeyEvent *e) | - |
1157 | { | - |
1158 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
1159 | bool next = true; executed (the execution status of this line is deduced): bool next = true; | - |
1160 | switch (e->key()) { | - |
1161 | case Qt::Key_Enter: | - |
1162 | case Qt::Key_Return: | - |
1163 | e->ignore(); executed (the execution status of this line is deduced): e->ignore(); | - |
1164 | break; executed: break; Execution Count:8 | 8 |
1165 | case Qt::Key_Select: | - |
1166 | case Qt::Key_Space: | - |
1167 | if (!e->isAutoRepeat()) { partially evaluated: !e->isAutoRepeat() yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
1168 | setDown(true); executed (the execution status of this line is deduced): setDown(true); | - |
1169 | repaint(); //flush paint event before invoking potentially expensive operation executed (the execution status of this line is deduced): repaint(); | - |
1170 | QApplication::flush(); executed (the execution status of this line is deduced): QApplication::flush(); | - |
1171 | d->emitPressed(); executed (the execution status of this line is deduced): d->emitPressed(); | - |
1172 | } executed: } Execution Count:14 | 14 |
1173 | break; executed: break; Execution Count:14 | 14 |
1174 | case Qt::Key_Up: | - |
1175 | next = false; executed (the execution status of this line is deduced): next = false; | - |
1176 | // fall through | - |
1177 | case Qt::Key_Left: | - |
1178 | case Qt::Key_Right: | - |
1179 | case Qt::Key_Down: { | - |
1180 | #ifdef QT_KEYPAD_NAVIGATION | - |
1181 | if ((QApplication::keypadNavigationEnabled() | - |
1182 | && (e->key() == Qt::Key_Left || e->key() == Qt::Key_Right)) | - |
1183 | || (!QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional | - |
1184 | || (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down))) { | - |
1185 | e->ignore(); | - |
1186 | return; | - |
1187 | } | - |
1188 | #endif | - |
1189 | QWidget *pw = parentWidget(); executed (the execution status of this line is deduced): QWidget *pw = parentWidget(); | - |
1190 | if (d->autoExclusive evaluated: d->autoExclusive yes Evaluation Count:11 | yes Evaluation Count:2 |
| 2-11 |
1191 | #ifndef QT_NO_BUTTONGROUP executed (the execution status of this line is deduced):
| - |
1192 | || d->group partially evaluated: d->group yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1193 | #endif executed (the execution status of this line is deduced):
| - |
1194 | #ifndef QT_NO_ITEMVIEWS executed (the execution status of this line is deduced):
| - |
1195 | || (pw && qobject_cast<QAbstractItemView *>(pw->parentWidget())) never evaluated: pw never evaluated: qobject_cast<QAbstractItemView *>(pw->parentWidget()) | 0 |
1196 | #endif | - |
1197 | ) { | - |
1198 | // ### Using qobject_cast to check if the parent is a viewport of | - |
1199 | // QAbstractItemView is a crude hack, and should be revisited and | - |
1200 | // cleaned up when fixing task 194373. It's here to ensure that we | - |
1201 | // keep compatibility outside QAbstractItemView. | - |
1202 | d->moveFocus(e->key()); executed (the execution status of this line is deduced): d->moveFocus(e->key()); | - |
1203 | if (hasFocus()) // nothing happend, propagate evaluated: hasFocus() yes Evaluation Count:3 | yes Evaluation Count:10 |
| 3-10 |
1204 | e->ignore(); executed: e->ignore(); Execution Count:3 | 3 |
1205 | } else { executed: } Execution Count:13 | 13 |
1206 | // Prefer parent widget, use this if parent is absent | - |
1207 | QWidget *w = pw ? pw : this; | 0 |
1208 | bool reverse = (w->layoutDirection() == Qt::RightToLeft); never executed (the execution status of this line is deduced): bool reverse = (w->layoutDirection() == Qt::RightToLeft); | - |
1209 | if ((e->key() == Qt::Key_Left && !reverse) never evaluated: e->key() == Qt::Key_Left never evaluated: !reverse | 0 |
1210 | || (e->key() == Qt::Key_Right && reverse)) { never evaluated: e->key() == Qt::Key_Right never evaluated: reverse | 0 |
1211 | next = false; never executed (the execution status of this line is deduced): next = false; | - |
1212 | } | 0 |
1213 | focusNextPrevChild(next); never executed (the execution status of this line is deduced): focusNextPrevChild(next); | - |
1214 | } | 0 |
1215 | break; executed: break; Execution Count:13 | 13 |
1216 | } | - |
1217 | case Qt::Key_Escape: | - |
1218 | if (d->down) { partially evaluated: d->down yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1219 | setDown(false); executed (the execution status of this line is deduced): setDown(false); | - |
1220 | repaint(); //flush paint event before invoking potentially expensive operation executed (the execution status of this line is deduced): repaint(); | - |
1221 | QApplication::flush(); executed (the execution status of this line is deduced): QApplication::flush(); | - |
1222 | d->emitReleased(); executed (the execution status of this line is deduced): d->emitReleased(); | - |
1223 | break; executed: break; Execution Count:3 | 3 |
1224 | } | - |
1225 | // fall through | - |
1226 | default: code before this statement never executed: default: | 0 |
1227 | e->ignore(); executed (the execution status of this line is deduced): e->ignore(); | - |
1228 | } executed: } Execution Count:4 | 4 |
1229 | } executed: } Execution Count:42 | 42 |
1230 | | - |
1231 | /*! \reimp */ | - |
1232 | void QAbstractButton::keyReleaseEvent(QKeyEvent *e) | - |
1233 | { | - |
1234 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
1235 | | - |
1236 | if (!e->isAutoRepeat()) partially evaluated: !e->isAutoRepeat() yes Evaluation Count:40 | no Evaluation Count:0 |
| 0-40 |
1237 | d->repeatTimer.stop(); executed: d->repeatTimer.stop(); Execution Count:40 | 40 |
1238 | | - |
1239 | switch (e->key()) { | - |
1240 | case Qt::Key_Select: | - |
1241 | case Qt::Key_Space: | - |
1242 | if (!e->isAutoRepeat() && d->down) partially evaluated: !e->isAutoRepeat() yes Evaluation Count:13 | no Evaluation Count:0 |
partially evaluated: d->down yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
1243 | d->click(); executed: d->click(); Execution Count:13 | 13 |
1244 | break; executed: break; Execution Count:13 | 13 |
1245 | default: | - |
1246 | e->ignore(); executed (the execution status of this line is deduced): e->ignore(); | - |
1247 | } executed: } Execution Count:27 | 27 |
1248 | } executed: } Execution Count:40 | 40 |
1249 | | - |
1250 | /*!\reimp | - |
1251 | */ | - |
1252 | void QAbstractButton::timerEvent(QTimerEvent *e) | - |
1253 | { | - |
1254 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
1255 | if (e->timerId() == d->repeatTimer.timerId()) { evaluated: e->timerId() == d->repeatTimer.timerId() yes Evaluation Count:63 | yes Evaluation Count:38 |
| 38-63 |
1256 | d->repeatTimer.start(d->autoRepeatInterval, this); executed (the execution status of this line is deduced): d->repeatTimer.start(d->autoRepeatInterval, this); | - |
1257 | if (d->down) { partially evaluated: d->down yes Evaluation Count:63 | no Evaluation Count:0 |
| 0-63 |
1258 | QPointer<QAbstractButton> guard(this); executed (the execution status of this line is deduced): QPointer<QAbstractButton> guard(this); | - |
1259 | nextCheckState(); executed (the execution status of this line is deduced): nextCheckState(); | - |
1260 | if (guard) partially evaluated: guard yes Evaluation Count:63 | no Evaluation Count:0 |
| 0-63 |
1261 | d->emitReleased(); executed: d->emitReleased(); Execution Count:63 | 63 |
1262 | if (guard) partially evaluated: guard yes Evaluation Count:63 | no Evaluation Count:0 |
| 0-63 |
1263 | d->emitClicked(); executed: d->emitClicked(); Execution Count:63 | 63 |
1264 | if (guard) partially evaluated: guard yes Evaluation Count:63 | no Evaluation Count:0 |
| 0-63 |
1265 | d->emitPressed(); executed: d->emitPressed(); Execution Count:63 | 63 |
1266 | } executed: } Execution Count:63 | 63 |
1267 | } else if (e->timerId() == d->animateTimer.timerId()) { executed: } Execution Count:63 partially evaluated: e->timerId() == d->animateTimer.timerId() yes Evaluation Count:38 | no Evaluation Count:0 |
| 0-63 |
1268 | d->animateTimer.stop(); executed (the execution status of this line is deduced): d->animateTimer.stop(); | - |
1269 | d->click(); executed (the execution status of this line is deduced): d->click(); | - |
1270 | } executed: } Execution Count:38 | 38 |
1271 | } | - |
1272 | | - |
1273 | /*! \reimp */ | - |
1274 | void QAbstractButton::focusInEvent(QFocusEvent *e) | - |
1275 | { | - |
1276 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
1277 | #ifdef QT_KEYPAD_NAVIGATION | - |
1278 | if (!QApplication::keypadNavigationEnabled()) | - |
1279 | #endif | - |
1280 | d->fixFocusPolicy(); executed (the execution status of this line is deduced): d->fixFocusPolicy(); | - |
1281 | QWidget::focusInEvent(e); executed (the execution status of this line is deduced): QWidget::focusInEvent(e); | - |
1282 | } executed: } Execution Count:240 | 240 |
1283 | | - |
1284 | /*! \reimp */ | - |
1285 | void QAbstractButton::focusOutEvent(QFocusEvent *e) | - |
1286 | { | - |
1287 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
1288 | if (e->reason() != Qt::PopupFocusReason) evaluated: e->reason() != Qt::PopupFocusReason yes Evaluation Count:155 | yes Evaluation Count:5 |
| 5-155 |
1289 | d->down = false; executed: d->down = false; Execution Count:155 | 155 |
1290 | QWidget::focusOutEvent(e); executed (the execution status of this line is deduced): QWidget::focusOutEvent(e); | - |
1291 | } executed: } Execution Count:160 | 160 |
1292 | | - |
1293 | /*! \reimp */ | - |
1294 | void QAbstractButton::changeEvent(QEvent *e) | - |
1295 | { | - |
1296 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
1297 | switch (e->type()) { | - |
1298 | case QEvent::EnabledChange: | - |
1299 | if (!isEnabled()) evaluated: !isEnabled() yes Evaluation Count:1704 | yes Evaluation Count:970 |
| 970-1704 |
1300 | setDown(false); executed: setDown(false); Execution Count:1704 | 1704 |
1301 | break; executed: break; Execution Count:2674 | 2674 |
1302 | default: | - |
1303 | d->sizeHint = QSize(); executed (the execution status of this line is deduced): d->sizeHint = QSize(); | - |
1304 | break; executed: break; Execution Count:10667 | 10667 |
1305 | } | - |
1306 | QWidget::changeEvent(e); executed (the execution status of this line is deduced): QWidget::changeEvent(e); | - |
1307 | } executed: } Execution Count:13341 | 13341 |
1308 | | - |
1309 | /*! | - |
1310 | \fn void QAbstractButton::paintEvent(QPaintEvent *e) | - |
1311 | \reimp | - |
1312 | */ | - |
1313 | | - |
1314 | /*! | - |
1315 | \fn void QAbstractButton::pressed() | - |
1316 | | - |
1317 | This signal is emitted when the button is pressed down. | - |
1318 | | - |
1319 | \sa released(), clicked() | - |
1320 | */ | - |
1321 | | - |
1322 | /*! | - |
1323 | \fn void QAbstractButton::released() | - |
1324 | | - |
1325 | This signal is emitted when the button is released. | - |
1326 | | - |
1327 | \sa pressed(), clicked(), toggled() | - |
1328 | */ | - |
1329 | | - |
1330 | /*! | - |
1331 | \fn void QAbstractButton::clicked(bool checked) | - |
1332 | | - |
1333 | This signal is emitted when the button is activated (i.e., pressed down | - |
1334 | then released while the mouse cursor is inside the button), when the | - |
1335 | shortcut key is typed, or when click() or animateClick() is called. | - |
1336 | Notably, this signal is \e not emitted if you call setDown(), | - |
1337 | setChecked() or toggle(). | - |
1338 | | - |
1339 | If the button is checkable, \a checked is true if the button is | - |
1340 | checked, or false if the button is unchecked. | - |
1341 | | - |
1342 | \sa pressed(), released(), toggled() | - |
1343 | */ | - |
1344 | | - |
1345 | /*! | - |
1346 | \fn void QAbstractButton::toggled(bool checked) | - |
1347 | | - |
1348 | This signal is emitted whenever a checkable button changes its state. | - |
1349 | \a checked is true if the button is checked, or false if the button is | - |
1350 | unchecked. | - |
1351 | | - |
1352 | This may be the result of a user action, click() slot activation, | - |
1353 | or because setChecked() is called. | - |
1354 | | - |
1355 | The states of buttons in exclusive button groups are updated before this | - |
1356 | signal is emitted. This means that slots can act on either the "off" | - |
1357 | signal or the "on" signal emitted by the buttons in the group whose | - |
1358 | states have changed. | - |
1359 | | - |
1360 | For example, a slot that reacts to signals emitted by newly checked | - |
1361 | buttons but which ignores signals from buttons that have been unchecked | - |
1362 | can be implemented using the following pattern: | - |
1363 | | - |
1364 | \snippet code/src_gui_widgets_qabstractbutton.cpp 2 | - |
1365 | | - |
1366 | Button groups can be created using the QButtonGroup class, and | - |
1367 | updates to the button states monitored with the | - |
1368 | \l{QButtonGroup::buttonClicked()} signal. | - |
1369 | | - |
1370 | \sa checked, clicked() | - |
1371 | */ | - |
1372 | | - |
1373 | /*! | - |
1374 | \property QAbstractButton::iconSize | - |
1375 | \brief the icon size used for this button. | - |
1376 | | - |
1377 | The default size is defined by the GUI style. This is a maximum | - |
1378 | size for the icons. Smaller icons will not be scaled up. | - |
1379 | */ | - |
1380 | | - |
1381 | QSize QAbstractButton::iconSize() const | - |
1382 | { | - |
1383 | Q_D(const QAbstractButton); executed (the execution status of this line is deduced): const QAbstractButtonPrivate * const d = d_func(); | - |
1384 | if (d->iconSize.isValid()) evaluated: d->iconSize.isValid() yes Evaluation Count:253 | yes Evaluation Count:7653 |
| 253-7653 |
1385 | return d->iconSize; executed: return d->iconSize; Execution Count:253 | 253 |
1386 | int e = style()->pixelMetric(QStyle::PM_ButtonIconSize, 0, this); executed (the execution status of this line is deduced): int e = style()->pixelMetric(QStyle::PM_ButtonIconSize, 0, this); | - |
1387 | return QSize(e, e); executed: return QSize(e, e); Execution Count:7653 | 7653 |
1388 | } | - |
1389 | | - |
1390 | void QAbstractButton::setIconSize(const QSize &size) | - |
1391 | { | - |
1392 | Q_D(QAbstractButton); executed (the execution status of this line is deduced): QAbstractButtonPrivate * const d = d_func(); | - |
1393 | if (d->iconSize == size) partially evaluated: d->iconSize == size no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
1394 | return; | 0 |
1395 | | - |
1396 | d->iconSize = size; executed (the execution status of this line is deduced): d->iconSize = size; | - |
1397 | d->sizeHint = QSize(); executed (the execution status of this line is deduced): d->sizeHint = QSize(); | - |
1398 | updateGeometry(); executed (the execution status of this line is deduced): updateGeometry(); | - |
1399 | if (isVisible()) { partially evaluated: isVisible() no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
1400 | update(); never executed (the execution status of this line is deduced): update(); | - |
1401 | } | 0 |
1402 | } executed: } Execution Count:26 | 26 |
1403 | | - |
1404 | | - |
1405 | | - |
1406 | QT_END_NAMESPACE | - |
1407 | | - |
| | |