• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • fonts
kfontchooser.h
Go to the documentation of this file.
1/*
2 Requires the Qt widget libraries, available at no cost at
3 http://www.troll.no
4
5 Copyright (C) 1997 Bernd Johannes Wuebben <wuebben@kde.org>
6 Copyright (c) 1999 Preston Brown <pbrown@kde.org>
7 Copyright (c) 1999 Mario Weilguni <mweilguni@kde.org>
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA.
23*/
24#ifndef K_FONT_CHOOSER_H
25#define K_FONT_CHOOSER_H
26
27#include <kdeui_export.h>
28#include <QtGui/QWidget>
29
30class QFont;
31class QStringList;
32
47class KDEUI_EXPORT KFontChooser : public QWidget
48{
49 Q_OBJECT
50 Q_PROPERTY( QFont font READ font WRITE setFont NOTIFY fontSelected USER true )
51 Q_PROPERTY( QColor color READ color WRITE setColor )
52 Q_PROPERTY( QColor backgroundColor READ backgroundColor WRITE setBackgroundColor )
53 Q_PROPERTY( Qt::CheckState sizeIsRelative READ sizeIsRelative WRITE setSizeIsRelative )
54 Q_PROPERTY( QString sampleText READ sampleText WRITE setSampleText )
55
56public:
62 enum FontColumn { FamilyList=0x01, StyleList=0x02, SizeList=0x04};
63
69 enum FontDiff { NoFontDiffFlags = 0,
70 FontDiffFamily = 1,
71 FontDiffStyle = 2,
72 FontDiffSize = 4,
73 AllFontDiffs = FontDiffFamily | FontDiffStyle | FontDiffSize };
74 Q_DECLARE_FLAGS( FontDiffFlags, FontDiff )
75
76
81 enum DisplayFlag { NoDisplayFlags = 0,
82 FixedFontsOnly = 1,
83 DisplayFrame = 2,
84 ShowDifferences = 4 };
85 Q_DECLARE_FLAGS( DisplayFlags, DisplayFlag )
86
87
116 explicit KFontChooser( QWidget *parent = 0L,
117 const DisplayFlags& flags = DisplayFrame,
118 const QStringList &fontList = QStringList(),
119 int visibleListSize = 8,
120 Qt::CheckState *sizeIsRelativeState = 0L );
121
125 virtual ~KFontChooser();
126
138 void enableColumn( int column, bool state );
139
147 void setFont( const QFont &font, bool onlyFixed = false );
148
153 FontDiffFlags fontDiffFlags() const;
154
158 QFont font() const;
159
163 void setColor( const QColor & col );
164
169 QColor color() const;
170
174 void setBackgroundColor( const QColor & col );
175
180 QColor backgroundColor() const;
181
188 void setSizeIsRelative( Qt::CheckState relative );
189
194 Qt::CheckState sizeIsRelative() const;
195
196
200 QString sampleText() const;
201
212 void setSampleText( const QString &text );
213
219 void setSampleBoxVisible( bool visible );
220
232 enum FontListCriteria { FixedWidthFonts=0x01, ScalableFonts=0x02, SmoothScalableFonts=0x04 };
233
241 static void getFontList( QStringList &list, uint fontListCriteria);
242
246 virtual QSize sizeHint( void ) const;
247
248Q_SIGNALS:
252 void fontSelected( const QFont &font );
253
254private:
255 class Private;
256 Private * const d;
257
258 Q_DISABLE_COPY(KFontChooser)
259
260 Q_PRIVATE_SLOT(d, void _k_toggled_checkbox())
261 Q_PRIVATE_SLOT(d, void _k_family_chosen_slot(const QString&))
262 Q_PRIVATE_SLOT(d, void _k_size_chosen_slot(const QString&))
263 Q_PRIVATE_SLOT(d, void _k_style_chosen_slot(const QString&))
264 Q_PRIVATE_SLOT(d, void _k_displaySample(const QFont &font))
265 Q_PRIVATE_SLOT(d, void _k_showXLFDArea(bool))
266 Q_PRIVATE_SLOT(d, void _k_size_value_slot(double))
267};
268
269Q_DECLARE_OPERATORS_FOR_FLAGS( KFontChooser::DisplayFlags )
270
271#endif
KFontChooser
A font selection widget.
Definition kfontchooser.h:48
KFontChooser::FontColumn
FontColumn
Definition kfontchooser.h:62
KFontChooser::FamilyList
@ FamilyList
Definition kfontchooser.h:62
KFontChooser::SizeList
@ SizeList
Definition kfontchooser.h:62
KFontChooser::StyleList
@ StyleList
Definition kfontchooser.h:62
KFontChooser::setColor
void setColor(const QColor &col)
Sets the color to use in the preview.
Definition kfontchooser.cpp:448
KFontChooser::setBackgroundColor
void setBackgroundColor(const QColor &col)
Sets the background color to use in the preview.
Definition kfontchooser.cpp:465
KFontChooser::FontListCriteria
FontListCriteria
The selection criteria for the font families shown in the dialog.
Definition kfontchooser.h:232
KFontChooser::FixedWidthFonts
@ FixedWidthFonts
Definition kfontchooser.h:232
KFontChooser::ScalableFonts
@ ScalableFonts
Definition kfontchooser.h:232
KFontChooser::SmoothScalableFonts
@ SmoothScalableFonts
Definition kfontchooser.h:232
KFontChooser::DisplayFlag
DisplayFlag
Definition kfontchooser.h:81
KFontChooser::DisplayFrame
@ DisplayFrame
Definition kfontchooser.h:83
KFontChooser::ShowDifferences
@ ShowDifferences
Definition kfontchooser.h:84
KFontChooser::FixedFontsOnly
@ FixedFontsOnly
Definition kfontchooser.h:82
KFontChooser::NoDisplayFlags
@ NoDisplayFlags
Definition kfontchooser.h:81
KFontChooser::fontSelected
void fontSelected(const QFont &font)
Emitted whenever the selected font changes.
KFontChooser::setSampleText
void setSampleText(const QString &text)
Sets the sample text.
Definition kfontchooser.cpp:501
KFontChooser::setSizeIsRelative
void setSizeIsRelative(Qt::CheckState relative)
Sets the state of the checkbox indicating whether the font size is to be interpreted as relative size...
Definition kfontchooser.cpp:478
KFontChooser::sampleText
QString sampleText
Definition kfontchooser.h:54
KFontChooser::color
QColor color
Definition kfontchooser.h:51
KFontChooser::backgroundColor
QColor backgroundColor
Definition kfontchooser.h:52
KFontChooser::setFont
void setFont(const QFont &font, bool onlyFixed=false)
Sets the currently selected font in the chooser.
Definition kfontchooser.cpp:535
KFontChooser::sizeIsRelative
Qt::CheckState sizeIsRelative
Definition kfontchooser.h:53
KFontChooser::FontDiff
FontDiff
Definition kfontchooser.h:69
KFontChooser::NoFontDiffFlags
@ NoFontDiffFlags
Definition kfontchooser.h:69
KFontChooser::FontDiffFamily
@ FontDiffFamily
Definition kfontchooser.h:70
KFontChooser::FontDiffStyle
@ FontDiffStyle
Definition kfontchooser.h:71
KFontChooser::AllFontDiffs
@ AllFontDiffs
Definition kfontchooser.h:73
KFontChooser::FontDiffSize
@ FontDiffSize
Definition kfontchooser.h:72
KFontChooser::KFontChooser
KFontChooser(QWidget *parent=0L, const DisplayFlags &flags=DisplayFrame, const QStringList &fontList=QStringList(), int visibleListSize=8, Qt::CheckState *sizeIsRelativeState=0L)
Constructs a font picker widget.
Definition kfontchooser.cpp:156
KFontChooser::font
QFont font
Definition kfontchooser.h:50
QWidget
kdeui_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 2025 00:00:00 by doxygen 1.14.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal