File indexing completed on 2024-05-12 16:34:57

0001 /* This file is part of the KDE project
0002     Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
0003               (C) 1999 Simon Hausmann <hausmann@kde.org>
0004               (C) 2000 Nicolas Hadacek <haadcek@kde.org>
0005               (C) 2000 Kurt Granroth <granroth@kde.org>
0006               (C) 2000 Michael Koch <koch@kde.org>
0007               (C) 2001 Holger Freyther <freyther@kde.org>
0008               (C) 2002 Ellis Whitehead <ellis@kde.org>
0009               (C) 2003 Andras Mantia <amantia@kde.org>
0010               (C) 2005-2006 Hamish Rodda <rodda@kde.org>
0011  *
0012  * This library is free software; you can redistribute it and/or
0013  * modify it under the terms of the GNU Library General Public
0014  * License as published by the Free Software Foundation; either
0015  * version 2 of the License, or (at your option) any later version.
0016  *
0017  * This library is distributed in the hope that it will be useful,
0018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0020  * Library General Public License for more details.
0021  *
0022  * You should have received a copy of the GNU Library General Public License
0023  * along with this library; see the file COPYING.LIB.  If not, write to
0024  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0025  * Boston, MA 02110-1301, USA.
0026  */
0027 
0028 #ifndef FONTSIZEACTION_H
0029 #define FONTSIZEACTION_H
0030 
0031 #include <kselectaction.h>
0032 
0033 class QIcon;
0034 
0035 /**
0036  * An action to allow changing of the font size.
0037  * This action will be shown as a combobox on a toolbar with a proper set of font sizes.
0038  *
0039  * NOTE: We do not use KFontSizeAction because it does not support font size
0040  * values of type qreal.
0041  */
0042 class FontSizeAction : public KSelectAction
0043 {
0044     Q_OBJECT
0045     Q_PROPERTY( qreal fontSize READ fontSize WRITE setFontSize )
0046 
0047 public:
0048     explicit FontSizeAction(QObject *parent);
0049     FontSizeAction(const QString &text, QObject *parent);
0050     FontSizeAction(const QIcon &icon, const QString &text, QObject *parent);
0051 
0052     ~FontSizeAction() override;
0053 
0054     qreal fontSize() const;
0055 
0056     void setFontSize( qreal size );
0057 
0058 Q_SIGNALS:
0059     void fontSizeChanged( qreal );
0060 
0061 protected Q_SLOTS:
0062     /**
0063      * This function is called whenever an action from the selections is triggered.
0064      */
0065     void actionTriggered(QAction* action) override;
0066 
0067 private:
0068     class Private;
0069     Private* const d;
0070 };
0071 
0072 #endif