24#include <private/qfontdatabase_p.h>
25#include <private/qdialog_p.h>
26#include <private/qfont_p.h>
144 q->setSizeGripEnabled(
true);
145 q->setWindowTitle(QFontDialog::tr(
"Select Font"));
154#ifndef QT_NO_SHORTCUT
165#ifndef QT_NO_SHORTCUT
177#ifndef QT_NO_SHORTCUT
203#ifndef QT_NO_SHORTCUT
223 if (writingSystemName.
isEmpty())
332 FontDialogOptions options)
364 const QString &
title, QFontDialog::FontDialogOptions options)
394 if (
o ==
d->sizeEdit &&
400 int ci =
d->sizeList->currentItem();
403 if (ci !=
d->sizeList->currentItem()
405 d->sizeEdit->selectAll();
407 }
else if ((
o ==
d->familyList ||
o ==
d->styleList) &&
415 if (
o ==
d->familyList)
416 d->familyEdit->selectAll();
417 else if (
o ==
d->styleList)
418 d->styleEdit->selectAll();
419 else if (
o ==
d->sizeList)
420 d->sizeEdit->selectAll();
422 d->sizeEdit->setFocus();
432 fontDialogHelper->setCurrentFont(
q->currentFont());
451 enum match_t { MATCH_NONE = 0, MATCH_LAST_RESORT = 1, MATCH_APP = 2, MATCH_FAMILY = 3 };
463 if ((
options & scalableMask) && (
options & scalableMask) != scalableMask) {
467 if ((
options & spacingMask) && (
options & spacingMask) != spacingMask) {
476 QString foundryName1, familyName1, foundryName2, familyName2;
477 int bestFamilyMatch = -1;
478 match_t bestFamilyType = MATCH_NONE;
485 QStringList::const_iterator
it = familyNames.constBegin();
487 for(;
it != familyNames.constEnd(); ++
it, ++
i) {
491 if (familyName1 == familyName2) {
492 bestFamilyType = MATCH_FAMILY;
493 if (foundryName1 == foundryName2) {
497 if (bestFamilyMatch < MATCH_FAMILY)
502 match_t
type = MATCH_NONE;
503 if (bestFamilyType <= MATCH_NONE && familyName2 ==
QStringLiteral(
"helvetica"))
504 type = MATCH_LAST_RESORT;
505 if (bestFamilyType <= MATCH_LAST_RESORT && familyName2 ==
f.families().
first())
508 if (
type != MATCH_NONE) {
509 bestFamilyType =
type;
514 if (
i != -1 && bestFamilyType != MATCH_NONE)
536 if (styles.isEmpty()) {
553 if (!found &&
first) {
555 cstyle.
replace(
"Italic"_L1,
"Oblique"_L1);
558 }
else if (cstyle.
contains(
"Oblique"_L1)) {
559 cstyle.
replace(
"Oblique"_L1,
"Italic"_L1);
562 }
else if (cstyle.
contains(
"Regular"_L1)) {
563 cstyle.
replace(
"Regular"_L1,
"Normal"_L1);
566 }
else if (cstyle.
contains(
"Normal"_L1)) {
567 cstyle.
replace(
"Normal"_L1,
"Regular"_L1);
605 str_sizes.reserve(
sizes.size());
608 if (current == -1 && *
it ==
size)
647 emit q->currentFontChanged(newFont);
722 int size =
s.toInt();
723 if (this->size ==
size)
761 d->retranslateStrings();
788 d->size =
fi.pointSize();
794 if (
d->nativeDialogInUse) {
796 helper->setCurrentFont(
font);
811 if (
d->nativeDialogInUse) {
813 return helper->currentFont();
815 return d->sampleEdit->font();
829 return d->selectedFont;
865 const QFontDialog::FontDialogOptions previousOptions =
options();
866 if (!(previousOptions &
option) != !on)
902 d->options->setOptions(QFontDialogOptions::FontDialogOptions(
int(
options)));
909 return QFontDialog::FontDialogOptions(
int(
d->options->options()));
924 d->receiverToDisconnectOnClose = receiver;
925 d->memberToDisconnectOnClose = member;
966 if (
d->canBeNativeDialog())
968 if (
d->nativeDialogInUse) {
996 d->selectedFont =
QFont();
997 if (
d->receiverToDisconnectOnClose) {
999 d->receiverToDisconnectOnClose,
d->memberToDisconnectOnClose);
1000 d->receiverToDisconnectOnClose =
nullptr;
1002 d->memberToDisconnectOnClose.clear();
1019 return strcmp(QFontDialog::staticMetaObject.
className(),
q->metaObject()->className()) == 0;
1024#include "qfontdialog.moc"
1025#include "moc_qfontdialog.cpp"
void setEditTriggers(EditTriggers triggers)
QAbstractItemModel * model() const
Returns the model that this view is presenting.
void setCurrentIndex(const QModelIndex &index)
Sets the current item to be the item at index.
QModelIndex currentIndex() const
Returns the model index of the current item.
virtual void setModel(QAbstractItemModel *model)
Sets the model for the view to present.
virtual void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
This slot is called when a new item becomes the current item.
void clearSelection()
Deselects all selected items.
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=Qt::Alignment())
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment 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())
Adds an item to the combobox with the given text, and containing the specified userData (stored in th...
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
The QDialog class is the base class of dialog windows.
bool eventFilter(QObject *, QEvent *) override
\reimp
virtual int exec()
Shows the dialog as a \l{QDialog::Modal Dialogs}{modal dialog}, blocking until the user closes it.
virtual void done(int)
Closes the dialog and sets its result code to r.
virtual void accept()
Hides the modal dialog and sets the result code to Accepted.
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
static void parseFontName(const QString &name, QString &foundry, QString &family)
\threadsafe \inmodule QtGui
static QString writingSystemName(WritingSystem writingSystem)
Returns the names the writingSystem (e.g.
WritingSystem
\value Any \value Latin \value Greek \value Cyrillic \value Armenian \value Hebrew \value Arabic \val...
static bool isSmoothlyScalable(const QString &family, const QString &style=QString())
Returns true if the font that has family family and style style is smoothly scalable; otherwise retur...
static bool isPrivateFamily(const QString &family)
static QString styleString(const QFont &font)
Returns a string that describes the style of the font.
static QFont font(const QString &family, const QString &style, int pointSize)
Returns a QFont object that has family family, style style and point size pointSize.
static QString writingSystemSample(WritingSystem writingSystem)
Returns a string with sample characters from writingSystem.
static QStringList families(WritingSystem writingSystem=Any)
Returns a sorted list of the available font families which support the writingSystem.
static QList< int > pointSizes(const QString &family, const QString &style=QString())
Returns a list of the point sizes available for the font that has family family and style styleName.
static QStringList styles(const QString &family)
Returns a list of the styles available for the font family family.
static bool isFixedPitch(const QString &family, const QString &style=QString())
Returns true if the font that has family family and style style is fixed pitch; otherwise returns fal...
void setWindowTitle(const QString &)
FontDialogOptions options() const
virtual void initHelper(QPlatformDialogHelper *) override
QFontListView * familyList
void updateSampleFont(const QFont &newFont)
void retranslateStrings()
void _q_sizeHighlighted(int)
void _q_writingSystemHighlighted(int)
bool canBeNativeDialog() const override
virtual void helperPrepareShow(QPlatformDialogHelper *) 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
QFontDialog(QWidget *parent=nullptr)
void fontSelected(const QFont &font)
void setOption(FontDialogOption option, bool on=true)
Sets the given option to be enabled if on is true; otherwise, clears the given option.
void setOptions(FontDialogOptions options)
FontDialogOptions options
the various options that affect the look and feel of the dialog
bool testOption(FontDialogOption option) const
Returns true if the given option is enabled; otherwise, returns false.
QFont selectedFont() const
Returns the font that the user selected by clicking the \uicontrol{OK} or equivalent button.
QFont currentFont
the current font of the dialog.
bool eventFilter(QObject *object, QEvent *event) override
void changeEvent(QEvent *event) override
\reimp
static QFont getFont(bool *ok, QWidget *parent=nullptr)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void currentFontChanged(const QFont &font)
void setCurrentFont(const QFont &font)
QStringListModel * model() const
QFontListView(QWidget *parent)
void setCurrentItem(int item)
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override
This slot is called when a new item becomes the current item.
QString currentText() const
QString text(int i) const
void setStrikeOut(bool)
If enable is true, sets strikeout on; otherwise sets strikeout off.
bool strikeOut() const
Returns true if strikeout has been set; otherwise returns false.
bool underline() const
Returns true if underline has been set; otherwise returns false.
QStringList families() const
int pointSize() const
Returns the point size of the font.
void setUnderline(bool)
If enable is true, sets underline on; otherwise sets underline off.
The QGridLayout class lays out widgets in a grid.
void addWidget(QWidget *w)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setRowMinimumHeight(int row, int minSize)
Sets the minimum height of row row to minSize pixels.
void setColumnMinimumWidth(int column, int minSize)
Sets the minimum width of column column to minSize pixels.
void setSpacing(int spacing) override
This function sets both the vertical and horizontal spacing to spacing.
int spacing() const override
If the vertical spacing is equal to the horizontal spacing, this function returns that value; otherwi...
void setColumnStretch(int column, int stretch)
Sets the stretch factor of column column to 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.
int key() const
Returns the code of the key that was pressed or released.
The QLabel widget provides a text or image display.
void setBuddy(QWidget *)
Sets this label's buddy to buddy.
void setText(const QString &)
void getContentsMargins(int *left, int *top, int *right, int *bottom) const
The QLineEdit widget is a one-line text editor.
void setValidator(const QValidator *)
Sets the validator for values of line edit to v.
void setAlignment(Qt::Alignment flag)
void selectAll()
Selects all the text (i.e.
void clear()
Clears the contents of the line edit.
void setText(const QString &)
QString text
the line edit's text.
The QListView class provides a list or icon view onto a model.
constexpr int row() const noexcept
Returns the row this model index refers to.
constexpr bool isValid() const noexcept
Returns {true} if this model index is valid; otherwise returns {false}.
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Q_WEAK_OVERLOAD void setObjectName(const QString &name)
Sets the object's name to name.
const_iterator constBegin() const noexcept
const_iterator constEnd() const noexcept
Exception-safe wrapper around QObject::blockSignals().
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
QStringList stringList() const
Returns the string list used by the model to store data.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows in the model.
void setStringList(const QStringList &strings)
Sets the model's internal string list to strings.
\macro QT_RESTRICTED_CAST_FROM_ASCII
int toInt(bool *ok=nullptr, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
QString & replace(qsizetype i, qsizetype len, QChar after)
QString first(qsizetype n) const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
@ SH_FontDialog_SelectAssociatedText
The QVBoxLayout class lines up widgets vertically.
void textChanged(const QString &newText)
QSet< QString >::iterator it
Combined button and popup list for selecting options.
@ WA_WState_ExplicitShowHide
@ AA_DontUseNativeDialogs
static const Qt::WindowFlags qfd_DefaultWindowFlags
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)
static QT_BEGIN_NAMESPACE QString windowTitle(HWND hwnd)
const char className[16]
[1]
QFileInfo fi("c:/temp/foo")
[newstuff]
myObject disconnect()
[26]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent