1 /* ============================================================ 2 * 3 * This file is a part of digiKam project 4 * https://www.digikam.org 5 * 6 * Date : 2008-12-23 7 * Description : a widget to select between system font or a custom font. 8 * 9 * Copyright (C) 2008-2021 by Gilles Caulier <caulier dot gilles at gmail dot com> 10 * 11 * This program is free software; you can redistribute it 12 * and/or modify it under the terms of the GNU General 13 * Public License as published by the Free Software Foundation; 14 * either version 2, or (at your option) 15 * any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * ============================================================ */ 23 24 #ifndef DIGIKAM_DFONT_SELECT_H 25 #define DIGIKAM_DFONT_SELECT_H 26 27 // Qt includes 28 29 #include <QFont> 30 31 // Local includes 32 33 #include "dlayoutbox.h" 34 #include "digikam_export.h" 35 36 namespace Digikam 37 { 38 39 class DIGIKAM_EXPORT DFontSelect : public DHBox 40 { 41 Q_OBJECT 42 43 public: 44 45 enum FontMode 46 { 47 SystemFont=0, 48 CustomFont 49 }; 50 51 public: 52 53 explicit DFontSelect(const QString& text, QWidget* const parent = nullptr); 54 ~DFontSelect() override; 55 56 void setMode(FontMode mode); 57 FontMode mode() const; 58 59 QFont font() const; 60 void setFont(const QFont& font); 61 62 Q_SIGNALS: 63 64 void signalFontChanged(); 65 66 protected: 67 68 bool event(QEvent* e) override; 69 70 private Q_SLOTS: 71 72 void slotOpenFontDialog(); 73 void slotChangeMode(int index); 74 75 private: 76 77 class Private; 78 Private* const d; 79 }; 80 81 } // namespace Digikam 82 83 #endif // DIGIKAM_DFONT_SELECT_H 84