60 #include <private/qfontdatabase_p.h>
61 #include <private/qdialog_p.h>
62 #include <private/qfont_p.h>
106 static const Qt::WindowFlags DefaultWindowFlags =
178 q->setSizeGripEnabled(
true);
188 #ifndef QT_NO_SHORTCUT
199 #ifndef QT_NO_SHORTCUT
211 #ifndef QT_NO_SHORTCUT
237 #ifndef QT_NO_SHORTCUT
257 if (writingSystemName.
isEmpty())
366 FontDialogOptions options)
398 const QString &
title, QFontDialog::FontDialogOptions options)
428 if (
o ==
d->sizeEdit &&
434 int ci =
d->sizeList->currentItem();
437 if (ci !=
d->sizeList->currentItem()
439 d->sizeEdit->selectAll();
441 }
else if ((
o ==
d->familyList ||
o ==
d->styleList) &&
449 if (
o ==
d->familyList)
450 d->familyEdit->selectAll();
451 else if (
o ==
d->styleList)
452 d->styleEdit->selectAll();
453 else if (
o ==
d->sizeList)
454 d->sizeEdit->selectAll();
456 d->sizeEdit->setFocus();
483 enum match_t { MATCH_NONE = 0, MATCH_LAST_RESORT = 1, MATCH_APP = 2, MATCH_FAMILY = 3 };
495 if ((
options & scalableMask) && (
options & scalableMask) != scalableMask) {
499 if ((
options & spacingMask) && (
options & spacingMask) != spacingMask) {
508 QString foundryName1, familyName1, foundryName2, familyName2;
509 int bestFamilyMatch = -1;
510 match_t bestFamilyType = MATCH_NONE;
519 for(;
it != familyNames.constEnd(); ++
it, ++
i) {
523 if (familyName1 == familyName2) {
524 bestFamilyType = MATCH_FAMILY;
525 if (foundryName1 == foundryName2) {
529 if (bestFamilyMatch < MATCH_FAMILY)
534 match_t
type = MATCH_NONE;
535 if (bestFamilyType <= MATCH_NONE && familyName2 ==
QStringLiteral(
"helvetica"))
536 type = MATCH_LAST_RESORT;
537 if (bestFamilyType <= MATCH_LAST_RESORT && familyName2 ==
f.families().
first())
540 if (
type != MATCH_NONE) {
541 bestFamilyType =
type;
546 if (
i != -1 && bestFamilyType != MATCH_NONE)
568 if (styles.isEmpty()) {
585 if (!found &&
first) {
637 str_sizes.reserve(
sizes.size());
640 if (current == -1 && *
it ==
size)
679 emit q->currentFontChanged(newFont);
754 int size =
s.toInt();
755 if (this->size ==
size)
793 d->retranslateStrings();
820 d->size =
fi.pointSize();
840 return helper->currentFont();
841 return d->sampleEdit->font();
855 return d->selectedFont;
891 const QFontDialog::FontDialogOptions previousOptions =
options();
892 if (!(previousOptions &
option) != !on)
928 d->options->setOptions(QFontDialogOptions::FontDialogOptions(
int(
options)));
935 return QFontDialog::FontDialogOptions(
int(
d->options->options()));
950 d->receiverToDisconnectOnClose = receiver;
951 d->memberToDisconnectOnClose = member;
992 if (
d->canBeNativeDialog())
994 if (
d->nativeDialogInUse) {
999 d->nativeDialogInUse =
false;
1023 d->selectedFont =
QFont();
1024 if (
d->receiverToDisconnectOnClose) {
1026 d->receiverToDisconnectOnClose,
d->memberToDisconnectOnClose);
1027 d->receiverToDisconnectOnClose =
nullptr;
1029 d->memberToDisconnectOnClose.clear();
1048 return (staticName == dynamicName);
1053 #include "qfontdialog.moc"
1054 #include "moc_qfontdialog.cpp"
small capitals from c petite p scientific i
[1]
void setEditTriggers(EditTriggers triggers)
QAbstractItemModel * model() const
void setCurrentIndex(const QModelIndex &index)
QModelIndex currentIndex() const
virtual void setModel(QAbstractItemModel *model)
The QAbstractListModel class provides an abstract model that can be subclassed to create one-dimensio...
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=Qt::Alignment())
The QCheckBox widget provides a checkbox with a text label.
The QComboBox widget is a combined button and popup list.
void addItem(const QString &text, const QVariant &userData=QVariant())
static bool sendEvent(QObject *receiver, QEvent *event)
static bool testAttribute(Qt::ApplicationAttribute attribute)
The QDialog class is the base class of dialog windows.
bool eventFilter(QObject *, QEvent *) override
void setVisible(bool visible) override
The QEvent class is the base class of all event classes. Event objects contain event parameters.
The QFontDatabase class provides information about the fonts available in the underlying window syste...
static QString writingSystemName(WritingSystem writingSystem)
static bool isSmoothlyScalable(const QString &family, const QString &style=QString())
static bool isPrivateFamily(const QString &family)
static QString styleString(const QFont &font)
static QFont font(const QString &family, const QString &style, int pointSize)
static QString writingSystemSample(WritingSystem writingSystem)
static QStringList families(WritingSystem writingSystem=Any)
static QList< int > pointSizes(const QString &family, const QString &style=QString())
static QStringList styles(const QString &family)
static bool isFixedPitch(const QString &family, const QString &style=QString())
static void parseFontName(const QString &name, QString &foundry, QString &family)
The QFontDialog class provides a dialog widget for selecting a font.
QFontDialog(QWidget *parent=nullptr)
void fontSelected(const QFont &font)
void setOption(FontDialogOption option, bool on=true)
void setVisible(bool visible) override
void setOptions(FontDialogOptions options)
FontDialogOptions options
the various options that affect the look and feel of the dialog
bool testOption(FontDialogOption option) const
QFont selectedFont() const
QFont currentFont
the current font of the dialog.
bool eventFilter(QObject *object, QEvent *event) override
void changeEvent(QEvent *event) override
static QFont getFont(bool *ok, QWidget *parent=nullptr)
void done(int result) override
void currentFontChanged(const QFont &font)
void setCurrentFont(const QFont &font)
void setWindowTitle(const QString &)
FontDialogOptions options() const
QFontListView * familyList
void updateSampleFont(const QFont &newFont)
void retranslateStrings()
void _q_sizeHighlighted(int)
void _q_writingSystemHighlighted(int)
bool canBeNativeDialog() const override
void _q_sizeChanged(const QString &)
QLabel * writingSystemAccel
void _q_styleHighlighted(int)
QSharedPointer< QFontDialogOptions > options
static QFont getFont(bool *ok, const QFont &initial, QWidget *parent, const QString &title, QFontDialog::FontDialogOptions options)
void _q_familyHighlighted(int)
QComboBox * writingSystemCombo
QDialogButtonBox * buttonBox
QFontListView * styleList
QFontDatabase::WritingSystem writingSystem
The QFont class specifies a query for a font used for drawing text.
QStringList families() const
The QFontInfo class provides general information about fonts. \inmodule QtGui.
QFontListView(QWidget *parent)
void setCurrentItem(int item)
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override
QStringListModel * model() const
QString currentText() const
QString text(int i) const
The QGridLayout class lays out widgets in a grid.
void addWidget(QWidget *w)
void setRowMinimumHeight(int row, int minSize)
void setColumnMinimumWidth(int column, int minSize)
void setSpacing(int spacing) override
int spacing() const override
void setColumnStretch(int column, int stretch)
The QGroupBox widget provides a group box frame with a title.
void setTitle(const QString &title)
The QHBoxLayout class lines up widgets horizontally.
The QIntValidator class provides a validator that ensures a string contains a valid integer within a ...
The QKeyEvent class describes a key event.
The QLabel widget provides a text or image display.
void setText(const QString &)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
void getContentsMargins(int *left, int *top, int *right, int *bottom) const
The QLineEdit widget is a one-line text editor.
void setValidator(const QValidator *)
void setAlignment(Qt::Alignment flag)
void setText(const QString &)
QString text
the line edit's text.
The QListView class provides a list or icon view onto a model.
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override
The QModelIndex class is used to locate data in a data model.
constexpr int row() const noexcept
constexpr bool isValid() const noexcept
The QObject class is the base class of all Qt objects.
void installEventFilter(QObject *filterObj)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
void setObjectName(const QString &name)
Exception-safe wrapper around QObject::blockSignals().
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
The QString class provides a Unicode character string.
int toInt(bool *ok=nullptr, int base=10) const
QString & replace(qsizetype i, qsizetype len, QChar after)
QString first(qsizetype n) const
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString number(int, int base=10)
The QStringList class provides a list of strings.
The QStringListModel class provides a model that supplies strings to views.
QStringList stringList() const
int rowCount(const QModelIndex &parent=QModelIndex()) const override
void setStringList(const QStringList &strings)
@ SH_FontDialog_SelectAssociatedText
The QVBoxLayout class lines up widgets vertically.
void textChanged(const QString &newText)
typename C::const_iterator const_iterator
@ WA_WState_ExplicitShowHide
@ AA_DontUseNativeDialogs
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLfloat GLfloat GLfloat GLfloat h
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
GLdouble GLdouble GLdouble GLdouble q
GLenum GLenum GLsizei void * row
#define QStringLiteral(str)
const char className[16]
[1]
QFileInfo fi("c:/temp/foo")
[newstuff]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent