Qt 4.8
qtextformat.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QTEXTFORMAT_H
43 #define QTEXTFORMAT_H
44 
45 #include <QtGui/qcolor.h>
46 #include <QtGui/qfont.h>
47 #include <QtCore/qshareddata.h>
48 #include <QtCore/qvector.h>
49 #include <QtCore/qvariant.h>
50 #include <QtGui/qpen.h>
51 #include <QtGui/qbrush.h>
52 #include <QtGui/qtextoption.h>
53 
55 
57 
58 QT_MODULE(Gui)
59 
60 class QString;
61 class QVariant;
62 class QFont;
63 
65 class QTextFormatPrivate;
66 class QTextBlockFormat;
67 class QTextCharFormat;
68 class QTextListFormat;
69 class QTextTableFormat;
70 class QTextFrameFormat;
71 class QTextImageFormat;
73 class QTextFormat;
74 class QTextObject;
75 class QTextCursor;
76 class QTextDocument;
77 class QTextLength;
78 
79 #ifndef QT_NO_DATASTREAM
82 #endif
83 
85 {
86 public:
87  enum Type { VariableLength = 0, FixedLength, PercentageLength };
88 
89  inline QTextLength() : lengthType(VariableLength), fixedValueOrPercentage(0) {}
90 
91  inline explicit QTextLength(Type type, qreal value);
92 
93  inline Type type() const { return lengthType; }
94  inline qreal value(qreal maximumLength) const
95  {
96  switch (lengthType) {
97  case FixedLength: return fixedValueOrPercentage;
98  case VariableLength: return maximumLength;
99  case PercentageLength: return fixedValueOrPercentage * maximumLength / qreal(100);
100  }
101  return -1;
102  }
103 
104  inline qreal rawValue() const { return fixedValueOrPercentage; }
105 
106  inline bool operator==(const QTextLength &other) const
107  { return lengthType == other.lengthType
108  && qFuzzyCompare(fixedValueOrPercentage, other.fixedValueOrPercentage); }
109  inline bool operator!=(const QTextLength &other) const
110  { return lengthType != other.lengthType
111  || !qFuzzyCompare(fixedValueOrPercentage, other.fixedValueOrPercentage); }
112  operator QVariant() const;
113 
114 private:
119 };
120 
121 inline QTextLength::QTextLength(Type atype, qreal avalue)
122  : lengthType(atype), fixedValueOrPercentage(avalue) {}
123 
124 #ifndef QT_NO_DATASTREAM
127 #endif
128 
130 {
131  Q_GADGET
133 public:
134  enum FormatType {
135  InvalidFormat = -1,
136  BlockFormat = 1,
137  CharFormat = 2,
138  ListFormat = 3,
139  TableFormat = 4,
140  FrameFormat = 5,
141 
142  UserFormat = 100
143  };
144 
145  enum Property {
146  ObjectIndex = 0x0,
147 
148  // paragraph and char
149  CssFloat = 0x0800,
150  LayoutDirection = 0x0801,
151 
152  OutlinePen = 0x810,
153  BackgroundBrush = 0x820,
154  ForegroundBrush = 0x821,
155  // Internal to qtextlayout.cpp: ObjectSelectionBrush = 0x822
156  BackgroundImageUrl = 0x823,
157 
158  // paragraph
159  BlockAlignment = 0x1010,
160  BlockTopMargin = 0x1030,
161  BlockBottomMargin = 0x1031,
162  BlockLeftMargin = 0x1032,
163  BlockRightMargin = 0x1033,
164  TextIndent = 0x1034,
165  TabPositions = 0x1035,
166  BlockIndent = 0x1040,
167  LineHeight = 0x1048,
168  LineHeightType = 0x1049,
169  BlockNonBreakableLines = 0x1050,
170  BlockTrailingHorizontalRulerWidth = 0x1060,
171 
172  // character properties
173  FirstFontProperty = 0x1FE0,
174  FontCapitalization = FirstFontProperty,
175  FontLetterSpacing = 0x1FE1,
176  FontWordSpacing = 0x1FE2,
177  FontStyleHint = 0x1FE3,
178  FontStyleStrategy = 0x1FE4,
179  FontKerning = 0x1FE5,
180  FontHintingPreference = 0x1FE6,
181  FontFamily = 0x2000,
182  FontPointSize = 0x2001,
183  FontSizeAdjustment = 0x2002,
184  FontSizeIncrement = FontSizeAdjustment, // old name, compat
185  FontWeight = 0x2003,
186  FontItalic = 0x2004,
187  FontUnderline = 0x2005, // deprecated, use TextUnderlineStyle instead
188  FontOverline = 0x2006,
189  FontStrikeOut = 0x2007,
190  FontFixedPitch = 0x2008,
191  FontPixelSize = 0x2009,
192  LastFontProperty = FontPixelSize,
193 
194  TextUnderlineColor = 0x2010,
195  TextVerticalAlignment = 0x2021,
196  TextOutline = 0x2022,
198  TextToolTip = 0x2024,
199 
200  IsAnchor = 0x2030,
201  AnchorHref = 0x2031,
202  AnchorName = 0x2032,
203  ObjectType = 0x2f00,
204 
205  // list properties
206  ListStyle = 0x3000,
207  ListIndent = 0x3001,
208  ListNumberPrefix = 0x3002,
209  ListNumberSuffix = 0x3003,
210 
211  // table and frame properties
212  FrameBorder = 0x4000,
213  FrameMargin = 0x4001,
214  FramePadding = 0x4002,
215  FrameWidth = 0x4003,
216  FrameHeight = 0x4004,
217  FrameTopMargin = 0x4005,
218  FrameBottomMargin = 0x4006,
219  FrameLeftMargin = 0x4007,
220  FrameRightMargin = 0x4008,
221  FrameBorderBrush = 0x4009,
222  FrameBorderStyle = 0x4010,
223 
224  TableColumns = 0x4100,
225  TableColumnWidthConstraints = 0x4101,
226  TableCellSpacing = 0x4102,
227  TableCellPadding = 0x4103,
228  TableHeaderRowCount = 0x4104,
229 
230  // table cell properties
231  TableCellRowSpan = 0x4810,
232  TableCellColumnSpan = 0x4811,
233 
234  TableCellTopPadding = 0x4812,
235  TableCellBottomPadding = 0x4813,
236  TableCellLeftPadding = 0x4814,
237  TableCellRightPadding = 0x4815,
238 
239  // image properties
240  ImageName = 0x5000,
241  ImageWidth = 0x5010,
242  ImageHeight = 0x5011,
243 
244  // internal
245  /*
246  SuppressText = 0x5012,
247  SuppressBackground = 0x513
248  */
249 
250  // selection properties
251  FullWidthSelection = 0x06000,
252 
253  // page break properties
254  PageBreakPolicy = 0x7000,
255 
256  // --
257  UserProperty = 0x100000
258  };
259 
260  enum ObjectTypes {
265 
266  UserObject = 0x1000
267  };
268 
270  PageBreak_Auto = 0,
271  PageBreak_AlwaysBefore = 0x001,
272  PageBreak_AlwaysAfter = 0x010
273  // PageBreak_AlwaysInside = 0x100
274  };
275  Q_DECLARE_FLAGS(PageBreakFlags, PageBreakFlag)
276 
277  QTextFormat();
278 
279  explicit QTextFormat(int type);
280 
281  QTextFormat(const QTextFormat &rhs);
282  QTextFormat &operator=(const QTextFormat &rhs);
283  ~QTextFormat();
284 
285  void merge(const QTextFormat &other);
286 
287  inline bool isValid() const { return type() != InvalidFormat; }
288 
289  int type() const;
290 
291  int objectIndex() const;
292  void setObjectIndex(int object);
293 
294  QVariant property(int propertyId) const;
295  void setProperty(int propertyId, const QVariant &value);
296  void clearProperty(int propertyId);
297  bool hasProperty(int propertyId) const;
298 
299  bool boolProperty(int propertyId) const;
300  int intProperty(int propertyId) const;
301  qreal doubleProperty(int propertyId) const;
302  QString stringProperty(int propertyId) const;
303  QColor colorProperty(int propertyId) const;
304  QPen penProperty(int propertyId) const;
305  QBrush brushProperty(int propertyId) const;
306  QTextLength lengthProperty(int propertyId) const;
307  QVector<QTextLength> lengthVectorProperty(int propertyId) const;
308 
309  void setProperty(int propertyId, const QVector<QTextLength> &lengths);
310 
312  int propertyCount() const;
313 
314  inline void setObjectType(int type);
315  inline int objectType() const
316  { return intProperty(ObjectType); }
317 
318  inline bool isCharFormat() const { return type() == CharFormat; }
319  inline bool isBlockFormat() const { return type() == BlockFormat; }
320  inline bool isListFormat() const { return type() == ListFormat; }
321  inline bool isFrameFormat() const { return type() == FrameFormat; }
322  inline bool isImageFormat() const { return type() == CharFormat && objectType() == ImageObject; }
323  inline bool isTableFormat() const { return type() == FrameFormat && objectType() == TableObject; }
324  inline bool isTableCellFormat() const { return type() == CharFormat && objectType() == TableCellObject; }
325 
326  QTextBlockFormat toBlockFormat() const;
327  QTextCharFormat toCharFormat() const;
328  QTextListFormat toListFormat() const;
329  QTextTableFormat toTableFormat() const;
330  QTextFrameFormat toFrameFormat() const;
331  QTextImageFormat toImageFormat() const;
332  QTextTableCellFormat toTableCellFormat() const;
333 
334  bool operator==(const QTextFormat &rhs) const;
335  inline bool operator!=(const QTextFormat &rhs) const { return !operator==(rhs); }
336  operator QVariant() const;
337 
339  { setProperty(QTextFormat::LayoutDirection, direction); }
341  { return Qt::LayoutDirection(intProperty(QTextFormat::LayoutDirection)); }
342 
343  inline void setBackground(const QBrush &brush)
344  { setProperty(BackgroundBrush, brush); }
345  inline QBrush background() const
346  { return brushProperty(BackgroundBrush); }
347  inline void clearBackground()
348  { clearProperty(BackgroundBrush); }
349 
350  inline void setForeground(const QBrush &brush)
351  { setProperty(ForegroundBrush, brush); }
352  inline QBrush foreground() const
353  { return brushProperty(ForegroundBrush); }
354  inline void clearForeground()
355  { clearProperty(ForegroundBrush); }
356 
357 private:
360 
361  friend class QTextFormatCollection;
362  friend class QTextCharFormat;
365 };
366 
367 inline void QTextFormat::setObjectType(int atype)
368 { setProperty(ObjectType, atype); }
369 
370 Q_DECLARE_OPERATORS_FOR_FLAGS(QTextFormat::PageBreakFlags)
371 
373 {
374 public:
383  };
384  enum UnderlineStyle { // keep in sync with Qt::PenStyle!
393  };
394 
395  QTextCharFormat();
396 
397  bool isValid() const { return isCharFormat(); }
398  void setFont(const QFont &font);
399  QFont font() const;
400 
401  inline void setFontFamily(const QString &family)
402  { setProperty(FontFamily, family); }
403  inline QString fontFamily() const
404  { return stringProperty(FontFamily); }
405 
406  inline void setFontPointSize(qreal size)
407  { setProperty(FontPointSize, size); }
408  inline qreal fontPointSize() const
409  { return doubleProperty(FontPointSize); }
410 
411  inline void setFontWeight(int weight)
412  { if (weight == QFont::Normal) weight = 0; setProperty(FontWeight, weight); }
413  inline int fontWeight() const
414  { int weight = intProperty(FontWeight); if (weight == 0) weight = QFont::Normal; return weight; }
415  inline void setFontItalic(bool italic)
416  { setProperty(FontItalic, italic); }
417  inline bool fontItalic() const
418  { return boolProperty(FontItalic); }
419  inline void setFontCapitalization(QFont::Capitalization capitalization)
420  { setProperty(FontCapitalization, capitalization); }
422  { return static_cast<QFont::Capitalization>(intProperty(FontCapitalization)); }
423  inline void setFontLetterSpacing(qreal spacing)
424  { setProperty(FontLetterSpacing, spacing); }
425  inline qreal fontLetterSpacing() const
426  { return doubleProperty(FontLetterSpacing); }
427  inline void setFontWordSpacing(qreal spacing)
428  { setProperty(FontWordSpacing, spacing); }
429  inline qreal fontWordSpacing() const
430  { return doubleProperty(FontWordSpacing); }
431 
432  inline void setFontUnderline(bool underline)
434  bool fontUnderline() const;
435 
436  inline void setFontOverline(bool overline)
437  { setProperty(FontOverline, overline); }
438  inline bool fontOverline() const
439  { return boolProperty(FontOverline); }
440 
441  inline void setFontStrikeOut(bool strikeOut)
442  { setProperty(FontStrikeOut, strikeOut); }
443  inline bool fontStrikeOut() const
444  { return boolProperty(FontStrikeOut); }
445 
446  inline void setUnderlineColor(const QColor &color)
447  { setProperty(TextUnderlineColor, color); }
448  inline QColor underlineColor() const
449  { return colorProperty(TextUnderlineColor); }
450 
451  inline void setFontFixedPitch(bool fixedPitch)
452  { setProperty(FontFixedPitch, fixedPitch); }
453  inline bool fontFixedPitch() const
454  { return boolProperty(FontFixedPitch); }
455 
459  { setProperty(FontStyleStrategy, strategy); }
461  { return static_cast<QFont::StyleHint>(intProperty(FontStyleHint)); }
463  { return static_cast<QFont::StyleStrategy>(intProperty(FontStyleStrategy)); }
464 
465  inline void setFontHintingPreference(QFont::HintingPreference hintingPreference)
466  {
467  setProperty(FontHintingPreference, hintingPreference);
468  }
469 
471  {
473  }
474 
475  inline void setFontKerning(bool enable)
476  { setProperty(FontKerning, enable); }
477  inline bool fontKerning() const
478  { return boolProperty(FontKerning); }
479 
480  void setUnderlineStyle(UnderlineStyle style);
482  { return static_cast<UnderlineStyle>(intProperty(TextUnderlineStyle)); }
483 
485  { setProperty(TextVerticalAlignment, alignment); }
487  { return static_cast<VerticalAlignment>(intProperty(TextVerticalAlignment)); }
488 
489  inline void setTextOutline(const QPen &pen)
490  { setProperty(TextOutline, pen); }
491  inline QPen textOutline() const
492  { return penProperty(TextOutline); }
493 
494  inline void setToolTip(const QString &tip)
495  { setProperty(TextToolTip, tip); }
496  inline QString toolTip() const
497  { return stringProperty(TextToolTip); }
498 
499  inline void setAnchor(bool anchor)
500  { setProperty(IsAnchor, anchor); }
501  inline bool isAnchor() const
502  { return boolProperty(IsAnchor); }
503 
504  inline void setAnchorHref(const QString &value)
505  { setProperty(AnchorHref, value); }
506  inline QString anchorHref() const
507  { return stringProperty(AnchorHref); }
508 
509  inline void setAnchorName(const QString &name)
510  { setAnchorNames(QStringList(name)); }
511  QString anchorName() const;
512 
513  inline void setAnchorNames(const QStringList &names)
514  { setProperty(AnchorName, names); }
515  QStringList anchorNames() const;
516 
517  inline void setTableCellRowSpan(int tableCellRowSpan);
518  inline int tableCellRowSpan() const
519  { int s = intProperty(TableCellRowSpan); if (s == 0) s = 1; return s; }
521  inline int tableCellColumnSpan() const
522  { int s = intProperty(TableCellColumnSpan); if (s == 0) s = 1; return s; }
523 
524 protected:
525  explicit QTextCharFormat(const QTextFormat &fmt);
526  friend class QTextFormat;
527 };
528 
529 inline void QTextCharFormat::setTableCellRowSpan(int _tableCellRowSpan)
530 {
531  if (_tableCellRowSpan <= 1)
532  clearProperty(TableCellRowSpan); // the getter will return 1 here.
533  else
534  setProperty(TableCellRowSpan, _tableCellRowSpan);
535 }
536 
537 inline void QTextCharFormat::setTableCellColumnSpan(int _tableCellColumnSpan)
538 {
539  if (_tableCellColumnSpan <= 1)
540  clearProperty(TableCellColumnSpan); // the getter will return 1 here.
541  else
542  setProperty(TableCellColumnSpan, _tableCellColumnSpan);
543 }
544 
546 {
547 public:
549  SingleHeight = 0,
550  ProportionalHeight = 1,
551  FixedHeight = 2,
553  LineDistanceHeight = 4
554  };
555 
557 
558  bool isValid() const { return isBlockFormat(); }
559 
560  inline void setAlignment(Qt::Alignment alignment);
561  inline Qt::Alignment alignment() const
562  { int a = intProperty(BlockAlignment); if (a == 0) a = Qt::AlignLeft; return QFlag(a); }
563 
564  inline void setTopMargin(qreal margin)
565  { setProperty(BlockTopMargin, margin); }
566  inline qreal topMargin() const
567  { return doubleProperty(BlockTopMargin); }
568 
569  inline void setBottomMargin(qreal margin)
570  { setProperty(BlockBottomMargin, margin); }
571  inline qreal bottomMargin() const
572  { return doubleProperty(BlockBottomMargin); }
573 
574  inline void setLeftMargin(qreal margin)
575  { setProperty(BlockLeftMargin, margin); }
576  inline qreal leftMargin() const
577  { return doubleProperty(BlockLeftMargin); }
578 
579  inline void setRightMargin(qreal margin)
580  { setProperty(BlockRightMargin, margin); }
581  inline qreal rightMargin() const
582  { return doubleProperty(BlockRightMargin); }
583 
584  inline void setTextIndent(qreal aindent)
585  { setProperty(TextIndent, aindent); }
586  inline qreal textIndent() const
587  { return doubleProperty(TextIndent); }
588 
589  inline void setIndent(int indent);
590  inline int indent() const
591  { return intProperty(BlockIndent); }
592 
593  inline void setLineHeight(qreal height, int heightType)
594  { setProperty(LineHeight, height); setProperty(LineHeightType, heightType); }
595  inline qreal lineHeight(qreal scriptLineHeight, qreal scaling) const;
596  inline qreal lineHeight() const
597  { return doubleProperty(LineHeight); }
598  inline int lineHeightType() const
599  { return intProperty(LineHeightType); }
600 
601  inline void setNonBreakableLines(bool b)
602  { setProperty(BlockNonBreakableLines, b); }
603  inline bool nonBreakableLines() const
604  { return boolProperty(BlockNonBreakableLines); }
605 
606  inline void setPageBreakPolicy(PageBreakFlags flags)
607  { setProperty(PageBreakPolicy, int(flags)); }
608  inline PageBreakFlags pageBreakPolicy() const
609  { return PageBreakFlags(intProperty(PageBreakPolicy)); }
610 
611  void setTabPositions(const QList<QTextOption::Tab> &tabs);
612  QList<QTextOption::Tab> tabPositions() const;
613 
614 protected:
615  explicit QTextBlockFormat(const QTextFormat &fmt);
616  friend class QTextFormat;
617 };
618 
619 inline void QTextBlockFormat::setAlignment(Qt::Alignment aalignment)
620 { setProperty(BlockAlignment, int(aalignment)); }
621 
622 inline void QTextBlockFormat::setIndent(int aindent)
623 { setProperty(BlockIndent, aindent); }
624 
625 inline qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling = 1.0) const
626 {
627  switch(intProperty(LineHeightType)) {
628  case SingleHeight:
629  return(scriptLineHeight);
630  case ProportionalHeight:
631  return(scriptLineHeight * doubleProperty(LineHeight) / 100.0);
632  case FixedHeight:
633  return(doubleProperty(LineHeight) * scaling);
634  case MinimumHeight:
635  return(qMax(scriptLineHeight, doubleProperty(LineHeight) * scaling));
636  case LineDistanceHeight:
637  return(scriptLineHeight + doubleProperty(LineHeight) * scaling);
638  }
639  return(0);
640 }
641 
643 {
644 public:
645  QTextListFormat();
646 
647  bool isValid() const { return isListFormat(); }
648 
649  enum Style {
650  ListDisc = -1,
651  ListCircle = -2,
652  ListSquare = -3,
653  ListDecimal = -4,
654  ListLowerAlpha = -5,
655  ListUpperAlpha = -6,
656  ListLowerRoman = -7,
657  ListUpperRoman = -8,
658  ListStyleUndefined = 0
659  };
660 
661  inline void setStyle(Style style);
662  inline Style style() const
663  { return static_cast<Style>(intProperty(ListStyle)); }
664 
665  inline void setIndent(int indent);
666  inline int indent() const
667  { return intProperty(ListIndent); }
668 
669  inline void setNumberPrefix(const QString &numberPrefix);
670  inline QString numberPrefix() const
671  { return stringProperty(ListNumberPrefix); }
672 
673  inline void setNumberSuffix(const QString &numberSuffix);
674  inline QString numberSuffix() const
675  { return stringProperty(ListNumberSuffix); }
676 
677 protected:
678  explicit QTextListFormat(const QTextFormat &fmt);
679  friend class QTextFormat;
680 };
681 
682 inline void QTextListFormat::setStyle(Style astyle)
683 { setProperty(ListStyle, astyle); }
684 
685 inline void QTextListFormat::setIndent(int aindent)
686 { setProperty(ListIndent, aindent); }
687 
690 
693 
695 {
696 public:
698 
699  bool isValid() const { return isImageFormat(); }
700 
701  inline void setName(const QString &name);
702  inline QString name() const
703  { return stringProperty(ImageName); }
704 
705  inline void setWidth(qreal width);
706  inline qreal width() const
707  { return doubleProperty(ImageWidth); }
708 
709  inline void setHeight(qreal height);
710  inline qreal height() const
711  { return doubleProperty(ImageHeight); }
712 
713 protected:
714  explicit QTextImageFormat(const QTextFormat &format);
715  friend class QTextFormat;
716 };
717 
718 inline void QTextImageFormat::setName(const QString &aname)
719 { setProperty(ImageName, aname); }
720 
722 { setProperty(ImageWidth, awidth); }
723 
724 inline void QTextImageFormat::setHeight(qreal aheight)
725 { setProperty(ImageHeight, aheight); }
726 
728 {
729 public:
731 
732  bool isValid() const { return isFrameFormat(); }
733 
734  enum Position {
737  FloatRight
738  // ######
739 // Absolute
740  };
741 
742  enum BorderStyle {
754  };
755 
756  inline void setPosition(Position f)
757  { setProperty(CssFloat, f); }
758  inline Position position() const
759  { return static_cast<Position>(intProperty(CssFloat)); }
760 
761  inline void setBorder(qreal border);
762  inline qreal border() const
763  { return doubleProperty(FrameBorder); }
764 
765  inline void setBorderBrush(const QBrush &brush)
766  { setProperty(FrameBorderBrush, brush); }
767  inline QBrush borderBrush() const
768  { return brushProperty(FrameBorderBrush); }
769 
770  inline void setBorderStyle(BorderStyle style)
771  { setProperty(FrameBorderStyle, style); }
772  inline BorderStyle borderStyle() const
773  { return static_cast<BorderStyle>(intProperty(FrameBorderStyle)); }
774 
775  void setMargin(qreal margin);
776  inline qreal margin() const
777  { return doubleProperty(FrameMargin); }
778 
779  inline void setTopMargin(qreal margin);
780  qreal topMargin() const;
781 
782  inline void setBottomMargin(qreal margin);
783  qreal bottomMargin() const;
784 
785  inline void setLeftMargin(qreal margin);
786  qreal leftMargin() const;
787 
788  inline void setRightMargin(qreal margin);
789  qreal rightMargin() const;
790 
791  inline void setPadding(qreal padding);
792  inline qreal padding() const
793  { return doubleProperty(FramePadding); }
794 
795  inline void setWidth(qreal width);
796  inline void setWidth(const QTextLength &length)
797  { setProperty(FrameWidth, length); }
798  inline QTextLength width() const
799  { return lengthProperty(FrameWidth); }
800 
801  inline void setHeight(qreal height);
802  inline void setHeight(const QTextLength &height);
803  inline QTextLength height() const
804  { return lengthProperty(FrameHeight); }
805 
806  inline void setPageBreakPolicy(PageBreakFlags flags)
807  { setProperty(PageBreakPolicy, int(flags)); }
808  inline PageBreakFlags pageBreakPolicy() const
809  { return PageBreakFlags(intProperty(PageBreakPolicy)); }
810 
811 protected:
812  explicit QTextFrameFormat(const QTextFormat &fmt);
813  friend class QTextFormat;
814 };
815 
816 inline void QTextFrameFormat::setBorder(qreal aborder)
817 { setProperty(FrameBorder, aborder); }
818 
819 inline void QTextFrameFormat::setPadding(qreal apadding)
820 { setProperty(FramePadding, apadding); }
821 
824 
825 inline void QTextFrameFormat::setHeight(qreal aheight)
827 inline void QTextFrameFormat::setHeight(const QTextLength &aheight)
828 { setProperty(FrameHeight, aheight); }
829 
831 { setProperty(FrameTopMargin, amargin); }
832 
834 { setProperty(FrameBottomMargin, amargin); }
835 
837 { setProperty(FrameLeftMargin, amargin); }
838 
840 { setProperty(FrameRightMargin, amargin); }
841 
843 {
844 public:
846 
847  inline bool isValid() const { return isTableFormat(); }
848 
849  inline int columns() const
850  { int cols = intProperty(TableColumns); if (cols == 0) cols = 1; return cols; }
851  inline void setColumns(int columns);
852 
853  inline void setColumnWidthConstraints(const QVector<QTextLength> &constraints)
854  { setProperty(TableColumnWidthConstraints, constraints); }
855 
857  { return lengthVectorProperty(TableColumnWidthConstraints); }
858 
860  { clearProperty(TableColumnWidthConstraints); }
861 
862  inline qreal cellSpacing() const
863  { return doubleProperty(TableCellSpacing); }
864  inline void setCellSpacing(qreal spacing)
865  { setProperty(TableCellSpacing, spacing); }
866 
867  inline qreal cellPadding() const
868  { return doubleProperty(TableCellPadding); }
869  inline void setCellPadding(qreal padding);
870 
871  inline void setAlignment(Qt::Alignment alignment);
872  inline Qt::Alignment alignment() const
873  { return QFlag(intProperty(BlockAlignment)); }
874 
875  inline void setHeaderRowCount(int count)
876  { setProperty(TableHeaderRowCount, count); }
877  inline int headerRowCount() const
878  { return intProperty(TableHeaderRowCount); }
879 
880 protected:
881  explicit QTextTableFormat(const QTextFormat &fmt);
882  friend class QTextFormat;
883 };
884 
885 inline void QTextTableFormat::setColumns(int acolumns)
886 {
887  if (acolumns == 1)
888  acolumns = 0;
889  setProperty(TableColumns, acolumns);
890 }
891 
893 { setProperty(TableCellPadding, apadding); }
894 
895 inline void QTextTableFormat::setAlignment(Qt::Alignment aalignment)
896 { setProperty(BlockAlignment, int(aalignment)); }
897 
899 {
900 public:
902 
903  inline bool isValid() const { return isTableCellFormat(); }
904 
905  inline void setTopPadding(qreal padding);
906  inline qreal topPadding() const;
907 
908  inline void setBottomPadding(qreal padding);
909  inline qreal bottomPadding() const;
910 
911  inline void setLeftPadding(qreal padding);
912  inline qreal leftPadding() const;
913 
914  inline void setRightPadding(qreal padding);
915  inline qreal rightPadding() const;
916 
917  inline void setPadding(qreal padding);
918 
919 protected:
920  explicit QTextTableCellFormat(const QTextFormat &fmt);
921  friend class QTextFormat;
922 };
923 
925 {
927 }
928 
930 {
932 }
933 
935 {
937 }
938 
940 {
942 }
943 
945 {
947 }
948 
950 {
952 }
953 
955 {
957 }
958 
960 {
962 }
963 
965 {
966  setTopPadding(padding);
967  setBottomPadding(padding);
968  setLeftPadding(padding);
969  setRightPadding(padding);
970 }
971 
972 
974 
976 
977 #endif // QTEXTFORMAT_H
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
void setRightPadding(qreal padding)
Sets the right padding of the table cell.
Definition: qtextformat.h:954
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
void setFontKerning(bool enable)
Enables kerning for this font if enable is true; otherwise disables it.
Definition: qtextformat.h:475
qreal cellSpacing() const
Returns the table&#39;s cell spacing.
Definition: qtextformat.h:862
QStringList anchorNames() const
Returns the anchor names associated with this text format, or an empty string list if none has been s...
QFont font() const
Returns the font for this character format.
qreal rightPadding() const
Gets the right padding of the table cell.
Definition: qtextformat.h:959
HintingPreference
This enum describes the different levels of hinting that can be applied to glyphs to improve legibili...
Definition: qfont.h:96
void setTextOutline(const QPen &pen)
Sets the pen used to draw the outlines of characters to the given pen.
Definition: qtextformat.h:489
void setBorderBrush(const QBrush &brush)
Sets the brush used for the frame&#39;s border.
Definition: qtextformat.h:765
int type
Definition: qmetatype.cpp:239
void setFontItalic(bool italic)
If italic is true, sets the text format&#39;s font to be italic; otherwise the font will be non-italic...
Definition: qtextformat.h:415
The QTextCharFormat class provides formatting information for characters in a QTextDocument.
Definition: qtextformat.h:372
double qreal
Definition: qglobal.h:1193
bool isFrameFormat() const
Returns true if this text format is a FrameFormat; otherwise returns false.
Definition: qtextformat.h:321
The QTextListFormat class provides formatting information for lists in a QTextDocument.
Definition: qtextformat.h:642
QFont::StyleStrategy fontStyleStrategy() const
Returns the current font style strategy.
Definition: qtextformat.h:462
QTextLength()
Constructs a new length object which represents a variable size.
Definition: qtextformat.h:89
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
int qint32
Definition: qglobal.h:937
int columns() const
Returns the number of columns specified by the table format.
Definition: qtextformat.h:849
#define QT_MODULE(x)
Definition: qglobal.h:2783
void setLineHeight(qreal height, int heightType)
Sets the line height for the paragraph to the value given by height which is dependent on heightType ...
Definition: qtextformat.h:593
void setPadding(qreal padding)
Sets the width of the frame&#39;s internal padding in pixels.
Definition: qtextformat.h:819
bool fontStrikeOut() const
Returns true if the text format&#39;s font is struck out (has a horizontal line drawn through it); otherw...
Definition: qtextformat.h:443
void setToolTip(const QString &tip)
Sets the tool tip for a fragment of text to the given text.
Definition: qtextformat.h:494
void setBorder(qreal border)
Sets the width (in pixels) of the frame&#39;s border.
Definition: qtextformat.h:816
int headerRowCount() const
Returns the number of rows in the table that define the header.
Definition: qtextformat.h:877
void setFontStrikeOut(bool strikeOut)
If strikeOut is true, sets the text format&#39;s font with strike-out enabled (with a horizontal line thr...
Definition: qtextformat.h:441
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
Definition: qglobal.h:2348
The QFlag class is a helper data type for QFlags.
Definition: qglobal.h:2289
QColor colorProperty(int propertyId) const
Returns the value of the property given by propertyId; if the property isn&#39;t of QVariant::Color type...
void setBorderStyle(BorderStyle style)
Sets the style of the frame&#39;s border.
Definition: qtextformat.h:770
void setProperty(int propertyId, const QVariant &value)
Sets the property specified by the propertyId to the given value.
QColor underlineColor() const
Returns the color used to underline the characters with this format.
Definition: qtextformat.h:448
Type type() const
Returns the type of this length object.
Definition: qtextformat.h:93
ObjectTypes
This enum describes what kind of QTextObject this format is associated with.
Definition: qtextformat.h:260
Position
This enum describes how a frame is located relative to the surrounding text.
Definition: qtextformat.h:734
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
PageBreakFlags pageBreakPolicy() const
Returns the currently set page break policy for the paragraph.
Definition: qtextformat.h:608
friend Q_GUI_EXPORT QDataStream & operator>>(QDataStream &, QTextLength &)
QFont::HintingPreference fontHintingPreference() const
Returns the hinting preference set for this text format.
Definition: qtextformat.h:470
void clearBackground()
Clears the brush used to paint the document&#39;s background.
Definition: qtextformat.h:347
void setIndent(int indent)
Sets the list format&#39;s indentation.
Definition: qtextformat.h:685
void setFontOverline(bool overline)
If overline is true, sets the text format&#39;s font to be overlined; otherwise the font is displayed non...
Definition: qtextformat.h:436
void setVerticalAlignment(VerticalAlignment alignment)
Sets the vertical alignment used for the characters with this format to the alignment specified...
Definition: qtextformat.h:484
void setFont(const QFont &font)
Sets the text format&#39;s font.
void setFontStyleStrategy(QFont::StyleStrategy strategy)
Sets the font style strategy.
Definition: qtextformat.h:458
void setWidth(qreal width)
Convenience method that sets the width of the frame&#39;s border rectangle&#39;s width to the specified fixed...
Definition: qtextformat.h:822
void setCellPadding(qreal padding)
Sets the cell padding for the table.
Definition: qtextformat.h:892
static Q_DECL_CONSTEXPR bool qFuzzyCompare(double p1, double p2)
Definition: qglobal.h:2030
bool isValid() const
Returns true if this block format is valid; otherwise returns false.
Definition: qtextformat.h:558
QString anchorName() const
This function is deprecated.
bool isValid() const
Returns true if the format description is valid; otherwise returns false.
Definition: qtextformat.h:732
void setTextIndent(qreal aindent)
Sets the indent for the first line in the block.
Definition: qtextformat.h:584
void setFontFixedPitch(bool fixedPitch)
If fixedPitch is true, sets the text format&#39;s font to be fixed pitch; otherwise a non-fixed pitch fon...
Definition: qtextformat.h:451
long ASN1_INTEGER_get ASN1_INTEGER * a
Type
This enum describes the different types a length object can have.
Definition: qtextformat.h:87
QTextCharFormat()
Constructs a new character format object.
QString anchorHref() const
Returns the text format&#39;s hypertext link, or an empty string if none has been set.
Definition: qtextformat.h:506
void setBackground(const QBrush &brush)
Sets the brush use to paint the document&#39;s background to the brush specified.
Definition: qtextformat.h:343
void setTableCellRowSpan(int tableCellRowSpan)
If this character format is applied to characters in a table cell, the cell will span tableCellRowSpa...
Definition: qtextformat.h:529
The QString class provides a Unicode character string.
Definition: qstring.h:83
qreal height() const
Returns the height of the rectangle occupied by the image.
Definition: qtextformat.h:710
bool isValid() const
Returns true if this character format is valid; otherwise returns false.
Definition: qtextformat.h:397
qreal topMargin() const
Returns the paragraph&#39;s top margin.
Definition: qtextformat.h:566
void setLeftPadding(qreal padding)
Sets the left padding of the table cell.
Definition: qtextformat.h:944
int indent() const
Returns the paragraph&#39;s indent.
Definition: qtextformat.h:590
qreal rightMargin() const
Returns the paragraph&#39;s right margin.
Definition: qtextformat.h:581
Capitalization
Rendering option for text this font applies to.
Definition: qfont.h:129
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64
LineHeightTypes
This enum describes the various types of line spacing support paragraphs can have.
Definition: qtextformat.h:548
Qt::Alignment alignment() const
Returns the paragraph&#39;s alignment.
Definition: qtextformat.h:561
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
void clearForeground()
Clears the brush used to paint the document&#39;s foreground.
Definition: qtextformat.h:354
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
Qt::LayoutDirection layoutDirection() const
Returns the document&#39;s layout direction.
Definition: qtextformat.h:340
bool isValid() const
Returns true if this image format is valid; otherwise returns false.
Definition: qtextformat.h:699
bool isValid() const
Returns true if this table format is valid; otherwise returns false.
Definition: qtextformat.h:847
void setColumnWidthConstraints(const QVector< QTextLength > &constraints)
Sets the column width constraints for the table.
Definition: qtextformat.h:853
void setTopMargin(qreal margin)
Sets the paragraph&#39;s top margin.
Definition: qtextformat.h:564
void setFontWeight(int weight)
Sets the text format&#39;s font weight to weight.
Definition: qtextformat.h:411
void setAnchorName(const QString &name)
This function is deprecated.
Definition: qtextformat.h:509
void setAnchorNames(const QStringList &names)
Sets the text format&#39;s anchor names.
Definition: qtextformat.h:513
#define Q_ENUMS(x)
Definition: qobjectdefs.h:84
void setPosition(Position f)
Sets the policy for positioning frames with this frame format.
Definition: qtextformat.h:756
Position position() const
Returns the positioning policy for frames with this frame format.
Definition: qtextformat.h:758
void setTopMargin(qreal margin)
Sets the frame&#39;s top margin in pixels.
Definition: qtextformat.h:830
qreal padding() const
Returns the width of the frame&#39;s internal padding in pixels.
Definition: qtextformat.h:792
void setTableCellColumnSpan(int tableCellColumnSpan)
If this character format is applied to characters in a table cell, the cell will span tableCellColumn...
Definition: qtextformat.h:537
void setLeftMargin(qreal margin)
Sets the paragraph&#39;s left margin.
Definition: qtextformat.h:574
VerticalAlignment
This enum describes the ways that adjacent characters can be vertically aligned.
Definition: qtextformat.h:375
Qt::Alignment alignment() const
Returns the table&#39;s alignment.
Definition: qtextformat.h:872
void setBottomMargin(qreal margin)
Sets the paragraph&#39;s bottom margin.
Definition: qtextformat.h:569
The QTextImageFormat class provides formatting information for images in a QTextDocument.
Definition: qtextformat.h:694
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Style style() const
Returns the list format&#39;s style.
Definition: qtextformat.h:662
int objectType() const
Returns the text format&#39;s object type.
Definition: qtextformat.h:315
UnderlineStyle underlineStyle() const
Returns the style of underlining the text.
Definition: qtextformat.h:481
UnderlineStyle
This enum describes the different ways drawing underlined text.
Definition: qtextformat.h:384
bool fontOverline() const
Returns true if the text format&#39;s font is overlined; otherwise returns false.
Definition: qtextformat.h:438
void setBottomPadding(qreal padding)
Sets the bottom padding of the table cell.
Definition: qtextformat.h:934
qreal margin() const
Returns the width of the frame&#39;s external margin in pixels.
Definition: qtextformat.h:776
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
Definition: qglobal.h:2355
void setHeaderRowCount(int count)
Declares the first count rows of the table as table header.
Definition: qtextformat.h:875
void setPageBreakPolicy(PageBreakFlags flags)
Sets the page break policy for the frame/table to policy.
Definition: qtextformat.h:806
bool isAnchor() const
Returns true if the text is formatted as an anchor; otherwise returns false.
Definition: qtextformat.h:501
Property
This enum describes the different properties a format can have.
Definition: qtextformat.h:145
friend Q_GUI_EXPORT QDataStream & operator<<(QDataStream &, const QTextLength &)
void setFontCapitalization(QFont::Capitalization capitalization)
Sets the capitalization of the text that apppears in this font to capitalization. ...
Definition: qtextformat.h:419
QString numberSuffix() const
Returns the list format&#39;s number suffix.
Definition: qtextformat.h:674
Style
This enum describes the symbols used to decorate list items:
Definition: qtextformat.h:649
bool isListFormat() const
Returns true if this text format is a ListFormat; otherwise returns false.
Definition: qtextformat.h:320
The QTextFormat class provides formatting information for a QTextDocument.
Definition: qtextformat.h:129
PageBreakFlag
This enum describes how page breaking is performed when printing.
Definition: qtextformat.h:269
The QTextCursor class offers an API to access and modify QTextDocuments.
Definition: qtextcursor.h:70
void setName(const QString &name)
Sets the name of the image.
Definition: qtextformat.h:718
const char * name
bool isValid() const
Returns true if the format is valid (i.
Definition: qtextformat.h:287
FormatType
This enum describes the text item a QTextFormat object is formatting.
Definition: qtextformat.h:134
void setPageBreakPolicy(PageBreakFlags flags)
Sets the page break policy for the paragraph to policy.
Definition: qtextformat.h:606
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
Type lengthType
Definition: qtextformat.h:115
void setFontLetterSpacing(qreal spacing)
Sets the letter spacing of this format to the given spacing, in percent.
Definition: qtextformat.h:423
LayoutDirection
Definition: qnamespace.h:1580
int fontWeight() const
Returns the text format&#39;s font weight.
Definition: qtextformat.h:413
bool operator==(const QTextLength &other) const
Returns true if this text length is the same as the other text length.
Definition: qtextformat.h:106
QString toolTip() const
Returns the tool tip that is displayed for a fragment of text.
Definition: qtextformat.h:496
void setUnderlineColor(const QColor &color)
Sets the underline color used for the characters with this format to the color specified.
Definition: qtextformat.h:446
void setFontPointSize(qreal size)
Sets the text format&#39;s font size.
Definition: qtextformat.h:406
void setNumberPrefix(const QString &numberPrefix)
Sets the list format&#39;s number prefix to the string specified by numberPrefix.
Definition: qtextformat.h:688
void setWidth(const QTextLength &length)
Sets the frame&#39;s border rectangle&#39;s width.
Definition: qtextformat.h:796
bool isTableFormat() const
Returns true if this text format is a TableFormat; otherwise returns false.
Definition: qtextformat.h:323
QBrush background() const
Returns the brush used to paint the document&#39;s background.
Definition: qtextformat.h:345
void setNonBreakableLines(bool b)
If b is true, the lines in the paragraph are treated as non-breakable; otherwise they are breakable...
Definition: qtextformat.h:601
qreal lineHeight() const
This returns the LineHeight property for the paragraph.
Definition: qtextformat.h:596
qreal textIndent() const
Returns the paragraph&#39;s text indent.
Definition: qtextformat.h:586
void setObjectType(int type)
Sets the text format&#39;s object type to type.
Definition: qtextformat.h:367
int tableCellRowSpan() const
If this character format is applied to characters in a table cell, this function returns the number o...
Definition: qtextformat.h:518
qint32 format_type
Definition: qtextformat.h:359
QFont::StyleHint fontStyleHint() const
Returns the font style hint.
Definition: qtextformat.h:460
bool fontKerning() const
Returns true if the font kerning is enabled.
Definition: qtextformat.h:477
#define Q_GADGET
Definition: qobjectdefs.h:173
QTextLength height() const
Returns the height of the frame&#39;s border rectangle.
Definition: qtextformat.h:803
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
void setColumns(int columns)
Sets the number of columns required by the table format.
Definition: qtextformat.h:885
VerticalAlignment verticalAlignment() const
Returns the vertical alignment used for characters with this format.
Definition: qtextformat.h:486
QTextLength width() const
Returns the width of the frame&#39;s border rectangle.
Definition: qtextformat.h:798
void setAlignment(Qt::Alignment alignment)
Sets the paragraph&#39;s alignment.
Definition: qtextformat.h:619
bool nonBreakableLines() const
Returns true if the lines in the paragraph are non-breakable; otherwise returns false.
Definition: qtextformat.h:603
QString numberPrefix() const
Returns the list format&#39;s number prefix.
Definition: qtextformat.h:670
StyleHint
Style hints are used by the font matching algorithm to find an appropriate default family if a select...
Definition: qfont.h:69
void setCellSpacing(qreal spacing)
Sets the cell spacing for the table.
Definition: qtextformat.h:864
qreal fixedValueOrPercentage
Definition: qtextformat.h:116
void setAnchorHref(const QString &value)
Sets the hypertext link for the text format to the given value.
Definition: qtextformat.h:504
bool isValid() const
Returns true if this table cell format is valid; otherwise returns false.
Definition: qtextformat.h:903
void setNumberSuffix(const QString &numberSuffix)
Sets the list format&#39;s number suffix to the string specified by numberSuffix.
Definition: qtextformat.h:691
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
void setPadding(qreal padding)
Sets the left, right, top, and bottom padding of the table cell.
Definition: qtextformat.h:964
void setAlignment(Qt::Alignment alignment)
Sets the table&#39;s alignment.
Definition: qtextformat.h:895
QSharedDataPointer< QTextFormatPrivate > d
Definition: qtextformat.h:358
void setFontUnderline(bool underline)
If underline is true, sets the text format&#39;s font to be underlined; otherwise it is displayed non-und...
Definition: qtextformat.h:432
void setHeight(qreal height)
Sets the height of the rectangle occupied by the image.
Definition: qtextformat.h:724
void setLeftMargin(qreal margin)
Sets the frame&#39;s left margin in pixels.
Definition: qtextformat.h:836
void setHeight(qreal height)
Sets the frame&#39;s height.
Definition: qtextformat.h:825
qreal bottomMargin() const
Returns the paragraph&#39;s bottom margin.
Definition: qtextformat.h:571
qreal fontWordSpacing() const
Returns the current word spacing value.
Definition: qtextformat.h:429
bool isBlockFormat() const
Returns true if this text format is a BlockFormat; otherwise returns false.
Definition: qtextformat.h:319
int tableCellColumnSpan() const
If this character format is applied to characters in a table cell, this function returns the number o...
Definition: qtextformat.h:521
bool operator!=(const QTextLength &other) const
Returns true if this text length is different from the other text length.
Definition: qtextformat.h:109
void setTopPadding(qreal padding)
Sets the top padding of the table cell.
Definition: qtextformat.h:924
The QTextFrameFormat class provides formatting information for frames in a QTextDocument.
Definition: qtextformat.h:727
QBrush borderBrush() const
Returns the brush used for the frame&#39;s border.
Definition: qtextformat.h:767
The QTextLength class encapsulates the different types of length used in a QTextDocument.
Definition: qtextformat.h:84
The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument...
Definition: qtextformat.h:545
bool fontFixedPitch() const
Returns true if the text format&#39;s font is fixed pitch; otherwise returns false.
Definition: qtextformat.h:453
QBrush foreground() const
Returns the brush used to render foreground details, such as text, frame outlines, and table borders.
Definition: qtextformat.h:352
bool operator!=(const QTextFormat &rhs) const
Returns true if this text format is different from the other text format.
Definition: qtextformat.h:335
void setFontFamily(const QString &family)
Sets the text format&#39;s font family.
Definition: qtextformat.h:401
bool boolProperty(int propertyId) const
Returns the value of the property specified by propertyId.
const char * property
Definition: qwizard.cpp:138
void setRightMargin(qreal margin)
Sets the frame&#39;s right margin in pixels.
Definition: qtextformat.h:839
qreal value(qreal maximumLength) const
Returns the effective length, constrained by the type of the length object and the specified maximumL...
Definition: qtextformat.h:94
void clearColumnWidthConstraints()
Clears the column width constraints for the table.
Definition: qtextformat.h:859
void setIndent(int indent)
Sets the paragraph&#39;s indentation.
Definition: qtextformat.h:622
void setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy=QFont::PreferDefault)
Sets the font style hint and strategy.
Definition: qtextformat.h:456
bool isCharFormat() const
Returns true if this text format is a CharFormat; otherwise returns false.
Definition: qtextformat.h:318
StyleStrategy
The style strategy tells the font matching algorithm what type of fonts should be used to find an app...
Definition: qfont.h:81
static const QCssKnownValue properties[NumProperties - 1]
Definition: qcssparser.cpp:67
void setRightMargin(qreal margin)
Sets the paragraph&#39;s right margin.
Definition: qtextformat.h:579
void setFontWordSpacing(qreal spacing)
Sets the word spacing of this format to the given spacing, in pixels.
Definition: qtextformat.h:427
The QTextTableCellFormat class provides formatting information for table cells in a QTextDocument...
Definition: qtextformat.h:898
QString stringProperty(int propertyId) const
Returns the value of the property given by propertyId; if the property isn&#39;t of QVariant::String type...
void setAnchor(bool anchor)
If anchor is true, text with this format represents an anchor, and is formatted in the appropriate wa...
Definition: qtextformat.h:499
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
The QTextTableFormat class provides formatting information for tables in a QTextDocument.
Definition: qtextformat.h:842
int lineHeightType() const
This returns the LineHeightType property of the paragraph.
Definition: qtextformat.h:598
void setForeground(const QBrush &brush)
Sets the foreground brush to the specified brush.
Definition: qtextformat.h:350
PageBreakFlags pageBreakPolicy() const
Returns the currently set page break policy for the frame/table.
Definition: qtextformat.h:808
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71
void clearProperty(int propertyId)
Clears the value of the property given by propertyId.
qreal rawValue() const
Returns the constraint value that is specific for the type of the length.
Definition: qtextformat.h:104
qreal fontPointSize() const
Returns the font size used to display text in this format.
Definition: qtextformat.h:408
qreal topPadding() const
Gets the top padding of the table cell.
Definition: qtextformat.h:929
int intProperty(int propertyId) const
Returns the value of the property specified by propertyId.
bool isImageFormat() const
Returns true if this text format is an image format; otherwise returns false.
Definition: qtextformat.h:322
bool isTableCellFormat() const
Returns true if this text format is a TableCellFormat; otherwise returns false.
Definition: qtextformat.h:324
qreal border() const
Returns the width of the border in pixels.
Definition: qtextformat.h:762
void setBottomMargin(qreal margin)
Sets the frame&#39;s bottom margin in pixels.
Definition: qtextformat.h:833
#define class
qreal cellPadding() const
Returns the table&#39;s cell padding.
Definition: qtextformat.h:867
qreal fontLetterSpacing() const
Returns the current letter spacing percentage.
Definition: qtextformat.h:425
The QTextObject class is a base class for different kinds of objects that can group parts of a QTextD...
Definition: qtextobject.h:64
Q_GUI_EXPORT QDataStream & operator>>(QDataStream &, QTextLength &)
void setStyle(Style style)
Sets the list format&#39;s style.
Definition: qtextformat.h:682
qreal leftPadding() const
Gets the left padding of the table cell.
Definition: qtextformat.h:949
bool isValid() const
Returns true if this list format is valid; otherwise returns false.
Definition: qtextformat.h:647
QPen penProperty(int propertyId) const
Returns the value of the property given by propertyId; if the property isn&#39;t of QVariant::Pen type...
bool fontItalic() const
Returns true if the text format&#39;s font is italic; otherwise returns false.
Definition: qtextformat.h:417
QString fontFamily() const
Returns the text format&#39;s font family.
Definition: qtextformat.h:403
void setLayoutDirection(Qt::LayoutDirection direction)
Sets the document&#39;s layout direction to the specified direction.
Definition: qtextformat.h:338
void setUnderlineStyle(UnderlineStyle style)
Sets the style of underlining the text to style.
#define QT_END_HEADER
Definition: qglobal.h:137
qreal bottomPadding() const
Gets the bottom padding of the table cell.
Definition: qtextformat.h:939
void setWidth(qreal width)
Sets the width of the rectangle occupied by the image.
Definition: qtextformat.h:721
qreal doubleProperty(int propertyId) const
Returns the value of the property specified by propertyId.
QDataStream & operator<<(QDataStream &out, const QUrl &url)
Writes url url to the stream out and returns a reference to the stream.
Definition: qurl.cpp:6757
BorderStyle
This enum describes different border styles for the text frame.
Definition: qtextformat.h:742
int indent() const
Returns the list format&#39;s indentation.
Definition: qtextformat.h:666
qreal leftMargin() const
Returns the paragraph&#39;s left margin.
Definition: qtextformat.h:576
void setFontHintingPreference(QFont::HintingPreference hintingPreference)
Sets the hinting preference of the text format&#39;s font to be hintingPreference.
Definition: qtextformat.h:465
QFont::Capitalization fontCapitalization() const
Returns the current capitalization type of the font.
Definition: qtextformat.h:421
QVector< QTextLength > columnWidthConstraints() const
Returns a list of constraints used by this table format to control the appearance of columns in a tab...
Definition: qtextformat.h:856
QString name() const
Returns the name of the image.
Definition: qtextformat.h:702
bool fontUnderline() const
Returns true if the text format&#39;s font is underlined; otherwise returns false.
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67
QPen textOutline() const
Returns the pen used to draw the outlines of characters in this format.
Definition: qtextformat.h:491
Q_GUI_EXPORT QDataStream & operator<<(QDataStream &, const QTextLength &)
qreal width() const
Returns the width of the rectangle occupied by the image.
Definition: qtextformat.h:706
BorderStyle borderStyle() const
Returns the style of the frame&#39;s border.
Definition: qtextformat.h:772
Qt::LayoutDirection direction
QDataStream & operator>>(QDataStream &in, QUrl &url)
Reads a url into url from the stream in and returns a reference to the stream.
Definition: qurl.cpp:6774