OpenCoverage

qfontdialog.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/dialogs/qfontdialog.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtWidgets 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 The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://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 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qwindowdefs.h"-
41-
42#ifndef QT_NO_FONTDIALOG-
43-
44#include "qfontdialog.h"-
45#include "qfontdialog_p.h"-
46-
47#include <qapplication.h>-
48#include <qcheckbox.h>-
49#include <qcombobox.h>-
50#include <qevent.h>-
51#include <qfontdatabase.h>-
52#include <qgroupbox.h>-
53#include <qlabel.h>-
54#include <qlayout.h>-
55#include <qlineedit.h>-
56#include <qpushbutton.h>-
57#include <qstyle.h>-
58#include <qdialogbuttonbox.h>-
59#include <qheaderview.h>-
60#include <qlistview.h>-
61#include <qstringlistmodel.h>-
62#include <qvalidator.h>-
63#include <private/qdialog_p.h>-
64#include <private/qfont_p.h>-
65-
66QT_BEGIN_NAMESPACE-
67-
68class QFontListView : public QListView-
69{-
70 Q_OBJECT-
71public:-
72 QFontListView(QWidget *parent);-
73 inline QStringListModel *model() const {-
74 return static_cast<QStringListModel *>(QListView::model());
never executed: return static_cast<QStringListModel *>(QListView::model());
0
75 }-
76 inline void setCurrentItem(int item) {-
77 QListView::setCurrentIndex(static_cast<QAbstractListModel*>(model())->index(item));-
78 }
never executed: end of block
0
79 inline int currentItem() const {-
80 return QListView::currentIndex().row();
never executed: return QListView::currentIndex().row();
0
81 }-
82 inline int count() const {-
83 return model()->rowCount();
never executed: return model()->rowCount();
0
84 }-
85 inline QString currentText() const {-
86 int row = QListView::currentIndex().row();-
87 return row < 0 ? QString() : model()->stringList().at(row);
never executed: return row < 0 ? QString() : model()->stringList().at(row);
0
88 }-
89 void currentChanged(const QModelIndex &current, const QModelIndex &previous) Q_DECL_OVERRIDE {-
90 QListView::currentChanged(current, previous);-
91 if (current.isValid())
current.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
92 emit highlighted(current.row());
never executed: highlighted(current.row());
0
93 }
never executed: end of block
0
94 QString text(int i) const {-
95 return model()->stringList().at(i);
never executed: return model()->stringList().at(i);
0
96 }-
97signals:-
98 void highlighted(int);-
99};-
100-
101QFontListView::QFontListView(QWidget *parent)-
102 : QListView(parent)-
103{-
104 setModel(new QStringListModel(parent));-
105 setEditTriggers(NoEditTriggers);-
106}
never executed: end of block
0
107-
108static const Qt::WindowFlags DefaultWindowFlags =-
109 Qt::Dialog | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;-
110-
111QFontDialogPrivate::QFontDialogPrivate()-
112 : writingSystem(QFontDatabase::Any),-
113 options(QSharedPointer<QFontDialogOptions>::create())-
114{-
115}
never executed: end of block
0
116-
117QFontDialogPrivate::~QFontDialogPrivate()-
118{-
119}-
120-
121/*!-
122 \class QFontDialog-
123 \ingroup standard-dialogs-
124 \inmodule QtWidgets-
125-
126 \brief The QFontDialog class provides a dialog widget for selecting a font.-
127-
128 A font dialog is created through one of the static getFont()-
129 functions.-
130-
131 Examples:-
132-
133 \snippet code/src_gui_dialogs_qfontdialog.cpp 0-
134-
135 The dialog can also be used to set a widget's font directly:-
136 \snippet code/src_gui_dialogs_qfontdialog.cpp 1-
137 If the user clicks OK the font they chose will be used for myWidget,-
138 and if they click Cancel the original font is used.-
139-
140 \image fusion-fontdialog.png A font dialog in the Fusion widget style.-
141-
142 \sa QFont, QFontInfo, QFontMetrics, QColorDialog, QFileDialog,-
143 {Standard Dialogs Example}-
144*/-
145-
146/*!-
147 \since 4.5-
148-
149 Constructs a standard font dialog.-
150-
151 Use setCurrentFont() to set the initial font attributes.-
152-
153 The \a parent parameter is passed to the QDialog constructor.-
154-
155 \sa getFont()-
156*/-
157QFontDialog::QFontDialog(QWidget *parent)-
158 : QDialog(*new QFontDialogPrivate, parent, DefaultWindowFlags)-
159{-
160 Q_D(QFontDialog);-
161 d->init();-
162}
never executed: end of block
0
163-
164/*!-
165 \since 4.5-
166-
167 Constructs a standard font dialog with the given \a parent and specified-
168 \a initial color.-
169*/-
170QFontDialog::QFontDialog(const QFont &initial, QWidget *parent)-
171 : QDialog(*new QFontDialogPrivate, parent, DefaultWindowFlags)-
172{-
173 Q_D(QFontDialog);-
174 d->init();-
175 setCurrentFont(initial);-
176}
never executed: end of block
0
177-
178void QFontDialogPrivate::init()-
179{-
180 Q_Q(QFontDialog);-
181-
182 q->setSizeGripEnabled(true);-
183 q->setWindowTitle(QFontDialog::tr("Select Font"));-
184-
185 // grid-
186 familyEdit = new QLineEdit(q);-
187 familyEdit->setReadOnly(true);-
188 familyList = new QFontListView(q);-
189 familyEdit->setFocusProxy(familyList);-
190-
191 familyAccel = new QLabel(q);-
192#ifndef QT_NO_SHORTCUT-
193 familyAccel->setBuddy(familyList);-
194#endif-
195 familyAccel->setIndent(2);-
196-
197 styleEdit = new QLineEdit(q);-
198 styleEdit->setReadOnly(true);-
199 styleList = new QFontListView(q);-
200 styleEdit->setFocusProxy(styleList);-
201-
202 styleAccel = new QLabel(q);-
203#ifndef QT_NO_SHORTCUT-
204 styleAccel->setBuddy(styleList);-
205#endif-
206 styleAccel->setIndent(2);-
207-
208 sizeEdit = new QLineEdit(q);-
209 sizeEdit->setFocusPolicy(Qt::ClickFocus);-
210 QIntValidator *validator = new QIntValidator(1, 512, q);-
211 sizeEdit->setValidator(validator);-
212 sizeList = new QFontListView(q);-
213-
214 sizeAccel = new QLabel(q);-
215#ifndef QT_NO_SHORTCUT-
216 sizeAccel->setBuddy(sizeEdit);-
217#endif-
218 sizeAccel->setIndent(2);-
219-
220 // effects box-
221 effects = new QGroupBox(q);-
222 QVBoxLayout *vbox = new QVBoxLayout(effects);-
223 strikeout = new QCheckBox(effects);-
224 vbox->addWidget(strikeout);-
225 underline = new QCheckBox(effects);-
226 vbox->addWidget(underline);-
227-
228 sample = new QGroupBox(q);-
229 QHBoxLayout *hbox = new QHBoxLayout(sample);-
230 sampleEdit = new QLineEdit(sample);-
231 sampleEdit->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));-
232 sampleEdit->setAlignment(Qt::AlignCenter);-
233 // Note that the sample text is *not* translated with tr(), as the-
234 // characters used depend on the charset encoding.-
235 sampleEdit->setText(QLatin1String("AaBbYyZz"));-
236 hbox->addWidget(sampleEdit);-
237-
238 writingSystemCombo = new QComboBox(q);-
239-
240 writingSystemAccel = new QLabel(q);-
241#ifndef QT_NO_SHORTCUT-
242 writingSystemAccel->setBuddy(writingSystemCombo);-
243#endif-
244 writingSystemAccel->setIndent(2);-
245-
246 size = 0;-
247 smoothScalable = false;-
248-
249 QObject::connect(writingSystemCombo, SIGNAL(activated(int)), q, SLOT(_q_writingSystemHighlighted(int)));-
250 QObject::connect(familyList, SIGNAL(highlighted(int)), q, SLOT(_q_familyHighlighted(int)));-
251 QObject::connect(styleList, SIGNAL(highlighted(int)), q, SLOT(_q_styleHighlighted(int)));-
252 QObject::connect(sizeList, SIGNAL(highlighted(int)), q, SLOT(_q_sizeHighlighted(int)));-
253 QObject::connect(sizeEdit, SIGNAL(textChanged(QString)), q, SLOT(_q_sizeChanged(QString)));-
254-
255 QObject::connect(strikeout, SIGNAL(clicked()), q, SLOT(_q_updateSample()));-
256 QObject::connect(underline, SIGNAL(clicked()), q, SLOT(_q_updateSample()));-
257-
258 for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
i < QFontDatab...ngSystemsCountDescription
TRUEnever evaluated
FALSEnever evaluated
0
259 QFontDatabase::WritingSystem ws = QFontDatabase::WritingSystem(i);-
260 QString writingSystemName = QFontDatabase::writingSystemName(ws);-
261 if (writingSystemName.isEmpty())
writingSystemName.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
262 break;
never executed: break;
0
263 writingSystemCombo->addItem(writingSystemName);-
264 }
never executed: end of block
0
265-
266 updateFamilies();-
267 if (familyList->count() != 0) {
familyList->count() != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
268 familyList->setCurrentItem(0);-
269 sizeList->setCurrentItem(0);-
270 }
never executed: end of block
0
271-
272 // grid layout-
273 QGridLayout *mainGrid = new QGridLayout(q);-
274-
275 int spacing = mainGrid->spacing();-
276 if (spacing >= 0) { // uniform spacing
spacing >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
277 mainGrid->setSpacing(0);-
278-
279 mainGrid->setColumnMinimumWidth(1, spacing);-
280 mainGrid->setColumnMinimumWidth(3, spacing);-
281-
282 int margin = 0;-
283 mainGrid->getContentsMargins(0, 0, 0, &margin);-
284-
285 mainGrid->setRowMinimumHeight(3, margin);-
286 mainGrid->setRowMinimumHeight(6, 2);-
287 mainGrid->setRowMinimumHeight(8, margin);-
288 }
never executed: end of block
0
289-
290 mainGrid->addWidget(familyAccel, 0, 0);-
291 mainGrid->addWidget(familyEdit, 1, 0);-
292 mainGrid->addWidget(familyList, 2, 0);-
293-
294 mainGrid->addWidget(styleAccel, 0, 2);-
295 mainGrid->addWidget(styleEdit, 1, 2);-
296 mainGrid->addWidget(styleList, 2, 2);-
297-
298 mainGrid->addWidget(sizeAccel, 0, 4);-
299 mainGrid->addWidget(sizeEdit, 1, 4);-
300 mainGrid->addWidget(sizeList, 2, 4);-
301-
302 mainGrid->setColumnStretch(0, 38);-
303 mainGrid->setColumnStretch(2, 24);-
304 mainGrid->setColumnStretch(4, 10);-
305-
306 mainGrid->addWidget(effects, 4, 0);-
307-
308 mainGrid->addWidget(sample, 4, 2, 4, 3);-
309-
310 mainGrid->addWidget(writingSystemAccel, 5, 0);-
311 mainGrid->addWidget(writingSystemCombo, 7, 0);-
312-
313 buttonBox = new QDialogButtonBox(q);-
314 mainGrid->addWidget(buttonBox, 9, 0, 1, 5);-
315-
316 QPushButton *button-
317 = static_cast<QPushButton *>(buttonBox->addButton(QDialogButtonBox::Ok));-
318 QObject::connect(buttonBox, SIGNAL(accepted()), q, SLOT(accept()));-
319 button->setDefault(true);-
320-
321 buttonBox->addButton(QDialogButtonBox::Cancel);-
322 QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject()));-
323-
324#if defined(Q_OS_WINCE)-
325 q->resize(180, 120);-
326#else-
327 q->resize(500, 360);-
328#endif // Q_OS_WINCE-
329-
330 sizeEdit->installEventFilter(q);-
331 familyList->installEventFilter(q);-
332 styleList->installEventFilter(q);-
333 sizeList->installEventFilter(q);-
334-
335 familyList->setFocus();-
336 retranslateStrings();-
337 sampleEdit->setObjectName(QLatin1String("qt_fontDialog_sampleEdit"));-
338}
never executed: end of block
0
339-
340/*!-
341 \internal-
342 Destroys the font dialog and frees up its storage.-
343*/-
344-
345QFontDialog::~QFontDialog()-
346{-
347}-
348-
349/*!-
350 Executes a modal font dialog and returns a font.-
351-
352 If the user clicks \uicontrol OK, the selected font is returned. If the user-
353 clicks \uicontrol Cancel, the \a initial font is returned.-
354-
355 The dialog is constructed with the given \a parent and the options specified-
356 in \a options. \a title is shown as the window title of the dialog and \a-
357 initial is the initially selected font. If the \a ok parameter is not-null,-
358 the value it refers to is set to true if the user clicks \uicontrol OK, and set to-
359 false if the user clicks \uicontrol Cancel.-
360-
361 Examples:-
362 \snippet code/src_gui_dialogs_qfontdialog.cpp 2-
363-
364 The dialog can also be used to set a widget's font directly:-
365 \snippet code/src_gui_dialogs_qfontdialog.cpp 3-
366 In this example, if the user clicks OK the font they chose will be-
367 used, and if they click Cancel the original font is used.-
368-
369 \warning Do not delete \a parent during the execution of the dialog.-
370 If you want to do this, you should create the dialog-
371 yourself using one of the QFontDialog constructors.-
372*/-
373QFont QFontDialog::getFont(bool *ok, const QFont &initial, QWidget *parent, const QString &title,-
374 FontDialogOptions options)-
375{-
376 return QFontDialogPrivate::getFont(ok, initial, parent, title, options);
never executed: return QFontDialogPrivate::getFont(ok, initial, parent, title, options);
0
377}-
378-
379/*!-
380 \overload-
381-
382 Executes a modal font dialog and returns a font.-
383-
384 If the user clicks \uicontrol OK, the selected font is returned. If the user-
385 clicks \uicontrol Cancel, the Qt default font is returned.-
386-
387 The dialog is constructed with the given \a parent.-
388 If the \a ok parameter is not-null, the value it refers to is set-
389 to true if the user clicks \uicontrol OK, and false if the user clicks-
390 \uicontrol Cancel.-
391-
392 Example:-
393 \snippet code/src_gui_dialogs_qfontdialog.cpp 4-
394-
395 \warning Do not delete \a parent during the execution of the dialog.-
396 If you want to do this, you should create the dialog-
397 yourself using one of the QFontDialog constructors.-
398*/-
399QFont QFontDialog::getFont(bool *ok, QWidget *parent)-
400{-
401 QFont initial;-
402 return QFontDialogPrivate::getFont(ok, initial, parent, QString(), 0);
never executed: return QFontDialogPrivate::getFont(ok, initial, parent, QString(), 0);
0
403}-
404-
405QFont QFontDialogPrivate::getFont(bool *ok, const QFont &initial, QWidget *parent,-
406 const QString &title, QFontDialog::FontDialogOptions options)-
407{-
408 QFontDialog dlg(parent);-
409 dlg.setOptions(options);-
410 dlg.setCurrentFont(initial);-
411 if (!title.isEmpty())
!title.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
412 dlg.setWindowTitle(title);
never executed: dlg.setWindowTitle(title);
0
413-
414 int ret = (dlg.exec() || (options & QFontDialog::NoButtons));
dlg.exec()Description
TRUEnever evaluated
FALSEnever evaluated
(options & QFo...og::NoButtons)Description
TRUEnever evaluated
FALSEnever evaluated
0
415 if (ok)
okDescription
TRUEnever evaluated
FALSEnever evaluated
0
416 *ok = !!ret;
never executed: *ok = !!ret;
0
417 if (ret) {
retDescription
TRUEnever evaluated
FALSEnever evaluated
0
418 return dlg.selectedFont();
never executed: return dlg.selectedFont();
0
419 } else {-
420 return initial;
never executed: return initial;
0
421 }-
422}-
423-
424/*!-
425 \internal-
426 An event filter to make the Up, Down, PageUp and PageDown keys work-
427 correctly in the line edits. The source of the event is the object-
428 \a o and the event is \a e.-
429*/-
430-
431bool QFontDialog::eventFilter(QObject *o , QEvent *e)-
432{-
433 Q_D(QFontDialog);-
434 if (e->type() == QEvent::KeyPress) {
e->type() == QEvent::KeyPressDescription
TRUEnever evaluated
FALSEnever evaluated
0
435 QKeyEvent *k = (QKeyEvent *)e;-
436 if (o == d->sizeEdit &&
o == d->sizeEditDescription
TRUEnever evaluated
FALSEnever evaluated
0
437 (k->key() == Qt::Key_Up ||
k->key() == Qt::Key_UpDescription
TRUEnever evaluated
FALSEnever evaluated
0
438 k->key() == Qt::Key_Down ||
k->key() == Qt::Key_DownDescription
TRUEnever evaluated
FALSEnever evaluated
0
439 k->key() == Qt::Key_PageUp ||
k->key() == Qt::Key_PageUpDescription
TRUEnever evaluated
FALSEnever evaluated
0
440 k->key() == Qt::Key_PageDown)) {
k->key() == Qt::Key_PageDownDescription
TRUEnever evaluated
FALSEnever evaluated
0
441-
442 int ci = d->sizeList->currentItem();-
443 (void)QApplication::sendEvent(d->sizeList, k);-
444-
445 if (ci != d->sizeList->currentItem()
ci != d->sizeL...>currentItem()Description
TRUEnever evaluated
FALSEnever evaluated
0
446 && style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, this))
style()->style...Text, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
0
447 d->sizeEdit->selectAll();
never executed: d->sizeEdit->selectAll();
0
448 return true;
never executed: return true;
0
449 } else if ((o == d->familyList || o == d->styleList) &&
o == d->familyListDescription
TRUEnever evaluated
FALSEnever evaluated
o == d->styleListDescription
TRUEnever evaluated
FALSEnever evaluated
0
450 (k->key() == Qt::Key_Return || k->key() == Qt::Key_Enter)) {
k->key() == Qt::Key_ReturnDescription
TRUEnever evaluated
FALSEnever evaluated
k->key() == Qt::Key_EnterDescription
TRUEnever evaluated
FALSEnever evaluated
0
451 k->accept();-
452 accept();-
453 return true;
never executed: return true;
0
454 }-
455 } else if (e->type() == QEvent::FocusIn
never executed: end of block
e->type() == QEvent::FocusInDescription
TRUEnever evaluated
FALSEnever evaluated
0
456 && style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, this)) {
style()->style...Text, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
0
457 if (o == d->familyList)
o == d->familyListDescription
TRUEnever evaluated
FALSEnever evaluated
0
458 d->familyEdit->selectAll();
never executed: d->familyEdit->selectAll();
0
459 else if (o == d->styleList)
o == d->styleListDescription
TRUEnever evaluated
FALSEnever evaluated
0
460 d->styleEdit->selectAll();
never executed: d->styleEdit->selectAll();
0
461 else if (o == d->sizeList)
o == d->sizeListDescription
TRUEnever evaluated
FALSEnever evaluated
0
462 d->sizeEdit->selectAll();
never executed: d->sizeEdit->selectAll();
0
463 } else if (e->type() == QEvent::MouseButtonPress && o == d->sizeList) {
never executed: end of block
e->type() == Q...useButtonPressDescription
TRUEnever evaluated
FALSEnever evaluated
o == d->sizeListDescription
TRUEnever evaluated
FALSEnever evaluated
0
464 d->sizeEdit->setFocus();-
465 }
never executed: end of block
0
466 return QDialog::eventFilter(o, e);
never executed: return QDialog::eventFilter(o, e);
0
467}-
468-
469void QFontDialogPrivate::initHelper(QPlatformDialogHelper *h)-
470{-
471 QFontDialog *d = q_func();-
472 QObject::connect(h, SIGNAL(currentFontChanged(QFont)), d, SIGNAL(currentFontChanged(QFont)));-
473 QObject::connect(h, SIGNAL(fontSelected(QFont)), d, SIGNAL(fontSelected(QFont)));-
474 static_cast<QPlatformFontDialogHelper *>(h)->setOptions(options);-
475}
never executed: end of block
0
476-
477void QFontDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)-
478{-
479 options->setWindowTitle(q_func()->windowTitle());-
480}
never executed: end of block
0
481-
482/*-
483 Updates the contents of the "font family" list box. This-
484 function can be reimplemented if you have special requirements.-
485*/-
486-
487void QFontDialogPrivate::updateFamilies()-
488{-
489 Q_Q(QFontDialog);-
490-
491 enum match_t { MATCH_NONE = 0, MATCH_LAST_RESORT = 1, MATCH_APP = 2, MATCH_FAMILY = 3 };-
492-
493 const QFontDialog::FontDialogOptions scalableMask = (QFontDialog::ScalableFonts | QFontDialog::NonScalableFonts);-
494 const QFontDialog::FontDialogOptions spacingMask = (QFontDialog::ProportionalFonts | QFontDialog::MonospacedFonts);-
495 const QFontDialog::FontDialogOptions options = q->options();-
496-
497 QFontDatabase fdb;-
498-
499 QStringList familyNames;-
500 const auto families = fdb.families(writingSystem);-
501 for (const QString &family : families) {-
502 if (fdb.isPrivateFamily(family))
fdb.isPrivateFamily(family)Description
TRUEnever evaluated
FALSEnever evaluated
0
503 continue;
never executed: continue;
0
504-
505 if ((options & scalableMask) && (options & scalableMask) != scalableMask) {
(options & scalableMask)Description
TRUEnever evaluated
FALSEnever evaluated
(options & sca...= scalableMaskDescription
TRUEnever evaluated
FALSEnever evaluated
0
506 if (bool(options & QFontDialog::ScalableFonts) != fdb.isSmoothlyScalable(family))
bool(options &...alable(family)Description
TRUEnever evaluated
FALSEnever evaluated
0
507 continue;
never executed: continue;
0
508 }
never executed: end of block
0
509 if ((options & spacingMask) && (options & spacingMask) != spacingMask) {
(options & spacingMask)Description
TRUEnever evaluated
FALSEnever evaluated
(options & spa...!= spacingMaskDescription
TRUEnever evaluated
FALSEnever evaluated
0
510 if (bool(options & QFontDialog::MonospacedFonts) != fdb.isFixedPitch(family))
bool(options &...dPitch(family)Description
TRUEnever evaluated
FALSEnever evaluated
0
511 continue;
never executed: continue;
0
512 }
never executed: end of block
0
513 familyNames << family;-
514 }
never executed: end of block
0
515-
516 familyList->model()->setStringList(familyNames);-
517-
518 QString foundryName1, familyName1, foundryName2, familyName2;-
519 int bestFamilyMatch = -1;-
520 match_t bestFamilyType = MATCH_NONE;-
521-
522 QFont f;-
523-
524 // ##### do the right thing for a list of family names in the font.-
525 QFontDatabase::parseFontName(family, foundryName1, familyName1);-
526-
527 QStringList::const_iterator it = familyNames.constBegin();-
528 int i = 0;-
529 for(; it != familyNames.constEnd(); ++it, ++i) {
it != familyNames.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
0
530 QFontDatabase::parseFontName(*it, foundryName2, familyName2);-
531-
532 //try to match...-
533 if (familyName1 == familyName2) {
familyName1 == familyName2Description
TRUEnever evaluated
FALSEnever evaluated
0
534 bestFamilyType = MATCH_FAMILY;-
535 if (foundryName1 == foundryName2) {
foundryName1 == foundryName2Description
TRUEnever evaluated
FALSEnever evaluated
0
536 bestFamilyMatch = i;-
537 break;
never executed: break;
0
538 }-
539 if (bestFamilyMatch < MATCH_FAMILY)
bestFamilyMatch < MATCH_FAMILYDescription
TRUEnever evaluated
FALSEnever evaluated
0
540 bestFamilyMatch = i;
never executed: bestFamilyMatch = i;
0
541 }
never executed: end of block
0
542-
543 //and try some fall backs-
544 match_t type = MATCH_NONE;-
545 if (bestFamilyType <= MATCH_NONE && familyName2 == f.lastResortFamily())
bestFamilyType <= MATCH_NONEDescription
TRUEnever evaluated
FALSEnever evaluated
familyName2 ==...ResortFamily()Description
TRUEnever evaluated
FALSEnever evaluated
0
546 type = MATCH_LAST_RESORT;
never executed: type = MATCH_LAST_RESORT;
0
547 if (bestFamilyType <= MATCH_LAST_RESORT && familyName2 == f.family())
bestFamilyType...CH_LAST_RESORTDescription
TRUEnever evaluated
FALSEnever evaluated
familyName2 == f.family()Description
TRUEnever evaluated
FALSEnever evaluated
0
548 type = MATCH_APP;
never executed: type = MATCH_APP;
0
549 // ### add fallback for writingSystem-
550 if (type != MATCH_NONE) {
type != MATCH_NONEDescription
TRUEnever evaluated
FALSEnever evaluated
0
551 bestFamilyType = type;-
552 bestFamilyMatch = i;-
553 }
never executed: end of block
0
554 }
never executed: end of block
0
555-
556 if (i != -1 && bestFamilyType != MATCH_NONE)
i != -1Description
TRUEnever evaluated
FALSEnever evaluated
bestFamilyType != MATCH_NONEDescription
TRUEnever evaluated
FALSEnever evaluated
0
557 familyList->setCurrentItem(bestFamilyMatch);
never executed: familyList->setCurrentItem(bestFamilyMatch);
0
558 else-
559 familyList->setCurrentItem(0);
never executed: familyList->setCurrentItem(0);
0
560 familyEdit->setText(familyList->currentText());-
561 if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
q->style()->st...tedText, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
0
562 && familyList->hasFocus())
familyList->hasFocus()Description
TRUEnever evaluated
FALSEnever evaluated
0
563 familyEdit->selectAll();
never executed: familyEdit->selectAll();
0
564-
565 updateStyles();-
566}
never executed: end of block
0
567-
568/*-
569 Updates the contents of the "font style" list box. This-
570 function can be reimplemented if you have special requirements.-
571*/-
572void QFontDialogPrivate::updateStyles()-
573{-
574 Q_Q(QFontDialog);-
575 QStringList styles = fdb.styles(familyList->currentText());-
576 styleList->model()->setStringList(styles);-
577-
578 if (styles.isEmpty()) {
styles.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
579 styleEdit->clear();-
580 smoothScalable = false;-
581 } else {
never executed: end of block
0
582 if (!style.isEmpty()) {
!style.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
583 bool found = false;-
584 bool first = true;-
585 QString cstyle = style;-
586-
587 redo:
code before this statement never executed: redo:
0
588 for (int i = 0; i < (int)styleList->count(); i++) {
i < (int)styleList->count()Description
TRUEnever evaluated
FALSEnever evaluated
0
589 if (cstyle == styleList->text(i)) {
cstyle == styleList->text(i)Description
TRUEnever evaluated
FALSEnever evaluated
0
590 styleList->setCurrentItem(i);-
591 found = true;-
592 break;
never executed: break;
0
593 }-
594 }
never executed: end of block
0
595 if (!found && first) {
!foundDescription
TRUEnever evaluated
FALSEnever evaluated
firstDescription
TRUEnever evaluated
FALSEnever evaluated
0
596 if (cstyle.contains(QLatin1String("Italic"))) {
cstyle.contain...ing("Italic"))Description
TRUEnever evaluated
FALSEnever evaluated
0
597 cstyle.replace(QLatin1String("Italic"), QLatin1String("Oblique"));-
598 first = false;-
599 goto redo;
never executed: goto redo;
0
600 } else if (cstyle.contains(QLatin1String("Oblique"))) {
cstyle.contain...ng("Oblique"))Description
TRUEnever evaluated
FALSEnever evaluated
0
601 cstyle.replace(QLatin1String("Oblique"), QLatin1String("Italic"));-
602 first = false;-
603 goto redo;
never executed: goto redo;
0
604 }-
605 }
never executed: end of block
0
606 if (!found)
!foundDescription
TRUEnever evaluated
FALSEnever evaluated
0
607 styleList->setCurrentItem(0);
never executed: styleList->setCurrentItem(0);
0
608 } else {
never executed: end of block
0
609 styleList->setCurrentItem(0);-
610 }
never executed: end of block
0
611-
612 styleEdit->setText(styleList->currentText());-
613 if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
q->style()->st...tedText, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
0
614 && styleList->hasFocus())
styleList->hasFocus()Description
TRUEnever evaluated
FALSEnever evaluated
0
615 styleEdit->selectAll();
never executed: styleEdit->selectAll();
0
616-
617 smoothScalable = fdb.isSmoothlyScalable(familyList->currentText(), styleList->currentText());-
618 }
never executed: end of block
0
619-
620 updateSizes();-
621}
never executed: end of block
0
622-
623/*!-
624 \internal-
625 Updates the contents of the "font size" list box. This-
626 function can be reimplemented if you have special requirements.-
627*/-
628-
629void QFontDialogPrivate::updateSizes()-
630{-
631 Q_Q(QFontDialog);-
632-
633 if (!familyList->currentText().isEmpty()) {
!familyList->c...xt().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
634 QList<int> sizes = fdb.pointSizes(familyList->currentText(), styleList->currentText());-
635-
636 int i = 0;-
637 int current = -1;-
638 QStringList str_sizes;-
639 str_sizes.reserve(sizes.size());-
640 for(QList<int>::const_iterator it = sizes.constBegin(); it != sizes.constEnd(); ++it) {
it != sizes.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
0
641 str_sizes.append(QString::number(*it));-
642 if (current == -1 && *it == size)
current == -1Description
TRUEnever evaluated
FALSEnever evaluated
*it == sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
643 current = i;
never executed: current = i;
0
644 ++i;-
645 }
never executed: end of block
0
646 sizeList->model()->setStringList(str_sizes);-
647 if (current != -1)
current != -1Description
TRUEnever evaluated
FALSEnever evaluated
0
648 sizeList->setCurrentItem(current);
never executed: sizeList->setCurrentItem(current);
0
649-
650 const QSignalBlocker blocker(sizeEdit);-
651 sizeEdit->setText((smoothScalable ? QString::number(size) : sizeList->currentText()));-
652 if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
q->style()->st...tedText, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
0
653 && sizeList->hasFocus())
sizeList->hasFocus()Description
TRUEnever evaluated
FALSEnever evaluated
0
654 sizeEdit->selectAll();
never executed: sizeEdit->selectAll();
0
655 } else {
never executed: end of block
0
656 sizeEdit->clear();-
657 }
never executed: end of block
0
658-
659 _q_updateSample();-
660}
never executed: end of block
0
661-
662void QFontDialogPrivate::_q_updateSample()-
663{-
664 // compute new font-
665 int pSize = sizeEdit->text().toInt();-
666 QFont newFont(fdb.font(familyList->currentText(), style, pSize));-
667 newFont.setStrikeOut(strikeout->isChecked());-
668 newFont.setUnderline(underline->isChecked());-
669-
670 if (familyList->currentText().isEmpty())
familyList->cu...xt().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
671 sampleEdit->clear();
never executed: sampleEdit->clear();
0
672-
673 updateSampleFont(newFont);-
674}
never executed: end of block
0
675-
676void QFontDialogPrivate::updateSampleFont(const QFont &newFont)-
677{-
678 Q_Q(QFontDialog);-
679 if (newFont != sampleEdit->font()) {
newFont != sampleEdit->font()Description
TRUEnever evaluated
FALSEnever evaluated
0
680 sampleEdit->setFont(newFont);-
681 emit q->currentFontChanged(newFont);-
682 }
never executed: end of block
0
683}
never executed: end of block
0
684-
685/*!-
686 \internal-
687*/-
688void QFontDialogPrivate::_q_writingSystemHighlighted(int index)-
689{-
690 writingSystem = QFontDatabase::WritingSystem(index);-
691 sampleEdit->setText(fdb.writingSystemSample(writingSystem));-
692 updateFamilies();-
693}
never executed: end of block
0
694-
695/*!-
696 \internal-
697*/-
698void QFontDialogPrivate::_q_familyHighlighted(int i)-
699{-
700 Q_Q(QFontDialog);-
701 family = familyList->text(i);-
702 familyEdit->setText(family);-
703 if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
q->style()->st...tedText, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
0
704 && familyList->hasFocus())
familyList->hasFocus()Description
TRUEnever evaluated
FALSEnever evaluated
0
705 familyEdit->selectAll();
never executed: familyEdit->selectAll();
0
706-
707 updateStyles();-
708}
never executed: end of block
0
709-
710-
711/*!-
712 \internal-
713*/-
714-
715void QFontDialogPrivate::_q_styleHighlighted(int index)-
716{-
717 Q_Q(QFontDialog);-
718 QString s = styleList->text(index);-
719 styleEdit->setText(s);-
720 if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
q->style()->st...tedText, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
0
721 && styleList->hasFocus())
styleList->hasFocus()Description
TRUEnever evaluated
FALSEnever evaluated
0
722 styleEdit->selectAll();
never executed: styleEdit->selectAll();
0
723-
724 style = s;-
725-
726 updateSizes();-
727}
never executed: end of block
0
728-
729-
730/*!-
731 \internal-
732*/-
733-
734void QFontDialogPrivate::_q_sizeHighlighted(int index)-
735{-
736 Q_Q(QFontDialog);-
737 QString s = sizeList->text(index);-
738 sizeEdit->setText(s);-
739 if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
q->style()->st...tedText, 0, q)Description
TRUEnever evaluated
FALSEnever evaluated
0
740 && sizeEdit->hasFocus())
sizeEdit->hasFocus()Description
TRUEnever evaluated
FALSEnever evaluated
0
741 sizeEdit->selectAll();
never executed: sizeEdit->selectAll();
0
742-
743 size = s.toInt();-
744 _q_updateSample();-
745}
never executed: end of block
0
746-
747/*!-
748 \internal-
749 This slot is called if the user changes the font size.-
750 The size is passed in the \a s argument as a \e string.-
751*/-
752-
753void QFontDialogPrivate::_q_sizeChanged(const QString &s)-
754{-
755 // no need to check if the conversion is valid, since we have an QIntValidator in the size edit-
756 int size = s.toInt();-
757 if (this->size == size)
this->size == sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
758 return;
never executed: return;
0
759-
760 this->size = size;-
761 if (sizeList->count() != 0) {
sizeList->count() != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
762 int i;-
763 for (i = 0; i < sizeList->count() - 1; i++) {
i < sizeList->count() - 1Description
TRUEnever evaluated
FALSEnever evaluated
0
764 if (sizeList->text(i).toInt() >= this->size)
sizeList->text... >= this->sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
765 break;
never executed: break;
0
766 }
never executed: end of block
0
767 const QSignalBlocker blocker(sizeList);-
768 if (sizeList->text(i).toInt() == this->size)
sizeList->text... == this->sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
769 sizeList->setCurrentItem(i);
never executed: sizeList->setCurrentItem(i);
0
770 else-
771 sizeList->clearSelection();
never executed: sizeList->clearSelection();
0
772 }-
773 _q_updateSample();-
774}
never executed: end of block
0
775-
776void QFontDialogPrivate::retranslateStrings()-
777{-
778 familyAccel->setText(QFontDialog::tr("&Font"));-
779 styleAccel->setText(QFontDialog::tr("Font st&yle"));-
780 sizeAccel->setText(QFontDialog::tr("&Size"));-
781 effects->setTitle(QFontDialog::tr("Effects"));-
782 strikeout->setText(QFontDialog::tr("Stri&keout"));-
783 underline->setText(QFontDialog::tr("&Underline"));-
784 sample->setTitle(QFontDialog::tr("Sample"));-
785 writingSystemAccel->setText(QFontDialog::tr("Wr&iting System"));-
786}
never executed: end of block
0
787-
788/*!-
789 \reimp-
790*/-
791void QFontDialog::changeEvent(QEvent *e)-
792{-
793 Q_D(QFontDialog);-
794 if (e->type() == QEvent::LanguageChange) {
e->type() == Q...LanguageChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
795 d->retranslateStrings();-
796 }
never executed: end of block
0
797 QDialog::changeEvent(e);-
798}
never executed: end of block
0
799-
800/*!-
801 \since 4.5-
802-
803 \property QFontDialog::currentFont-
804 \brief the current font of the dialog.-
805*/-
806-
807/*!-
808 \since 4.5-
809-
810 Sets the font highlighted in the QFontDialog to the given \a font.-
811-
812 \sa selectedFont()-
813*/-
814void QFontDialog::setCurrentFont(const QFont &font)-
815{-
816 Q_D(QFontDialog);-
817 d->family = font.family();-
818 d->style = d->fdb.styleString(font);-
819 d->size = font.pointSize();-
820 if (d->size == -1) {
d->size == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
821 QFontInfo fi(font);-
822 d->size = fi.pointSize();-
823 }
never executed: end of block
0
824 d->strikeout->setChecked(font.strikeOut());-
825 d->underline->setChecked(font.underline());-
826 d->updateFamilies();-
827 if (QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
QPlatformFontD...DialogHelper()Description
TRUEnever evaluated
FALSEnever evaluated
0
828 helper->setCurrentFont(font);
never executed: helper->setCurrentFont(font);
0
829}
never executed: end of block
0
830-
831/*!-
832 \since 4.5-
833-
834 Returns the current font.-
835-
836 \sa selectedFont()-
837*/-
838QFont QFontDialog::currentFont() const-
839{-
840 Q_D(const QFontDialog);-
841 if (const QPlatformFontDialogHelper *helper = d->platformFontDialogHelper())
const QPlatfor...DialogHelper()Description
TRUEnever evaluated
FALSEnever evaluated
0
842 return helper->currentFont();
never executed: return helper->currentFont();
0
843 return d->sampleEdit->font();
never executed: return d->sampleEdit->font();
0
844}-
845-
846/*!-
847 Returns the font that the user selected by clicking the \uicontrol{OK}-
848 or equivalent button.-
849-
850 \note This font is not always the same as the font held by the-
851 \l currentFont property since the user can choose different fonts-
852 before finally selecting the one to use.-
853*/-
854QFont QFontDialog::selectedFont() const-
855{-
856 Q_D(const QFontDialog);-
857 return d->selectedFont;
never executed: return d->selectedFont;
0
858}-
859-
860/*!-
861 \enum QFontDialog::FontDialogOption-
862 \since 4.5-
863-
864 This enum specifies various options that affect the look and feel-
865 of a font dialog.-
866-
867 For instance, it allows to specify which type of font should be-
868 displayed. If none are specified all fonts available will be listed.-
869-
870 Note that the font filtering options might not be supported on some-
871 platforms (e.g. Mac). They are always supported by the non native-
872 dialog (used on Windows or Linux).-
873-
874 \value NoButtons Don't display \uicontrol{OK} and \uicontrol{Cancel} buttons. (Useful for "live dialogs".)-
875 \value DontUseNativeDialog Use Qt's standard font dialog on the Mac instead of Apple's-
876 native font panel. (Currently, the native dialog is never used,-
877 but this is likely to change in future Qt releases.)-
878 \value ScalableFonts Show scalable fonts-
879 \value NonScalableFonts Show non scalable fonts-
880 \value MonospacedFonts Show monospaced fonts-
881 \value ProportionalFonts Show proportional fonts-
882-
883 \sa options, setOption(), testOption()-
884*/-
885-
886/*!-
887 Sets the given \a option to be enabled if \a on is true;-
888 otherwise, clears the given \a option.-
889-
890 \sa options, testOption()-
891*/-
892void QFontDialog::setOption(FontDialogOption option, bool on)-
893{-
894 const QFontDialog::FontDialogOptions previousOptions = options();-
895 if (!(previousOptions & option) != !on)
!(previousOpti...option) != !onDescription
TRUEnever evaluated
FALSEnever evaluated
0
896 setOptions(previousOptions ^ option);
never executed: setOptions(previousOptions ^ option);
0
897}
never executed: end of block
0
898-
899/*!-
900 Returns \c true if the given \a option is enabled; otherwise, returns-
901 false.-
902-
903 \sa options, setOption()-
904*/-
905bool QFontDialog::testOption(FontDialogOption option) const-
906{-
907 Q_D(const QFontDialog);-
908 return d->options->testOption(static_cast<QFontDialogOptions::FontDialogOption>(option));
never executed: return d->options->testOption(static_cast<QFontDialogOptions::FontDialogOption>(option));
0
909}-
910-
911/*!-
912 \property QFontDialog::options-
913 \brief the various options that affect the look and feel of the dialog-
914 \since 4.5-
915-
916 By default, all options are disabled.-
917-
918 Options should be set before showing the dialog. Setting them while the-
919 dialog is visible is not guaranteed to have an immediate effect on the-
920 dialog (depending on the option and on the platform).-
921-
922 \sa setOption(), testOption()-
923*/-
924void QFontDialog::setOptions(FontDialogOptions options)-
925{-
926 Q_D(QFontDialog);-
927-
928 if (QFontDialog::options() == options)
QFontDialog::o...s() == optionsDescription
TRUEnever evaluated
FALSEnever evaluated
0
929 return;
never executed: return;
0
930-
931 d->options->setOptions(QFontDialogOptions::FontDialogOptions(int(options)));-
932 d->buttonBox->setVisible(!(options & NoButtons));-
933}
never executed: end of block
0
934-
935QFontDialog::FontDialogOptions QFontDialog::options() const-
936{-
937 Q_D(const QFontDialog);-
938 return QFontDialog::FontDialogOptions(int(d->options->options()));
never executed: return QFontDialog::FontDialogOptions(int(d->options->options()));
0
939}-
940-
941/*!-
942 \since 4.5-
943 \overload-
944-
945 Opens the dialog and connects its fontSelected() signal to the slot specified-
946 by \a receiver and \a member.-
947-
948 The signal will be disconnected from the slot when the dialog is closed.-
949*/-
950void QFontDialog::open(QObject *receiver, const char *member)-
951{-
952 Q_D(QFontDialog);-
953 connect(this, SIGNAL(fontSelected(QFont)), receiver, member);-
954 d->receiverToDisconnectOnClose = receiver;-
955 d->memberToDisconnectOnClose = member;-
956 QDialog::open();-
957}
never executed: end of block
0
958-
959/*!-
960 \since 4.5-
961-
962 \fn void QFontDialog::currentFontChanged(const QFont &font)-
963-
964 This signal is emitted when the current font is changed. The new font is-
965 specified in \a font.-
966-
967 The signal is emitted while a user is selecting a font. Ultimately, the-
968 chosen font may differ from the font currently selected.-
969-
970 \sa currentFont, fontSelected(), selectedFont()-
971*/-
972-
973/*!-
974 \since 4.5-
975-
976 \fn void QFontDialog::fontSelected(const QFont &font)-
977-
978 This signal is emitted when a font has been selected. The selected font is-
979 specified in \a font.-
980-
981 The signal is only emitted when a user has chosen the final font to be-
982 used. It is not emitted while the user is changing the current font in the-
983 font dialog.-
984-
985 \sa selectedFont(), currentFontChanged(), currentFont-
986*/-
987-
988/*!-
989 \reimp-
990*/-
991void QFontDialog::setVisible(bool visible)-
992{-
993 if (testAttribute(Qt::WA_WState_ExplicitShowHide) && testAttribute(Qt::WA_WState_Hidden) != visible)
testAttribute(...licitShowHide)Description
TRUEnever evaluated
FALSEnever evaluated
testAttribute(...en) != visibleDescription
TRUEnever evaluated
FALSEnever evaluated
0
994 return;
never executed: return;
0
995 Q_D(QFontDialog);-
996 if (d->canBeNativeDialog())
d->canBeNativeDialog()Description
TRUEnever evaluated
FALSEnever evaluated
0
997 d->setNativeDialogVisible(visible);
never executed: d->setNativeDialogVisible(visible);
0
998 if (d->nativeDialogInUse) {
d->nativeDialogInUseDescription
TRUEnever evaluated
FALSEnever evaluated
0
999 // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below-
1000 // updates the state correctly, but skips showing the non-native version:-
1001 setAttribute(Qt::WA_DontShowOnScreen, true);-
1002 } else {
never executed: end of block
0
1003 d->nativeDialogInUse = false;-
1004 setAttribute(Qt::WA_DontShowOnScreen, false);-
1005 }
never executed: end of block
0
1006 QDialog::setVisible(visible);-
1007}
never executed: end of block
0
1008-
1009/*!-
1010 Closes the dialog and sets its result code to \a result. If this dialog-
1011 is shown with exec(), done() causes the local event loop to finish,-
1012 and exec() to return \a result.-
1013-
1014 \sa QDialog::done()-
1015*/-
1016void QFontDialog::done(int result)-
1017{-
1018 Q_D(QFontDialog);-
1019 QDialog::done(result);-
1020 if (result == Accepted) {
result == AcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1021 // We check if this is the same font we had before, if so we emit currentFontChanged-
1022 QFont selectedFont = currentFont();-
1023 if(selectedFont != d->selectedFont)
selectedFont !...->selectedFontDescription
TRUEnever evaluated
FALSEnever evaluated
0
1024 emit(currentFontChanged(selectedFont));
never executed: (currentFontChanged(selectedFont));
0
1025 d->selectedFont = selectedFont;-
1026 emit fontSelected(d->selectedFont);-
1027 } else
never executed: end of block
0
1028 d->selectedFont = QFont();
never executed: d->selectedFont = QFont();
0
1029 if (d->receiverToDisconnectOnClose) {
d->receiverToDisconnectOnCloseDescription
TRUEnever evaluated
FALSEnever evaluated
0
1030 disconnect(this, SIGNAL(fontSelected(QFont)),-
1031 d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);-
1032 d->receiverToDisconnectOnClose = 0;-
1033 }
never executed: end of block
0
1034 d->memberToDisconnectOnClose.clear();-
1035}
never executed: end of block
0
1036-
1037bool QFontDialogPrivate::canBeNativeDialog() const-
1038{-
1039 // Don't use Q_Q here! This function is called from ~QDialog,-
1040 // so Q_Q calling q_func() invokes undefined behavior (invalid cast in q_func()).-
1041 const QDialog * const q = static_cast<const QDialog*>(q_ptr);-
1042 if (nativeDialogInUse)
nativeDialogInUseDescription
TRUEnever evaluated
FALSEnever evaluated
0
1043 return true;
never executed: return true;
0
1044 if (QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs)
QCoreApplicati...NativeDialogs)Description
TRUEnever evaluated
FALSEnever evaluated
0
1045 || q->testAttribute(Qt::WA_DontShowOnScreen)
q->testAttribu...tShowOnScreen)Description
TRUEnever evaluated
FALSEnever evaluated
0
1046 || (options->options() & QFontDialog::DontUseNativeDialog)) {
(options->opti...eNativeDialog)Description
TRUEnever evaluated
FALSEnever evaluated
0
1047 return false;
never executed: return false;
0
1048 }-
1049-
1050 QLatin1String staticName(QFontDialog::staticMetaObject.className());-
1051 QLatin1String dynamicName(q->metaObject()->className());-
1052 return (staticName == dynamicName);
never executed: return (staticName == dynamicName);
0
1053}-
1054-
1055QT_END_NAMESPACE-
1056-
1057#include "qfontdialog.moc"-
1058#include "moc_qfontdialog.cpp"-
1059-
1060#endif // QT_NO_FONTDIALOG-
Source codeSwitch to Preprocessed file

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