Qt 4.8
Public Functions | Static Public Functions | Public Variables | Static Public Variables | List of all members
QFontDialogPrivate Class Reference

#include <qfontdialog_p.h>

Inheritance diagram for QFontDialogPrivate:
QDialogPrivate QWidgetPrivate QObjectPrivate QObjectData

Public Functions

void _q_familyHighlighted (int)
 
void _q_macRunNativeAppModalPanel ()
 
void _q_sizeChanged (const QString &)
 This slot is called if the user changes the font size. More...
 
void _q_sizeHighlighted (int)
 
void _q_styleHighlighted (int)
 
void _q_updateSample ()
 
void _q_writingSystemHighlighted (int)
 
bool canBeNativeDialog ()
 
void closeCocoaFontPanel ()
 
void createNSFontPanelDelegate ()
 
void done (int result)
 
QFontDialogfontDialog ()
 
bool hideCocoaFontPanel ()
 
void init ()
 
void mac_nativeDialogModalHelp ()
 
 QFontDialogPrivate ()
 
void retranslateStrings ()
 
bool setVisible_sys (bool visible)
 
bool showCocoaFontPanel ()
 
void updateFamilies ()
 
void updateSampleFont (const QFont &newFont)
 
void updateSizes ()
 Updates the contents of the "font size" list box. More...
 
void updateStyles ()
 
- Public Functions inherited from QDialogPrivate
void hideDefault ()
 Hides the default button indicator. More...
 
 QDialogPrivate ()
 
void resetModalitySetByOpen ()
 
void setDefault (QPushButton *)
 This function is called by the push button pushButton when it becomes the default button. More...
 
void setMainDefault (QPushButton *)
 This function sets the default default push button to pushButton. More...
 
- Public Functions inherited from QWidgetPrivate
void _q_showIfNotHidden ()
 
virtual void aboutToDestroy ()
 
void activateChildLayoutsRecursively ()
 
QSize adjustedSize () const
 
void adjustQuitOnCloseAttribute ()
 
QInputContextassignedInputContext () const
 
QPainterbeginSharedPainter ()
 
QWidgetchildAt_helper (const QPoint &, bool) const
 
QWidgetchildAtRecursiveHelper (const QPoint &p, bool, bool includeFrame=false) const
 
QRect clipRect () const
 
QRegion clipRegion () const
 
void clipToEffectiveMask (QRegion &region) const
 
bool close_helper (CloseMode mode)
 
void create_sys (WId window, bool initializeWindow, bool destroyOldWindow)
 
QWindowSurfacecreateDefaultWindowSurface ()
 
QWindowSurfacecreateDefaultWindowSurface_sys ()
 
void createExtra ()
 Creates the widget extra data. More...
 
void createRecursively ()
 
void createSysExtra ()
 
void createTLExtra ()
 
void createTLSysExtra ()
 
void createWinId (WId id=0)
 
void deactivateWidgetCleanup ()
 
void deleteExtra ()
 Deletes the widget extra data. More...
 
void deleteSysExtra ()
 
void deleteTLSysExtra ()
 
void drawWidget (QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter=0, QWidgetBackingStore *backingStore=0)
 
QWidgeteffectiveFocusWidget ()
 
QRect effectiveRectFor (const QRect &rect) const
 
bool endSharedPainter ()
 
void enforceNativeChildren ()
 
QWExtraextraData () const
 
QRect frameStrut () const
 
void getLayoutItemMargins (int *left, int *top, int *right, int *bottom) const
 
const QRegiongetOpaqueChildren () const
 
void handleSoftwareInputPanel (Qt::MouseButton button, bool clickCausedFocus)
 
virtual bool hasHeightForWidth () const
 
void hide_helper ()
 
void hide_sys ()
 Platform-specific part of QWidget::hide(). More...
 
void hideChildren (bool spontaneous)
 
void inheritStyle ()
 
void init (QWidget *desktopWidget, Qt::WindowFlags f)
 
QInputContextinputContext () const
 
