Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:09:33

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