File indexing completed on 2025-02-02 04:11:28

0001 /*
0002  * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #ifndef FONT_FONTPREVIEWWIDGET_H
0008 #define FONT_FONTPREVIEWWIDGET_H
0009 
0010 #include <memory>
0011 #include <QWidget>
0012 
0013 namespace glaxnimate::gui::font {
0014 
0015 class FontPreviewWidget : public QWidget
0016 {
0017     Q_OBJECT
0018 
0019 public:
0020     FontPreviewWidget(QWidget* parent = nullptr);
0021     ~FontPreviewWidget();
0022 
0023     void set_text(const QString& text, bool fallback_to_default = true);
0024 
0025     QFont selected_font() const;
0026 
0027 public Q_SLOTS:
0028     void set_font(const QFont& font);
0029 
0030 protected:
0031     void changeEvent ( QEvent* e ) override;
0032     void resizeEvent(QResizeEvent * event) override;
0033     void showEvent(QShowEvent * event) override;
0034 
0035 private Q_SLOTS:
0036     void zoom_changed(double zoom);
0037 
0038 private:
0039     class Private;
0040     std::unique_ptr<Private> d;
0041 };
0042 
0043 }
0044 
0045 #endif // FONT_FONTPREVIEWWIDGET_H