void invalidateBuffer (const QRegion &)
 Invalidates the rgn (in widget's coordinates) of the backing store, i.e. More...
 
void invalidateBuffer (const QRect &)
 This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but is more efficient as it eliminates QRegion operations/allocations and can use the rect more precisely for additional cut-offs. More...
 
void invalidateBuffer_resizeHelper (const QPoint &oldPos, const QSize &oldSize)
 Invalidates the buffer when the widget is resized. More...
 
void invalidateGraphicsEffectsRecursively ()
 
bool isAboutToShow () const
 
bool isBackgroundInherited () const
 
bool isOverlapped (const QRect &) const
 
void lower_sys ()
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QWidgetBackingStoremaybeBackingStore () const
 
QTLWExtramaybeTopData () const
 
void moveRect (const QRect &, int dx, int dy)
 
bool nativeChildrenForced () const
 
QFont naturalWidgetFont (uint inheritedMask) const
 
QPalette naturalWidgetPalette (uint inheritedMask) const
 Returns the palette that the widget w inherits from its ancestors and QApplication::palette. More...
 
void paintBackground (QPainter *, const QRegion &, int flags=DrawAsRoot) const
 
bool paintOnScreen () const
 
void paintSiblingsRecursive (QPaintDevice *pdev, const QObjectList &children, int index, const QRegion &rgn, const QPoint &offset, int flags, QPainter *sharedPainter, QWidgetBackingStore *backingStore)
 
bool pointInsideRectAndMask (const QPoint &) const
 
QRegion prepareToRender (const QRegion &region, QWidget::RenderFlags renderFlags)
 
void propagatePaletteChange ()
 Propagate this widget's palette to all children, except style sheet widgets, and windows that don't enable window propagation (palettes don't normally propagate to windows). More...
 
 QWidgetPrivate (int version=QObjectPrivateVersion)
 
void raise_sys ()
 
QPaintDeviceredirected (QPoint *offset) const
 
void registerDropSite (bool)
 
void render (QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags, bool readyToRender)
 
void render_helper (QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
 
void repaint_sys (const QRegion &rgn)
 
void reparentFocusWidgets (QWidget *oldtlw)
 
void resolveFont ()
 Determine which font is implicitly imposed on this widget by its ancestors and QApplication::font, resolve this against its own font (attributes from the implicit font are copied over). More...
 
void resolveLayoutDirection ()
 
void resolveLocale ()
 
void resolvePalette ()
 Determine which palette is inherited from this widget's ancestors and QApplication::palette, resolve this against this widget's palette (attributes from the inherited palette are copied over this widget's palette). More...
 
void restoreRedirected ()
 
void scroll_sys (int dx, int dy)
 
void scroll_sys (int dx, int dy, const QRect &r)
 
void scrollChildren (int dx, int dy)
 
void scrollRect (const QRect &, int dx, int dy)
 
void sendPendingMoveAndResizeEvents (bool recursive=false, bool disableUpdates=false)
 
void sendStartupMessage (const char *message) const
 Platform-specific part of QWidget::show(). More...
 
void setConstraints_sys ()
 
void setCursor_sys (const QCursor &cursor)
 
void setDirtyOpaqueRegion ()
 
void setEnabled_helper (bool)
 
void setFocus_sys ()
 
void setFont_helper (const QFont &font)
 
void setGeometry_sys (int, int, int, int, bool)
 
void setLayoutDirection_helper (Qt::LayoutDirection)
 
void setLayoutItemMargins (int left, int top, int right, int bottom)
 
void setLayoutItemMargins (QStyle::SubElement element, const QStyleOption *opt=0)
 
void setLocale_helper (const QLocale &l, bool forceUpdate=false)
 
void setMask_sys (const QRegion &)
 
bool setMaximumSize_helper (int &maxw, int &maxh)
 
bool setMinimumSize_helper (int &minw, int &minh)
 
void setModal_sys ()
 
void setNetWmWindowTypes ()
 
void setOpaque (bool opaque)
 
void setPalette_helper (const QPalette &)
 
void setParent_sys (QWidget *parent, Qt::WindowFlags)
 
void setRedirected (QPaintDevice *replacement, const QPoint &offset)
 
void setSharedPainter (QPainter *painter)
 
void setStyle_helper (QStyle *newStyle, bool propagate, bool metalHack=false)
 
void setUpdatesEnabled_helper (bool)
 
void setWindowFilePath_helper (const QString &filePath)
 
void setWindowIcon_helper ()
 
void setWindowIcon_sys (bool forceReset=false)
 
void setWindowIconText_helper (const QString &cap)
 
void setWindowIconText_sys (const QString &cap)
 
void setWindowOpacity_sys (qreal opacity)
 
void setWindowRole ()
 
void setWindowTitle_helper (const QString &cap)
 
void setWindowTitle_sys (const QString &cap)
 
void setWinId (WId)
 
QPaintersharedPainter () const
 
void show_helper ()
 
void show_recursive ()
 Makes the widget visible in the isVisible() meaning of the word. More...
 
void show_sys ()
 Platform-specific part of QWidget::show(). More...
 
void showChildren (bool spontaneous)
 
void stackUnder_sys (QWidget *)
 
void subtractOpaqueChildren (QRegion &rgn, const QRect &clipRect) const
 
void subtractOpaqueSiblings (QRegion &source, bool *hasDirtySiblingsAbove=0, bool alsoNonOpaque=false) const
 
void syncBackingStore ()
 
void syncBackingStore (const QRegion &region)
 
QTLWExtratopData () const
 
void unsetCursor_sys ()
 
void updateFont (const QFont &)
 Assign font to this widget, and propagate it to all children, except style sheet widgets (handled differently) and windows that don't enable window propagation. More...
 
void updateFrameStrut ()
 Computes the frame rectangle when needed. More...
 
void updateGeometry_helper (bool forceUpdate)
 
void updateIsOpaque ()
 
void updateIsTranslucent ()
 
void updateSystemBackground ()
 
void updateX11AcceptFocus ()
 
void x11UpdateIsOpaque ()
 
 ~QWidgetPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Static Public Functions

static QFont getFont (bool *ok, const QFont &initial, QWidget *parent, const QString &title, QFontDialog::FontDialogOptions options)
 
static void setFont (void *delegate, const QFont &font)
 
- Static Public Functions inherited from QWidgetPrivate
static void adjustFlags (Qt::WindowFlags &flags, QWidget *w=0)
 
static QGraphicsProxyWidgetnearestGraphicsProxyWidget (const QWidget *origin)
 Finds the nearest widget embedded in a graphics proxy widget along the chain formed by this widget and its ancestors. More...
 
static int pointToRect (const QPoint &p, const QRect &r)
 
static QRect screenGeometry (const QWidget *widget)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 

Public Variables

QDialogButtonBoxbuttonBox
 
QBoxLayoutbuttonLayout
 
QComboBoxcolor
 
void * delegate
 
QGroupBoxeffects
 
QBoxLayouteffectsLayout
 
QString family
 
QLabelfamilyAccel
 
QLineEditfamilyEdit
 
QFontListViewfamilyList
 
QFontDatabase fdb
 
QByteArray memberToDisconnectOnClose
 
bool nativeDialogInUse
 
QFontDialog::FontDialogOptions opts
 
QPointer< QObjectreceiverToDisconnectOnClose
 
QGroupBoxsample
 
QLineEditsampleEdit
 
QBoxLayoutsampleEditLayout
 
QBoxLayoutsampleLayout
 
QFont selectedFont
 
int size
 
QLabelsizeAccel
 
QLineEditsizeEdit
 
QFontListViewsizeList
 
bool smoothScalable
 
QCheckBoxstrikeout
 
QString style
 
QLabelstyleAccel
 
QLineEditstyleEdit
 
QFontListViewstyleList
 
QCheckBoxunderline
 
QFontDatabase::WritingSystem writingSystem
 
QLabelwritingSystemAccel
 
QComboBoxwritingSystemCombo
 
- Public Variables inherited from QDialogPrivate
bool doShowExtension
 
QPointer< QEventLoopeventLoop
 
QWidgetextension
 
QPoint lastRMBPress
 
QPointer< QPushButtonmainDef
 
QSize max
 
QSize min
 
Qt::Orientation orientation
 
int rescode
 
int resetModalityTo
 
QSizeGripresizer
 
QSize size
 
bool sizeGripEnabled
 
bool wasModalitySet
 
- Public Variables inherited from QWidgetPrivate
QString accessibleDescription
 
QString accessibleName
 
QList< QAction * > actions
 
QPalette::ColorRole bg_role: 8
 
signed char bottomLayoutItemMargin
 
short bottommargin
 
QWidgetData data
 
QRegion dirty
 
uint dirtyOpaqueChildren: 1
 
QWExtraextra
 
QPaintEngineextraPaintEngine
 
QPalette::ColorRole fg_role: 8
 
QWidgetfocus_child
 
QWidgetfocus_next
 
QWidgetfocus_prev
 
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
 
QGraphicsEffectgraphicsEffect
 
Qt::HANDLE hd
 
uint high_attributes [4]
 
QPointer< QInputContextic
 
Qt::InputMethodHints imHints
 
uint inDirtyList: 1
 
uint inheritedFontResolveMask
 
uint inheritedPaletteResolveMask
 
uint inheritsInputMethodHints: 1
 
uint inSetParent: 1
 
uint isGLWidget: 1
 
uint isMoved: 1
 
uint isOpaque: 1
 
uint isScrolled: 1
 
QLayoutlayout
 
signed char leftLayoutItemMargin
 
short leftmargin
 
QLocale locale
 
QRegionneedsFlush
 
QRegion opaqueChildren
 
Qt::HANDLE picture
 
const QMetaObjectpolished
 
QPaintDeviceredirectDev
 
QPoint redirectOffset
 
signed char rightLayoutItemMargin
 
short rightmargin
 
QSizePolicy size_policy
 
QString statusTip
 
QString toolTip
 
signed char topLayoutItemMargin
 
short topmargin
 
uint usesDoubleBufferedGLContext: 1
 
QString whatsThis
 
QWidgetItemV2widgetItem
 
QX11Info xinfo
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Static Public Variables

static bool sharedFontPanelAvailable = true
 
- Static Public Variables inherited from QWidgetPrivate
static QWidgetSetallWidgets = 0
 
static int instanceCounter = 0
 
static QWidgetkeyboardGrabber = 0
 
static QWidgetMappermapper = 0
 
static int maxInstances = 0
 
static QWidgetmouseGrabber = 0
 

Additional Inherited Members

- Public Types inherited from QWidgetPrivate
enum  CloseMode { CloseNoEvent, CloseWithEvent, CloseWithSpontaneousEvent }
 
enum  Direction { DirectionNorth = 0x01, DirectionEast = 0x10, DirectionSouth = 0x02, DirectionWest = 0x20 }
 
enum  DrawWidgetFlags {
  DrawAsRoot = 0x01, DrawPaintOnScreen = 0x02, DrawRecursive = 0x04, DrawInvisible = 0x08,
  DontSubtractOpaqueChildren = 0x10, DontSetCompositionMode = 0x20, DontDrawOpaqueChildren = 0x40, DontDrawNativeChildren = 0x80
}
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 

Detailed Description

Definition at line 74 of file qfontdialog_p.h.

Constructors and Destructors

◆ QFontDialogPrivate()

QFontDialogPrivate::QFontDialogPrivate ( )
inline

Definition at line 79 of file qfontdialog_p.h.

81  { }
QFontDatabase::WritingSystem writingSystem

Functions

◆ _q_familyHighlighted()

void QFontDialogPrivate::_q_familyHighlighted ( int  i)
Warning
This function is not part of the public interface.

Definition at line 708 of file qfontdialog.cpp.

Referenced by QFontDialogPrivate().

709 {
710  Q_Q(QFontDialog);
711  family = familyList->text(i);
713  if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
714  && familyList->hasFocus())
716 
717  updateStyles();
718 }
bool hasFocus() const
Definition: qwidget.cpp:6583
QLineEdit * familyEdit
#define Q_Q(Class)
Definition: qglobal.h:2483
QFontListView * familyList
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59
void setText(const QString &)
Definition: qlineedit.cpp:401
void selectAll()
Selects all the text (i.e.
Definition: qlineedit.cpp:1405
QString text(int i) const

◆ _q_macRunNativeAppModalPanel()

void QFontDialogPrivate::_q_macRunNativeAppModalPanel ( )

Definition at line 653 of file qfontdialog_mac.mm.

654 {
657  [del runApplicationModalPanel];
658 }
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106

◆ _q_sizeChanged()

void QFontDialogPrivate::_q_sizeChanged ( const QString s)

This slot is called if the user changes the font size.

Warning
This function is not part of the public interface.

The size is passed in the s argument as a string.

Definition at line 766 of file qfontdialog.cpp.

Referenced by QFontDialogPrivate().

767 {
768  // no need to check if the conversion is valid, since we have an QIntValidator in the size edit
769  int size = s.toInt();
770  if (this->size == size)
771  return;
772 
773  this->size = size;
774  if (sizeList->count() != 0) {
775  int i;
776  for (i = 0; i < sizeList->count() - 1; i++) {
777  if (sizeList->text(i).toInt() >= this->size)
778  break;
779  }
780  sizeList->blockSignals(true);
782  sizeList->blockSignals(false);
783  }
784  _q_updateSample();
785 }
bool blockSignals(bool b)
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke...
Definition: qobject.cpp:1406
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
Definition: qstring.cpp:6090
int count() const
Definition: qfontdialog.cpp:88
void setCurrentItem(int item)
Definition: qfontdialog.cpp:82
QFontListView * sizeList
QString text(int i) const

◆ _q_sizeHighlighted()

void QFontDialogPrivate::_q_sizeHighlighted ( int  index)
Warning
This function is not part of the public interface.

Definition at line 744 of file qfontdialog.cpp.

Referenced by QFontDialogPrivate().

745 {
746  Q_Q(QFontDialog);
747  QString s = sizeList->text(index);
748  sizeEdit->setText(s);
749  if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
750  && sizeEdit->hasFocus())
751  sizeEdit->selectAll();
752 
753  size = s.toInt();
754  _q_updateSample();
755 }
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
Definition: qstring.cpp:6090
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool hasFocus() const
Definition: qwidget.cpp:6583
#define Q_Q(Class)
Definition: qglobal.h:2483
QFontListView * sizeList
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59
QLineEdit * sizeEdit
void setText(const QString &)
Definition: qlineedit.cpp:401
quint16 index
void selectAll()
Selects all the text (i.e.
Definition: qlineedit.cpp:1405
QString text(int i) const

◆ _q_styleHighlighted()

void QFontDialogPrivate::_q_styleHighlighted ( int  index)
Warning
This function is not part of the public interface.

Definition at line 725 of file qfontdialog.cpp.

Referenced by QFontDialogPrivate().

726 {
727  Q_Q(QFontDialog);
728  QString s = styleList->text(index);
729  styleEdit->setText(s);
730  if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
731  && styleList->hasFocus())
732  styleEdit->selectAll();
733 
734  style = s;
735 
736  updateSizes();
737 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool hasFocus() const
Definition: qwidget.cpp:6583
#define Q_Q(Class)
Definition: qglobal.h:2483
QLineEdit * styleEdit
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59
void setText(const QString &)
Definition: qlineedit.cpp:401
void updateSizes()
Updates the contents of the "font size" list box.
quint16 index
void selectAll()
Selects all the text (i.e.
Definition: qlineedit.cpp:1405
QFontListView * styleList
QString text(int i) const

◆ _q_updateSample()

void QFontDialogPrivate::_q_updateSample ( )

Definition at line 672 of file qfontdialog.cpp.

Referenced by QFontDialogPrivate().

673 {
674  // compute new font
675  int pSize = sizeEdit->text().toInt();
676  QFont newFont(fdb.font(familyList->currentText(), style, pSize));
677  newFont.setStrikeOut(strikeout->isChecked());
678  newFont.setUnderline(underline->isChecked());
679 
680  if (familyList->currentText().isEmpty())
681  sampleEdit->clear();
682 
683  updateSampleFont(newFont);
684 }
QFont font(const QString &family, const QString &style, int pointSize) const
Returns a QFont object that has family family, style style and point size pointSize.
bool isChecked() const
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
Definition: qstring.cpp:6090
QLineEdit * sampleEdit
QFontDatabase fdb
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QString text
the line edit&#39;s text
Definition: qlineedit.h:72
QCheckBox * underline
QFontListView * familyList
QLineEdit * sizeEdit
void clear()
Clears the contents of the line edit.
Definition: qlineedit.cpp:1443
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
QString currentText() const
Definition: qfontdialog.cpp:91
QCheckBox * strikeout
void updateSampleFont(const QFont &newFont)

◆ _q_writingSystemHighlighted()

void QFontDialogPrivate::_q_writingSystemHighlighted ( int  index)
Warning
This function is not part of the public interface.

Definition at line 698 of file qfontdialog.cpp.

Referenced by QFontDialogPrivate().

699 {
702  updateFamilies();
703 }
QLineEdit * sampleEdit
QFontDatabase::WritingSystem writingSystem
QFontDatabase fdb
static QString writingSystemSample(WritingSystem writingSystem)
Returns a string with sample characters from writingSystem.
void setText(const QString &)
Definition: qlineedit.cpp:401
quint16 index

◆ canBeNativeDialog()

bool QFontDialogPrivate::canBeNativeDialog ( )

Definition at line 1076 of file qfontdialog.cpp.

1077 {
1078  Q_Q(QFontDialog);
1079  if (nativeDialogInUse)
1080  return true;
1081  if (q->testAttribute(Qt::WA_DontShowOnScreen))
1082  return false;
1084  return false;
1085 
1087  QLatin1String dynamicName(q->metaObject()->className());
1088  return (staticName == dynamicName);
1089 }
static const QMetaObject staticMetaObject
This variable stores the meta-object for the class.
Definition: qobject.h:128
const char * className
Definition: qwizard.cpp:137
#define Q_Q(Class)
Definition: qglobal.h:2483
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59
QFontDialog::FontDialogOptions opts

◆ closeCocoaFontPanel()

void QFontDialogPrivate::closeCocoaFontPanel ( )

Definition at line 491 of file qfontdialog_mac.mm.

492 {
495  NSWindow *ourPanel = [theDelegate actualPanel];
496  [ourPanel close];
497  if ([theDelegate isAppModal])
498  [ourPanel release];
499  [theDelegate cleanUpAfterMyself];
500  [theDelegate release];
501  this->delegate = 0;
503 }
static bool sharedFontPanelAvailable
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106

◆ createNSFontPanelDelegate()

void QFontDialogPrivate::createNSFontPanelDelegate ( )

Definition at line 540 of file qfontdialog_mac.mm.

541 {
542  if (delegate)
543  return;
544 
545  sharedFontPanelAvailable = false;
547  bool sharedFontPanelExisted = [NSFontPanel sharedFontPanelExists];
548  NSFontPanel *sharedFontPanel = [NSFontPanel sharedFontPanel];
549  [sharedFontPanel setHidesOnDeactivate:false];
550 
551  // hack to ensure that QCocoaApplication's validModesForFontPanel:
552  // implementation is honored
553  if (!sharedFontPanelExisted) {
554  [sharedFontPanel makeKeyAndOrderFront:sharedFontPanel];
555  [sharedFontPanel close];
556  }
557 
558  NSPanel *ourPanel = 0;
559  NSView *stolenContentView = 0;
560  NSButton *okButton = 0;
561  NSButton *cancelButton = 0;
562 
563  CGFloat dialogExtraWidth = 0.0;
564  CGFloat dialogExtraHeight = 0.0;
565 
566  // compute dialogExtra{Width,Height}
567  dialogExtraWidth = 2.0 * DialogSideMargin;
569 
570  // compute initial contents rectangle
571  NSRect contentRect = [sharedFontPanel contentRectForFrameRect:[sharedFontPanel frame]];
572  contentRect.size.width += dialogExtraWidth;
573  contentRect.size.height += dialogExtraHeight;
574 
575  // create the new panel
576  ourPanel = [[NSPanel alloc] initWithContentRect:contentRect
577  styleMask:StyleMask
578  backing:NSBackingStoreBuffered
579  defer:YES];
580  [ourPanel setReleasedWhenClosed:YES];
581  stolenContentView = [sharedFontPanel contentView];
582 
583  // steal the font panel's contents view
584  [stolenContentView retain];
585  [sharedFontPanel setContentView:0];
586 
587  {
588  // create a new content view and add the stolen one as a subview
589  NSRect frameRect = { { 0.0, 0.0 }, { 0.0, 0.0 } };
590  NSView *ourContentView = [[NSView alloc] initWithFrame:frameRect];
591  [ourContentView addSubview:stolenContentView];
592 
593  // create OK and Cancel buttons and add these as subviews
594  okButton = macCreateButton("&OK", ourContentView);
595  cancelButton = macCreateButton("Cancel", ourContentView);
596 
597  [ourPanel setContentView:ourContentView];
598  [ourPanel setDefaultButtonCell:[okButton cell]];
599  }
600 
601  // create the delegate and set it
602  QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *del = [[QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) alloc] initWithFontPanel:sharedFontPanel
603  stolenContentView:stolenContentView
604  okButton:okButton
605  cancelButton:cancelButton
606  priv:this
607  extraWidth:dialogExtraWidth
608  extraHeight:dialogExtraHeight];
609  delegate = del;
610  [ourPanel setDelegate:del];
611 
612  [[NSFontManager sharedFontManager] setDelegate:del];
613 #ifdef QT_MAC_USE_COCOA
614  [[NSFontManager sharedFontManager] setTarget:del];
615 #endif
616  setFont(del, q_func()->currentFont());
617 
618  {
619  // hack to get correct initial layout
620  NSRect frameRect = [ourPanel frame];
621  frameRect.size.width += 1.0;
622  [ourPanel setFrame:frameRect display:NO];
623  frameRect.size.width -= 1.0;
624  frameRect.size = [del windowWillResize:ourPanel toSize:frameRect.size];
625  [ourPanel setFrame:frameRect display:NO];
626  [ourPanel center];
627  }
628  [del setSubwindowStacking];
629  NSString *title = @"Select font";
630  [ourPanel setTitle:title];
631 }
const CGFloat DialogTopMargin
const CGFloat ButtonBottomMargin
static bool sharedFontPanelAvailable
const CGFloat DialogSideMargin
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
const CGFloat ButtonTopMargin
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
static void setFont(void *delegate, const QFont &font)
const CGFloat ButtonMinHeight
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106
static const QMetaObjectPrivate * priv(const uint *data)
const int StyleMask
NSButton * macCreateButton(const char *text, NSView *superview)
float CGFloat

◆ done()

void QFontDialogPrivate::done ( int  result)
inline

Definition at line 144 of file qfontdialog_p.h.

144 { q_func()->done(result); }

◆ fontDialog()

QFontDialog* QFontDialogPrivate::fontDialog ( )
inline

Definition at line 145 of file qfontdialog_p.h.

145 { return q_func(); }

◆ getFont()

QFont QFontDialogPrivate::getFont ( bool *  ok,
const QFont initial,
QWidget parent,
const QString title,
QFontDialog::FontDialogOptions  options 
)
static

Definition at line 440 of file qfontdialog.cpp.

Referenced by QFontDialog::getFont(), and QFontDialogPrivate().

442 {
443  QFontDialog dlg(parent);
444  dlg.setOptions(options);
445  dlg.setCurrentFont(initial);
446  if (!title.isEmpty())
447  dlg.setWindowTitle(title);
448 
449  int ret = (dlg.exec() || (options & QFontDialog::NoButtons));
450  if (ok)
451  *ok = !!ret;
452  if (ret) {
453  return dlg.selectedFont();
454  } else {
455  return initial;
456  }
457 }
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59

◆ hideCocoaFontPanel()

bool QFontDialogPrivate::hideCocoaFontPanel ( )

Definition at line 676 of file qfontdialog_mac.mm.

677 {
678  if (!delegate){
679  // Nothing to do. We return false to leave the question
680  // open regarding whether or not to go native:
681  return false;
682  } else {
684  // Even when we hide it, we are still using a
685  // native dialog, so return true:
686  return true;
687  }
688 }

◆ init()

void QFontDialogPrivate::init ( )

Definition at line 182 of file qfontdialog.cpp.

Referenced by QFontDialogPrivate().

183 {
184  Q_Q(QFontDialog);
185 
186 #ifdef Q_WS_MAC
187  nativeDialogInUse = false;
188  delegate = 0;
189 #endif
190 
191  q->setSizeGripEnabled(true);
192  q->setWindowTitle(QFontDialog::tr("Select Font"));
193 
194  // grid
195  familyEdit = new QLineEdit(q);
196  familyEdit->setReadOnly(true);
197  familyList = new QFontListView(q);
199 
200  familyAccel = new QLabel(q);
201 #ifndef QT_NO_SHORTCUT
203 #endif
205 
206  styleEdit = new QLineEdit(q);
207  styleEdit->setReadOnly(true);
208  styleList = new QFontListView(q);
210 
211  styleAccel = new QLabel(q);
212 #ifndef QT_NO_SHORTCUT
214 #endif
215  styleAccel->setIndent(2);
216 
217  sizeEdit = new QLineEdit(q);
219  QIntValidator *validator = new QIntValidator(1, 512, q);
220  sizeEdit->setValidator(validator);
221  sizeList = new QFontListView(q);
222 
223  sizeAccel = new QLabel(q);
224 #ifndef QT_NO_SHORTCUT
226 #endif
227  sizeAccel->setIndent(2);
228 
229  // effects box
230  effects = new QGroupBox(q);
231  QVBoxLayout *vbox = new QVBoxLayout(effects);
232  strikeout = new QCheckBox(effects);
233  vbox->addWidget(strikeout);
234  underline = new QCheckBox(effects);
235  vbox->addWidget(underline);
236 
237  sample = new QGroupBox(q);
238  QHBoxLayout *hbox = new QHBoxLayout(sample);
239  sampleEdit = new QLineEdit(sample);
242  // Note that the sample text is *not* translated with tr(), as the
243  // characters used depend on the charset encoding.
244  sampleEdit->setText(QLatin1String("AaBbYyZz"));
245  hbox->addWidget(sampleEdit);
246 
247  writingSystemCombo = new QComboBox(q);
248 
249  writingSystemAccel = new QLabel(q);
250 #ifndef QT_NO_SHORTCUT
252 #endif
254 
255  size = 0;
256  smoothScalable = false;
257 
259  QObject::connect(familyList, SIGNAL(highlighted(int)), q, SLOT(_q_familyHighlighted(int)));
260  QObject::connect(styleList, SIGNAL(highlighted(int)), q, SLOT(_q_styleHighlighted(int)));
261  QObject::connect(sizeList, SIGNAL(highlighted(int)), q, SLOT(_q_sizeHighlighted(int)));
263 
266 
267  for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
269  QString writingSystemName = QFontDatabase::writingSystemName(ws);
270  if (writingSystemName.isEmpty())
271  break;
272  writingSystemCombo->addItem(writingSystemName);
273  }
274 
275  updateFamilies();
276  if (familyList->count() != 0)
278 
279  // grid layout
280  QGridLayout *mainGrid = new QGridLayout(q);
281 
282  int spacing = mainGrid->spacing();
283  if (spacing >= 0) { // uniform spacing
284  mainGrid->setSpacing(0);
285 
286  mainGrid->setColumnMinimumWidth(1, spacing);
287  mainGrid->setColumnMinimumWidth(3, spacing);
288 
289  int margin = 0;
290  mainGrid->getContentsMargins(0, 0, 0, &margin);
291 
292  mainGrid->setRowMinimumHeight(3, margin);
293  mainGrid->setRowMinimumHeight(6, 2);
294  mainGrid->setRowMinimumHeight(8, margin);
295  }
296 
297  mainGrid->addWidget(familyAccel, 0, 0);
298  mainGrid->addWidget(familyEdit, 1, 0);
299  mainGrid->addWidget(familyList, 2, 0);
300 
301  mainGrid->addWidget(styleAccel, 0, 2);
302  mainGrid->addWidget(styleEdit, 1, 2);
303  mainGrid->addWidget(styleList, 2, 2);
304 
305  mainGrid->addWidget(sizeAccel, 0, 4);
306  mainGrid->addWidget(sizeEdit, 1, 4);
307  mainGrid->addWidget(sizeList, 2, 4);
308 
309  mainGrid->setColumnStretch(0, 38);
310  mainGrid->setColumnStretch(2, 24);
311  mainGrid->setColumnStretch(4, 10);
312 
313  mainGrid->addWidget(effects, 4, 0);
314 
315  mainGrid->addWidget(sample, 4, 2, 4, 3);
316 
317  mainGrid->addWidget(writingSystemAccel, 5, 0);
318  mainGrid->addWidget(writingSystemCombo, 7, 0);
319 
320  buttonBox = new QDialogButtonBox(q);
321  mainGrid->addWidget(buttonBox, 9, 0, 1, 5);
322 
323  QPushButton *button
325  QObject::connect(buttonBox, SIGNAL(accepted()), q, SLOT(accept()));
326  button->setDefault(true);
327 
329  QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject()));
330 
331 #if defined(Q_WS_WINCE)
332  q->resize(180, 120);
333 #elif defined(Q_WS_S60)
334  q->resize(QApplication::desktop()->availableGeometry(QCursor::pos()).size());
335 #else
336  q->resize(500, 360);
337 #endif // Q_WS_WINCE
338 
343 
344  familyList->setFocus();
346 }
void setReadOnly(bool)
Definition: qlineedit.cpp:1499
void setAlignment(Qt::Alignment flag)
Definition: qlineedit.cpp:827
Q_CORE_EXPORT QTextStream & ws(QTextStream &s)
QGroupBox * effects
#define SLOT(a)
Definition: qobjectdefs.h:226
QLabel * writingSystemAccel
void setColumnMinimumWidth(int column, int minSize)
Sets the minimum width of column column to minSize pixels.
void setDefault(bool)
void _q_sizeHighlighted(int)
QLineEdit * sampleEdit
The QPushButton widget provides a command button.
Definition: qpushbutton.h:57
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
int count() const
Definition: qfontdialog.cpp:88
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...
Definition: qcombobox.h:323
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=0)
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment...
The QIntValidator class provides a validator that ensures a string contains a valid integer within a ...
Definition: qvalidator.h:96
QLineEdit * familyEdit
#define Q_Q(Class)
Definition: qglobal.h:2483
QLineEdit * styleEdit
#define SIGNAL(a)
Definition: qobjectdefs.h:227
QGroupBox * sample
void setCurrentItem(int item)
Definition: qfontdialog.cpp:82
void _q_writingSystemHighlighted(int)
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...
Definition: qobject.cpp:2580
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
void _q_styleHighlighted(int)
QFontListView * sizeList
The QComboBox widget is a combined button and popup list.
Definition: qcombobox.h:62
void setValidator(const QValidator *)
Sets this line edit to only accept input that the validator, v, will accept.
Definition: qlineedit.cpp:627
void setRowMinimumHeight(int row, int minSize)
Sets the minimum height of row row to minSize pixels.
QCheckBox * underline
int spacing() const
If the vertical spacing is equal to the horizontal spacing, this function returns that value; otherwi...
void _q_familyHighlighted(int)
The QGroupBox widget provides a group box frame with a title.
Definition: qgroupbox.h:57
QFontListView * familyList
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59
void addButton(QAbstractButton *button, ButtonRole role)
Adds the given button to the button box with the specified role.
QLineEdit * sizeEdit
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
void setText(const QString &)
Definition: qlineedit.cpp:401
void setFocus()
Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its paren...
Definition: qwidget.h:432
void _q_sizeChanged(const QString &)
This slot is called if the user changes the font size.
void setFocusProxy(QWidget *)
Sets the widget&#39;s focus proxy to widget w.
Definition: qwidget.cpp:6537
void setBuddy(QWidget *)
Sets this label&#39;s buddy to buddy.
Definition: qlabel.cpp:1297
void setColumnStretch(int column, int stretch)
Sets the stretch factor of column column to stretch.
void getContentsMargins(int *left, int *top, int *right, int *bottom) const
Definition: qlayout.cpp:551
The QDialogButtonBox class is a widget that presents buttons in a layout that is appropriate to the c...
The QGridLayout class lays out widgets in a grid.
Definition: qgridlayout.h:60
void installEventFilter(QObject *)
Installs an event filter filterObj on this object.
Definition: qobject.cpp:2070
The QLabel widget provides a text or image display.
Definition: qlabel.h:55
The QHBoxLayout class lines up widgets horizontally.
Definition: qboxlayout.h:129
The QLineEdit widget is a one-line text editor.
Definition: qlineedit.h:66
QDialogButtonBox * buttonBox
The QVBoxLayout class lines up widgets vertically.
Definition: qboxlayout.h:149
void addWidget(QWidget *w)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qgridlayout.h:116
static QString writingSystemName(WritingSystem writingSystem)
Returns the names the writingSystem (e.g.
QFontListView * styleList
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198
The QCheckBox widget provides a checkbox with a text label.
Definition: qcheckbox.h:56
void setSpacing(int spacing)
This function sets both the vertical and horizontal spacing to spacing.
QCheckBox * strikeout
QComboBox * writingSystemCombo
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
Definition: qcursor_mac.mm:310
void setFocusPolicy(Qt::FocusPolicy policy)
Definition: qwidget.cpp:7631
void setIndent(int)
Definition: qlabel.cpp:620

◆ mac_nativeDialogModalHelp()

void QFontDialogPrivate::mac_nativeDialogModalHelp ( )
virtual

Reimplemented from QDialogPrivate.

Definition at line 633 of file qfontdialog_mac.mm.

634 {
635  // Copied from QFileDialogPrivate
636  // Do a queued meta-call to open the native modal dialog so it opens after the new
637  // event loop has started to execute (in QDialog::exec). Using a timer rather than
638  // a queued meta call is intentional to ensure that the call is only delivered when
639  // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
640  // running (which is the case if e.g a top-most QEventLoop has been
641  // interrupted, and the second-most event loop has not yet been reactivated (regardless
642  // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
643  if (nativeDialogInUse) {
644  Q_Q(QFontDialog);
646  }
647 }
#define SLOT(a)
Definition: qobjectdefs.h:226
void _q_macRunNativeAppModalPanel()
#define Q_Q(Class)
Definition: qglobal.h:2483
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59
bool singleShot
This static function calls a slot after a given time interval.
Definition: qtimer.h:59

◆ retranslateStrings()

void QFontDialogPrivate::retranslateStrings ( )

Definition at line 787 of file qfontdialog.cpp.

Referenced by QFontDialogPrivate().

788 {
790  styleAccel->setText(QFontDialog::tr("Font st&yle"));
791  sizeAccel->setText(QFontDialog::tr("&Size"));
792 #ifndef Q_WS_S60
793  // Removed the title due to lack of screen estate in small S60 screen.
794  // The effects are descriptive without a title (strikeout, underline).
795  effects->setTitle(QFontDialog::tr("Effects"));
796 #endif
797  strikeout->setText(QFontDialog::tr("Stri&keout"));
798  underline->setText(QFontDialog::tr("&Underline"));
799  sample->setTitle(QFontDialog::tr("Sample"));
800  writingSystemAccel->setText(QFontDialog::tr("Wr&iting System"));
801 }
void setText(const QString &text)
QGroupBox * effects
void setText(const QString &)
Definition: qlabel.cpp:366
QLabel * writingSystemAccel
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QGroupBox * sample
QCheckBox * underline
void setTitle(const QString &title)
Definition: qgroupbox.cpp:239
QCheckBox * strikeout

◆ setFont()

void QFontDialogPrivate::setFont ( void *  delegate,
const QFont font 
)
static

Definition at line 505 of file qfontdialog_mac.mm.

Referenced by QFontDialog::setCurrentFont().

506 {
509  NSFontManager *mgr = [NSFontManager sharedFontManager];
510  const NSFont *nsFont = 0;
511 
512 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
513  if (qstrcmp(fe->name(), "CoreText") == 0) {
514  nsFont = reinterpret_cast<const NSFont *>(static_cast<QCoreTextFontEngineMulti *>(fe)->ctfont);
515  } else
516 #endif
517  {
518  int weight = 5;
519  NSFontTraitMask mask = 0;
520  if (font.style() == QFont::StyleItalic) {
521  mask |= NSItalicFontMask;
522  }
523  if (font.weight() == QFont::Bold) {
524  weight = 9;
525  mask |= NSBoldFontMask;
526  }
527 
528  NSFontManager *mgr = [NSFontManager sharedFontManager];
529  QFontInfo fontInfo(font);
530  nsFont = [mgr fontWithFamily:qt_mac_QStringToNSString(fontInfo.family())
531  traits:mask
532  weight:weight
533  size:fontInfo.pointSize()];
534  }
535 
536  [mgr setSelectedFont:const_cast<NSFont *>(nsFont) isMultiple:NO];
537  [static_cast<QT_MANGLE_NAMESPACE(QCocoaFontPanelDelegate) *>(delegate) setQtFont:font];
538 }
Style style() const
Returns the style of the font.
Definition: qfont.cpp:1223
virtual const char * name() const =0
The QFontInfo class provides general information about fonts.
Definition: qfontinfo.h:54
QFontEngine * engineForScript(int script) const
Definition: qfont.cpp:294
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106
QExplicitlySharedDataPointer< QFontPrivate > d
Definition: qfont.h:343
int weight() const
Returns the weight of the font which is one of the enumerated values from QFont::Weight.
Definition: qfont.cpp:1248
int qstrcmp(const QByteArray &str1, const char *str2)
Definition: qbytearray.cpp:336

◆ setVisible_sys()

bool QFontDialogPrivate::setVisible_sys ( bool  visible)

Definition at line 689 of file qfontdialog_mac.mm.

690 {
691  Q_Q(QFontDialog);
692  if (!visible == q->isHidden())
693  return false;
694 
695  return visible ? showCocoaFontPanel() : hideCocoaFontPanel();
696 }
#define Q_Q(Class)
Definition: qglobal.h:2483
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59

◆ showCocoaFontPanel()

bool QFontDialogPrivate::showCocoaFontPanel ( )

Definition at line 660 of file qfontdialog_mac.mm.

661 {
663  return false;
664 
665  Q_Q(QFontDialog);
669  if (qt_mac_is_macsheet(q))
670  [del showWindowModalSheet:q->parentWidget()];
671  else
672  [del showModelessPanel];
673  return true;
674 }
#define Q_Q(Class)
Definition: qglobal.h:2483
static bool sharedFontPanelAvailable
bool qt_mac_is_macsheet(const QWidget *w)
Definition: qwidget_mac.mm:295
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106

◆ updateFamilies()

void QFontDialogPrivate::updateFamilies ( )

Definition at line 512 of file qfontdialog.cpp.

Referenced by QFontDialogPrivate().

513 {
514  Q_Q(QFontDialog);
515 
516  enum match_t { MATCH_NONE = 0, MATCH_LAST_RESORT = 1, MATCH_APP = 2, MATCH_FAMILY = 3 };
517 
518  QStringList familyNames = fdb.families(writingSystem);
519 
520  familyList->model()->setStringList(familyNames);
521 
522  QString foundryName1, familyName1, foundryName2, familyName2;
523  int bestFamilyMatch = -1;
524  match_t bestFamilyType = MATCH_NONE;
525 
526  QFont f;
527 
528  // ##### do the right thing for a list of family names in the font.
529  QFontDatabase::parseFontName(family, foundryName1, familyName1);
530 
531  QStringList::const_iterator it = familyNames.constBegin();
532  int i = 0;
533  for(; it != familyNames.constEnd(); ++it, ++i) {
534  QFontDatabase::parseFontName(*it, foundryName2, familyName2);
535 
536  //try to match...
537  if (familyName1 == familyName2) {
538  bestFamilyType = MATCH_FAMILY;
539  if (foundryName1 == foundryName2) {
540  bestFamilyMatch = i;
541  break;
542  }
543  if (bestFamilyMatch < MATCH_FAMILY)
544  bestFamilyMatch = i;
545  }
546 
547  //and try some fall backs
548  match_t type = MATCH_NONE;
549  if (bestFamilyType <= MATCH_NONE && familyName2 == f.lastResortFamily())
550  type = MATCH_LAST_RESORT;
551  if (bestFamilyType <= MATCH_LAST_RESORT && familyName2 == f.family())
552  type = MATCH_APP;
553  // ### add fallback for writingSystem
554  if (type != MATCH_NONE) {
555  bestFamilyType = type;
556  bestFamilyMatch = i;
557  }
558  }
559 
560  if (i != -1 && bestFamilyType != MATCH_NONE)
561  familyList->setCurrentItem(bestFamilyMatch);
562  else
565  if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
566  && familyList->hasFocus())
568 
569  updateStyles();
570 }
int type
Definition: qmetatype.cpp:239
#define it(className, varName)
QStringListModel * model() const
Definition: qfontdialog.cpp:79
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
Definition: qlist.h:269
QString lastResortFamily() const
Returns the "last resort" font family name.
Definition: qfont_mac.cpp:156
static void parseFontName(const QString &name, QString &foundry, QString &family)
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool hasFocus() const
Definition: qwidget.cpp:6583
QFontDatabase::WritingSystem writingSystem
QLineEdit * familyEdit
#define Q_Q(Class)
Definition: qglobal.h:2483
QFontDatabase fdb
friend class const_iterator
Definition: qlist.h:264
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&#39;s internal string list to strings.
void setCurrentItem(int item)
Definition: qfontdialog.cpp:82
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QFontListView * familyList
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59
void setText(const QString &)
Definition: qlineedit.cpp:401
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
QString family() const
Returns the requested font family name, i.e.
Definition: qfont.cpp:906
QString currentText() const
Definition: qfontdialog.cpp:91
void selectAll()
Selects all the text (i.e.
Definition: qlineedit.cpp:1405
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272

◆ updateSampleFont()

void QFontDialogPrivate::updateSampleFont ( const QFont newFont)

Definition at line 686 of file qfontdialog.cpp.

Referenced by QFontDialogPrivate().

687 {
688  Q_Q(QFontDialog);
689  if (newFont != sampleEdit->font()) {
690  sampleEdit->setFont(newFont);
691  emit q->currentFontChanged(newFont);
692  }
693 }
void setFont(const QFont &)
Use the single-argument overload instead.
Definition: qwidget.cpp:4996
QLineEdit * sampleEdit
#define Q_Q(Class)
Definition: qglobal.h:2483
#define emit
Definition: qobjectdefs.h:76
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59
const QFont & font() const

◆ updateSizes()

void QFontDialogPrivate::updateSizes ( )

Updates the contents of the "font size" list box.

Warning
This function is not part of the public interface. This function can be reimplemented if you have special requirements.

Definition at line 636 of file qfontdialog.cpp.

Referenced by QFontDialogPrivate().

637 {
638  Q_Q(QFontDialog);
639 
640  if (!familyList->currentText().isEmpty()) {
642 
643  int i = 0;
644  int current = -1;
645  QStringList str_sizes;
646  for(QList<int>::const_iterator it = sizes.constBegin(); it != sizes.constEnd(); ++it) {
647  str_sizes.append(QString::number(*it));
648  if (current == -1 && *it >= size)
649  current = i;
650  ++i;
651  }
652  sizeList->model()->setStringList(str_sizes);
653  if (current == -1) {
654  // we request a size bigger than the ones in the list, select the biggest one
655  current = sizeList->count() - 1;
656  }
657  sizeList->setCurrentItem(current);
658 
659  sizeEdit->blockSignals(true);
661  if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
662  && sizeList->hasFocus())
663  sizeEdit->selectAll();
664  sizeEdit->blockSignals(false);
665  } else {
666  sizeEdit->clear();
667  }
668 
669  _q_updateSample();
670 }
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
bool blockSignals(bool b)
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke...
Definition: qobject.cpp:1406
#define it(className, varName)
QStringListModel * model() const
Definition: qfontdialog.cpp:79
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
Definition: qlist.h:269
bool hasFocus() const
Definition: qwidget.cpp:6583
int count() const
Definition: qfontdialog.cpp:88
#define Q_Q(Class)
Definition: qglobal.h:2483
QFontDatabase fdb
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
void setStringList(const QStringList &strings)
Sets the model&#39;s internal string list to strings.
void setCurrentItem(int item)
Definition: qfontdialog.cpp:82
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QFontListView * sizeList
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QList< int > pointSizes(const QString &family, const QString &style=QString())
Returns a list of the point sizes available for the font with the given family and style...
QFontListView * familyList
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59
QLineEdit * sizeEdit
void setText(const QString &)
Definition: qlineedit.cpp:401
void clear()
Clears the contents of the line edit.
Definition: qlineedit.cpp:1443
QString currentText() const
Definition: qfontdialog.cpp:91
void selectAll()
Selects all the text (i.e.
Definition: qlineedit.cpp:1405
QFontListView * styleList
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272

◆ updateStyles()

void QFontDialogPrivate::updateStyles ( )

Definition at line 576 of file qfontdialog.cpp.

Referenced by QFontDialogPrivate().

577 {
578  Q_Q(QFontDialog);
580  styleList->model()->setStringList(styles);
581 
582  if (styles.isEmpty()) {
583  styleEdit->clear();
584  smoothScalable = false;
585  } else {
586  if (!style.isEmpty()) {
587  bool found = false;
588  bool first = true;
589  QString cstyle = style;
590 
591  redo:
592  for (int i = 0; i < (int)styleList->count(); i++) {
593  if (cstyle == styleList->text(i)) {
595  found = true;
596  break;
597  }
598  }
599  if (!found && first) {
600  if (cstyle.contains(QLatin1String("Italic"))) {
601  cstyle.replace(QLatin1String("Italic"), QLatin1String("Oblique"));
602  first = false;
603  goto redo;
604  } else if (cstyle.contains(QLatin1String("Oblique"))) {
605  cstyle.replace(QLatin1String("Oblique"), QLatin1String("Italic"));
606  first = false;
607  goto redo;
608  }
609  }
610  if (!found)
612  } else {
614  }
615 
617  if (q->style()->styleHint(QStyle::SH_FontDialog_SelectAssociatedText, 0, q)
618  && styleList->hasFocus())
619  styleEdit->selectAll();
620 
622  }
623 
624  updateSizes();
625 }
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.h:904
QStringList styles(const QString &family) const
Returns a list of the styles available for the font family family.
QString & replace(int i, int len, QChar after)
Definition: qstring.cpp:2005
QStringListModel * model() const
Definition: qfontdialog.cpp:79
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool hasFocus() const
Definition: qwidget.cpp:6583
int count() const
Definition: qfontdialog.cpp:88
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
#define Q_Q(Class)
Definition: qglobal.h:2483
QFontDatabase fdb
QLineEdit * styleEdit
void setStringList(const QStringList &strings)
Sets the model&#39;s internal string list to strings.
void setCurrentItem(int item)
Definition: qfontdialog.cpp:82
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
QFontListView * familyList
The QFontDialog class provides a dialog widget for selecting a font.
Definition: qfontdialog.h:59
void setText(const QString &)
Definition: qlineedit.cpp:401
void updateSizes()
Updates the contents of the "font size" list box.
void clear()
Clears the contents of the line edit.
Definition: qlineedit.cpp:1443
QString currentText() const
Definition: qfontdialog.cpp:91
void selectAll()
Selects all the text (i.e.
Definition: qlineedit.cpp:1405
QFontListView * styleList
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...
QString text(int i) const

Properties

◆ buttonBox

QDialogButtonBox* QFontDialogPrivate::buttonBox

Definition at line 128 of file qfontdialog_p.h.

◆ buttonLayout

QBoxLayout* QFontDialogPrivate::buttonLayout

Definition at line 123 of file qfontdialog_p.h.

◆ color

QComboBox* QFontDialogPrivate::color

Definition at line 115 of file qfontdialog_p.h.

◆ delegate

void* QFontDialogPrivate::delegate

Definition at line 147 of file qfontdialog_p.h.

◆ effects

QGroupBox* QFontDialogPrivate::effects

Definition at line 112 of file qfontdialog_p.h.

◆ effectsLayout

QBoxLayout* QFontDialogPrivate::effectsLayout

Definition at line 124 of file qfontdialog_p.h.

◆ family

QString QFontDialogPrivate::family

Definition at line 131 of file qfontdialog_p.h.

◆ familyAccel

QLabel* QFontDialogPrivate::familyAccel

Definition at line 100 of file qfontdialog_p.h.

◆ familyEdit

QLineEdit* QFontDialogPrivate::familyEdit

Definition at line 101 of file qfontdialog_p.h.

◆ familyList

QFontListView* QFontDialogPrivate::familyList

Definition at line 102 of file qfontdialog_p.h.

◆ fdb

QFontDatabase QFontDialogPrivate::fdb

Definition at line 130 of file qfontdialog_p.h.

◆ memberToDisconnectOnClose

QByteArray QFontDialogPrivate::memberToDisconnectOnClose

Definition at line 139 of file qfontdialog_p.h.

◆ nativeDialogInUse

bool QFontDialogPrivate::nativeDialogInUse

Definition at line 149 of file qfontdialog_p.h.

◆ opts

QFontDialog::FontDialogOptions QFontDialogPrivate::opts

Definition at line 137 of file qfontdialog_p.h.

◆ receiverToDisconnectOnClose

QPointer<QObject> QFontDialogPrivate::receiverToDisconnectOnClose

Definition at line 138 of file qfontdialog_p.h.

◆ sample

QGroupBox* QFontDialogPrivate::sample

Definition at line 117 of file qfontdialog_p.h.

◆ sampleEdit

QLineEdit* QFontDialogPrivate::sampleEdit

Definition at line 118 of file qfontdialog_p.h.

◆ sampleEditLayout

QBoxLayout* QFontDialogPrivate::sampleEditLayout

Definition at line 126 of file qfontdialog_p.h.

◆ sampleLayout

QBoxLayout* QFontDialogPrivate::sampleLayout

Definition at line 125 of file qfontdialog_p.h.

◆ selectedFont

QFont QFontDialogPrivate::selectedFont

Definition at line 136 of file qfontdialog_p.h.

◆ sharedFontPanelAvailable

bool QFontDialogPrivate::sharedFontPanelAvailable = true
static

Definition at line 158 of file qfontdialog_p.h.

Referenced by QFontDialog::setOptions().

◆ size

int QFontDialogPrivate::size

Definition at line 134 of file qfontdialog_p.h.

◆ sizeAccel

QLabel* QFontDialogPrivate::sizeAccel

Definition at line 108 of file qfontdialog_p.h.

◆ sizeEdit

QLineEdit* QFontDialogPrivate::sizeEdit

Definition at line 109 of file qfontdialog_p.h.

◆ sizeList

QFontListView* QFontDialogPrivate::sizeList

Definition at line 110 of file qfontdialog_p.h.

◆ smoothScalable

bool QFontDialogPrivate::smoothScalable

Definition at line 135 of file qfontdialog_p.h.

◆ strikeout

QCheckBox* QFontDialogPrivate::strikeout

Definition at line 113 of file qfontdialog_p.h.

◆ style

QString QFontDialogPrivate::style

Definition at line 133 of file qfontdialog_p.h.

◆ styleAccel

QLabel* QFontDialogPrivate::styleAccel

Definition at line 104 of file qfontdialog_p.h.

◆ styleEdit

QLineEdit* QFontDialogPrivate::styleEdit

Definition at line 105 of file qfontdialog_p.h.

◆ styleList

QFontListView* QFontDialogPrivate::styleList

Definition at line 106 of file qfontdialog_p.h.

◆ underline

QCheckBox* QFontDialogPrivate::underline

Definition at line 114 of file qfontdialog_p.h.

◆ writingSystem

QFontDatabase::WritingSystem QFontDialogPrivate::writingSystem

Definition at line 132 of file qfontdialog_p.h.

◆ writingSystemAccel

QLabel* QFontDialogPrivate::writingSystemAccel

Definition at line 120 of file qfontdialog_p.h.

◆ writingSystemCombo

QComboBox* QFontDialogPrivate::writingSystemCombo

Definition at line 121 of file qfontdialog_p.h.


The documentation for this class was generated from the following files: