qdialogbuttonbox.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qdialogbuttonbox.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtWidgets module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
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 The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34#include <QtCore/qhash.h>-
35#include <QtWidgets/qpushbutton.h>-
36#include <QtWidgets/qstyle.h>-
37#include <QtWidgets/qlayout.h>-
38#include <QtWidgets/qdialog.h>-
39#include <QtWidgets/qapplication.h>-
40#include <private/qwidget_p.h>-
41#include <private/qguiapplication_p.h>-
42#include <QtGui/qpa/qplatformdialoghelper.h>-
43#include <QtGui/qpa/qplatformtheme.h>-
44#include <QtWidgets/qaction.h>-
45-
46#include "qdialogbuttonbox.h"-
47-
48QT_BEGIN_NAMESPACE-
49-
50/*!-
51 \class QDialogButtonBox-
52 \since 4.2-
53 \brief The QDialogButtonBox class is a widget that presents buttons in a-
54 layout that is appropriate to the current widget style.-
55-
56 \ingroup dialog-classes-
57 \inmodule QtWidgets-
58-
59 Dialogs and message boxes typically present buttons in a layout that-
60 conforms to the interface guidelines for that platform. Invariably,-
61 different platforms have different layouts for their dialogs.-
62 QDialogButtonBox allows a developer to add buttons to it and will-
63 automatically use the appropriate layout for the user's desktop-
64 environment.-
65-
66 Most buttons for a dialog follow certain roles. Such roles include:-
67-
68 \list-
69 \li Accepting or rejecting the dialog.-
70 \li Asking for help.-
71 \li Performing actions on the dialog itself (such as resetting fields or-
72 applying changes).-
73 \endlist-
74-
75 There can also be alternate ways of dismissing the dialog which may cause-
76 destructive results.-
77-
78 Most dialogs have buttons that can almost be considered standard (e.g.-
79 \uicontrol OK and \uicontrol Cancel buttons). It is sometimes convenient to create these-
80 buttons in a standard way.-
81-
82 There are a couple ways of using QDialogButtonBox. One ways is to create-
83 the buttons (or button texts) yourself and add them to the button box,-
84 specifying their role.-
85-
86 \snippet dialogs/extension/finddialog.cpp 1-
87-
88 Alternatively, QDialogButtonBox provides several standard buttons (e.g. OK, Cancel, Save)-
89 that you can use. They exist as flags so you can OR them together in the constructor.-
90-
91 \snippet dialogs/tabdialog/tabdialog.cpp 2-
92-
93 You can mix and match normal buttons and standard buttons.-
94-
95 Currently the buttons are laid out in the following way if the button box is horizontal:-
96 \table-
97 \row \li \inlineimage buttonbox-gnomelayout-horizontal.png GnomeLayout Horizontal-
98 \li Button box laid out in horizontal GnomeLayout-
99 \row \li \inlineimage buttonbox-kdelayout-horizontal.png KdeLayout Horizontal-
100 \li Button box laid out in horizontal KdeLayout-
101 \row \li \inlineimage buttonbox-maclayout-horizontal.png MacLayout Horizontal-
102 \li Button box laid out in horizontal MacLayout-
103 \row \li \inlineimage buttonbox-winlayout-horizontal.png WinLayout Horizontal-
104 \li Button box laid out in horizontal WinLayout-
105 \endtable-
106-
107 The buttons are laid out the following way if the button box is vertical:-
108-
109 \table-
110 \row \li GnomeLayout-
111 \li KdeLayout-
112 \li MacLayout-
113 \li WinLayout-
114 \row \li \inlineimage buttonbox-gnomelayout-vertical.png GnomeLayout Vertical-
115 \li \inlineimage buttonbox-kdelayout-vertical.png KdeLayout Vertical-
116 \li \inlineimage buttonbox-maclayout-vertical.png MacLayout Vertical-
117 \li \inlineimage buttonbox-winlayout-vertical.png WinLayout Vertical-
118 \endtable-
119-
120 Additionally, button boxes that contain only buttons with ActionRole or-
121 HelpRole can be considered modeless and have an alternate look on \macos:-
122-
123 \table-
124 \row \li modeless horizontal MacLayout-
125 \li \inlineimage buttonbox-mac-modeless-horizontal.png Screenshot of modeless horizontal MacLayout-
126 \row \li modeless vertical MacLayout-
127 \li \inlineimage buttonbox-mac-modeless-vertical.png Screenshot of modeless vertical MacLayout-
128 \endtable-
129-
130 When a button is clicked in the button box, the clicked() signal is emitted-
131 for the actual button is that is pressed. For convenience, if the button-
132 has an AcceptRole, RejectRole, or HelpRole, the accepted(), rejected(), or-
133 helpRequested() signals are emitted respectively.-
134-
135 If you want a specific button to be default you need to call-
136 QPushButton::setDefault() on it yourself. However, if there is no default-
137 button set and to preserve which button is the default button across-
138 platforms when using the QPushButton::autoDefault property, the first push-
139 button with the accept role is made the default button when the-
140 QDialogButtonBox is shown,-
141-
142 \sa QMessageBox, QPushButton, QDialog-
143*/-
144-
145class QDialogButtonBoxPrivate : public QWidgetPrivate-
146{-
147 Q_DECLARE_PUBLIC(QDialogButtonBox)-
148-
149public:-
150 QDialogButtonBoxPrivate(Qt::Orientation orient);-
151-
152 QList<QAbstractButton *> buttonLists[QDialogButtonBox::NRoles];-
153 QHash<QPushButton *, QDialogButtonBox::StandardButton> standardButtonHash;-
154-
155 Qt::Orientation orientation;-
156 QDialogButtonBox::ButtonLayout layoutPolicy;-
157 QBoxLayout *buttonLayout;-
158 bool internalRemove;-
159 bool center;-
160-
161 void createStandardButtons(QDialogButtonBox::StandardButtons buttons);-
162-
163 void layoutButtons();-
164 void initLayout();-
165 void resetLayout();-
166 QPushButton *createButton(QDialogButtonBox::StandardButton button, bool doLayout = true);-
167 void addButton(QAbstractButton *button, QDialogButtonBox::ButtonRole role, bool doLayout = true);-
168 void _q_handleButtonDestroyed();-
169 void _q_handleButtonClicked();-
170 void addButtonsToLayout(const QList<QAbstractButton *> &buttonList, bool reverse);-
171 void retranslateStrings();-
172};-
173-
174QDialogButtonBoxPrivate::QDialogButtonBoxPrivate(Qt::Orientation orient)-
175 : orientation(orient), buttonLayout(0), internalRemove(false), center(false)-
176{-
177}
never executed: end of block
0
178-
179void QDialogButtonBoxPrivate::initLayout()-
180{-
181 Q_Q(QDialogButtonBox);-
182 layoutPolicy = QDialogButtonBox::ButtonLayout(q->style()->styleHint(QStyle::SH_DialogButtonLayout, 0, q));-
183 bool createNewLayout = buttonLayout == 0
buttonLayout == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
184 || (orientation == Qt::Horizontal && qobject_cast<QVBoxLayout *>(buttonLayout) != 0)
orientation == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
qobject_cast<Q...onLayout) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
185 || (orientation == Qt::Vertical && qobject_cast<QHBoxLayout *>(buttonLayout) != 0);
orientation == Qt::VerticalDescription
TRUEnever evaluated
FALSEnever evaluated
qobject_cast<Q...onLayout) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
186 if (createNewLayout) {
createNewLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
0
187 delete buttonLayout;-
188 if (orientation == Qt::Horizontal)
orientation == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
189 buttonLayout = new QHBoxLayout(q);
never executed: buttonLayout = new QHBoxLayout(q);
0
190 else-
191 buttonLayout = new QVBoxLayout(q);
never executed: buttonLayout = new QVBoxLayout(q);
0
192 }-
193-
194 int left, top, right, bottom;-
195 setLayoutItemMargins(QStyle::SE_PushButtonLayoutItem);-
196 getLayoutItemMargins(&left, &top, &right, &bottom);-
197 buttonLayout->setContentsMargins(-left, -top, -right, -bottom);-
198-
199 if (!q->testAttribute(Qt::WA_WState_OwnSizePolicy)) {
!q->testAttrib...OwnSizePolicy)Description
TRUEnever evaluated
FALSEnever evaluated
0
200 QSizePolicy sp(QSizePolicy::Expanding, QSizePolicy::Fixed, QSizePolicy::ButtonBox);-
201 if (orientation == Qt::Vertical)
orientation == Qt::VerticalDescription
TRUEnever evaluated
FALSEnever evaluated
0
202 sp.transpose();
never executed: sp.transpose();
0
203 q->setSizePolicy(sp);-
204 q->setAttribute(Qt::WA_WState_OwnSizePolicy, false);-
205 }
never executed: end of block
0
206}
never executed: end of block
0
207-
208void QDialogButtonBoxPrivate::resetLayout()-
209{-
210 //delete buttonLayout;-
211 initLayout();-
212 layoutButtons();-
213}
never executed: end of block
0
214-
215void QDialogButtonBoxPrivate::addButtonsToLayout(const QList<QAbstractButton *> &buttonList,-
216 bool reverse)-
217{-
218 int start = reverse ? buttonList.count() - 1 : 0;
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
0
219 int end = reverse ? -1 : buttonList.count();
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
0
220 int step = reverse ? -1 : 1;
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
0
221-
222 for (int i = start; i != end; i += step) {
i != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
223 QAbstractButton *button = buttonList.at(i);-
224 buttonLayout->addWidget(button);-
225 button->show();-
226 }
never executed: end of block
0
227}
never executed: end of block
0
228-
229void QDialogButtonBoxPrivate::layoutButtons()-
230{-
231 Q_Q(QDialogButtonBox);-
232 const int MacGap = 36 - 8; // 8 is the default gap between a widget and a spacer item-
233-
234 for (int i = buttonLayout->count() - 1; i >= 0; --i) {
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
235 QLayoutItem *item = buttonLayout->takeAt(i);-
236 if (QWidget *widget = item->widget())
QWidget *widge...item->widget()Description
TRUEnever evaluated
FALSEnever evaluated
0
237 widget->hide();
never executed: widget->hide();
0
238 delete item;-
239 }
never executed: end of block
0
240-
241 int tmpPolicy = layoutPolicy;-
242-
243 static const int M = 5;-
244 static const int ModalRoles[M] = { QPlatformDialogHelper::AcceptRole, QPlatformDialogHelper::RejectRole,-
245 QPlatformDialogHelper::DestructiveRole, QPlatformDialogHelper::YesRole, QPlatformDialogHelper::NoRole };-
246 if (tmpPolicy == QDialogButtonBox::MacLayout) {
tmpPolicy == Q...Box::MacLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
0
247 bool hasModalButton = false;-
248 for (int i = 0; i < M; ++i) {
i < MDescription
TRUEnever evaluated
FALSEnever evaluated
0
249 if (!buttonLists[ModalRoles[i]].isEmpty()) {
!buttonLists[M...[i]].isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
250 hasModalButton = true;-
251 break;
never executed: break;
0
252 }-
253 }
never executed: end of block
0
254 if (!hasModalButton)
!hasModalButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
255 tmpPolicy = 4; // Mac modeless
never executed: tmpPolicy = 4;
0
256 }
never executed: end of block
0
257-
258 const int *currentLayout = QPlatformDialogHelper::buttonLayout(-
259 orientation, static_cast<QPlatformDialogHelper::ButtonLayout>(tmpPolicy));-
260-
261 if (center)
centerDescription
TRUEnever evaluated
FALSEnever evaluated
0
262 buttonLayout->addStretch();
never executed: buttonLayout->addStretch();
0
263-
264 const QList<QAbstractButton *> &acceptRoleList = buttonLists[QPlatformDialogHelper::AcceptRole];-
265-
266 while (*currentLayout != QPlatformDialogHelper::EOL) {
*currentLayout...logHelper::EOLDescription
TRUEnever evaluated
FALSEnever evaluated
0
267 int role = (*currentLayout & ~QPlatformDialogHelper::Reverse);-
268 bool reverse = (*currentLayout & QPlatformDialogHelper::Reverse);-
269-
270 switch (role) {-
271 case QPlatformDialogHelper::Stretch:
never executed: case QPlatformDialogHelper::Stretch:
0
272 if (!center)
!centerDescription
TRUEnever evaluated
FALSEnever evaluated
0
273 buttonLayout->addStretch();
never executed: buttonLayout->addStretch();
0
274 break;
never executed: break;
0
275 case QPlatformDialogHelper::AcceptRole: {
never executed: case QPlatformDialogHelper::AcceptRole:
0
276 if (acceptRoleList.isEmpty())
acceptRoleList.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
277 break;
never executed: break;
0
278 // Only the first one-
279 QAbstractButton *button = acceptRoleList.first();-
280 buttonLayout->addWidget(button);-
281 button->show();-
282 }-
283 break;
never executed: break;
0
284 case QPlatformDialogHelper::AlternateRole:
never executed: case QPlatformDialogHelper::AlternateRole:
0
285 {-
286 if (acceptRoleList.size() < 2)
acceptRoleList.size() < 2Description
TRUEnever evaluated
FALSEnever evaluated
0
287 break;
never executed: break;
0
288 QList<QAbstractButton *> list = acceptRoleList;-
289 list.removeFirst();-
290 addButtonsToLayout(list, reverse);-
291 }-
292 break;
never executed: break;
0
293 case QPlatformDialogHelper::DestructiveRole:
never executed: case QPlatformDialogHelper::DestructiveRole:
0
294 {-
295 const QList<QAbstractButton *> &list = buttonLists[role];-
296-
297 /*-
298 Mac: Insert a gap on the left of the destructive-
299 buttons to ensure that they don't get too close to-
300 the help and action buttons (but only if there are-
301 some buttons to the left of the destructive buttons-
302 (and the stretch, whence buttonLayout->count() > 1-
303 and not 0)).-
304 */-
305 if (tmpPolicy == QDialogButtonBox::MacLayout
tmpPolicy == Q...Box::MacLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
0
306 && !list.isEmpty() && buttonLayout->count() > 1)
!list.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
buttonLayout->count() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
307 buttonLayout->addSpacing(MacGap);
never executed: buttonLayout->addSpacing(MacGap);
0
308-
309 addButtonsToLayout(list, reverse);-
310-
311 /*-
312 Insert a gap between the destructive buttons and the-
313 accept and reject buttons.-
314 */-
315 if (tmpPolicy == QDialogButtonBox::MacLayout && !list.isEmpty())
tmpPolicy == Q...Box::MacLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
!list.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
316 buttonLayout->addSpacing(MacGap);
never executed: buttonLayout->addSpacing(MacGap);
0
317 }-
318 break;
never executed: break;
0
319 case QPlatformDialogHelper::RejectRole:
never executed: case QPlatformDialogHelper::RejectRole:
0
320 case QPlatformDialogHelper::ActionRole:
never executed: case QPlatformDialogHelper::ActionRole:
0
321 case QPlatformDialogHelper::HelpRole:
never executed: case QPlatformDialogHelper::HelpRole:
0
322 case QPlatformDialogHelper::YesRole:
never executed: case QPlatformDialogHelper::YesRole:
0
323 case QPlatformDialogHelper::NoRole:
never executed: case QPlatformDialogHelper::NoRole:
0
324 case QPlatformDialogHelper::ApplyRole:
never executed: case QPlatformDialogHelper::ApplyRole:
0
325 case QPlatformDialogHelper::ResetRole:
never executed: case QPlatformDialogHelper::ResetRole:
0
326 addButtonsToLayout(buttonLists[role], reverse);-
327 }
never executed: end of block
0
328 ++currentLayout;-
329 }
never executed: end of block
0
330-
331 QWidget *lastWidget = 0;-
332 q->setFocusProxy(0);-
333 for (int i = 0; i < buttonLayout->count(); ++i) {
i < buttonLayout->count()Description
TRUEnever evaluated
FALSEnever evaluated
0
334 QLayoutItem *item = buttonLayout->itemAt(i);-
335 if (QWidget *widget = item->widget()) {
QWidget *widge...item->widget()Description
TRUEnever evaluated
FALSEnever evaluated
0
336 if (lastWidget)
lastWidgetDescription
TRUEnever evaluated
FALSEnever evaluated
0
337 QWidget::setTabOrder(lastWidget, widget);
never executed: QWidget::setTabOrder(lastWidget, widget);
0
338 else-
339 q->setFocusProxy(widget);
never executed: q->setFocusProxy(widget);
0
340 lastWidget = widget;-
341 }
never executed: end of block
0
342 }
never executed: end of block
0
343-
344 if (center)
centerDescription
TRUEnever evaluated
FALSEnever evaluated
0
345 buttonLayout->addStretch();
never executed: buttonLayout->addStretch();
0
346}
never executed: end of block
0
347-
348QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardButton sbutton,-
349 bool doLayout)-
350{-
351 Q_Q(QDialogButtonBox);-
352 int icon = 0;-
353-
354 switch (sbutton) {-
355 case QDialogButtonBox::Ok:
never executed: case QDialogButtonBox::Ok:
0
356 icon = QStyle::SP_DialogOkButton;-
357 break;
never executed: break;
0
358 case QDialogButtonBox::Save:
never executed: case QDialogButtonBox::Save:
0
359 icon = QStyle::SP_DialogSaveButton;-
360 break;
never executed: break;
0
361 case QDialogButtonBox::Open:
never executed: case QDialogButtonBox::Open:
0
362 icon = QStyle::SP_DialogOpenButton;-
363 break;
never executed: break;
0
364 case QDialogButtonBox::Cancel:
never executed: case QDialogButtonBox::Cancel:
0
365 icon = QStyle::SP_DialogCancelButton;-
366 break;
never executed: break;
0
367 case QDialogButtonBox::Close:
never executed: case QDialogButtonBox::Close:
0
368 icon = QStyle::SP_DialogCloseButton;-
369 break;
never executed: break;
0
370 case QDialogButtonBox::Apply:
never executed: case QDialogButtonBox::Apply:
0
371 icon = QStyle::SP_DialogApplyButton;-
372 break;
never executed: break;
0
373 case QDialogButtonBox::Reset:
never executed: case QDialogButtonBox::Reset:
0
374 icon = QStyle::SP_DialogResetButton;-
375 break;
never executed: break;
0
376 case QDialogButtonBox::Help:
never executed: case QDialogButtonBox::Help:
0
377 icon = QStyle::SP_DialogHelpButton;-
378 break;
never executed: break;
0
379 case QDialogButtonBox::Discard:
never executed: case QDialogButtonBox::Discard:
0
380 icon = QStyle::SP_DialogDiscardButton;-
381 break;
never executed: break;
0
382 case QDialogButtonBox::Yes:
never executed: case QDialogButtonBox::Yes:
0
383 icon = QStyle::SP_DialogYesButton;-
384 break;
never executed: break;
0
385 case QDialogButtonBox::No:
never executed: case QDialogButtonBox::No:
0
386 icon = QStyle::SP_DialogNoButton;-
387 break;
never executed: break;
0
388 case QDialogButtonBox::YesToAll:
never executed: case QDialogButtonBox::YesToAll:
0
389 case QDialogButtonBox::NoToAll:
never executed: case QDialogButtonBox::NoToAll:
0
390 case QDialogButtonBox::SaveAll:
never executed: case QDialogButtonBox::SaveAll:
0
391 case QDialogButtonBox::Abort:
never executed: case QDialogButtonBox::Abort:
0
392 case QDialogButtonBox::Retry:
never executed: case QDialogButtonBox::Retry:
0
393 case QDialogButtonBox::Ignore:
never executed: case QDialogButtonBox::Ignore:
0
394 case QDialogButtonBox::RestoreDefaults:
never executed: case QDialogButtonBox::RestoreDefaults:
0
395 break;
never executed: break;
0
396 case QDialogButtonBox::NoButton:
never executed: case QDialogButtonBox::NoButton:
0
397 return 0;
never executed: return 0;
0
398 ;-
399 }-
400 QPushButton *button = new QPushButton(QGuiApplicationPrivate::platformTheme()->standardButtonText(sbutton), q);-
401 QStyle *style = q->style();-
402 if (style->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons, 0, q) && icon != 0)
style->styleHi...veIcons, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
icon != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
403 button->setIcon(style->standardIcon(QStyle::StandardPixmap(icon), 0, q));
never executed: button->setIcon(style->standardIcon(QStyle::StandardPixmap(icon), 0, q));
0
404 if (style != QApplication::style()) // Propagate style
style != QApplication::style()Description
TRUEnever evaluated
FALSEnever evaluated
0
405 button->setStyle(style);
never executed: button->setStyle(style);
0
406 standardButtonHash.insert(button, sbutton);-
407 QPlatformDialogHelper::ButtonRole role = QPlatformDialogHelper::buttonRole(static_cast<QPlatformDialogHelper::StandardButton>(sbutton));-
408 if (role != QPlatformDialogHelper::InvalidRole) {
role != QPlatf...r::InvalidRoleDescription
TRUEnever evaluated
FALSEnever evaluated
0
409 addButton(button, static_cast<QDialogButtonBox::ButtonRole>(role), doLayout);-
410 } else {
never executed: end of block
0
411 qWarning("QDialogButtonBox::createButton: Invalid ButtonRole, button not added");-
412 }
never executed: end of block
0
413-
414#ifdef Q_DEAD_CODE_FROM_QT4_MAC-
415 // Since mnemonics is off by default on Mac, we add a Cmd-D-
416 // shortcut here to e.g. make the "Don't Save" button work nativly:-
417 if (sbutton == QDialogButtonBox::Discard)-
418 button->setShortcut(QKeySequence(QLatin1String("Ctrl+D")));-
419#endif-
420-
421 return button;
never executed: return button;
0
422}-
423-
424void QDialogButtonBoxPrivate::addButton(QAbstractButton *button, QDialogButtonBox::ButtonRole role,-
425 bool doLayout)-
426{-
427 Q_Q(QDialogButtonBox);-
428 QObject::connect(button, SIGNAL(clicked()), q, SLOT(_q_handleButtonClicked()));-
429 QObject::connect(button, SIGNAL(destroyed()), q, SLOT(_q_handleButtonDestroyed()));-
430 buttonLists[role].append(button);-
431 if (doLayout)
doLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
0
432 layoutButtons();
never executed: layoutButtons();
0
433}
never executed: end of block
0
434-
435void QDialogButtonBoxPrivate::createStandardButtons(QDialogButtonBox::StandardButtons buttons)-
436{-
437 uint i = QDialogButtonBox::FirstButton;-
438 while (i <= QDialogButtonBox::LastButton) {
i <= QDialogBu...ox::LastButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
439 if (i & buttons) {
i & buttonsDescription
TRUEnever evaluated
FALSEnever evaluated
0
440 createButton(QDialogButtonBox::StandardButton(i), false);-
441 }
never executed: end of block
0
442 i = i << 1;-
443 }
never executed: end of block
0
444 layoutButtons();-
445}
never executed: end of block
0
446-
447void QDialogButtonBoxPrivate::retranslateStrings()-
448{-
449 typedef QHash<QPushButton *, QDialogButtonBox::StandardButton>::iterator Iterator;-
450-
451 const Iterator end = standardButtonHash.end();-
452 for (Iterator it = standardButtonHash.begin(); it != end; ++it) {
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
453 const QString text = QGuiApplicationPrivate::platformTheme()->standardButtonText(it.value());-
454 if (!text.isEmpty())
!text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
455 it.key()->setText(text);
never executed: it.key()->setText(text);
0
456 }
never executed: end of block
0
457}
never executed: end of block
0
458-
459/*!-
460 Constructs an empty, horizontal button box with the given \a parent.-
461-
462 \sa orientation, addButton()-
463*/-
464QDialogButtonBox::QDialogButtonBox(QWidget *parent)-
465 : QWidget(*new QDialogButtonBoxPrivate(Qt::Horizontal), parent, 0)-
466{-
467 d_func()->initLayout();-
468}
never executed: end of block
0
469-
470/*!-
471 Constructs an empty button box with the given \a orientation and \a parent.-
472-
473 \sa orientation, addButton()-
474*/-
475QDialogButtonBox::QDialogButtonBox(Qt::Orientation orientation, QWidget *parent)-
476 : QWidget(*new QDialogButtonBoxPrivate(orientation), parent, 0)-
477{-
478 d_func()->initLayout();-
479}
never executed: end of block
0
480-
481/*!-
482 \since 5.2-
483-
484 Constructs a horizontal button box with the given \a parent, containing-
485 the standard buttons specified by \a buttons.-
486-
487 \sa orientation, addButton()-
488*/-
489QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, QWidget *parent)-
490 : QWidget(*new QDialogButtonBoxPrivate(Qt::Horizontal), parent, 0)-
491{-
492 d_func()->initLayout();-
493 d_func()->createStandardButtons(buttons);-
494}
never executed: end of block
0
495-
496/*!-
497 Constructs a button box with the given \a orientation and \a parent, containing-
498 the standard buttons specified by \a buttons.-
499-
500 \sa orientation, addButton()-
501*/-
502QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation,-
503 QWidget *parent)-
504 : QWidget(*new QDialogButtonBoxPrivate(orientation), parent, 0)-
505{-
506 d_func()->initLayout();-
507 d_func()->createStandardButtons(buttons);-
508}
never executed: end of block
0
509-
510/*!-
511 Destroys the button box.-
512*/-
513QDialogButtonBox::~QDialogButtonBox()-
514{-
515}-
516-
517/*!-
518 \enum QDialogButtonBox::ButtonRole-
519 \enum QMessageBox::ButtonRole-
520-
521 This enum describes the roles that can be used to describe buttons in-
522 the button box. Combinations of these roles are as flags used to-
523 describe different aspects of their behavior.-
524-
525 \value InvalidRole The button is invalid.-
526 \value AcceptRole Clicking the button causes the dialog to be accepted-
527 (e.g. OK).-
528 \value RejectRole Clicking the button causes the dialog to be rejected-
529 (e.g. Cancel).-
530 \value DestructiveRole Clicking the button causes a destructive change-
531 (e.g. for Discarding Changes) and closes the dialog.-
532 \value ActionRole Clicking the button causes changes to the elements within-
533 the dialog.-
534 \value HelpRole The button can be clicked to request help.-
535 \value YesRole The button is a "Yes"-like button.-
536 \value NoRole The button is a "No"-like button.-
537 \value ApplyRole The button applies current changes.-
538 \value ResetRole The button resets the dialog's fields to default values.-
539-
540 \omitvalue NRoles-
541-
542 \sa StandardButton-
543*/-
544-
545/*!-
546 \enum QDialogButtonBox::StandardButton-
547-
548 These enums describe flags for standard buttons. Each button has a-
549 defined \l ButtonRole.-
550-
551 \value Ok An "OK" button defined with the \l AcceptRole.-
552 \value Open An "Open" button defined with the \l AcceptRole.-
553 \value Save A "Save" button defined with the \l AcceptRole.-
554 \value Cancel A "Cancel" button defined with the \l RejectRole.-
555 \value Close A "Close" button defined with the \l RejectRole.-
556 \value Discard A "Discard" or "Don't Save" button, depending on the platform,-
557 defined with the \l DestructiveRole.-
558 \value Apply An "Apply" button defined with the \l ApplyRole.-
559 \value Reset A "Reset" button defined with the \l ResetRole.-
560 \value RestoreDefaults A "Restore Defaults" button defined with the \l ResetRole.-
561 \value Help A "Help" button defined with the \l HelpRole.-
562 \value SaveAll A "Save All" button defined with the \l AcceptRole.-
563 \value Yes A "Yes" button defined with the \l YesRole.-
564 \value YesToAll A "Yes to All" button defined with the \l YesRole.-
565 \value No A "No" button defined with the \l NoRole.-
566 \value NoToAll A "No to All" button defined with the \l NoRole.-
567 \value Abort An "Abort" button defined with the \l RejectRole.-
568 \value Retry A "Retry" button defined with the \l AcceptRole.-
569 \value Ignore An "Ignore" button defined with the \l AcceptRole.-
570-
571 \value NoButton An invalid button.-
572-
573 \omitvalue FirstButton-
574 \omitvalue LastButton-
575-
576 \sa ButtonRole, standardButtons-
577*/-
578-
579/*!-
580 \enum QDialogButtonBox::ButtonLayout-
581-
582 This enum describes the layout policy to be used when arranging the buttons-
583 contained in the button box.-
584-
585 \value WinLayout Use a policy appropriate for applications on Windows.-
586 \value MacLayout Use a policy appropriate for applications on \macos.-
587 \value KdeLayout Use a policy appropriate for applications on KDE.-
588 \value GnomeLayout Use a policy appropriate for applications on GNOME.-
589-
590 The button layout is specified by the \l{style()}{current style}. However,-
591 on the X11 platform, it may be influenced by the desktop environment.-
592*/-
593-
594/*!-
595 \fn void QDialogButtonBox::clicked(QAbstractButton *button)-
596-
597 This signal is emitted when a button inside the button box is clicked. The-
598 specific button that was pressed is specified by \a button.-
599-
600 \sa accepted(), rejected(), helpRequested()-
601*/-
602-
603/*!-
604 \fn void QDialogButtonBox::accepted()-
605-
606 This signal is emitted when a button inside the button box is clicked, as long-
607 as it was defined with the \l AcceptRole or \l YesRole.-
608-
609 \sa rejected(), clicked(), helpRequested()-
610*/-
611-
612/*!-
613 \fn void QDialogButtonBox::rejected()-
614-
615 This signal is emitted when a button inside the button box is clicked, as long-
616 as it was defined with the \l RejectRole or \l NoRole.-
617-
618 \sa accepted(), helpRequested(), clicked()-
619*/-
620-
621/*!-
622 \fn void QDialogButtonBox::helpRequested()-
623-
624 This signal is emitted when a button inside the button box is clicked, as long-
625 as it was defined with the \l HelpRole.-
626-
627 \sa accepted(), rejected(), clicked()-
628*/-
629-
630/*!-
631 \property QDialogButtonBox::orientation-
632 \brief the orientation of the button box-
633-
634 By default, the orientation is horizontal (i.e. the buttons are laid out-
635 side by side). The possible orientations are Qt::Horizontal and-
636 Qt::Vertical.-
637*/-
638Qt::Orientation QDialogButtonBox::orientation() const-
639{-
640 return d_func()->orientation;
never executed: return d_func()->orientation;
0
641}-
642-
643void QDialogButtonBox::setOrientation(Qt::Orientation orientation)-
644{-
645 Q_D(QDialogButtonBox);-
646 if (orientation == d->orientation)
orientation == d->orientationDescription
TRUEnever evaluated
FALSEnever evaluated
0
647 return;
never executed: return;
0
648-
649 d->orientation = orientation;-
650 d->resetLayout();-
651}
never executed: end of block
0
652-
653/*!-
654 Clears the button box, deleting all buttons within it.-
655-
656 \sa removeButton(), addButton()-
657*/-
658void QDialogButtonBox::clear()-
659{-
660 Q_D(QDialogButtonBox);-
661 // Remove the created standard buttons, they should be in the other lists, which will-
662 // do the deletion-
663 d->standardButtonHash.clear();-
664 for (int i = 0; i < NRoles; ++i) {
i < NRolesDescription
TRUEnever evaluated
FALSEnever evaluated
0
665 QList<QAbstractButton *> &list = d->buttonLists[i];-
666 while (list.count()) {
list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
667 QAbstractButton *button = list.takeAt(0);-
668 QObject::disconnect(button, SIGNAL(destroyed()), this, SLOT(_q_handleButtonDestroyed()));-
669 delete button;-
670 }
never executed: end of block
0
671 }
never executed: end of block
0
672}
never executed: end of block
0
673-
674/*!-
675 Returns a list of all the buttons that have been added to the button box.-
676-
677 \sa buttonRole(), addButton(), removeButton()-
678*/-
679QList<QAbstractButton *> QDialogButtonBox::buttons() const-
680{-
681 Q_D(const QDialogButtonBox);-
682 QList<QAbstractButton *> finalList;-
683 for (int i = 0; i < NRoles; ++i) {
i < NRolesDescription
TRUEnever evaluated
FALSEnever evaluated
0
684 const QList<QAbstractButton *> &list = d->buttonLists[i];-
685 for (int j = 0; j < list.count(); ++j)
j < list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
686 finalList.append(list.at(j));
never executed: finalList.append(list.at(j));
0
687 }
never executed: end of block
0
688 return finalList;
never executed: return finalList;
0
689}-
690-
691/*!-
692 Returns the button role for the specified \a button. This function returns-
693 \l InvalidRole if \a button is 0 or has not been added to the button box.-
694-
695 \sa buttons(), addButton()-
696*/-
697QDialogButtonBox::ButtonRole QDialogButtonBox::buttonRole(QAbstractButton *button) const-
698{-
699 Q_D(const QDialogButtonBox);-
700 for (int i = 0; i < NRoles; ++i) {
i < NRolesDescription
TRUEnever evaluated
FALSEnever evaluated
0
701 const QList<QAbstractButton *> &list = d->buttonLists[i];-
702 for (int j = 0; j < list.count(); ++j) {
j < list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
703 if (list.at(j) == button)
list.at(j) == buttonDescription
TRUEnever evaluated
FALSEnever evaluated
0
704 return ButtonRole(i);
never executed: return ButtonRole(i);
0
705 }
never executed: end of block
0
706 }
never executed: end of block
0
707 return InvalidRole;
never executed: return InvalidRole;
0
708}-
709-
710/*!-
711 Removes \a button from the button box without deleting it and sets its parent to zero.-
712-
713 \sa clear(), buttons(), addButton()-
714*/-
715void QDialogButtonBox::removeButton(QAbstractButton *button)-
716{-
717 Q_D(QDialogButtonBox);-
718-
719 if (!button)
!buttonDescription
TRUEnever evaluated
FALSEnever evaluated
0
720 return;
never executed: return;
0
721-
722 // Remove it from the standard button hash first and then from the roles-
723 if (QPushButton *pushButton = qobject_cast<QPushButton *>(button))
QPushButton *p...ton *>(button)Description
TRUEnever evaluated
FALSEnever evaluated
0
724 d->standardButtonHash.remove(pushButton);
never executed: d->standardButtonHash.remove(pushButton);
0
725 for (int i = 0; i < NRoles; ++i) {
i < NRolesDescription
TRUEnever evaluated
FALSEnever evaluated
0
726 QList<QAbstractButton *> &list = d->buttonLists[i];-
727 for (int j = 0; j < list.count(); ++j) {
j < list.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
728 if (list.at(j) == button) {
list.at(j) == buttonDescription
TRUEnever evaluated
FALSEnever evaluated
0
729 list.takeAt(j);-
730 if (!d->internalRemove) {
!d->internalRemoveDescription
TRUEnever evaluated
FALSEnever evaluated
0
731 disconnect(button, SIGNAL(clicked()), this, SLOT(_q_handleButtonClicked()));-
732 disconnect(button, SIGNAL(destroyed()), this, SLOT(_q_handleButtonDestroyed()));-
733 }
never executed: end of block
0
734 break;
never executed: break;
0
735 }-
736 }
never executed: end of block
0
737 }
never executed: end of block
0
738 if (!d->internalRemove)
!d->internalRemoveDescription
TRUEnever evaluated
FALSEnever evaluated
0
739 button->setParent(0);
never executed: button->setParent(0);
0
740}
never executed: end of block
0
741-
742/*!-
743 Adds the given \a button to the button box with the specified \a role.-
744 If the role is invalid, the button is not added.-
745-
746 If the button has already been added, it is removed and added again with the-
747 new role.-
748-
749 \note The button box takes ownership of the button.-
750-
751 \sa removeButton(), clear()-
752*/-
753void QDialogButtonBox::addButton(QAbstractButton *button, ButtonRole role)-
754{-
755 Q_D(QDialogButtonBox);-
756 if (role <= InvalidRole || role >= NRoles) {
role <= InvalidRoleDescription
TRUEnever evaluated
FALSEnever evaluated
role >= NRolesDescription
TRUEnever evaluated
FALSEnever evaluated
0
757 qWarning("QDialogButtonBox::addButton: Invalid ButtonRole, button not added");-
758 return;
never executed: return;
0
759 }-
760 removeButton(button);-
761 button->setParent(this);-
762 d->addButton(button, role);-
763}
never executed: end of block
0
764-
765/*!-
766 Creates a push button with the given \a text, adds it to the button box for the-
767 specified \a role, and returns the corresponding push button. If \a role is-
768 invalid, no button is created, and zero is returned.-
769-
770 \sa removeButton(), clear()-
771*/-
772QPushButton *QDialogButtonBox::addButton(const QString &text, ButtonRole role)-
773{-
774 Q_D(QDialogButtonBox);-
775 if (role <= InvalidRole || role >= NRoles) {
role <= InvalidRoleDescription
TRUEnever evaluated
FALSEnever evaluated
role >= NRolesDescription
TRUEnever evaluated
FALSEnever evaluated
0
776 qWarning("QDialogButtonBox::addButton: Invalid ButtonRole, button not added");-
777 return 0;
never executed: return 0;
0
778 }-
779 QPushButton *button = new QPushButton(text, this);-
780 d->addButton(button, role);-
781 return button;
never executed: return button;
0
782}-
783-
784/*!-
785 Adds a standard \a button to the button box if it is valid to do so, and returns-
786 a push button. If \a button is invalid, it is not added to the button box, and-
787 zero is returned.-
788-
789 \sa removeButton(), clear()-
790*/-
791QPushButton *QDialogButtonBox::addButton(StandardButton button)-
792{-
793 Q_D(QDialogButtonBox);-
794 return d->createButton(button);
never executed: return d->createButton(button);
0
795}-
796-
797/*!-
798 \property QDialogButtonBox::standardButtons-
799 \brief collection of standard buttons in the button box-
800-
801 This property controls which standard buttons are used by the button box.-
802-
803 \sa addButton()-
804*/-
805void QDialogButtonBox::setStandardButtons(StandardButtons buttons)-
806{-
807 Q_D(QDialogButtonBox);-
808 // Clear out all the old standard buttons, then recreate them.-
809 qDeleteAll(d->standardButtonHash.keys());-
810 d->standardButtonHash.clear();-
811-
812 d->createStandardButtons(buttons);-
813}
never executed: end of block
0
814-
815QDialogButtonBox::StandardButtons QDialogButtonBox::standardButtons() const-
816{-
817 Q_D(const QDialogButtonBox);-
818 StandardButtons standardButtons = NoButton;-
819 QHash<QPushButton *, StandardButton>::const_iterator it = d->standardButtonHash.constBegin();-
820 while (it != d->standardButtonHash.constEnd()) {
it != d->stand...ash.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
0
821 standardButtons |= it.value();-
822 ++it;-
823 }
never executed: end of block
0
824 return standardButtons;
never executed: return standardButtons;
0
825}-
826-
827/*!-
828 Returns the QPushButton corresponding to the standard button \a which,-
829 or 0 if the standard button doesn't exist in this button box.-
830-
831 \sa standardButton(), standardButtons(), buttons()-
832*/-
833QPushButton *QDialogButtonBox::button(StandardButton which) const-
834{-
835 Q_D(const QDialogButtonBox);-
836 return d->standardButtonHash.key(which);
never executed: return d->standardButtonHash.key(which);
0
837}-
838-
839/*!-
840 Returns the standard button enum value corresponding to the given \a button,-
841 or NoButton if the given \a button isn't a standard button.-
842-
843 \sa button(), buttons(), standardButtons()-
844*/-
845QDialogButtonBox::StandardButton QDialogButtonBox::standardButton(QAbstractButton *button) const-
846{-
847 Q_D(const QDialogButtonBox);-
848 return d->standardButtonHash.value(static_cast<QPushButton *>(button));
never executed: return d->standardButtonHash.value(static_cast<QPushButton *>(button));
0
849}-
850-
851void QDialogButtonBoxPrivate::_q_handleButtonClicked()-
852{-
853 Q_Q(QDialogButtonBox);-
854 if (QAbstractButton *button = qobject_cast<QAbstractButton *>(q->sender())) {
QAbstractButto...>(q->sender())Description
TRUEnever evaluated
FALSEnever evaluated
0
855 // Can't fetch this *after* emitting clicked, as clicked may destroy the button-
856 // or change its role. Now changing the role is not possible yet, but arguably-
857 // both clicked and accepted/rejected/etc. should be emitted "atomically"-
858 // depending on whatever role the button had at the time of the click.-
859 const QDialogButtonBox::ButtonRole buttonRole = q->buttonRole(button);-
860 QPointer<QDialogButtonBox> guard(q);-
861-
862 emit q->clicked(button);-
863-
864 if (!guard)
!guardDescription
TRUEnever evaluated
FALSEnever evaluated
0
865 return;
never executed: return;
0
866-
867 switch (buttonRole) {-
868 case QPlatformDialogHelper::AcceptRole:
never executed: case QPlatformDialogHelper::AcceptRole:
0
869 case QPlatformDialogHelper::YesRole:
never executed: case QPlatformDialogHelper::YesRole:
0
870 emit q->accepted();-
871 break;
never executed: break;
0
872 case QPlatformDialogHelper::RejectRole:
never executed: case QPlatformDialogHelper::RejectRole:
0
873 case QPlatformDialogHelper::NoRole:
never executed: case QPlatformDialogHelper::NoRole:
0
874 emit q->rejected();-
875 break;
never executed: break;
0
876 case QPlatformDialogHelper::HelpRole:
never executed: case QPlatformDialogHelper::HelpRole:
0
877 emit q->helpRequested();-
878 break;
never executed: break;
0
879 default:
never executed: default:
0
880 break;
never executed: break;
0
881 }-
882 }-
883}
never executed: end of block
0
884-
885void QDialogButtonBoxPrivate::_q_handleButtonDestroyed()-
886{-
887 Q_Q(QDialogButtonBox);-
888 if (QObject *object = q->sender()) {
QObject *object = q->sender()Description
TRUEnever evaluated
FALSEnever evaluated
0
889 QBoolBlocker skippy(internalRemove);-
890 q->removeButton(static_cast<QAbstractButton *>(object));-
891 }
never executed: end of block
0
892}
never executed: end of block
0
893-
894/*!-
895 \property QDialogButtonBox::centerButtons-
896 \brief whether the buttons in the button box are centered-
897-
898 By default, this property is \c false. This behavior is appopriate-
899 for most types of dialogs. A notable exception is message boxes-
900 on most platforms (e.g. Windows), where the button box is-
901 centered horizontally.-
902-
903 \sa QMessageBox-
904*/-
905void QDialogButtonBox::setCenterButtons(bool center)-
906{-
907 Q_D(QDialogButtonBox);-
908 if (d->center != center) {
d->center != centerDescription
TRUEnever evaluated
FALSEnever evaluated
0
909 d->center = center;-
910 d->resetLayout();-
911 }
never executed: end of block
0
912}
never executed: end of block
0
913-
914bool QDialogButtonBox::centerButtons() const-
915{-
916 Q_D(const QDialogButtonBox);-
917 return d->center;
never executed: return d->center;
0
918}-
919-
920/*!-
921 \reimp-
922*/-
923void QDialogButtonBox::changeEvent(QEvent *event)-
924{-
925 typedef QHash<QPushButton *, QDialogButtonBox::StandardButton> StandardButtonHash;-
926-
927 Q_D(QDialogButtonBox);-
928 switch (event->type()) {-
929 case QEvent::StyleChange: // Propagate style
never executed: case QEvent::StyleChange:
0
930 if (!d->standardButtonHash.empty()) {
!d->standardButtonHash.empty()Description
TRUEnever evaluated
FALSEnever evaluated
0
931 QStyle *newStyle = style();-
932 const StandardButtonHash::iterator end = d->standardButtonHash.end();-
933 for (StandardButtonHash::iterator it = d->standardButtonHash.begin(); it != end; ++it)
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
0
934 it.key()->setStyle(newStyle);
never executed: it.key()->setStyle(newStyle);
0
935 }
never executed: end of block
0
936 // fallthrough intended-
937#ifdef Q_OS_MAC-
938 case QEvent::MacSizeChange:-
939#endif-
940 d->resetLayout();-
941 QWidget::changeEvent(event);-
942 break;
never executed: break;
0
943 default:
never executed: default:
0
944 QWidget::changeEvent(event);-
945 break;
never executed: break;
0
946 }-
947}-
948-
949/*!-
950 \reimp-
951*/-
952bool QDialogButtonBox::event(QEvent *event)-
953{-
954 Q_D(QDialogButtonBox);-
955 if (event->type() == QEvent::Show) {
event->type() == QEvent::ShowDescription
TRUEnever evaluated
FALSEnever evaluated
0
956 QList<QAbstractButton *> acceptRoleList = d->buttonLists[AcceptRole];-
957 QPushButton *firstAcceptButton = acceptRoleList.isEmpty() ? 0 : qobject_cast<QPushButton *>(acceptRoleList.at(0));
acceptRoleList.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
958 bool hasDefault = false;-
959 QWidget *dialog = 0;-
960 QWidget *p = this;-
961 while (p && !p->isWindow()) {
pDescription
TRUEnever evaluated
FALSEnever evaluated
!p->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
962 p = p->parentWidget();-
963 if ((dialog = qobject_cast<QDialog *>(p)))
(dialog = qobj...QDialog *>(p))Description
TRUEnever evaluated
FALSEnever evaluated
0
964 break;
never executed: break;
0
965 }
never executed: end of block
0
966-
967 foreach (QPushButton *pb, (dialog ? dialog : this)->findChildren<QPushButton *>()) {-
968 if (pb->isDefault() && pb != firstAcceptButton) {
pb->isDefault()Description
TRUEnever evaluated
FALSEnever evaluated
pb != firstAcceptButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
969 hasDefault = true;-
970 break;
never executed: break;
0
971 }-
972 }
never executed: end of block
0
973 if (!hasDefault && firstAcceptButton)
!hasDefaultDescription
TRUEnever evaluated
FALSEnever evaluated
firstAcceptButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
974 firstAcceptButton->setDefault(true);
never executed: firstAcceptButton->setDefault(true);
0
975 }else if (event->type() == QEvent::LanguageChange) {
never executed: end of block
event->type() ...LanguageChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
976 d->retranslateStrings();-
977 }
never executed: end of block
0
978 return QWidget::event(event);
never executed: return QWidget::event(event);
0
979}-
980-
981QT_END_NAMESPACE-
982-
983#include "moc_qdialogbuttonbox.cpp"-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9