File indexing completed on 2024-06-16 04:17:51

0001 /* This file is part of the KDE project
0002     SPDX-FileCopyrightText: 1999 Reginald Stadlbauer <reggie@kde.org>
0003     SPDX-FileCopyrightText: 1999 Simon Hausmann <hausmann@kde.org>
0004     SPDX-FileCopyrightText: 2000 Nicolas Hadacek <haadcek@kde.org>
0005     SPDX-FileCopyrightText: 2000 Kurt Granroth <granroth@kde.org>
0006     SPDX-FileCopyrightText: 2000 Michael Koch <koch@kde.org>
0007     SPDX-FileCopyrightText: 2001 Holger Freyther <freyther@kde.org>
0008     SPDX-FileCopyrightText: 2002 Ellis Whitehead <ellis@kde.org>
0009     SPDX-FileCopyrightText: 2003 Andras Mantia <amantia@kde.org>
0010     SPDX-FileCopyrightText: 2005-2006 Hamish Rodda <rodda@kde.org>
0011  *
0012  * SPDX-License-Identifier: LGPL-2.0-or-later
0013  */
0014 
0015 #ifndef FONTSIZEACTION_H
0016 #define FONTSIZEACTION_H
0017 
0018 #include <kselectaction.h>
0019 
0020 class QIcon;
0021 
0022 /**
0023  * An action to allow changing of the font size.
0024  * This action will be shown as a combobox on a toolbar with a proper set of font sizes.
0025  *
0026  * NOTE: We do not use KFontSizeAction because it does not support font size
0027  * values of type qreal.
0028  */
0029 class FontSizeAction : public KSelectAction
0030 {
0031     Q_OBJECT
0032     Q_PROPERTY(qreal fontSize READ fontSize WRITE setFontSize)
0033 
0034 public:
0035     explicit FontSizeAction(QObject *parent);
0036     FontSizeAction(const QString &text, QObject *parent);
0037     FontSizeAction(const QIcon &icon, const QString &text, QObject *parent);
0038 
0039     ~FontSizeAction() override;
0040 
0041     qreal fontSize() const;
0042 
0043     void setFontSize(qreal size);
0044 
0045 Q_SIGNALS:
0046     void fontSizeChanged(qreal);
0047 
0048 protected Q_SLOTS:
0049     /**
0050      * This function is called whenever an action from the selections is triggered.
0051      */
0052     void actionTriggered(QAction *action) override;
0053 
0054 private:
0055     class Private;
0056     Private *const d;
0057 };
0058 
0059 #endif