44 #ifndef QT_NO_FONTCOMBOBOX 52 #include <private/qcombobox_p.h> 72 if (writingSystems.
count())
73 system = writingSystems.
last();
82 system = writingSystems.
at(0);
86 if (writingSystems.
count() <= 2
89 system = writingSystems.
last();
93 if (writingSystems.
count() <= 5
96 system = writingSystems.
last();
220 void _q_updateModel();
221 void _q_currentChanged(
const QString &);
246 for (
int i = 0; i < list.
size(); ++i) {
247 if ((
filters & scalableMask) && (
filters & scalableMask) != scalableMask) {
251 if ((
filters & spacingMask) && (
filters & spacingMask) != spacingMask) {
255 result += list.
at(i);
257 offset = result.
count() - 1;
270 if (currentFont !=
QFont()) {
271 currentFont =
QFont();
272 emit q->currentFontChanged(currentFont);
275 q->setCurrentIndex(offset);
283 if (currentFont.family() !=
text) {
284 currentFont.setFamily(text);
285 emit q->currentFontChanged(currentFont);
339 d->currentFont =
font();
354 this,
SLOT(_q_updateModel()));
447 return d->currentFont;
453 if (font !=
d->currentFont) {
454 d->currentFont =
font;
456 if (
d->currentFont == font) {
500 #include "qfontcombobox.moc" 501 #include "moc_qfontcombobox.cpp" 503 #endif // QT_NO_FONTCOMBOBOX The QPainter class performs low-level painting on widgets and other paint devices.
void currentFontChanged(const QFont &f)
This signal is emitted whenever the current font changes, with the new font.
void setPointSize(int)
Sets the point size to pointSize.
bool event(QEvent *event)
Reimplemented Function
const QBrush & highlight() const
Returns the highlight brush of the current color group.
The QAbstractItemDelegate class is used to display and edit data items from a model.
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
bool blockSignals(bool b)
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke...
QFontComboBox(QWidget *parent=0)
Constructs a font combobox with the given parent.
QFont font
the font used for the item
The QFontMetrics class provides font metrics information.
void setItemDelegate(QAbstractItemDelegate *delegate)
Sets the item delegate for the popup list view.
#define QT_END_NAMESPACE
This macro expands to.
QFontFamilyDelegate(QObject *parent)
bool event(QEvent *e)
Reimplemented Function
qreal ascent() const
Returns the ascent of the font.
QVariant data(int role=Qt::DisplayRole) const
Returns the data for the given role for the item referred to by the index.
QStyle::State state
the style flags that are used when drawing the control
void restore()
Restores the current painter state (pops a saved state off the stack).
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
This pure abstract function must be reimplemented if you want to provide custom rendering.
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
int left() const
Returns the x-coordinate of the rectangle's left edge.
QSize sizeHint() const
Reimplemented Function
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
QRectF tightBoundingRect(const QString &text) const
Returns a tight bounding rectangle around the characters in the string specified by text...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void currentIndexChanged(int index)
This signal is sent whenever the currentIndex in the combobox changes either through user interaction...
int count(const T &t) const
Returns the number of occurrences of value in the list.
The QFontComboBox widget is a combobox that lets the user select a font family.
static QFontDatabase::WritingSystem writingSystemForFont(const QFont &font, bool *hasLatin)
QList< WritingSystem > writingSystems() const
Returns a sorted list of the available writing systems.
void setCurrentFont(const QFont &f)
int height() const
Returns the height of the rectangle.
The QString class provides a Unicode character string.
QAbstractItemDelegate * itemDelegate() const
Returns the item delegate used by this view and model.
T * qobject_cast(QObject *object)
The QStringListModel class provides a model that supplies strings to views.
The QObject class is the base class of all Qt objects.
FontFilters fontFilters() const
The QPen class defines how a QPainter should draw lines and outlines of shapes.
void setFontFilters(FontFilters filters)
void setUniformItemSizes(bool enable)
void save()
Saves the current painter state (pushes the state onto a stack).
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
void setFamily(const QString &)
Sets the family name of the font.
void setWidth(int w)
Sets the width to the given width.
int width() const
Returns the width.
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
#define QT_BEGIN_NAMESPACE
This macro expands to.
QFontMetrics fontMetrics() const
Returns the font metrics for the painter if the painter is active.
The QRectF class defines a rectangle in the plane using floating point precision. ...
~QFontComboBox()
Destroys the combobox.
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
The QFontDatabase class provides information about the fonts available in the underlying window syste...
QStringList families(WritingSystem writingSystem=Any) const
Returns a sorted list of the available font families which support the writingSystem.
void setStringList(const QStringList &strings)
Sets the model's internal string list to strings.
void setEditable(bool editable)
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
const QFont & font() const
Returns the currently set font used for drawing text.
qreal height() const
Returns the height of the rectangle.
QSize size() const
Returns the size of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
The QComboBox widget is a combined button and popup list.
void setWritingSystem(QFontDatabase::WritingSystem)
QFont currentFont() const
The QFontInfo class provides general information about fonts.
Q_CORE_EXPORT int QT_FASTCALL script(uint ucs4)
static QString writingSystemSample(WritingSystem writingSystem)
Returns a string with sample characters from writingSystem.
QPalette palette
the palette that should be used when painting the control
QFontDatabase::WritingSystem writingSystem
static const char *const filters[3]
QSize sizeHint() const
This implementation caches the size hint to avoid resizing when the contents change dynamically...
#define Q_DECLARE_PUBLIC(Class)
The QListView class provides a list or icon view onto a model.
int right() const
Returns the x-coordinate of the rectangle's right edge.
void setModel(QAbstractItemModel *model)
Sets the model to be model.
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
The QFont class specifies a font used for drawing text.
int y() const
Returns the y-coordinate of the rectangle's top edge.
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
QString family() const
Returns the requested font family name, i.e.
QSize actualSize(const QSize &size, Mode mode=Normal, State state=Off) const
Returns the actual size of the icon for the requested size, mode, and state.
QAbstractItemView * view() const
Returns the list view used for the combobox popup.
int x() const
Returns the x-coordinate of the rectangle's left edge.
QObject * parent() const
Returns a pointer to the parent object.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
T & last()
Returns a reference to the last item in the list.
The QModelIndex class is used to locate data in a data model.
int size() const
Returns the number of items in the list.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
void _q_currentChanged(const QString &)
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
The QRect class defines a rectangle in the plane using integer precision.
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
bool isFixedPitch(const QString &family, const QString &style=QString()) const
Returns true if the font that has family family and style style is fixed pitch; otherwise returns fal...
The QFontMetricsF class provides font metrics information.
The QSize class defines the size of a two-dimensional object using integer point precision.
void setFont(const QFont &f)
Sets the painter's font to the given font.
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
This pure abstract function must be reimplemented if you want to provide custom rendering.
The QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widg...
int height() const
Returns the height of the font.
bool isSmoothlyScalable(const QString &family, const QString &style=QString()) const
Returns true if the font that has family family and style style is smoothly scalable; otherwise retur...
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QRect rect
the area that should be used for various calculations and painting
static float pointSize(const QFontDef &fd, int dpi)
QFontDatabase::WritingSystem writingSystem() const
void paint(QPainter *painter, const QRect &rect, Qt::Alignment alignment=Qt::AlignCenter, Mode mode=Normal, State state=Off) const
Uses the painter to paint the icon with specified alignment, required mode, and state into the rectan...
QString family() const
Returns the family name of the matched window system font.
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
QFontComboBox::FontFilters filters
The QIcon class provides scalable icons in different modes and states.