| 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 "qcolordialog.h" | - |
| 43 | #include "qfontdialog.h" | - |
| 44 | #include "qfiledialog.h" | - |
| 45 | | - |
| 46 | #include "qevent.h" | - |
| 47 | #include "qdesktopwidget.h" | - |
| 48 | #include "qpushbutton.h" | - |
| 49 | #include "qapplication.h" | - |
| 50 | #include "qlayout.h" | - |
| 51 | #include "qsizegrip.h" | - |
| 52 | #include "qwhatsthis.h" | - |
| 53 | #include "qmenu.h" | - |
| 54 | #include "qcursor.h" | - |
| 55 | #include <qpa/qplatformtheme.h> | - |
| 56 | #include "private/qdialog_p.h" | - |
| 57 | #include "private/qguiapplication_p.h" | - |
| 58 | #ifndef QT_NO_ACCESSIBILITY | - |
| 59 | #include "qaccessible.h" | - |
| 60 | #endif | - |
| 61 | | - |
| 62 | QT_BEGIN_NAMESPACE | - |
| 63 | | - |
| 64 | static inline int themeDialogType(const QDialog *dialog) | - |
| 65 | { | - |
| 66 | #ifndef QT_NO_FILEDIALOG | - |
| 67 | if (qobject_cast<const QFileDialog *>(dialog)) evaluated: qobject_cast<const QFileDialog *>(dialog)| yes Evaluation Count:189 | yes Evaluation Count:5 |
| 5-189 |
| 68 | return QPlatformTheme::FileDialog; executed: return QPlatformTheme::FileDialog;Execution Count:189 | 189 |
| 69 | #endif | - |
| 70 | #ifndef QT_NO_COLORDIALOG | - |
| 71 | if (qobject_cast<const QColorDialog *>(dialog)) evaluated: qobject_cast<const QColorDialog *>(dialog)| yes Evaluation Count:3 | yes Evaluation Count:2 |
| 2-3 |
| 72 | return QPlatformTheme::ColorDialog; executed: return QPlatformTheme::ColorDialog;Execution Count:3 | 3 |
| 73 | #endif | - |
| 74 | #ifndef QT_NO_FONTDIALOG | - |
| 75 | if (qobject_cast<const QFontDialog *>(dialog)) partially evaluated: qobject_cast<const QFontDialog *>(dialog)| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 76 | return QPlatformTheme::FontDialog; executed: return QPlatformTheme::FontDialog;Execution Count:2 | 2 |
| 77 | #endif | - |
| 78 | return -1; never executed: return -1; | 0 |
| 79 | } | - |
| 80 | | - |
| 81 | QPlatformDialogHelper *QDialogPrivate::platformHelper() const | - |
| 82 | { | - |
| 83 | // Delayed creation of the platform, ensuring that | - |
| 84 | // that qobject_cast<> on the dialog works in the plugin. | - |
| 85 | if (!m_platformHelperCreated) { evaluated: !m_platformHelperCreated| yes Evaluation Count:194 | yes Evaluation Count:10 |
| 10-194 |
| 86 | m_platformHelperCreated = true; executed (the execution status of this line is deduced): m_platformHelperCreated = true; | - |
| 87 | QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this); executed (the execution status of this line is deduced): QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this); | - |
| 88 | QDialog *dialog = ncThis->q_func(); executed (the execution status of this line is deduced): QDialog *dialog = ncThis->q_func(); | - |
| 89 | const int type = themeDialogType(dialog); executed (the execution status of this line is deduced): const int type = themeDialogType(dialog); | - |
| 90 | if (type >= 0) { partially evaluated: type >= 0| yes Evaluation Count:194 | no Evaluation Count:0 |
| 0-194 |
| 91 | m_platformHelper = QGuiApplicationPrivate::platformTheme() executed (the execution status of this line is deduced): m_platformHelper = QGuiApplicationPrivate::platformTheme() | - |
| 92 | ->createPlatformDialogHelper(static_cast<QPlatformTheme::DialogType>(type)); executed (the execution status of this line is deduced): ->createPlatformDialogHelper(static_cast<QPlatformTheme::DialogType>(type)); | - |
| 93 | if (m_platformHelper) { partially evaluated: m_platformHelper| no Evaluation Count:0 | yes Evaluation Count:194 |
| 0-194 |
| 94 | QObject::connect(m_platformHelper, SIGNAL(accept()), dialog, SLOT(accept())); never executed (the execution status of this line is deduced): QObject::connect(m_platformHelper, "2""accept()", dialog, "1""accept()"); | - |
| 95 | QObject::connect(m_platformHelper, SIGNAL(reject()), dialog, SLOT(reject())); never executed (the execution status of this line is deduced): QObject::connect(m_platformHelper, "2""reject()", dialog, "1""reject()"); | - |
| 96 | ncThis->initHelper(m_platformHelper); never executed (the execution status of this line is deduced): ncThis->initHelper(m_platformHelper); | - |
| 97 | } | 0 |
| 98 | } executed: }Execution Count:194 | 194 |
| 99 | } executed: }Execution Count:194 | 194 |
| 100 | return m_platformHelper; executed: return m_platformHelper;Execution Count:204 | 204 |
| 101 | } | - |
| 102 | | - |
| 103 | QWindow *QDialogPrivate::parentWindow() const | - |
| 104 | { | - |
| 105 | if (const QWidget *parent = q_func()->nativeParentWidget()) never evaluated: const QWidget *parent = q_func()->nativeParentWidget() | 0 |
| 106 | return parent->windowHandle(); never executed: return parent->windowHandle(); | 0 |
| 107 | return 0; never executed: return 0; | 0 |
| 108 | } | - |
| 109 | | - |
| 110 | bool QDialogPrivate::setNativeDialogVisible(bool visible) | - |
| 111 | { | - |
| 112 | if (QPlatformDialogHelper *helper = platformHelper()) { partially evaluated: QPlatformDialogHelper *helper = platformHelper()| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 113 | if (visible) { | 0 |
| 114 | Q_Q(QDialog); never executed (the execution status of this line is deduced): QDialog * const q = q_func(); | - |
| 115 | helperPrepareShow(helper); never executed (the execution status of this line is deduced): helperPrepareShow(helper); | - |
| 116 | nativeDialogInUse = helper->show(q->windowFlags(), q->windowModality(), parentWindow()); never executed (the execution status of this line is deduced): nativeDialogInUse = helper->show(q->windowFlags(), q->windowModality(), parentWindow()); | - |
| 117 | } else { | 0 |
| 118 | helper->hide(); never executed (the execution status of this line is deduced): helper->hide(); | - |
| 119 | } | 0 |
| 120 | } | - |
| 121 | return nativeDialogInUse; executed: return nativeDialogInUse;Execution Count:8 | 8 |
| 122 | } | - |
| 123 | | - |
| 124 | QVariant QDialogPrivate::styleHint(QPlatformDialogHelper::StyleHint hint) const | - |
| 125 | { | - |
| 126 | if (const QPlatformDialogHelper *helper = platformHelper()) never evaluated: const QPlatformDialogHelper *helper = platformHelper() | 0 |
| 127 | return helper->styleHint(hint); never executed: return helper->styleHint(hint); | 0 |
| 128 | return QPlatformDialogHelper::defaultStyleHint(hint); never executed: return QPlatformDialogHelper::defaultStyleHint(hint); | 0 |
| 129 | } | - |
| 130 | | - |
| 131 | void QDialogPrivate::deletePlatformHelper() | - |
| 132 | { | - |
| 133 | delete m_platformHelper; executed (the execution status of this line is deduced): delete m_platformHelper; | - |
| 134 | m_platformHelper = 0; executed (the execution status of this line is deduced): m_platformHelper = 0; | - |
| 135 | m_platformHelperCreated = false; executed (the execution status of this line is deduced): m_platformHelperCreated = false; | - |
| 136 | nativeDialogInUse = false; executed (the execution status of this line is deduced): nativeDialogInUse = false; | - |
| 137 | } executed: }Execution Count:217 | 217 |
| 138 | | - |
| 139 | /*! | - |
| 140 | \class QDialog | - |
| 141 | \brief The QDialog class is the base class of dialog windows. | - |
| 142 | | - |
| 143 | \ingroup dialog-classes | - |
| 144 | \ingroup abstractwidgets | - |
| 145 | \inmodule QtWidgets | - |
| 146 | | - |
| 147 | A dialog window is a top-level window mostly used for short-term | - |
| 148 | tasks and brief communications with the user. QDialogs may be | - |
| 149 | modal or modeless. QDialogs can | - |
| 150 | provide a \l{#return}{return value}, and they can have \l{#default}{default buttons}. QDialogs can also have a QSizeGrip in their | - |
| 151 | lower-right corner, using setSizeGripEnabled(). | - |
| 152 | | - |
| 153 | Note that QDialog (an any other widget that has type Qt::Dialog) uses | - |
| 154 | the parent widget slightly differently from other classes in Qt. A | - |
| 155 | dialog is always a top-level widget, but if it has a parent, its | - |
| 156 | default location is centered on top of the parent's top-level widget | - |
| 157 | (if it is not top-level itself). It will also share the parent's | - |
| 158 | taskbar entry. | - |
| 159 | | - |
| 160 | Use the overload of the QWidget::setParent() function to change | - |
| 161 | the ownership of a QDialog widget. This function allows you to | - |
| 162 | explicitly set the window flags of the reparented widget; using | - |
| 163 | the overloaded function will clear the window flags specifying the | - |
| 164 | window-system properties for the widget (in particular it will | - |
| 165 | reset the Qt::Dialog flag). | - |
| 166 | | - |
| 167 | \section1 Modal Dialogs | - |
| 168 | | - |
| 169 | A \b{modal} dialog is a dialog that blocks input to other | - |
| 170 | visible windows in the same application. Dialogs that are used to | - |
| 171 | request a file name from the user or that are used to set | - |
| 172 | application preferences are usually modal. Dialogs can be | - |
| 173 | \l{Qt::ApplicationModal}{application modal} (the default) or | - |
| 174 | \l{Qt::WindowModal}{window modal}. | - |
| 175 | | - |
| 176 | When an application modal dialog is opened, the user must finish | - |
| 177 | interacting with the dialog and close it before they can access | - |
| 178 | any other window in the application. Window modal dialogs only | - |
| 179 | block access to the window associated with the dialog, allowing | - |
| 180 | the user to continue to use other windows in an application. | - |
| 181 | | - |
| 182 | The most common way to display a modal dialog is to call its | - |
| 183 | exec() function. When the user closes the dialog, exec() will | - |
| 184 | provide a useful \l{#return}{return value}. Typically, | - |
| 185 | to get the dialog to close and return the appropriate value, we | - |
| 186 | connect a default button, e.g. \uicontrol OK, to the accept() slot and a | - |
| 187 | \uicontrol Cancel button to the reject() slot. | - |
| 188 | Alternatively you can call the done() slot with \c Accepted or | - |
| 189 | \c Rejected. | - |
| 190 | | - |
| 191 | An alternative is to call setModal(true) or setWindowModality(), | - |
| 192 | then show(). Unlike exec(), show() returns control to the caller | - |
| 193 | immediately. Calling setModal(true) is especially useful for | - |
| 194 | progress dialogs, where the user must have the ability to interact | - |
| 195 | with the dialog, e.g. to cancel a long running operation. If you | - |
| 196 | use show() and setModal(true) together to perform a long operation, | - |
| 197 | you must call QApplication::processEvents() periodically during | - |
| 198 | processing to enable the user to interact with the dialog. (See | - |
| 199 | QProgressDialog.) | - |
| 200 | | - |
| 201 | \section1 Modeless Dialogs | - |
| 202 | | - |
| 203 | A \b{modeless} dialog is a dialog that operates | - |
| 204 | independently of other windows in the same application. Find and | - |
| 205 | replace dialogs in word-processors are often modeless to allow the | - |
| 206 | user to interact with both the application's main window and with | - |
| 207 | the dialog. | - |
| 208 | | - |
| 209 | Modeless dialogs are displayed using show(), which returns control | - |
| 210 | to the caller immediately. | - |
| 211 | | - |
| 212 | If you invoke the \l{QWidget::show()}{show()} function after hiding | - |
| 213 | a dialog, the dialog will be displayed in its original position. This is | - |
| 214 | because the window manager decides the position for windows that | - |
| 215 | have not been explicitly placed by the programmer. To preserve the | - |
| 216 | position of a dialog that has been moved by the user, save its position | - |
| 217 | in your \l{QWidget::closeEvent()}{closeEvent()} handler and then | - |
| 218 | move the dialog to that position, before showing it again. | - |
| 219 | | - |
| 220 | \target default | - |
| 221 | \section1 Default Button | - |
| 222 | | - |
| 223 | A dialog's \e default button is the button that's pressed when the | - |
| 224 | user presses Enter (Return). This button is used to signify that | - |
| 225 | the user accepts the dialog's settings and wants to close the | - |
| 226 | dialog. Use QPushButton::setDefault(), QPushButton::isDefault() | - |
| 227 | and QPushButton::autoDefault() to set and control the dialog's | - |
| 228 | default button. | - |
| 229 | | - |
| 230 | \target escapekey | - |
| 231 | \section1 Escape Key | - |
| 232 | | - |
| 233 | If the user presses the Esc key in a dialog, QDialog::reject() | - |
| 234 | will be called. This will cause the window to close: The \l{QCloseEvent}{close event} cannot be \l{QCloseEvent::ignore()}{ignored}. | - |
| 235 | | - |
| 236 | \section1 Extensibility | - |
| 237 | | - |
| 238 | Extensibility is the ability to show the dialog in two ways: a | - |
| 239 | partial dialog that shows the most commonly used options, and a | - |
| 240 | full dialog that shows all the options. Typically an extensible | - |
| 241 | dialog will initially appear as a partial dialog, but with a | - |
| 242 | \uicontrol More toggle button. If the user presses the \uicontrol More button down, | - |
| 243 | the dialog is expanded. The \l{Extension Example} shows how to achieve | - |
| 244 | extensible dialogs using Qt. | - |
| 245 | | - |
| 246 | \target return | - |
| 247 | \section1 Return Value (Modal Dialogs) | - |
| 248 | | - |
| 249 | Modal dialogs are often used in situations where a return value is | - |
| 250 | required, e.g. to indicate whether the user pressed \uicontrol OK or | - |
| 251 | \uicontrol Cancel. A dialog can be closed by calling the accept() or the | - |
| 252 | reject() slots, and exec() will return \c Accepted or \c Rejected | - |
| 253 | as appropriate. The exec() call returns the result of the dialog. | - |
| 254 | The result is also available from result() if the dialog has not | - |
| 255 | been destroyed. | - |
| 256 | | - |
| 257 | In order to modify your dialog's close behavior, you can reimplement | - |
| 258 | the functions accept(), reject() or done(). The | - |
| 259 | \l{QWidget::closeEvent()}{closeEvent()} function should only be | - |
| 260 | reimplemented to preserve the dialog's position or to override the | - |
| 261 | standard close or reject behavior. | - |
| 262 | | - |
| 263 | \target examples | - |
| 264 | \section1 Code Examples | - |
| 265 | | - |
| 266 | A modal dialog: | - |
| 267 | | - |
| 268 | \snippet dialogs/dialogs.cpp 1 | - |
| 269 | | - |
| 270 | A modeless dialog: | - |
| 271 | | - |
| 272 | \snippet dialogs/dialogs.cpp 0 | - |
| 273 | | - |
| 274 | \sa QDialogButtonBox, QTabWidget, QWidget, QProgressDialog, | - |
| 275 | {fowler}{GUI Design Handbook: Dialogs, Standard}, {Extension Example}, | - |
| 276 | {Standard Dialogs Example} | - |
| 277 | */ | - |
| 278 | | - |
| 279 | /*! \enum QDialog::DialogCode | - |
| 280 | | - |
| 281 | The value returned by a modal dialog. | - |
| 282 | | - |
| 283 | \value Accepted | - |
| 284 | \value Rejected | - |
| 285 | */ | - |
| 286 | | - |
| 287 | /*! | - |
| 288 | \property QDialog::sizeGripEnabled | - |
| 289 | \brief whether the size grip is enabled | - |
| 290 | | - |
| 291 | A QSizeGrip is placed in the bottom-right corner of the dialog when this | - |
| 292 | property is enabled. By default, the size grip is disabled. | - |
| 293 | */ | - |
| 294 | | - |
| 295 | | - |
| 296 | /*! | - |
| 297 | Constructs a dialog with parent \a parent. | - |
| 298 | | - |
| 299 | A dialog is always a top-level widget, but if it has a parent, its | - |
| 300 | default location is centered on top of the parent. It will also | - |
| 301 | share the parent's taskbar entry. | - |
| 302 | | - |
| 303 | The widget flags \a f are passed on to the QWidget constructor. | - |
| 304 | If, for example, you don't want a What's This button in the title bar | - |
| 305 | of the dialog, pass Qt::WindowTitleHint | Qt::WindowSystemMenuHint in \a f. | - |
| 306 | | - |
| 307 | \sa QWidget::setWindowFlags() | - |
| 308 | */ | - |
| 309 | | - |
| 310 | QDialog::QDialog(QWidget *parent, Qt::WindowFlags f) | - |
| 311 | : QWidget(*new QDialogPrivate, parent, | - |
| 312 | f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))) | - |
| 313 | { | - |
| 314 | } executed: }Execution Count:48 | 48 |
| 315 | | - |
| 316 | /*! | - |
| 317 | \overload | - |
| 318 | \internal | - |
| 319 | */ | - |
| 320 | QDialog::QDialog(QDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f) | - |
| 321 | : QWidget(dd, parent, f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))) | - |
| 322 | { | - |
| 323 | } executed: }Execution Count:337 | 337 |
| 324 | | - |
| 325 | /*! | - |
| 326 | Destroys the QDialog, deleting all its children. | - |
| 327 | */ | - |
| 328 | | - |
| 329 | QDialog::~QDialog() | - |
| 330 | { | - |
| 331 | QT_TRY { partially evaluated: true| yes Evaluation Count:382 | no Evaluation Count:0 |
| 0-382 |
| 332 | // Need to hide() here, as our (to-be) overridden hide() | - |
| 333 | // will not be called in ~QWidget. | - |
| 334 | hide(); executed (the execution status of this line is deduced): hide(); | - |
| 335 | } QT_CATCH(...) { executed: }Execution Count:382 | 382 |
| 336 | // we're in the destructor - just swallow the exception | - |
| 337 | } | 0 |
| 338 | } | - |
| 339 | | - |
| 340 | /*! | - |
| 341 | \internal | - |
| 342 | This function is called by the push button \a pushButton when it | - |
| 343 | becomes the default button. If \a pushButton is 0, the dialogs | - |
| 344 | default default button becomes the default button. This is what a | - |
| 345 | push button calls when it loses focus. | - |
| 346 | */ | - |
| 347 | void QDialogPrivate::setDefault(QPushButton *pushButton) | - |
| 348 | { | - |
| 349 | Q_Q(QDialog); executed (the execution status of this line is deduced): QDialog * const q = q_func(); | - |
| 350 | bool hasMain = false; executed (the execution status of this line is deduced): bool hasMain = false; | - |
| 351 | QList<QPushButton*> list = q->findChildren<QPushButton*>(); executed (the execution status of this line is deduced): QList<QPushButton*> list = q->findChildren<QPushButton*>(); | - |
| 352 | for (int i=0; i<list.size(); ++i) { evaluated: i<list.size()| yes Evaluation Count:1933 | yes Evaluation Count:518 |
| 518-1933 |
| 353 | QPushButton *pb = list.at(i); executed (the execution status of this line is deduced): QPushButton *pb = list.at(i); | - |
| 354 | if (pb->window() == q) { partially evaluated: pb->window() == q| yes Evaluation Count:1933 | no Evaluation Count:0 |
| 0-1933 |
| 355 | if (pb == mainDef) evaluated: pb == mainDef| yes Evaluation Count:81 | yes Evaluation Count:1852 |
| 81-1852 |
| 356 | hasMain = true; executed: hasMain = true;Execution Count:81 | 81 |
| 357 | if (pb != pushButton) evaluated: pb != pushButton| yes Evaluation Count:1486 | yes Evaluation Count:447 |
| 447-1486 |
| 358 | pb->setDefault(false); executed: pb->setDefault(false);Execution Count:1486 | 1486 |
| 359 | } executed: }Execution Count:1933 | 1933 |
| 360 | } executed: }Execution Count:1933 | 1933 |
| 361 | if (!pushButton && hasMain) evaluated: !pushButton| yes Evaluation Count:71 | yes Evaluation Count:447 |
partially evaluated: hasMain| yes Evaluation Count:71 | no Evaluation Count:0 |
| 0-447 |
| 362 | mainDef->setDefault(true); executed: mainDef->setDefault(true);Execution Count:71 | 71 |
| 363 | if (!hasMain) evaluated: !hasMain| yes Evaluation Count:437 | yes Evaluation Count:81 |
| 81-437 |
| 364 | mainDef = pushButton; executed: mainDef = pushButton;Execution Count:437 | 437 |
| 365 | } executed: }Execution Count:518 | 518 |
| 366 | | - |
| 367 | /*! | - |
| 368 | \internal | - |
| 369 | This function sets the default default push button to \a pushButton. | - |
| 370 | This function is called by QPushButton::setDefault(). | - |
| 371 | */ | - |
| 372 | void QDialogPrivate::setMainDefault(QPushButton *pushButton) | - |
| 373 | { | - |
| 374 | mainDef = 0; executed (the execution status of this line is deduced): mainDef = 0; | - |
| 375 | setDefault(pushButton); executed (the execution status of this line is deduced): setDefault(pushButton); | - |
| 376 | } executed: }Execution Count:435 | 435 |
| 377 | | - |
| 378 | /*! | - |
| 379 | \internal | - |
| 380 | Hides the default button indicator. Called when non auto-default | - |
| 381 | push button get focus. | - |
| 382 | */ | - |
| 383 | void QDialogPrivate::hideDefault() | - |
| 384 | { | - |
| 385 | Q_Q(QDialog); never executed (the execution status of this line is deduced): QDialog * const q = q_func(); | - |
| 386 | QList<QPushButton*> list = q->findChildren<QPushButton*>(); never executed (the execution status of this line is deduced): QList<QPushButton*> list = q->findChildren<QPushButton*>(); | - |
| 387 | for (int i=0; i<list.size(); ++i) { never evaluated: i<list.size() | 0 |
| 388 | list.at(i)->setDefault(false); never executed (the execution status of this line is deduced): list.at(i)->setDefault(false); | - |
| 389 | } | 0 |
| 390 | } | 0 |
| 391 | | - |
| 392 | void QDialogPrivate::resetModalitySetByOpen() | - |
| 393 | { | - |
| 394 | Q_Q(QDialog); executed (the execution status of this line is deduced): QDialog * const q = q_func(); | - |
| 395 | if (resetModalityTo != -1 && !q->testAttribute(Qt::WA_SetWindowModality)) { partially evaluated: resetModalityTo != -1| no Evaluation Count:0 | yes Evaluation Count:210 |
never evaluated: !q->testAttribute(Qt::WA_SetWindowModality) | 0-210 |
| 396 | // open() changed the window modality and the user didn't touch it afterwards; restore it | - |
| 397 | q->setWindowModality(Qt::WindowModality(resetModalityTo)); never executed (the execution status of this line is deduced): q->setWindowModality(Qt::WindowModality(resetModalityTo)); | - |
| 398 | q->setAttribute(Qt::WA_SetWindowModality, wasModalitySet); never executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_SetWindowModality, wasModalitySet); | - |
| 399 | #ifdef Q_OS_MAC | - |
| 400 | Q_ASSERT(resetModalityTo != Qt::WindowModal); | - |
| 401 | q->setParent(q->parentWidget(), Qt::Dialog); | - |
| 402 | #endif | - |
| 403 | } | 0 |
| 404 | resetModalityTo = -1; executed (the execution status of this line is deduced): resetModalityTo = -1; | - |
| 405 | } executed: }Execution Count:210 | 210 |
| 406 | | - |
| 407 | #if defined(Q_OS_WINCE) | - |
| 408 | #ifdef Q_OS_WINCE_WM | - |
| 409 | void QDialogPrivate::_q_doneAction() | - |
| 410 | { | - |
| 411 | //Done... | - |
| 412 | QApplication::postEvent(q_func(), new QEvent(QEvent::OkRequest)); | - |
| 413 | } | - |
| 414 | #endif | - |
| 415 | | - |
| 416 | /*! | - |
| 417 | \reimp | - |
| 418 | */ | - |
| 419 | bool QDialog::event(QEvent *e) | - |
| 420 | { | - |
| 421 | bool result = QWidget::event(e); | - |
| 422 | #ifdef Q_OS_WINCE | - |
| 423 | if (e->type() == QEvent::OkRequest) { | - |
| 424 | accept(); | - |
| 425 | result = true; | - |
| 426 | } | - |
| 427 | #endif | - |
| 428 | return result; | - |
| 429 | } | - |
| 430 | #endif | - |
| 431 | | - |
| 432 | /*! | - |
| 433 | In general returns the modal dialog's result code, \c Accepted or | - |
| 434 | \c Rejected. | - |
| 435 | | - |
| 436 | \note When called on a QMessageBox instance, the returned value is a | - |
| 437 | value of the \l QMessageBox::StandardButton enum. | - |
| 438 | | - |
| 439 | Do not call this function if the dialog was constructed with the | - |
| 440 | Qt::WA_DeleteOnClose attribute. | - |
| 441 | */ | - |
| 442 | int QDialog::result() const | - |
| 443 | { | - |
| 444 | Q_D(const QDialog); executed (the execution status of this line is deduced): const QDialogPrivate * const d = d_func(); | - |
| 445 | return d->rescode; executed: return d->rescode;Execution Count:99 | 99 |
| 446 | } | - |
| 447 | | - |
| 448 | /*! | - |
| 449 | \fn void QDialog::setResult(int i) | - |
| 450 | | - |
| 451 | Sets the modal dialog's result code to \a i. | - |
| 452 | | - |
| 453 | \note We recommend that you use one of the values defined by | - |
| 454 | QDialog::DialogCode. | - |
| 455 | */ | - |
| 456 | void QDialog::setResult(int r) | - |
| 457 | { | - |
| 458 | Q_D(QDialog); executed (the execution status of this line is deduced): QDialogPrivate * const d = d_func(); | - |
| 459 | d->rescode = r; executed (the execution status of this line is deduced): d->rescode = r; | - |
| 460 | } executed: }Execution Count:227 | 227 |
| 461 | | - |
| 462 | /*! | - |
| 463 | \since 4.5 | - |
| 464 | | - |
| 465 | Shows the dialog as a \l{QDialog#Modal Dialogs}{window modal dialog}, | - |
| 466 | returning immediately. | - |
| 467 | | - |
| 468 | \sa exec(), show(), result(), setWindowModality() | - |
| 469 | */ | - |
| 470 | void QDialog::open() | - |
| 471 | { | - |
| 472 | Q_D(QDialog); executed (the execution status of this line is deduced): QDialogPrivate * const d = d_func(); | - |
| 473 | | - |
| 474 | Qt::WindowModality modality = windowModality(); executed (the execution status of this line is deduced): Qt::WindowModality modality = windowModality(); | - |
| 475 | if (modality != Qt::WindowModal) { partially evaluated: modality != Qt::WindowModal| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 476 | d->resetModalityTo = modality; executed (the execution status of this line is deduced): d->resetModalityTo = modality; | - |
| 477 | d->wasModalitySet = testAttribute(Qt::WA_SetWindowModality); executed (the execution status of this line is deduced): d->wasModalitySet = testAttribute(Qt::WA_SetWindowModality); | - |
| 478 | setWindowModality(Qt::WindowModal); executed (the execution status of this line is deduced): setWindowModality(Qt::WindowModal); | - |
| 479 | setAttribute(Qt::WA_SetWindowModality, false); executed (the execution status of this line is deduced): setAttribute(Qt::WA_SetWindowModality, false); | - |
| 480 | #ifdef Q_OS_MAC | - |
| 481 | setParent(parentWidget(), Qt::Sheet); | - |
| 482 | #endif | - |
| 483 | } executed: }Execution Count:1 | 1 |
| 484 | | - |
| 485 | setResult(0); executed (the execution status of this line is deduced): setResult(0); | - |
| 486 | show(); executed (the execution status of this line is deduced): show(); | - |
| 487 | } executed: }Execution Count:1 | 1 |
| 488 | | - |
| 489 | /*! | - |
| 490 | Shows the dialog as a \l{QDialog#Modal Dialogs}{modal dialog}, | - |
| 491 | blocking until the user closes it. The function returns a \l | - |
| 492 | DialogCode result. | - |
| 493 | | - |
| 494 | If the dialog is \l{Qt::ApplicationModal}{application modal}, users cannot | - |
| 495 | interact with any other window in the same application until they close | - |
| 496 | the dialog. If the dialog is \l{Qt::ApplicationModal}{window modal}, only | - |
| 497 | interaction with the parent window is blocked while the dialog is open. | - |
| 498 | By default, the dialog is application modal. | - |
| 499 | | - |
| 500 | \sa open(), show(), result(), setWindowModality() | - |
| 501 | */ | - |
| 502 | | - |
| 503 | int QDialog::exec() | - |
| 504 | { | - |
| 505 | Q_D(QDialog); executed (the execution status of this line is deduced): QDialogPrivate * const d = d_func(); | - |
| 506 | | - |
| 507 | if (d->eventLoop) { partially evaluated: d->eventLoop| no Evaluation Count:0 | yes Evaluation Count:97 |
| 0-97 |
| 508 | qWarning("QDialog::exec: Recursive call detected"); never executed (the execution status of this line is deduced): QMessageLogger("dialogs/qdialog.cpp", 508, __PRETTY_FUNCTION__).warning("QDialog::exec: Recursive call detected"); | - |
| 509 | return -1; never executed: return -1; | 0 |
| 510 | } | - |
| 511 | | - |
| 512 | bool deleteOnClose = testAttribute(Qt::WA_DeleteOnClose); executed (the execution status of this line is deduced): bool deleteOnClose = testAttribute(Qt::WA_DeleteOnClose); | - |
| 513 | setAttribute(Qt::WA_DeleteOnClose, false); executed (the execution status of this line is deduced): setAttribute(Qt::WA_DeleteOnClose, false); | - |
| 514 | | - |
| 515 | d->resetModalitySetByOpen(); executed (the execution status of this line is deduced): d->resetModalitySetByOpen(); | - |
| 516 | | - |
| 517 | bool wasShowModal = testAttribute(Qt::WA_ShowModal); executed (the execution status of this line is deduced): bool wasShowModal = testAttribute(Qt::WA_ShowModal); | - |
| 518 | setAttribute(Qt::WA_ShowModal, true); executed (the execution status of this line is deduced): setAttribute(Qt::WA_ShowModal, true); | - |
| 519 | setResult(0); executed (the execution status of this line is deduced): setResult(0); | - |
| 520 | | - |
| 521 | show(); executed (the execution status of this line is deduced): show(); | - |
| 522 | | - |
| 523 | QPointer<QDialog> guard = this; executed (the execution status of this line is deduced): QPointer<QDialog> guard = this; | - |
| 524 | if (d->nativeDialogInUse) { partially evaluated: d->nativeDialogInUse| no Evaluation Count:0 | yes Evaluation Count:97 |
| 0-97 |
| 525 | d->platformHelper()->exec(); never executed (the execution status of this line is deduced): d->platformHelper()->exec(); | - |
| 526 | } else { | 0 |
| 527 | QEventLoop eventLoop; executed (the execution status of this line is deduced): QEventLoop eventLoop; | - |
| 528 | d->eventLoop = &eventLoop; executed (the execution status of this line is deduced): d->eventLoop = &eventLoop; | - |
| 529 | (void) eventLoop.exec(QEventLoop::DialogExec); executed (the execution status of this line is deduced): (void) eventLoop.exec(QEventLoop::DialogExec); | - |
| 530 | } executed: }Execution Count:97 | 97 |
| 531 | if (guard.isNull()) evaluated: guard.isNull()| yes Evaluation Count:1 | yes Evaluation Count:96 |
| 1-96 |
| 532 | return QDialog::Rejected; executed: return QDialog::Rejected;Execution Count:1 | 1 |
| 533 | d->eventLoop = 0; executed (the execution status of this line is deduced): d->eventLoop = 0; | - |
| 534 | | - |
| 535 | setAttribute(Qt::WA_ShowModal, wasShowModal); executed (the execution status of this line is deduced): setAttribute(Qt::WA_ShowModal, wasShowModal); | - |
| 536 | | - |
| 537 | int res = result(); executed (the execution status of this line is deduced): int res = result(); | - |
| 538 | if (d->nativeDialogInUse) partially evaluated: d->nativeDialogInUse| no Evaluation Count:0 | yes Evaluation Count:96 |
| 0-96 |
| 539 | d->helperDone(static_cast<QDialog::DialogCode>(res), d->platformHelper()); never executed: d->helperDone(static_cast<QDialog::DialogCode>(res), d->platformHelper()); | 0 |
| 540 | if (deleteOnClose) evaluated: deleteOnClose| yes Evaluation Count:2 | yes Evaluation Count:94 |
| 2-94 |
| 541 | delete this; executed: delete this;Execution Count:2 | 2 |
| 542 | return res; executed: return res;Execution Count:96 | 96 |
| 543 | } | - |
| 544 | | - |
| 545 | /*! | - |
| 546 | Closes the dialog and sets its result code to \a r. If this dialog | - |
| 547 | is shown with exec(), done() causes the local event loop to finish, | - |
| 548 | and exec() to return \a r. | - |
| 549 | | - |
| 550 | As with QWidget::close(), done() deletes the dialog if the | - |
| 551 | Qt::WA_DeleteOnClose flag is set. If the dialog is the application's | - |
| 552 | main widget, the application terminates. If the dialog is the | - |
| 553 | last window closed, the QApplication::lastWindowClosed() signal is | - |
| 554 | emitted. | - |
| 555 | | - |
| 556 | \sa accept(), reject(), QApplication::activeWindow(), QApplication::quit() | - |
| 557 | */ | - |
| 558 | | - |
| 559 | void QDialog::done(int r) | - |
| 560 | { | - |
| 561 | Q_D(QDialog); executed (the execution status of this line is deduced): QDialogPrivate * const d = d_func(); | - |
| 562 | hide(); executed (the execution status of this line is deduced): hide(); | - |
| 563 | setResult(r); executed (the execution status of this line is deduced): setResult(r); | - |
| 564 | | - |
| 565 | d->close_helper(QWidgetPrivate::CloseNoEvent); executed (the execution status of this line is deduced): d->close_helper(QWidgetPrivate::CloseNoEvent); | - |
| 566 | d->resetModalitySetByOpen(); executed (the execution status of this line is deduced): d->resetModalitySetByOpen(); | - |
| 567 | | - |
| 568 | emit finished(r); executed (the execution status of this line is deduced): finished(r); | - |
| 569 | if (r == Accepted) evaluated: r == Accepted| yes Evaluation Count:52 | yes Evaluation Count:61 |
| 52-61 |
| 570 | emit accepted(); executed: accepted();Execution Count:52 | 52 |
| 571 | else if (r == Rejected) evaluated: r == Rejected| yes Evaluation Count:32 | yes Evaluation Count:29 |
| 29-32 |
| 572 | emit rejected(); executed: rejected();Execution Count:32 | 32 |
| 573 | } | - |
| 574 | | - |
| 575 | /*! | - |
| 576 | Hides the modal dialog and sets the result code to \c Accepted. | - |
| 577 | | - |
| 578 | \sa reject(), done() | - |
| 579 | */ | - |
| 580 | | - |
| 581 | void QDialog::accept() | - |
| 582 | { | - |
| 583 | done(Accepted); executed (the execution status of this line is deduced): done(Accepted); | - |
| 584 | } executed: }Execution Count:20 | 20 |
| 585 | | - |
| 586 | /*! | - |
| 587 | Hides the modal dialog and sets the result code to \c Rejected. | - |
| 588 | | - |
| 589 | \sa accept(), done() | - |
| 590 | */ | - |
| 591 | | - |
| 592 | void QDialog::reject() | - |
| 593 | { | - |
| 594 | done(Rejected); executed (the execution status of this line is deduced): done(Rejected); | - |
| 595 | } executed: }Execution Count:30 | 30 |
| 596 | | - |
| 597 | /*! \reimp */ | - |
| 598 | bool QDialog::eventFilter(QObject *o, QEvent *e) | - |
| 599 | { | - |
| 600 | return QWidget::eventFilter(o, e); executed: return QWidget::eventFilter(o, e);Execution Count:303 | 303 |
| 601 | } | - |
| 602 | | - |
| 603 | /***************************************************************************** | - |
| 604 | Event handlers | - |
| 605 | *****************************************************************************/ | - |
| 606 | | - |
| 607 | #ifndef QT_NO_CONTEXTMENU | - |
| 608 | /*! \reimp */ | - |
| 609 | void QDialog::contextMenuEvent(QContextMenuEvent *e) | - |
| 610 | { | - |
| 611 | #if defined(QT_NO_WHATSTHIS) || defined(QT_NO_MENU) | - |
| 612 | Q_UNUSED(e); | - |
| 613 | #else | - |
| 614 | QWidget *w = childAt(e->pos()); never executed (the execution status of this line is deduced): QWidget *w = childAt(e->pos()); | - |
| 615 | if (!w) { | 0 |
| 616 | w = rect().contains(e->pos()) ? this : 0; never evaluated: rect().contains(e->pos()) | 0 |
| 617 | if (!w) | 0 |
| 618 | return; | 0 |
| 619 | } | 0 |
| 620 | while (w && w->whatsThis().size() == 0 && !w->testAttribute(Qt::WA_CustomWhatsThis)) never evaluated: w never evaluated: w->whatsThis().size() == 0 never evaluated: !w->testAttribute(Qt::WA_CustomWhatsThis) | 0 |
| 621 | w = w->isWindow() ? 0 : w->parentWidget(); never executed: w = w->isWindow() ? 0 : w->parentWidget(); never evaluated: w->isWindow() | 0 |
| 622 | if (w) { | 0 |
| 623 | QPointer<QMenu> p = new QMenu(this); never executed (the execution status of this line is deduced): QPointer<QMenu> p = new QMenu(this); | - |
| 624 | QAction *wt = p.data()->addAction(tr("What's This?")); never executed (the execution status of this line is deduced): QAction *wt = p.data()->addAction(tr("What's This?")); | - |
| 625 | if (p.data()->exec(e->globalPos()) == wt) { never evaluated: p.data()->exec(e->globalPos()) == wt | 0 |
| 626 | QHelpEvent e(QEvent::WhatsThis, w->rect().center(), never executed (the execution status of this line is deduced): QHelpEvent e(QEvent::WhatsThis, w->rect().center(), | - |
| 627 | w->mapToGlobal(w->rect().center())); never executed (the execution status of this line is deduced): w->mapToGlobal(w->rect().center())); | - |
| 628 | QApplication::sendEvent(w, &e); never executed (the execution status of this line is deduced): QApplication::sendEvent(w, &e); | - |
| 629 | } | 0 |
| 630 | delete p.data(); never executed (the execution status of this line is deduced): delete p.data(); | - |
| 631 | } | 0 |
| 632 | #endif | - |
| 633 | } | 0 |
| 634 | #endif // QT_NO_CONTEXTMENU | - |
| 635 | | - |
| 636 | /*! \reimp */ | - |
| 637 | void QDialog::keyPressEvent(QKeyEvent *e) | - |
| 638 | { | - |
| 639 | // Calls reject() if Escape is pressed. Simulates a button | - |
| 640 | // click for the default button if Enter is pressed. Move focus | - |
| 641 | // for the arrow keys. Ignore the rest. | - |
| 642 | #ifdef Q_OS_MAC | - |
| 643 | if(e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Period) { | - |
| 644 | reject(); | - |
| 645 | } else | - |
| 646 | #endif | - |
| 647 | if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) { partially evaluated: !e->modifiers()| yes Evaluation Count:35 | no Evaluation Count:0 |
never evaluated: e->modifiers() & Qt::KeypadModifier never evaluated: e->key() == Qt::Key_Enter | 0-35 |
| 648 | switch (e->key()) { | - |
| 649 | case Qt::Key_Enter: | - |
| 650 | case Qt::Key_Return: { | - |
| 651 | QList<QPushButton*> list = findChildren<QPushButton*>(); executed (the execution status of this line is deduced): QList<QPushButton*> list = findChildren<QPushButton*>(); | - |
| 652 | for (int i=0; i<list.size(); ++i) { partially evaluated: i<list.size()| yes Evaluation Count:44 | no Evaluation Count:0 |
| 0-44 |
| 653 | QPushButton *pb = list.at(i); executed (the execution status of this line is deduced): QPushButton *pb = list.at(i); | - |
| 654 | if (pb->isDefault() && pb->isVisible()) { evaluated: pb->isDefault()| yes Evaluation Count:29 | yes Evaluation Count:15 |
partially evaluated: pb->isVisible()| yes Evaluation Count:29 | no Evaluation Count:0 |
| 0-29 |
| 655 | if (pb->isEnabled()) evaluated: pb->isEnabled()| yes Evaluation Count:28 | yes Evaluation Count:1 |
| 1-28 |
| 656 | pb->click(); executed: pb->click();Execution Count:28 | 28 |
| 657 | return; executed: return;Execution Count:29 | 29 |
| 658 | } | - |
| 659 | } executed: }Execution Count:15 | 15 |
| 660 | } | - |
| 661 | break; | 0 |
| 662 | case Qt::Key_Escape: | - |
| 663 | reject(); executed (the execution status of this line is deduced): reject(); | - |
| 664 | break; executed: break;Execution Count:1 | 1 |
| 665 | default: | - |
| 666 | e->ignore(); executed (the execution status of this line is deduced): e->ignore(); | - |
| 667 | return; executed: return;Execution Count:5 | 5 |
| 668 | } | - |
| 669 | } else { executed: }Execution Count:1 | 1 |
| 670 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
| 671 | } | 0 |
| 672 | } | - |
| 673 | | - |
| 674 | /*! \reimp */ | - |
| 675 | void QDialog::closeEvent(QCloseEvent *e) | - |
| 676 | { | - |
| 677 | #ifndef QT_NO_WHATSTHIS | - |
| 678 | if (isModal() && QWhatsThis::inWhatsThisMode()) evaluated: isModal()| yes Evaluation Count:17 | yes Evaluation Count:10 |
partially evaluated: QWhatsThis::inWhatsThisMode()| no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
| 679 | QWhatsThis::leaveWhatsThisMode(); never executed: QWhatsThis::leaveWhatsThisMode(); | 0 |
| 680 | #endif | - |
| 681 | if (isVisible()) { partially evaluated: isVisible()| yes Evaluation Count:27 | no Evaluation Count:0 |
| 0-27 |
| 682 | QPointer<QObject> that = this; executed (the execution status of this line is deduced): QPointer<QObject> that = this; | - |
| 683 | reject(); executed (the execution status of this line is deduced): reject(); | - |
| 684 | if (that && isVisible()) partially evaluated: that| yes Evaluation Count:27 | no Evaluation Count:0 |
evaluated: isVisible()| yes Evaluation Count:1 | yes Evaluation Count:26 |
| 0-27 |
| 685 | e->ignore(); executed: e->ignore();Execution Count:1 | 1 |
| 686 | } else { executed: }Execution Count:27 | 27 |
| 687 | e->accept(); never executed (the execution status of this line is deduced): e->accept(); | - |
| 688 | } | 0 |
| 689 | } | - |
| 690 | | - |
| 691 | /***************************************************************************** | - |
| 692 | Geometry management. | - |
| 693 | *****************************************************************************/ | - |
| 694 | | - |
| 695 | /*! \reimp | - |
| 696 | */ | - |
| 697 | | - |
| 698 | void QDialog::setVisible(bool visible) | - |
| 699 | { | - |
| 700 | Q_D(QDialog); executed (the execution status of this line is deduced): QDialogPrivate * const d = d_func(); | - |
| 701 | if (visible) { evaluated: visible| yes Evaluation Count:243 | yes Evaluation Count:516 |
| 243-516 |
| 702 | if (testAttribute(Qt::WA_WState_ExplicitShowHide) && !testAttribute(Qt::WA_WState_Hidden)) evaluated: testAttribute(Qt::WA_WState_ExplicitShowHide)| yes Evaluation Count:38 | yes Evaluation Count:205 |
evaluated: !testAttribute(Qt::WA_WState_Hidden)| yes Evaluation Count:8 | yes Evaluation Count:30 |
| 8-205 |
| 703 | return; executed: return;Execution Count:8 | 8 |
| 704 | | - |
| 705 | if (!testAttribute(Qt::WA_Moved)) { evaluated: !testAttribute(Qt::WA_Moved)| yes Evaluation Count:231 | yes Evaluation Count:4 |
| 4-231 |
| 706 | Qt::WindowStates state = windowState(); executed (the execution status of this line is deduced): Qt::WindowStates state = windowState(); | - |
| 707 | adjustPosition(parentWidget()); executed (the execution status of this line is deduced): adjustPosition(parentWidget()); | - |
| 708 | setAttribute(Qt::WA_Moved, false); // not really an explicit position executed (the execution status of this line is deduced): setAttribute(Qt::WA_Moved, false); | - |
| 709 | if (state != windowState()) partially evaluated: state != windowState()| no Evaluation Count:0 | yes Evaluation Count:231 |
| 0-231 |
| 710 | setWindowState(state); never executed: setWindowState(state); | 0 |
| 711 | } executed: }Execution Count:231 | 231 |
| 712 | QWidget::setVisible(visible); executed (the execution status of this line is deduced): QWidget::setVisible(visible); | - |
| 713 | showExtension(d->doShowExtension); executed (the execution status of this line is deduced): showExtension(d->doShowExtension); | - |
| 714 | QWidget *fw = window()->focusWidget(); executed (the execution status of this line is deduced): QWidget *fw = window()->focusWidget(); | - |
| 715 | if (!fw) evaluated: !fw| yes Evaluation Count:77 | yes Evaluation Count:158 |
| 77-158 |
| 716 | fw = this; executed: fw = this;Execution Count:77 | 77 |
| 717 | | - |
| 718 | /* | - |
| 719 | The following block is to handle a special case, and does not | - |
| 720 | really follow propper logic in concern of autoDefault and TAB | - |
| 721 | order. However, it's here to ease usage for the users. If a | - |
| 722 | dialog has a default QPushButton, and first widget in the TAB | - |
| 723 | order also is a QPushButton, then we give focus to the main | - |
| 724 | default QPushButton. This simplifies code for the developers, | - |
| 725 | and actually catches most cases... If not, then they simply | - |
| 726 | have to use [widget*]->setFocus() themselves... | - |
| 727 | */ | - |
| 728 | if (d->mainDef && fw->focusPolicy() == Qt::NoFocus) { evaluated: d->mainDef| yes Evaluation Count:166 | yes Evaluation Count:69 |
evaluated: fw->focusPolicy() == Qt::NoFocus| yes Evaluation Count:10 | yes Evaluation Count:156 |
| 10-166 |
| 729 | QWidget *first = fw; executed (the execution status of this line is deduced): QWidget *first = fw; | - |
| 730 | while ((first = first->nextInFocusChain()) != fw && first->focusPolicy() == Qt::NoFocus) partially evaluated: (first = first->nextInFocusChain()) != fw| yes Evaluation Count:24 | no Evaluation Count:0 |
evaluated: first->focusPolicy() == Qt::NoFocus| yes Evaluation Count:14 | yes Evaluation Count:10 |
| 0-24 |
| 731 | ; executed: ;Execution Count:14 | 14 |
| 732 | if (first != d->mainDef && qobject_cast<QPushButton*>(first)) evaluated: first != d->mainDef| yes Evaluation Count:7 | yes Evaluation Count:3 |
evaluated: qobject_cast<QPushButton*>(first)| yes Evaluation Count:1 | yes Evaluation Count:6 |
| 1-7 |
| 733 | d->mainDef->setFocus(); executed: d->mainDef->setFocus();Execution Count:1 | 1 |
| 734 | } executed: }Execution Count:10 | 10 |
| 735 | if (!d->mainDef && isWindow()) { evaluated: !d->mainDef| yes Evaluation Count:69 | yes Evaluation Count:166 |
evaluated: isWindow()| yes Evaluation Count:68 | yes Evaluation Count:1 |
| 1-166 |
| 736 | QWidget *w = fw; executed (the execution status of this line is deduced): QWidget *w = fw; | - |
| 737 | while ((w = w->nextInFocusChain()) != fw) { evaluated: (w = w->nextInFocusChain()) != fw| yes Evaluation Count:145 | yes Evaluation Count:38 |
| 38-145 |
| 738 | QPushButton *pb = qobject_cast<QPushButton *>(w); executed (the execution status of this line is deduced): QPushButton *pb = qobject_cast<QPushButton *>(w); | - |
| 739 | if (pb && pb->autoDefault() && pb->focusPolicy() != Qt::NoFocus) { evaluated: pb| yes Evaluation Count:30 | yes Evaluation Count:115 |
partially evaluated: pb->autoDefault()| yes Evaluation Count:30 | no Evaluation Count:0 |
partially evaluated: pb->focusPolicy() != Qt::NoFocus| yes Evaluation Count:30 | no Evaluation Count:0 |
| 0-115 |
| 740 | pb->setDefault(true); executed (the execution status of this line is deduced): pb->setDefault(true); | - |
| 741 | break; executed: break;Execution Count:30 | 30 |
| 742 | } | - |
| 743 | } executed: }Execution Count:115 | 115 |
| 744 | } executed: }Execution Count:68 | 68 |
| 745 | if (fw && !fw->hasFocus()) { partially evaluated: fw| yes Evaluation Count:235 | no Evaluation Count:0 |
partially evaluated: !fw->hasFocus()| yes Evaluation Count:235 | no Evaluation Count:0 |
| 0-235 |
| 746 | QFocusEvent e(QEvent::FocusIn, Qt::TabFocusReason); executed (the execution status of this line is deduced): QFocusEvent e(QEvent::FocusIn, Qt::TabFocusReason); | - |
| 747 | QApplication::sendEvent(fw, &e); executed (the execution status of this line is deduced): QApplication::sendEvent(fw, &e); | - |
| 748 | } executed: }Execution Count:235 | 235 |
| 749 | | - |
| 750 | #ifndef QT_NO_ACCESSIBILITY | - |
| 751 | QAccessibleEvent event(this, QAccessible::DialogStart); executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::DialogStart); | - |
| 752 | QAccessible::updateAccessibility(&event); executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event); | - |
| 753 | #endif | - |
| 754 | | - |
| 755 | } else { executed: }Execution Count:235 | 235 |
| 756 | if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden)) evaluated: testAttribute(Qt::WA_WState_ExplicitShowHide)| yes Evaluation Count:336 | yes Evaluation Count:180 |
evaluated: testAttribute(Qt::WA_WState_Hidden)| yes Evaluation Count:104 | yes Evaluation Count:232 |
| 104-336 |
| 757 | return; executed: return;Execution Count:104 | 104 |
| 758 | | - |
| 759 | #ifndef QT_NO_ACCESSIBILITY | - |
| 760 | if (isVisible()) { evaluated: isVisible()| yes Evaluation Count:231 | yes Evaluation Count:181 |
| 181-231 |
| 761 | QAccessibleEvent event(this, QAccessible::DialogEnd); executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::DialogEnd); | - |
| 762 | QAccessible::updateAccessibility(&event); executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event); | - |
| 763 | } executed: }Execution Count:231 | 231 |
| 764 | #endif | - |
| 765 | | - |
| 766 | // Reimplemented to exit a modal event loop when the dialog is hidden. | - |
| 767 | QWidget::setVisible(visible); executed (the execution status of this line is deduced): QWidget::setVisible(visible); | - |
| 768 | if (d->eventLoop) evaluated: d->eventLoop| yes Evaluation Count:97 | yes Evaluation Count:315 |
| 97-315 |
| 769 | d->eventLoop->exit(); executed: d->eventLoop->exit();Execution Count:97 | 97 |
| 770 | } executed: }Execution Count:412 | 412 |
| 771 | if (d->mainDef && isActiveWindow() evaluated: d->mainDef| yes Evaluation Count:407 | yes Evaluation Count:240 |
partially evaluated: isActiveWindow()| no Evaluation Count:0 | yes Evaluation Count:407 |
| 0-407 |
| 772 | && d->styleHint(QPlatformDialogHelper::SnapToDefaultButton).toBool()) never evaluated: d->styleHint(QPlatformDialogHelper::SnapToDefaultButton).toBool() | 0 |
| 773 | QCursor::setPos(d->mainDef->mapToGlobal(d->mainDef->rect().center())); never executed: QCursor::setPos(d->mainDef->mapToGlobal(d->mainDef->rect().center())); | 0 |
| 774 | } executed: }Execution Count:647 | 647 |
| 775 | | - |
| 776 | /*!\reimp */ | - |
| 777 | void QDialog::showEvent(QShowEvent *event) | - |
| 778 | { | - |
| 779 | if (!event->spontaneous() && !testAttribute(Qt::WA_Moved)) { partially evaluated: !event->spontaneous()| yes Evaluation Count:231 | no Evaluation Count:0 |
evaluated: !testAttribute(Qt::WA_Moved)| yes Evaluation Count:227 | yes Evaluation Count:4 |
| 0-231 |
| 780 | Qt::WindowStates state = windowState(); executed (the execution status of this line is deduced): Qt::WindowStates state = windowState(); | - |
| 781 | adjustPosition(parentWidget()); executed (the execution status of this line is deduced): adjustPosition(parentWidget()); | - |
| 782 | setAttribute(Qt::WA_Moved, false); // not really an explicit position executed (the execution status of this line is deduced): setAttribute(Qt::WA_Moved, false); | - |
| 783 | if (state != windowState()) partially evaluated: state != windowState()| no Evaluation Count:0 | yes Evaluation Count:227 |
| 0-227 |
| 784 | setWindowState(state); never executed: setWindowState(state); | 0 |
| 785 | } executed: }Execution Count:227 | 227 |
| 786 | } executed: }Execution Count:231 | 231 |
| 787 | | - |
| 788 | /*! \internal */ | - |
| 789 | void QDialog::adjustPosition(QWidget* w) | - |
| 790 | { | - |
| 791 | | - |
| 792 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()| yes Evaluation Count:458 | no Evaluation Count:0 |
| 0-458 |
| 793 | if (theme->themeHint(QPlatformTheme::WindowAutoPlacement).toBool()) partially evaluated: theme->themeHint(QPlatformTheme::WindowAutoPlacement).toBool()| no Evaluation Count:0 | yes Evaluation Count:458 |
| 0-458 |
| 794 | return; | 0 |
| 795 | QPoint p(0, 0); executed (the execution status of this line is deduced): QPoint p(0, 0); | - |
| 796 | int extraw = 0, extrah = 0, scrn = 0; executed (the execution status of this line is deduced): int extraw = 0, extrah = 0, scrn = 0; | - |
| 797 | if (w) evaluated: w| yes Evaluation Count:78 | yes Evaluation Count:380 |
| 78-380 |
| 798 | w = w->window(); executed: w = w->window();Execution Count:78 | 78 |
| 799 | QRect desk; executed (the execution status of this line is deduced): QRect desk; | - |
| 800 | if (w) { evaluated: w| yes Evaluation Count:78 | yes Evaluation Count:380 |
| 78-380 |
| 801 | scrn = QApplication::desktop()->screenNumber(w); executed (the execution status of this line is deduced): scrn = QApplication::desktop()->screenNumber(w); | - |
| 802 | } else if (QApplication::desktop()->isVirtualDesktop()) { executed: }Execution Count:78 partially evaluated: QApplication::desktop()->isVirtualDesktop()| no Evaluation Count:0 | yes Evaluation Count:380 |
| 0-380 |
| 803 | scrn = QApplication::desktop()->screenNumber(QCursor::pos()); never executed (the execution status of this line is deduced): scrn = QApplication::desktop()->screenNumber(QCursor::pos()); | - |
| 804 | } else { | 0 |
| 805 | scrn = QApplication::desktop()->screenNumber(this); executed (the execution status of this line is deduced): scrn = QApplication::desktop()->screenNumber(this); | - |
| 806 | } executed: }Execution Count:380 | 380 |
| 807 | desk = QApplication::desktop()->availableGeometry(scrn); executed (the execution status of this line is deduced): desk = QApplication::desktop()->availableGeometry(scrn); | - |
| 808 | | - |
| 809 | QWidgetList list = QApplication::topLevelWidgets(); executed (the execution status of this line is deduced): QWidgetList list = QApplication::topLevelWidgets(); | - |
| 810 | for (int i = 0; (extraw == 0 || extrah == 0) && i < list.size(); ++i) { evaluated: extraw == 0| yes Evaluation Count:1133 | yes Evaluation Count:60 |
partially evaluated: extrah == 0| no Evaluation Count:0 | yes Evaluation Count:60 |
evaluated: i < list.size()| yes Evaluation Count:735 | yes Evaluation Count:398 |
| 0-1133 |
| 811 | QWidget * current = list.at(i); executed (the execution status of this line is deduced): QWidget * current = list.at(i); | - |
| 812 | if (current->isVisible()) { evaluated: current->isVisible()| yes Evaluation Count:292 | yes Evaluation Count:443 |
| 292-443 |
| 813 | int framew = current->geometry().x() - current->x(); executed (the execution status of this line is deduced): int framew = current->geometry().x() - current->x(); | - |
| 814 | int frameh = current->geometry().y() - current->y(); executed (the execution status of this line is deduced): int frameh = current->geometry().y() - current->y(); | - |
| 815 | | - |
| 816 | extraw = qMax(extraw, framew); executed (the execution status of this line is deduced): extraw = qMax(extraw, framew); | - |
| 817 | extrah = qMax(extrah, frameh); executed (the execution status of this line is deduced): extrah = qMax(extrah, frameh); | - |
| 818 | } executed: }Execution Count:292 | 292 |
| 819 | } executed: }Execution Count:735 | 735 |
| 820 | | - |
| 821 | // sanity check for decoration frames. With embedding, we | - |
| 822 | // might get extraordinary values | - |
| 823 | if (extraw == 0 || extrah == 0 || extraw >= 10 || extrah >= 40) { evaluated: extraw == 0| yes Evaluation Count:398 | yes Evaluation Count:60 |
partially evaluated: extrah == 0| no Evaluation Count:0 | yes Evaluation Count:60 |
partially evaluated: extraw >= 10| no Evaluation Count:0 | yes Evaluation Count:60 |
partially evaluated: extrah >= 40| no Evaluation Count:0 | yes Evaluation Count:60 |
| 0-398 |
| 824 | extrah = 40; executed (the execution status of this line is deduced): extrah = 40; | - |
| 825 | extraw = 10; executed (the execution status of this line is deduced): extraw = 10; | - |
| 826 | } executed: }Execution Count:398 | 398 |
| 827 | | - |
| 828 | | - |
| 829 | if (w) { evaluated: w| yes Evaluation Count:78 | yes Evaluation Count:380 |
| 78-380 |
| 830 | // Use pos() if the widget is embedded into a native window | - |
| 831 | QPoint pp; executed (the execution status of this line is deduced): QPoint pp; | - |
| 832 | if (w->windowHandle() && w->windowHandle()->property("_q_embedded_native_parent_handle").value<WId>()) evaluated: w->windowHandle()| yes Evaluation Count:46 | yes Evaluation Count:32 |
partially evaluated: w->windowHandle()->property("_q_embedded_native_parent_handle").value<WId>()| no Evaluation Count:0 | yes Evaluation Count:46 |
| 0-46 |
| 833 | pp = w->pos(); never executed: pp = w->pos(); | 0 |
| 834 | else | - |
| 835 | pp = w->mapToGlobal(QPoint(0,0)); executed: pp = w->mapToGlobal(QPoint(0,0));Execution Count:78 | 78 |
| 836 | p = QPoint(pp.x() + w->width()/2, executed (the execution status of this line is deduced): p = QPoint(pp.x() + w->width()/2, | - |
| 837 | pp.y() + w->height()/ 2); executed (the execution status of this line is deduced): pp.y() + w->height()/ 2); | - |
| 838 | } else { executed: }Execution Count:78 | 78 |
| 839 | // p = middle of the desktop | - |
| 840 | p = QPoint(desk.x() + desk.width()/2, desk.y() + desk.height()/2); executed (the execution status of this line is deduced): p = QPoint(desk.x() + desk.width()/2, desk.y() + desk.height()/2); | - |
| 841 | } executed: }Execution Count:380 | 380 |
| 842 | | - |
| 843 | // p = origin of this | - |
| 844 | p = QPoint(p.x()-width()/2 - extraw, executed (the execution status of this line is deduced): p = QPoint(p.x()-width()/2 - extraw, | - |
| 845 | p.y()-height()/2 - extrah); executed (the execution status of this line is deduced): p.y()-height()/2 - extrah); | - |
| 846 | | - |
| 847 | | - |
| 848 | if (p.x() + extraw + width() > desk.x() + desk.width()) evaluated: p.x() + extraw + width() > desk.x() + desk.width()| yes Evaluation Count:12 | yes Evaluation Count:446 |
| 12-446 |
| 849 | p.setX(desk.x() + desk.width() - width() - extraw); executed: p.setX(desk.x() + desk.width() - width() - extraw);Execution Count:12 | 12 |
| 850 | if (p.x() < desk.x()) evaluated: p.x() < desk.x()| yes Evaluation Count:12 | yes Evaluation Count:446 |
| 12-446 |
| 851 | p.setX(desk.x()); executed: p.setX(desk.x());Execution Count:12 | 12 |
| 852 | | - |
| 853 | if (p.y() + extrah + height() > desk.y() + desk.height()) evaluated: p.y() + extrah + height() > desk.y() + desk.height()| yes Evaluation Count:12 | yes Evaluation Count:446 |
| 12-446 |
| 854 | p.setY(desk.y() + desk.height() - height() - extrah); executed: p.setY(desk.y() + desk.height() - height() - extrah);Execution Count:12 | 12 |
| 855 | if (p.y() < desk.y()) evaluated: p.y() < desk.y()| yes Evaluation Count:12 | yes Evaluation Count:446 |
| 12-446 |
| 856 | p.setY(desk.y()); executed: p.setY(desk.y());Execution Count:12 | 12 |
| 857 | | - |
| 858 | move(p); executed (the execution status of this line is deduced): move(p); | - |
| 859 | } executed: }Execution Count:458 | 458 |
| 860 | | - |
| 861 | /*! | - |
| 862 | \obsolete | - |
| 863 | | - |
| 864 | If \a orientation is Qt::Horizontal, the extension will be displayed | - |
| 865 | to the right of the dialog's main area. If \a orientation is | - |
| 866 | Qt::Vertical, the extension will be displayed below the dialog's main | - |
| 867 | area. | - |
| 868 | | - |
| 869 | Instead of using this functionality, we recommend that you simply call | - |
| 870 | show() or hide() on the part of the dialog that you want to use as an | - |
| 871 | extension. See the \l{Extension Example} for details. | - |
| 872 | | - |
| 873 | \sa setExtension() | - |
| 874 | */ | - |
| 875 | void QDialog::setOrientation(Qt::Orientation orientation) | - |
| 876 | { | - |
| 877 | Q_D(QDialog); executed (the execution status of this line is deduced): QDialogPrivate * const d = d_func(); | - |
| 878 | d->orientation = orientation; executed (the execution status of this line is deduced): d->orientation = orientation; | - |
| 879 | } executed: }Execution Count:4 | 4 |
| 880 | | - |
| 881 | /*! | - |
| 882 | \obsolete | - |
| 883 | | - |
| 884 | Returns the dialog's extension orientation. | - |
| 885 | | - |
| 886 | Instead of using this functionality, we recommend that you simply call | - |
| 887 | show() or hide() on the part of the dialog that you want to use as an | - |
| 888 | extension. See the \l{Extension Example} for details. | - |
| 889 | | - |
| 890 | \sa extension() | - |
| 891 | */ | - |
| 892 | Qt::Orientation QDialog::orientation() const | - |
| 893 | { | - |
| 894 | Q_D(const QDialog); never executed (the execution status of this line is deduced): const QDialogPrivate * const d = d_func(); | - |
| 895 | return d->orientation; never executed: return d->orientation; | 0 |
| 896 | } | - |
| 897 | | - |
| 898 | /*! | - |
| 899 | \obsolete | - |
| 900 | | - |
| 901 | Sets the widget, \a extension, to be the dialog's extension, | - |
| 902 | deleting any previous extension. The dialog takes ownership of the | - |
| 903 | extension. Note that if 0 is passed any existing extension will be | - |
| 904 | deleted. This function must only be called while the dialog is hidden. | - |
| 905 | | - |
| 906 | Instead of using this functionality, we recommend that you simply call | - |
| 907 | show() or hide() on the part of the dialog that you want to use as an | - |
| 908 | extension. See the \l{Extension Example} for details. | - |
| 909 | | - |
| 910 | \sa showExtension(), setOrientation() | - |
| 911 | */ | - |
| 912 | void QDialog::setExtension(QWidget* extension) | - |
| 913 | { | - |
| 914 | Q_D(QDialog); executed (the execution status of this line is deduced): QDialogPrivate * const d = d_func(); | - |
| 915 | delete d->extension; executed (the execution status of this line is deduced): delete d->extension; | - |
| 916 | d->extension = extension; executed (the execution status of this line is deduced): d->extension = extension; | - |
| 917 | | - |
| 918 | if (!extension) evaluated: !extension| yes Evaluation Count:5 | yes Evaluation Count:6 |
| 5-6 |
| 919 | return; executed: return;Execution Count:5 | 5 |
| 920 | | - |
| 921 | if (extension->parentWidget() != this) evaluated: extension->parentWidget() != this| yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
| 922 | extension->setParent(this); executed: extension->setParent(this);Execution Count:1 | 1 |
| 923 | extension->hide(); executed (the execution status of this line is deduced): extension->hide(); | - |
| 924 | } executed: }Execution Count:6 | 6 |
| 925 | | - |
| 926 | /*! | - |
| 927 | \obsolete | - |
| 928 | | - |
| 929 | Returns the dialog's extension or 0 if no extension has been | - |
| 930 | defined. | - |
| 931 | | - |
| 932 | Instead of using this functionality, we recommend that you simply call | - |
| 933 | show() or hide() on the part of the dialog that you want to use as an | - |
| 934 | extension. See the \l{Extension Example} for details. | - |
| 935 | | - |
| 936 | \sa showExtension(), setOrientation() | - |
| 937 | */ | - |
| 938 | QWidget* QDialog::extension() const | - |
| 939 | { | - |
| 940 | Q_D(const QDialog); executed (the execution status of this line is deduced): const QDialogPrivate * const d = d_func(); | - |
| 941 | return d->extension; executed: return d->extension;Execution Count:13 | 13 |
| 942 | } | - |
| 943 | | - |
| 944 | | - |
| 945 | /*! | - |
| 946 | \obsolete | - |
| 947 | | - |
| 948 | If \a showIt is true, the dialog's extension is shown; otherwise the | - |
| 949 | extension is hidden. | - |
| 950 | | - |
| 951 | Instead of using this functionality, we recommend that you simply call | - |
| 952 | show() or hide() on the part of the dialog that you want to use as an | - |
| 953 | extension. See the \l{Extension Example} for details. | - |
| 954 | | - |
| 955 | \sa show(), setExtension(), setOrientation() | - |
| 956 | */ | - |
| 957 | void QDialog::showExtension(bool showIt) | - |
| 958 | { | - |
| 959 | Q_D(QDialog); executed (the execution status of this line is deduced): QDialogPrivate * const d = d_func(); | - |
| 960 | d->doShowExtension = showIt; executed (the execution status of this line is deduced): d->doShowExtension = showIt; | - |
| 961 | if (!d->extension) evaluated: !d->extension| yes Evaluation Count:234 | yes Evaluation Count:13 |
| 13-234 |
| 962 | return; executed: return;Execution Count:234 | 234 |
| 963 | if (!testAttribute(Qt::WA_WState_Visible)) partially evaluated: !testAttribute(Qt::WA_WState_Visible)| no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
| 964 | return; | 0 |
| 965 | if (d->extension->isVisible() == showIt) evaluated: d->extension->isVisible() == showIt| yes Evaluation Count:1 | yes Evaluation Count:12 |
| 1-12 |
| 966 | return; executed: return;Execution Count:1 | 1 |
| 967 | | - |
| 968 | if (showIt) { evaluated: showIt| yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
| 969 | d->size = size(); executed (the execution status of this line is deduced): d->size = size(); | - |
| 970 | d->min = minimumSize(); executed (the execution status of this line is deduced): d->min = minimumSize(); | - |
| 971 | d->max = maximumSize(); executed (the execution status of this line is deduced): d->max = maximumSize(); | - |
| 972 | if (layout()) partially evaluated: layout()| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 973 | layout()->setEnabled(false); never executed: layout()->setEnabled(false); | 0 |
| 974 | QSize s(d->extension->sizeHint() executed (the execution status of this line is deduced): QSize s(d->extension->sizeHint() | - |
| 975 | .expandedTo(d->extension->minimumSize()) executed (the execution status of this line is deduced): .expandedTo(d->extension->minimumSize()) | - |
| 976 | .boundedTo(d->extension->maximumSize())); executed (the execution status of this line is deduced): .boundedTo(d->extension->maximumSize())); | - |
| 977 | if (d->orientation == Qt::Horizontal) { evaluated: d->orientation == Qt::Horizontal| yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
| 978 | int h = qMax(height(), s.height()); executed (the execution status of this line is deduced): int h = qMax(height(), s.height()); | - |
| 979 | d->extension->setGeometry(width(), 0, s.width(), h); executed (the execution status of this line is deduced): d->extension->setGeometry(width(), 0, s.width(), h); | - |
| 980 | setFixedSize(width() + s.width(), h); executed (the execution status of this line is deduced): setFixedSize(width() + s.width(), h); | - |
| 981 | } else { executed: }Execution Count:4 | 4 |
| 982 | int w = qMax(width(), s.width()); executed (the execution status of this line is deduced): int w = qMax(width(), s.width()); | - |
| 983 | d->extension->setGeometry(0, height(), w, s.height()); executed (the execution status of this line is deduced): d->extension->setGeometry(0, height(), w, s.height()); | - |
| 984 | setFixedSize(w, height() + s.height()); executed (the execution status of this line is deduced): setFixedSize(w, height() + s.height()); | - |
| 985 | } executed: }Execution Count:2 | 2 |
| 986 | d->extension->show(); executed (the execution status of this line is deduced): d->extension->show(); | - |
| 987 | #ifndef QT_NO_SIZEGRIP | - |
| 988 | const bool sizeGripEnabled = isSizeGripEnabled(); executed (the execution status of this line is deduced): const bool sizeGripEnabled = isSizeGripEnabled(); | - |
| 989 | setSizeGripEnabled(false); executed (the execution status of this line is deduced): setSizeGripEnabled(false); | - |
| 990 | d->sizeGripEnabled = sizeGripEnabled; executed (the execution status of this line is deduced): d->sizeGripEnabled = sizeGripEnabled; | - |
| 991 | #endif | - |
| 992 | } else { executed: }Execution Count:6 | 6 |
| 993 | d->extension->hide(); executed (the execution status of this line is deduced): d->extension->hide(); | - |
| 994 | // workaround for CDE window manager that won't shrink with (-1,-1) | - |
| 995 | setMinimumSize(d->min.expandedTo(QSize(1, 1))); executed (the execution status of this line is deduced): setMinimumSize(d->min.expandedTo(QSize(1, 1))); | - |
| 996 | setMaximumSize(d->max); executed (the execution status of this line is deduced): setMaximumSize(d->max); | - |
| 997 | resize(d->size); executed (the execution status of this line is deduced): resize(d->size); | - |
| 998 | if (layout()) partially evaluated: layout()| no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
| 999 | layout()->setEnabled(true); never executed: layout()->setEnabled(true); | 0 |
| 1000 | #ifndef QT_NO_SIZEGRIP | - |
| 1001 | setSizeGripEnabled(d->sizeGripEnabled); executed (the execution status of this line is deduced): setSizeGripEnabled(d->sizeGripEnabled); | - |
| 1002 | #endif | - |
| 1003 | } executed: }Execution Count:6 | 6 |
| 1004 | } | - |
| 1005 | | - |
| 1006 | | - |
| 1007 | /*! \reimp */ | - |
| 1008 | QSize QDialog::sizeHint() const | - |
| 1009 | { | - |
| 1010 | Q_D(const QDialog); executed (the execution status of this line is deduced): const QDialogPrivate * const d = d_func(); | - |
| 1011 | if (d->extension) { partially evaluated: d->extension| no Evaluation Count:0 | yes Evaluation Count:315 |
| 0-315 |
| 1012 | if (d->orientation == Qt::Horizontal) never evaluated: d->orientation == Qt::Horizontal | 0 |
| 1013 | return QSize(QWidget::sizeHint().width(), never executed: return QSize(QWidget::sizeHint().width(), qMax(QWidget::sizeHint().height(),d->extension->sizeHint().height())); | 0 |
| 1014 | qMax(QWidget::sizeHint().height(),d->extension->sizeHint().height())); never executed: return QSize(QWidget::sizeHint().width(), qMax(QWidget::sizeHint().height(),d->extension->sizeHint().height())); | 0 |
| 1015 | else | - |
| 1016 | return QSize(qMax(QWidget::sizeHint().width(), d->extension->sizeHint().width()), never executed: return QSize(qMax(QWidget::sizeHint().width(), d->extension->sizeHint().width()), QWidget::sizeHint().height()); | 0 |
| 1017 | QWidget::sizeHint().height()); never executed: return QSize(qMax(QWidget::sizeHint().width(), d->extension->sizeHint().width()), QWidget::sizeHint().height()); | 0 |
| 1018 | } | - |
| 1019 | return QWidget::sizeHint(); executed: return QWidget::sizeHint();Execution Count:315 | 315 |
| 1020 | } | - |
| 1021 | | - |
| 1022 | | - |
| 1023 | /*! \reimp */ | - |
| 1024 | QSize QDialog::minimumSizeHint() const | - |
| 1025 | { | - |
| 1026 | Q_D(const QDialog); executed (the execution status of this line is deduced): const QDialogPrivate * const d = d_func(); | - |
| 1027 | if (d->extension) { partially evaluated: d->extension| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 1028 | if (d->orientation == Qt::Horizontal) never evaluated: d->orientation == Qt::Horizontal | 0 |
| 1029 | return QSize(QWidget::minimumSizeHint().width(), never executed: return QSize(QWidget::minimumSizeHint().width(), qMax(QWidget::minimumSizeHint().height(), d->extension->minimumSizeHint().height())); | 0 |
| 1030 | qMax(QWidget::minimumSizeHint().height(), d->extension->minimumSizeHint().height())); never executed: return QSize(QWidget::minimumSizeHint().width(), qMax(QWidget::minimumSizeHint().height(), d->extension->minimumSizeHint().height())); | 0 |
| 1031 | else | - |
| 1032 | return QSize(qMax(QWidget::minimumSizeHint().width(), d->extension->minimumSizeHint().width()), never executed: return QSize(qMax(QWidget::minimumSizeHint().width(), d->extension->minimumSizeHint().width()), QWidget::minimumSizeHint().height()); | 0 |
| 1033 | QWidget::minimumSizeHint().height()); never executed: return QSize(qMax(QWidget::minimumSizeHint().width(), d->extension->minimumSizeHint().width()), QWidget::minimumSizeHint().height()); | 0 |
| 1034 | } | - |
| 1035 | | - |
| 1036 | return QWidget::minimumSizeHint(); executed: return QWidget::minimumSizeHint();Execution Count:7 | 7 |
| 1037 | } | - |
| 1038 | | - |
| 1039 | /*! | - |
| 1040 | \property QDialog::modal | - |
| 1041 | \brief whether show() should pop up the dialog as modal or modeless | - |
| 1042 | | - |
| 1043 | By default, this property is false and show() pops up the dialog | - |
| 1044 | as modeless. Setting his property to true is equivalent to setting | - |
| 1045 | QWidget::windowModality to Qt::ApplicationModal. | - |
| 1046 | | - |
| 1047 | exec() ignores the value of this property and always pops up the | - |
| 1048 | dialog as modal. | - |
| 1049 | | - |
| 1050 | \sa QWidget::windowModality, show(), exec() | - |
| 1051 | */ | - |
| 1052 | | - |
| 1053 | void QDialog::setModal(bool modal) | - |
| 1054 | { | - |
| 1055 | setAttribute(Qt::WA_ShowModal, modal); executed (the execution status of this line is deduced): setAttribute(Qt::WA_ShowModal, modal); | - |
| 1056 | } executed: }Execution Count:42 | 42 |
| 1057 | | - |
| 1058 | | - |
| 1059 | bool QDialog::isSizeGripEnabled() const | - |
| 1060 | { | - |
| 1061 | #ifndef QT_NO_SIZEGRIP | - |
| 1062 | Q_D(const QDialog); executed (the execution status of this line is deduced): const QDialogPrivate * const d = d_func(); | - |
| 1063 | return !!d->resizer; executed: return !!d->resizer;Execution Count:14 | 14 |
| 1064 | #else | - |
| 1065 | return false; | - |
| 1066 | #endif | - |
| 1067 | } | - |
| 1068 | | - |
| 1069 | | - |
| 1070 | void QDialog::setSizeGripEnabled(bool enabled) | - |
| 1071 | { | - |
| 1072 | #ifdef QT_NO_SIZEGRIP | - |
| 1073 | Q_UNUSED(enabled); | - |
| 1074 | #else | - |
| 1075 | Q_D(QDialog); executed (the execution status of this line is deduced): QDialogPrivate * const d = d_func(); | - |
| 1076 | #ifndef QT_NO_SIZEGRIP | - |
| 1077 | d->sizeGripEnabled = enabled; executed (the execution status of this line is deduced): d->sizeGripEnabled = enabled; | - |
| 1078 | if (enabled && d->doShowExtension) evaluated: enabled| yes Evaluation Count:197 | yes Evaluation Count:15 |
partially evaluated: d->doShowExtension| no Evaluation Count:0 | yes Evaluation Count:197 |
| 0-197 |
| 1079 | return; | 0 |
| 1080 | #endif | - |
| 1081 | if (!enabled != !d->resizer) { evaluated: !enabled != !d->resizer| yes Evaluation Count:199 | yes Evaluation Count:13 |
| 13-199 |
| 1082 | if (enabled) { evaluated: enabled| yes Evaluation Count:197 | yes Evaluation Count:2 |
| 2-197 |
| 1083 | d->resizer = new QSizeGrip(this); executed (the execution status of this line is deduced): d->resizer = new QSizeGrip(this); | - |
| 1084 | // adjustSize() processes all events, which is suboptimal | - |
| 1085 | d->resizer->resize(d->resizer->sizeHint()); executed (the execution status of this line is deduced): d->resizer->resize(d->resizer->sizeHint()); | - |
| 1086 | if (isRightToLeft()) partially evaluated: isRightToLeft()| no Evaluation Count:0 | yes Evaluation Count:197 |
| 0-197 |
| 1087 | d->resizer->move(rect().bottomLeft() -d->resizer->rect().bottomLeft()); never executed: d->resizer->move(rect().bottomLeft() -d->resizer->rect().bottomLeft()); | 0 |
| 1088 | else | - |
| 1089 | d->resizer->move(rect().bottomRight() -d->resizer->rect().bottomRight()); executed: d->resizer->move(rect().bottomRight() -d->resizer->rect().bottomRight());Execution Count:197 | 197 |
| 1090 | d->resizer->raise(); executed (the execution status of this line is deduced): d->resizer->raise(); | - |
| 1091 | d->resizer->show(); executed (the execution status of this line is deduced): d->resizer->show(); | - |
| 1092 | } else { executed: }Execution Count:197 | 197 |
| 1093 | delete d->resizer; executed (the execution status of this line is deduced): delete d->resizer; | - |
| 1094 | d->resizer = 0; executed (the execution status of this line is deduced): d->resizer = 0; | - |
| 1095 | } executed: }Execution Count:2 | 2 |
| 1096 | } | - |
| 1097 | #endif //QT_NO_SIZEGRIP | - |
| 1098 | } executed: }Execution Count:212 | 212 |
| 1099 | | - |
| 1100 | | - |
| 1101 | | - |
| 1102 | /*! \reimp */ | - |
| 1103 | void QDialog::resizeEvent(QResizeEvent *) | - |
| 1104 | { | - |
| 1105 | #ifndef QT_NO_SIZEGRIP | - |
| 1106 | Q_D(QDialog); executed (the execution status of this line is deduced): QDialogPrivate * const d = d_func(); | - |
| 1107 | if (d->resizer) { evaluated: d->resizer| yes Evaluation Count:82 | yes Evaluation Count:255 |
| 82-255 |
| 1108 | if (isRightToLeft()) partially evaluated: isRightToLeft()| no Evaluation Count:0 | yes Evaluation Count:82 |
| 0-82 |
| 1109 | d->resizer->move(rect().bottomLeft() -d->resizer->rect().bottomLeft()); never executed: d->resizer->move(rect().bottomLeft() -d->resizer->rect().bottomLeft()); | 0 |
| 1110 | else | - |
| 1111 | d->resizer->move(rect().bottomRight() -d->resizer->rect().bottomRight()); executed: d->resizer->move(rect().bottomRight() -d->resizer->rect().bottomRight());Execution Count:82 | 82 |
| 1112 | d->resizer->raise(); executed (the execution status of this line is deduced): d->resizer->raise(); | - |
| 1113 | } executed: }Execution Count:82 | 82 |
| 1114 | #endif | - |
| 1115 | } executed: }Execution Count:337 | 337 |
| 1116 | | - |
| 1117 | /*! \fn void QDialog::finished(int result) | - |
| 1118 | \since 4.1 | - |
| 1119 | | - |
| 1120 | This signal is emitted when the dialog's \a result code has been | - |
| 1121 | set, either by the user or by calling done(), accept(), or | - |
| 1122 | reject(). | - |
| 1123 | | - |
| 1124 | Note that this signal is \e not emitted when hiding the dialog | - |
| 1125 | with hide() or setVisible(false). This includes deleting the | - |
| 1126 | dialog while it is visible. | - |
| 1127 | | - |
| 1128 | \sa accepted(), rejected() | - |
| 1129 | */ | - |
| 1130 | | - |
| 1131 | /*! \fn void QDialog::accepted() | - |
| 1132 | \since 4.1 | - |
| 1133 | | - |
| 1134 | This signal is emitted when the dialog has been accepted either by | - |
| 1135 | the user or by calling accept() or done() with the | - |
| 1136 | QDialog::Accepted argument. | - |
| 1137 | | - |
| 1138 | Note that this signal is \e not emitted when hiding the dialog | - |
| 1139 | with hide() or setVisible(false). This includes deleting the | - |
| 1140 | dialog while it is visible. | - |
| 1141 | | - |
| 1142 | \sa finished(), rejected() | - |
| 1143 | */ | - |
| 1144 | | - |
| 1145 | /*! \fn void QDialog::rejected() | - |
| 1146 | \since 4.1 | - |
| 1147 | | - |
| 1148 | This signal is emitted when the dialog has been rejected either by | - |
| 1149 | the user or by calling reject() or done() with the | - |
| 1150 | QDialog::Rejected argument. | - |
| 1151 | | - |
| 1152 | Note that this signal is \e not emitted when hiding the dialog | - |
| 1153 | with hide() or setVisible(false). This includes deleting the | - |
| 1154 | dialog while it is visible. | - |
| 1155 | | - |
| 1156 | \sa finished(), accepted() | - |
| 1157 | */ | - |
| 1158 | | - |
| 1159 | QT_END_NAMESPACE | - |
| 1160 | #include "moc_qdialog.cpp" | - |
| 1161 | | - |
| | |