Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:23:34

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 // Qt-Security score:significant reason:default
0004 
0005 #ifndef QFONTDIALOG_H
0006 #define QFONTDIALOG_H
0007 
0008 #include <QtWidgets/qtwidgetsglobal.h>
0009 #include <QtGui/qwindowdefs.h>
0010 #include <QtGui/qfont.h>
0011 
0012 #include <QtWidgets/qdialog.h>
0013 
0014 QT_REQUIRE_CONFIG(fontdialog);
0015 
0016 QT_BEGIN_NAMESPACE
0017 
0018 class QFontDialogPrivate;
0019 
0020 class Q_WIDGETS_EXPORT QFontDialog : public QDialog
0021 {
0022     Q_OBJECT
0023     Q_DECLARE_PRIVATE(QFontDialog)
0024     Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged)
0025     Q_PROPERTY(FontDialogOptions options READ options WRITE setOptions)
0026 
0027 public:
0028     enum FontDialogOption {
0029         NoButtons           = 0x00000001,
0030         DontUseNativeDialog = 0x00000002,
0031         ScalableFonts       = 0x00000004,
0032         NonScalableFonts    = 0x00000008,
0033         MonospacedFonts     = 0x00000010,
0034         ProportionalFonts   = 0x00000020
0035     };
0036     Q_ENUM(FontDialogOption)
0037 
0038     Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption)
0039 
0040     explicit QFontDialog(QWidget *parent = nullptr);
0041     explicit QFontDialog(const QFont &initial, QWidget *parent = nullptr);
0042     ~QFontDialog();
0043 
0044     void setCurrentFont(const QFont &font);
0045     QFont currentFont() const;
0046 
0047     QFont selectedFont() const;
0048 
0049     void setOption(FontDialogOption option, bool on = true);
0050     bool testOption(FontDialogOption option) const;
0051     void setOptions(FontDialogOptions options);
0052     FontDialogOptions options() const;
0053 
0054     using QDialog::open;
0055     void open(QObject *receiver, const char *member);
0056 
0057     void setVisible(bool visible) override;
0058 
0059     static QFont getFont(bool *ok, QWidget *parent = nullptr);
0060     static QFont getFont(bool *ok, const QFont &initial, QWidget *parent = nullptr, const QString &title = QString(),
0061                          FontDialogOptions options = FontDialogOptions());
0062 
0063 Q_SIGNALS:
0064     void currentFontChanged(const QFont &font);
0065     void fontSelected(const QFont &font);
0066 
0067 protected:
0068     void changeEvent(QEvent *event) override;
0069     void done(int result) override;
0070     bool eventFilter(QObject *object, QEvent *event) override;
0071 
0072 private:
0073     Q_DISABLE_COPY(QFontDialog)
0074 };
0075 
0076 Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)
0077 
0078 QT_END_NAMESPACE
0079 
0080 #endif // QFONTDIALOG_H