1 | // Copyright (C) 2021 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QTEXTFORMAT_H |
5 | #define QTEXTFORMAT_H |
6 | |
7 | #include <QtGui/qbrush.h> |
8 | #include <QtGui/qcolor.h> |
9 | #include <QtGui/qfont.h> |
10 | #include <QtGui/qpen.h> |
11 | #include <QtGui/qtextoption.h> |
12 | #include <QtGui/qtguiglobal.h> |
13 | |
14 | #include <QtCore/qlist.h> |
15 | #include <QtCore/qshareddata.h> |
16 | #include <QtCore/qvariant.h> |
17 | |
18 | QT_BEGIN_NAMESPACE |
19 | |
20 | |
21 | class QString; |
22 | class QVariant; |
23 | class QFont; |
24 | |
25 | class QTextFormatCollection; |
26 | class QTextFormatPrivate; |
27 | class QTextBlockFormat; |
28 | class QTextCharFormat; |
29 | class QTextListFormat; |
30 | class QTextTableFormat; |
31 | class QTextFrameFormat; |
32 | class QTextImageFormat; |
33 | class QTextTableCellFormat; |
34 | class QTextFormat; |
35 | class QTextObject; |
36 | class QTextCursor; |
37 | class QTextDocument; |
38 | class QTextLength; |
39 | |
40 | #ifndef QT_NO_DEBUG_STREAM |
41 | Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextLength &); |
42 | #endif |
43 | |
44 | class Q_GUI_EXPORT QTextLength |
45 | { |
46 | public: |
47 | enum Type { VariableLength = 0, FixedLength, PercentageLength }; |
48 | |
49 | inline QTextLength() : lengthType(VariableLength), fixedValueOrPercentage(0) {} |
50 | |
51 | inline explicit QTextLength(Type type, qreal value); |
52 | |
53 | inline Type type() const { return lengthType; } |
54 | inline qreal value(qreal maximumLength) const |
55 | { |
56 | switch (lengthType) { |
57 | case FixedLength: return fixedValueOrPercentage; |
58 | case VariableLength: return maximumLength; |
59 | case PercentageLength: return fixedValueOrPercentage * maximumLength / qreal(100); |
60 | } |
61 | return -1; |
62 | } |
63 | |
64 | inline qreal rawValue() const { return fixedValueOrPercentage; } |
65 | |
66 | inline bool operator==(const QTextLength &other) const |
67 | { return lengthType == other.lengthType |
68 | && qFuzzyCompare(p1: fixedValueOrPercentage, p2: other.fixedValueOrPercentage); } |
69 | inline bool operator!=(const QTextLength &other) const |
70 | { return lengthType != other.lengthType |
71 | || !qFuzzyCompare(p1: fixedValueOrPercentage, p2: other.fixedValueOrPercentage); } |
72 | operator QVariant() const; |
73 | |
74 | private: |
75 | Type lengthType; |
76 | qreal fixedValueOrPercentage; |
77 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &); |
78 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &); |
79 | }; |
80 | Q_DECLARE_TYPEINFO(QTextLength, Q_PRIMITIVE_TYPE); |
81 | |
82 | inline QTextLength::QTextLength(Type atype, qreal avalue) |
83 | : lengthType(atype), fixedValueOrPercentage(avalue) {} |
84 | |
85 | #ifndef QT_NO_DEBUG_STREAM |
86 | Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextFormat &); |
87 | #endif |
88 | |
89 | class Q_GUI_EXPORT QTextFormat |
90 | { |
91 | Q_GADGET |
92 | public: |
93 | enum FormatType { |
94 | InvalidFormat = -1, |
95 | BlockFormat = 1, |
96 | CharFormat = 2, |
97 | ListFormat = 3, |
98 | FrameFormat = 5, |
99 | |
100 | UserFormat = 100 |
101 | }; |
102 | Q_ENUM(FormatType) |
103 | |
104 | enum Property { |
105 | ObjectIndex = 0x0, |
106 | |
107 | // paragraph and char |
108 | CssFloat = 0x0800, |
109 | LayoutDirection = 0x0801, |
110 | |
111 | OutlinePen = 0x810, |
112 | BackgroundBrush = 0x820, |
113 | ForegroundBrush = 0x821, |
114 | // Internal to qtextlayout.cpp: ObjectSelectionBrush = 0x822 |
115 | BackgroundImageUrl = 0x823, |
116 | |
117 | // paragraph |
118 | BlockAlignment = 0x1010, |
119 | BlockTopMargin = 0x1030, |
120 | BlockBottomMargin = 0x1031, |
121 | BlockLeftMargin = 0x1032, |
122 | BlockRightMargin = 0x1033, |
123 | TextIndent = 0x1034, |
124 | TabPositions = 0x1035, |
125 | BlockIndent = 0x1040, |
126 | LineHeight = 0x1048, |
127 | LineHeightType = 0x1049, |
128 | BlockNonBreakableLines = 0x1050, |
129 | BlockTrailingHorizontalRulerWidth = 0x1060, |
130 | HeadingLevel = 0x1070, |
131 | BlockQuoteLevel = 0x1080, |
132 | BlockCodeLanguage = 0x1090, |
133 | BlockCodeFence = 0x1091, |
134 | BlockMarker = 0x10A0, |
135 | |
136 | // character properties |
137 | FirstFontProperty = 0x1FE0, |
138 | FontCapitalization = FirstFontProperty, |
139 | FontLetterSpacing = 0x1FE1, |
140 | FontWordSpacing = 0x1FE2, |
141 | FontStyleHint = 0x1FE3, |
142 | FontStyleStrategy = 0x1FE4, |
143 | FontKerning = 0x1FE5, |
144 | FontHintingPreference = 0x1FE6, |
145 | FontFamilies = 0x1FE7, |
146 | FontStyleName = 0x1FE8, |
147 | FontLetterSpacingType = 0x1FE9, |
148 | FontStretch = 0x1FEA, |
149 | #if QT_DEPRECATED_SINCE(6, 0) |
150 | FontFamily = 0x2000, |
151 | #endif |
152 | FontPointSize = 0x2001, |
153 | FontSizeAdjustment = 0x2002, |
154 | FontSizeIncrement = FontSizeAdjustment, // old name, compat |
155 | FontWeight = 0x2003, |
156 | FontItalic = 0x2004, |
157 | FontUnderline = 0x2005, // deprecated, use TextUnderlineStyle instead |
158 | FontOverline = 0x2006, |
159 | FontStrikeOut = 0x2007, |
160 | FontFixedPitch = 0x2008, |
161 | FontPixelSize = 0x2009, |
162 | LastFontProperty = FontPixelSize, |
163 | |
164 | TextUnderlineColor = 0x2020, |
165 | TextVerticalAlignment = 0x2021, |
166 | TextOutline = 0x2022, |
167 | TextUnderlineStyle = 0x2023, |
168 | TextToolTip = 0x2024, |
169 | TextSuperScriptBaseline = 0x2025, |
170 | TextSubScriptBaseline = 0x2026, |
171 | TextBaselineOffset = 0x2027, |
172 | |
173 | IsAnchor = 0x2030, |
174 | AnchorHref = 0x2031, |
175 | AnchorName = 0x2032, |
176 | |
177 | // Included for backwards compatibility with old QDataStreams. |
178 | // Should not be referenced in user code. |
179 | OldFontLetterSpacingType = 0x2033, |
180 | OldFontStretch = 0x2034, |
181 | OldTextUnderlineColor = 0x2010, |
182 | OldFontFamily = 0x2000, // same as FontFamily |
183 | |
184 | ObjectType = 0x2f00, |
185 | |
186 | // list properties |
187 | ListStyle = 0x3000, |
188 | ListIndent = 0x3001, |
189 | ListNumberPrefix = 0x3002, |
190 | ListNumberSuffix = 0x3003, |
191 | ListStart = 0x3004, |
192 | |
193 | // table and frame properties |
194 | FrameBorder = 0x4000, |
195 | FrameMargin = 0x4001, |
196 | FramePadding = 0x4002, |
197 | FrameWidth = 0x4003, |
198 | FrameHeight = 0x4004, |
199 | FrameTopMargin = 0x4005, |
200 | FrameBottomMargin = 0x4006, |
201 | FrameLeftMargin = 0x4007, |
202 | FrameRightMargin = 0x4008, |
203 | FrameBorderBrush = 0x4009, |
204 | FrameBorderStyle = 0x4010, |
205 | |
206 | TableColumns = 0x4100, |
207 | TableColumnWidthConstraints = 0x4101, |
208 | TableCellSpacing = 0x4102, |
209 | TableCellPadding = 0x4103, |
210 | TableHeaderRowCount = 0x4104, |
211 | TableBorderCollapse = 0x4105, |
212 | |
213 | // table cell properties |
214 | TableCellRowSpan = 0x4810, |
215 | TableCellColumnSpan = 0x4811, |
216 | |
217 | TableCellTopPadding = 0x4812, |
218 | TableCellBottomPadding = 0x4813, |
219 | TableCellLeftPadding = 0x4814, |
220 | TableCellRightPadding = 0x4815, |
221 | |
222 | TableCellTopBorder = 0x4816, |
223 | TableCellBottomBorder = 0x4817, |
224 | TableCellLeftBorder = 0x4818, |
225 | TableCellRightBorder = 0x4819, |
226 | |
227 | TableCellTopBorderStyle = 0x481a, |
228 | TableCellBottomBorderStyle = 0x481b, |
229 | TableCellLeftBorderStyle = 0x481c, |
230 | TableCellRightBorderStyle = 0x481d, |
231 | |
232 | TableCellTopBorderBrush = 0x481e, |
233 | TableCellBottomBorderBrush = 0x481f, |
234 | TableCellLeftBorderBrush = 0x4820, |
235 | TableCellRightBorderBrush = 0x4821, |
236 | |
237 | // image properties |
238 | ImageName = 0x5000, |
239 | ImageTitle = 0x5001, |
240 | ImageAltText = 0x5002, |
241 | ImageWidth = 0x5010, |
242 | ImageHeight = 0x5011, |
243 | ImageQuality = 0x5014, |
244 | ImageMaxWidth = 0x5015, |
245 | |
246 | // internal |
247 | /* |
248 | SuppressText = 0x5012, |
249 | SuppressBackground = 0x513 |
250 | */ |
251 | |
252 | // selection properties |
253 | FullWidthSelection = 0x06000, |
254 | |
255 | // page break properties |
256 | PageBreakPolicy = 0x7000, |
257 | |
258 | // -- |
259 | UserProperty = 0x100000 |
260 | }; |
261 | Q_ENUM(Property) |
262 | |
263 | enum ObjectTypes { |
264 | NoObject, |
265 | ImageObject, |
266 | TableObject, |
267 | TableCellObject, |
268 | |
269 | UserObject = 0x1000 |
270 | }; |
271 | Q_ENUM(ObjectTypes) |
272 | |
273 | enum PageBreakFlag { |
274 | PageBreak_Auto = 0, |
275 | PageBreak_AlwaysBefore = 0x001, |
276 | PageBreak_AlwaysAfter = 0x010 |
277 | // PageBreak_AlwaysInside = 0x100 |
278 | }; |
279 | Q_DECLARE_FLAGS(PageBreakFlags, PageBreakFlag) |
280 | |
281 | QTextFormat(); |
282 | |
283 | explicit QTextFormat(int type); |
284 | |
285 | QTextFormat(const QTextFormat &rhs); |
286 | QTextFormat &operator=(const QTextFormat &rhs); |
287 | ~QTextFormat(); |
288 | |
289 | void swap(QTextFormat &other) |
290 | { d.swap(other&: other.d); std::swap(a&: format_type, b&: other.format_type); } |
291 | |
292 | void merge(const QTextFormat &other); |
293 | |
294 | inline bool isValid() const { return type() != InvalidFormat; } |
295 | inline bool isEmpty() const { return propertyCount() == 0; } |
296 | |
297 | int type() const; |
298 | |
299 | int objectIndex() const; |
300 | void setObjectIndex(int object); |
301 | |
302 | QVariant property(int propertyId) const; |
303 | void setProperty(int propertyId, const QVariant &value); |
304 | void clearProperty(int propertyId); |
305 | bool hasProperty(int propertyId) const; |
306 | |
307 | bool boolProperty(int propertyId) const; |
308 | int intProperty(int propertyId) const; |
309 | qreal doubleProperty(int propertyId) const; |
310 | QString stringProperty(int propertyId) const; |
311 | QColor colorProperty(int propertyId) const; |
312 | QPen penProperty(int propertyId) const; |
313 | QBrush brushProperty(int propertyId) const; |
314 | QTextLength lengthProperty(int propertyId) const; |
315 | QList<QTextLength> lengthVectorProperty(int propertyId) const; |
316 | |
317 | void setProperty(int propertyId, const QList<QTextLength> &lengths); |
318 | |
319 | QMap<int, QVariant> properties() const; |
320 | int propertyCount() const; |
321 | |
322 | inline void setObjectType(int type); |
323 | inline int objectType() const |
324 | { return intProperty(propertyId: ObjectType); } |
325 | |
326 | inline bool isCharFormat() const { return type() == CharFormat; } |
327 | inline bool isBlockFormat() const { return type() == BlockFormat; } |
328 | inline bool isListFormat() const { return type() == ListFormat; } |
329 | inline bool isFrameFormat() const { return type() == FrameFormat; } |
330 | inline bool isImageFormat() const { return type() == CharFormat && objectType() == ImageObject; } |
331 | inline bool isTableFormat() const { return type() == FrameFormat && objectType() == TableObject; } |
332 | inline bool isTableCellFormat() const { return type() == CharFormat && objectType() == TableCellObject; } |
333 | |
334 | QTextBlockFormat toBlockFormat() const; |
335 | QTextCharFormat toCharFormat() const; |
336 | QTextListFormat toListFormat() const; |
337 | QTextTableFormat toTableFormat() const; |
338 | QTextFrameFormat toFrameFormat() const; |
339 | QTextImageFormat toImageFormat() const; |
340 | QTextTableCellFormat toTableCellFormat() const; |
341 | |
342 | bool operator==(const QTextFormat &rhs) const; |
343 | inline bool operator!=(const QTextFormat &rhs) const { return !operator==(rhs); } |
344 | operator QVariant() const; |
345 | |
346 | inline void setLayoutDirection(Qt::LayoutDirection direction) |
347 | { setProperty(propertyId: QTextFormat::LayoutDirection, value: direction); } |
348 | inline Qt::LayoutDirection layoutDirection() const |
349 | { return Qt::LayoutDirection(intProperty(propertyId: QTextFormat::LayoutDirection)); } |
350 | |
351 | inline void setBackground(const QBrush &brush) |
352 | { setProperty(propertyId: BackgroundBrush, value: brush); } |
353 | inline QBrush background() const |
354 | { return brushProperty(propertyId: BackgroundBrush); } |
355 | inline void clearBackground() |
356 | { clearProperty(propertyId: BackgroundBrush); } |
357 | |
358 | inline void setForeground(const QBrush &brush) |
359 | { setProperty(propertyId: ForegroundBrush, value: brush); } |
360 | inline QBrush foreground() const |
361 | { return brushProperty(propertyId: ForegroundBrush); } |
362 | inline void clearForeground() |
363 | { clearProperty(propertyId: ForegroundBrush); } |
364 | |
365 | private: |
366 | QSharedDataPointer<QTextFormatPrivate> d; |
367 | qint32 format_type; |
368 | |
369 | friend class QTextFormatCollection; |
370 | friend class QTextCharFormat; |
371 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFormat &); |
372 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFormat &); |
373 | }; |
374 | |
375 | Q_DECLARE_SHARED(QTextFormat) |
376 | |
377 | inline void QTextFormat::setObjectType(int atype) |
378 | { setProperty(propertyId: ObjectType, value: atype); } |
379 | |
380 | Q_DECLARE_OPERATORS_FOR_FLAGS(QTextFormat::PageBreakFlags) |
381 | |
382 | class Q_GUI_EXPORT QTextCharFormat : public QTextFormat |
383 | { |
384 | public: |
385 | enum VerticalAlignment { |
386 | AlignNormal = 0, |
387 | AlignSuperScript, |
388 | AlignSubScript, |
389 | AlignMiddle, |
390 | AlignTop, |
391 | AlignBottom, |
392 | AlignBaseline |
393 | }; |
394 | enum UnderlineStyle { // keep in sync with Qt::PenStyle! |
395 | NoUnderline, |
396 | SingleUnderline, |
397 | DashUnderline, |
398 | DotLine, |
399 | DashDotLine, |
400 | DashDotDotLine, |
401 | WaveUnderline, |
402 | SpellCheckUnderline |
403 | }; |
404 | |
405 | QTextCharFormat(); |
406 | |
407 | bool isValid() const { return isCharFormat(); } |
408 | |
409 | enum FontPropertiesInheritanceBehavior { |
410 | FontPropertiesSpecifiedOnly, |
411 | FontPropertiesAll |
412 | }; |
413 | void setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior = FontPropertiesAll); |
414 | QFont font() const; |
415 | |
416 | #if QT_DEPRECATED_SINCE(6, 1) |
417 | QT_DEPRECATED_VERSION_X_6_1("Use setFontFamilies instead") inline void setFontFamily(const QString &family) |
418 | { setProperty(propertyId: FontFamilies, value: QVariant(QStringList(family))); } |
419 | QT_DEPRECATED_VERSION_X_6_1("Use fontFamilies instead") inline QString fontFamily() const |
420 | { return property(propertyId: FontFamilies).toStringList().first(); } |
421 | #endif |
422 | |
423 | inline void setFontFamilies(const QStringList &families) |
424 | { setProperty(propertyId: FontFamilies, value: QVariant(families)); } |
425 | #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) |
426 | inline QVariant fontFamilies() const |
427 | { return property(propertyId: FontFamilies); } |
428 | #else |
429 | inline QStringList fontFamilies() const |
430 | { return property(FontFamilies).toStringList(); } |
431 | #endif |
432 | |
433 | inline void setFontStyleName(const QString &styleName) |
434 | { setProperty(propertyId: FontStyleName, value: styleName); } |
435 | #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) |
436 | inline QVariant fontStyleName() const |
437 | { return property(propertyId: FontStyleName); } |
438 | #else |
439 | inline QStringList fontStyleName() const |
440 | { return property(FontStyleName).toStringList(); } |
441 | #endif |
442 | |
443 | inline void setFontPointSize(qreal size) |
444 | { setProperty(propertyId: FontPointSize, value: size); } |
445 | inline qreal fontPointSize() const |
446 | { return doubleProperty(propertyId: FontPointSize); } |
447 | |
448 | inline void setFontWeight(int weight) |
449 | { setProperty(propertyId: FontWeight, value: weight); } |
450 | inline int fontWeight() const |
451 | { return hasProperty(propertyId: FontWeight) ? intProperty(propertyId: FontWeight) : QFont::Normal; } |
452 | inline void setFontItalic(bool italic) |
453 | { setProperty(propertyId: FontItalic, value: italic); } |
454 | inline bool fontItalic() const |
455 | { return boolProperty(propertyId: FontItalic); } |
456 | inline void setFontCapitalization(QFont::Capitalization capitalization) |
457 | { setProperty(propertyId: FontCapitalization, value: capitalization); } |
458 | inline QFont::Capitalization fontCapitalization() const |
459 | { return static_cast<QFont::Capitalization>(intProperty(propertyId: FontCapitalization)); } |
460 | inline void setFontLetterSpacingType(QFont::SpacingType letterSpacingType) |
461 | { setProperty(propertyId: FontLetterSpacingType, value: letterSpacingType); } |
462 | inline QFont::SpacingType fontLetterSpacingType() const |
463 | { return static_cast<QFont::SpacingType>(intProperty(propertyId: FontLetterSpacingType)); } |
464 | inline void setFontLetterSpacing(qreal spacing) |
465 | { setProperty(propertyId: FontLetterSpacing, value: spacing); } |
466 | inline qreal fontLetterSpacing() const |
467 | { return doubleProperty(propertyId: FontLetterSpacing); } |
468 | inline void setFontWordSpacing(qreal spacing) |
469 | { setProperty(propertyId: FontWordSpacing, value: spacing); } |
470 | inline qreal fontWordSpacing() const |
471 | { return doubleProperty(propertyId: FontWordSpacing); } |
472 | |
473 | inline void setFontUnderline(bool underline) |
474 | { setProperty(propertyId: TextUnderlineStyle, value: underline ? SingleUnderline : NoUnderline); } |
475 | bool fontUnderline() const; |
476 | |
477 | inline void setFontOverline(bool overline) |
478 | { setProperty(propertyId: FontOverline, value: overline); } |
479 | inline bool fontOverline() const |
480 | { return boolProperty(propertyId: FontOverline); } |
481 | |
482 | inline void setFontStrikeOut(bool strikeOut) |
483 | { setProperty(propertyId: FontStrikeOut, value: strikeOut); } |
484 | inline bool fontStrikeOut() const |
485 | { return boolProperty(propertyId: FontStrikeOut); } |
486 | |
487 | inline void setUnderlineColor(const QColor &color) |
488 | { setProperty(propertyId: TextUnderlineColor, value: color); } |
489 | inline QColor underlineColor() const |
490 | { return colorProperty(propertyId: TextUnderlineColor); } |
491 | |
492 | inline void setFontFixedPitch(bool fixedPitch) |
493 | { setProperty(propertyId: FontFixedPitch, value: fixedPitch); } |
494 | inline bool fontFixedPitch() const |
495 | { return boolProperty(propertyId: FontFixedPitch); } |
496 | |
497 | inline void setFontStretch(int factor) |
498 | { setProperty(propertyId: FontStretch, value: factor); } |
499 | inline int fontStretch() const |
500 | { return intProperty(propertyId: FontStretch); } |
501 | |
502 | inline void setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy = QFont::PreferDefault) |
503 | { setProperty(propertyId: FontStyleHint, value: hint); setProperty(propertyId: FontStyleStrategy, value: strategy); } |
504 | inline void setFontStyleStrategy(QFont::StyleStrategy strategy) |
505 | { setProperty(propertyId: FontStyleStrategy, value: strategy); } |
506 | QFont::StyleHint fontStyleHint() const |
507 | { return static_cast<QFont::StyleHint>(intProperty(propertyId: FontStyleHint)); } |
508 | QFont::StyleStrategy fontStyleStrategy() const |
509 | { return static_cast<QFont::StyleStrategy>(intProperty(propertyId: FontStyleStrategy)); } |
510 | |
511 | inline void setFontHintingPreference(QFont::HintingPreference hintingPreference) |
512 | { |
513 | setProperty(propertyId: FontHintingPreference, value: hintingPreference); |
514 | } |
515 | |
516 | inline QFont::HintingPreference fontHintingPreference() const |
517 | { |
518 | return static_cast<QFont::HintingPreference>(intProperty(propertyId: FontHintingPreference)); |
519 | } |
520 | |
521 | inline void setFontKerning(bool enable) |
522 | { setProperty(propertyId: FontKerning, value: enable); } |
523 | inline bool fontKerning() const |
524 | { return boolProperty(propertyId: FontKerning); } |
525 | |
526 | void setUnderlineStyle(UnderlineStyle style); |
527 | inline UnderlineStyle underlineStyle() const |
528 | { return static_cast<UnderlineStyle>(intProperty(propertyId: TextUnderlineStyle)); } |
529 | |
530 | inline void setVerticalAlignment(VerticalAlignment alignment) |
531 | { setProperty(propertyId: TextVerticalAlignment, value: alignment); } |
532 | inline VerticalAlignment verticalAlignment() const |
533 | { return static_cast<VerticalAlignment>(intProperty(propertyId: TextVerticalAlignment)); } |
534 | |
535 | inline void setTextOutline(const QPen &pen) |
536 | { setProperty(propertyId: TextOutline, value: pen); } |
537 | inline QPen textOutline() const |
538 | { return penProperty(propertyId: TextOutline); } |
539 | |
540 | inline void setToolTip(const QString &tip) |
541 | { setProperty(propertyId: TextToolTip, value: tip); } |
542 | inline QString toolTip() const |
543 | { return stringProperty(propertyId: TextToolTip); } |
544 | |
545 | inline void setSuperScriptBaseline(qreal baseline) |
546 | { setProperty(propertyId: TextSuperScriptBaseline, value: baseline); } |
547 | inline qreal superScriptBaseline() const |
548 | { return hasProperty(propertyId: TextSuperScriptBaseline) ? doubleProperty(propertyId: TextSuperScriptBaseline) : 50.0; } |
549 | |
550 | inline void setSubScriptBaseline(qreal baseline) |
551 | { setProperty(propertyId: TextSubScriptBaseline, value: baseline); } |
552 | inline qreal subScriptBaseline() const |
553 | { return hasProperty(propertyId: TextSubScriptBaseline) ? doubleProperty(propertyId: TextSubScriptBaseline) : 100.0 / 6.0; } |
554 | |
555 | inline void setBaselineOffset(qreal baseline) |
556 | { setProperty(propertyId: TextBaselineOffset, value: baseline); } |
557 | inline qreal baselineOffset() const |
558 | { return hasProperty(propertyId: TextBaselineOffset) ? doubleProperty(propertyId: TextBaselineOffset) : 0.0; } |
559 | |
560 | inline void setAnchor(bool anchor) |
561 | { setProperty(propertyId: IsAnchor, value: anchor); } |
562 | inline bool isAnchor() const |
563 | { return boolProperty(propertyId: IsAnchor); } |
564 | |
565 | inline void setAnchorHref(const QString &value) |
566 | { setProperty(propertyId: AnchorHref, value); } |
567 | inline QString anchorHref() const |
568 | { return stringProperty(propertyId: AnchorHref); } |
569 | |
570 | inline void setAnchorNames(const QStringList &names) |
571 | { setProperty(propertyId: AnchorName, value: names); } |
572 | QStringList anchorNames() const; |
573 | |
574 | inline void setTableCellRowSpan(int tableCellRowSpan); |
575 | inline int tableCellRowSpan() const |
576 | { int s = intProperty(propertyId: TableCellRowSpan); if (s == 0) s = 1; return s; } |
577 | inline void setTableCellColumnSpan(int tableCellColumnSpan); |
578 | inline int tableCellColumnSpan() const |
579 | { int s = intProperty(propertyId: TableCellColumnSpan); if (s == 0) s = 1; return s; } |
580 | |
581 | protected: |
582 | explicit QTextCharFormat(const QTextFormat &fmt); |
583 | friend class QTextFormat; |
584 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextCharFormat &); |
585 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextCharFormat &); |
586 | }; |
587 | |
588 | Q_DECLARE_SHARED(QTextCharFormat) |
589 | |
590 | inline void QTextCharFormat::setTableCellRowSpan(int _tableCellRowSpan) |
591 | { |
592 | if (_tableCellRowSpan <= 1) |
593 | clearProperty(propertyId: TableCellRowSpan); // the getter will return 1 here. |
594 | else |
595 | setProperty(propertyId: TableCellRowSpan, value: _tableCellRowSpan); |
596 | } |
597 | |
598 | inline void QTextCharFormat::setTableCellColumnSpan(int _tableCellColumnSpan) |
599 | { |
600 | if (_tableCellColumnSpan <= 1) |
601 | clearProperty(propertyId: TableCellColumnSpan); // the getter will return 1 here. |
602 | else |
603 | setProperty(propertyId: TableCellColumnSpan, value: _tableCellColumnSpan); |
604 | } |
605 | |
606 | class Q_GUI_EXPORT QTextBlockFormat : public QTextFormat |
607 | { |
608 | public: |
609 | enum LineHeightTypes { |
610 | SingleHeight = 0, |
611 | ProportionalHeight = 1, |
612 | FixedHeight = 2, |
613 | MinimumHeight = 3, |
614 | LineDistanceHeight = 4 |
615 | }; |
616 | |
617 | enum class MarkerType { |
618 | NoMarker = 0, |
619 | Unchecked = 1, |
620 | Checked = 2 |
621 | }; |
622 | |
623 | QTextBlockFormat(); |
624 | |
625 | bool isValid() const { return isBlockFormat(); } |
626 | |
627 | inline void setAlignment(Qt::Alignment alignment); |
628 | inline Qt::Alignment alignment() const |
629 | { int a = intProperty(propertyId: BlockAlignment); if (a == 0) a = Qt::AlignLeft; return QFlag(a); } |
630 | |
631 | inline void setTopMargin(qreal margin) |
632 | { setProperty(propertyId: BlockTopMargin, value: margin); } |
633 | inline qreal topMargin() const |
634 | { return doubleProperty(propertyId: BlockTopMargin); } |
635 | |
636 | inline void setBottomMargin(qreal margin) |
637 | { setProperty(propertyId: BlockBottomMargin, value: margin); } |
638 | inline qreal bottomMargin() const |
639 | { return doubleProperty(propertyId: BlockBottomMargin); } |
640 | |
641 | inline void setLeftMargin(qreal margin) |
642 | { setProperty(propertyId: BlockLeftMargin, value: margin); } |
643 | inline qreal leftMargin() const |
644 | { return doubleProperty(propertyId: BlockLeftMargin); } |
645 | |
646 | inline void setRightMargin(qreal margin) |
647 | { setProperty(propertyId: BlockRightMargin, value: margin); } |
648 | inline qreal rightMargin() const |
649 | { return doubleProperty(propertyId: BlockRightMargin); } |
650 | |
651 | inline void setTextIndent(qreal aindent) |
652 | { setProperty(propertyId: TextIndent, value: aindent); } |
653 | inline qreal textIndent() const |
654 | { return doubleProperty(propertyId: TextIndent); } |
655 | |
656 | inline void setIndent(int indent); |
657 | inline int indent() const |
658 | { return intProperty(propertyId: BlockIndent); } |
659 | |
660 | inline void setHeadingLevel(int alevel) |
661 | { setProperty(propertyId: HeadingLevel, value: alevel); } |
662 | inline int headingLevel() const |
663 | { return intProperty(propertyId: HeadingLevel); } |
664 | |
665 | inline void setLineHeight(qreal height, int heightType) |
666 | { setProperty(propertyId: LineHeight, value: height); setProperty(propertyId: LineHeightType, value: heightType); } |
667 | inline qreal lineHeight(qreal scriptLineHeight, qreal scaling) const; |
668 | inline qreal lineHeight() const |
669 | { return doubleProperty(propertyId: LineHeight); } |
670 | inline int lineHeightType() const |
671 | { return intProperty(propertyId: LineHeightType); } |
672 | |
673 | inline void setNonBreakableLines(bool b) |
674 | { setProperty(propertyId: BlockNonBreakableLines, value: b); } |
675 | inline bool nonBreakableLines() const |
676 | { return boolProperty(propertyId: BlockNonBreakableLines); } |
677 | |
678 | inline void setPageBreakPolicy(PageBreakFlags flags) |
679 | { setProperty(propertyId: PageBreakPolicy, value: int(flags.toInt())); } |
680 | inline PageBreakFlags pageBreakPolicy() const |
681 | { return PageBreakFlags(intProperty(propertyId: PageBreakPolicy)); } |
682 | |
683 | void setTabPositions(const QList<QTextOption::Tab> &tabs); |
684 | QList<QTextOption::Tab> tabPositions() const; |
685 | |
686 | inline void setMarker(MarkerType marker) |
687 | { setProperty(propertyId: BlockMarker, value: int(marker)); } |
688 | inline MarkerType marker() const |
689 | { return MarkerType(intProperty(propertyId: BlockMarker)); } |
690 | |
691 | protected: |
692 | explicit QTextBlockFormat(const QTextFormat &fmt); |
693 | friend class QTextFormat; |
694 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextBlockFormat &); |
695 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextBlockFormat &); |
696 | }; |
697 | |
698 | Q_DECLARE_SHARED(QTextBlockFormat) |
699 | |
700 | inline void QTextBlockFormat::setAlignment(Qt::Alignment aalignment) |
701 | { setProperty(propertyId: BlockAlignment, value: int(aalignment.toInt())); } |
702 | |
703 | inline void QTextBlockFormat::setIndent(int aindent) |
704 | { setProperty(propertyId: BlockIndent, value: aindent); } |
705 | |
706 | inline qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling = 1.0) const |
707 | { |
708 | switch(intProperty(propertyId: LineHeightType)) { |
709 | case SingleHeight: |
710 | return(scriptLineHeight); |
711 | case ProportionalHeight: |
712 | return(scriptLineHeight * doubleProperty(propertyId: LineHeight) / 100.0); |
713 | case FixedHeight: |
714 | return(doubleProperty(propertyId: LineHeight) * scaling); |
715 | case MinimumHeight: |
716 | return(qMax(a: scriptLineHeight, b: doubleProperty(propertyId: LineHeight) * scaling)); |
717 | case LineDistanceHeight: |
718 | return(scriptLineHeight + doubleProperty(propertyId: LineHeight) * scaling); |
719 | } |
720 | return(0); |
721 | } |
722 | |
723 | class Q_GUI_EXPORT QTextListFormat : public QTextFormat |
724 | { |
725 | public: |
726 | QTextListFormat(); |
727 | |
728 | bool isValid() const { return isListFormat(); } |
729 | |
730 | enum Style { |
731 | ListDisc = -1, |
732 | ListCircle = -2, |
733 | ListSquare = -3, |
734 | ListDecimal = -4, |
735 | ListLowerAlpha = -5, |
736 | ListUpperAlpha = -6, |
737 | ListLowerRoman = -7, |
738 | ListUpperRoman = -8, |
739 | ListStyleUndefined = 0 |
740 | }; |
741 | |
742 | inline void setStyle(Style style); |
743 | inline Style style() const |
744 | { return static_cast<Style>(intProperty(propertyId: ListStyle)); } |
745 | |
746 | inline void setIndent(int indent); |
747 | inline int indent() const |
748 | { return intProperty(propertyId: ListIndent); } |
749 | |
750 | inline void setNumberPrefix(const QString &numberPrefix); |
751 | inline QString numberPrefix() const |
752 | { return stringProperty(propertyId: ListNumberPrefix); } |
753 | |
754 | inline void setNumberSuffix(const QString &numberSuffix); |
755 | inline QString numberSuffix() const |
756 | { return stringProperty(propertyId: ListNumberSuffix); } |
757 | |
758 | inline void setStart(int indent); |
759 | inline int start() const { return intProperty(propertyId: ListStart); } |
760 | |
761 | protected: |
762 | explicit QTextListFormat(const QTextFormat &fmt); |
763 | friend class QTextFormat; |
764 | }; |
765 | |
766 | Q_DECLARE_SHARED(QTextListFormat) |
767 | |
768 | inline void QTextListFormat::setStyle(Style astyle) |
769 | { setProperty(propertyId: ListStyle, value: astyle); } |
770 | |
771 | inline void QTextListFormat::setIndent(int aindent) |
772 | { setProperty(propertyId: ListIndent, value: aindent); } |
773 | |
774 | inline void QTextListFormat::setNumberPrefix(const QString &np) |
775 | { setProperty(propertyId: ListNumberPrefix, value: np); } |
776 | |
777 | inline void QTextListFormat::setNumberSuffix(const QString &ns) |
778 | { setProperty(propertyId: ListNumberSuffix, value: ns); } |
779 | |
780 | inline void QTextListFormat::setStart(int astart) |
781 | { |
782 | setProperty(propertyId: ListStart, value: astart); |
783 | } |
784 | |
785 | class Q_GUI_EXPORT QTextImageFormat : public QTextCharFormat |
786 | { |
787 | public: |
788 | QTextImageFormat(); |
789 | |
790 | bool isValid() const { return isImageFormat(); } |
791 | |
792 | inline void setName(const QString &name); |
793 | inline QString name() const |
794 | { return stringProperty(propertyId: ImageName); } |
795 | |
796 | inline void setWidth(qreal width); |
797 | inline qreal width() const |
798 | { return doubleProperty(propertyId: ImageWidth); } |
799 | |
800 | inline void setMaximumWidth(QTextLength maxWidth); |
801 | inline QTextLength maximumWidth() const |
802 | { return lengthProperty(propertyId: ImageMaxWidth); } |
803 | |
804 | inline void setHeight(qreal height); |
805 | inline qreal height() const |
806 | { return doubleProperty(propertyId: ImageHeight); } |
807 | |
808 | inline void setQuality(int quality); |
809 | #if QT_DEPRECATED_SINCE(6, 3) |
810 | QT_DEPRECATED_VERSION_X_6_3("Pass a quality value, the default is 100") inline void setQuality() |
811 | { setQuality(100); } |
812 | #endif |
813 | inline int quality() const |
814 | { return intProperty(propertyId: ImageQuality); } |
815 | |
816 | protected: |
817 | explicit QTextImageFormat(const QTextFormat &format); |
818 | friend class QTextFormat; |
819 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextListFormat &); |
820 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextListFormat &); |
821 | }; |
822 | |
823 | Q_DECLARE_SHARED(QTextImageFormat) |
824 | |
825 | inline void QTextImageFormat::setName(const QString &aname) |
826 | { setProperty(propertyId: ImageName, value: aname); } |
827 | |
828 | inline void QTextImageFormat::setWidth(qreal awidth) |
829 | { setProperty(propertyId: ImageWidth, value: awidth); } |
830 | |
831 | inline void QTextImageFormat::setMaximumWidth(QTextLength maxWidth) |
832 | { setProperty(propertyId: ImageMaxWidth, value: maxWidth); } |
833 | |
834 | inline void QTextImageFormat::setHeight(qreal aheight) |
835 | { setProperty(propertyId: ImageHeight, value: aheight); } |
836 | |
837 | inline void QTextImageFormat::setQuality(int aquality) |
838 | { setProperty(propertyId: ImageQuality, value: aquality); } |
839 | |
840 | class Q_GUI_EXPORT QTextFrameFormat : public QTextFormat |
841 | { |
842 | public: |
843 | QTextFrameFormat(); |
844 | |
845 | bool isValid() const { return isFrameFormat(); } |
846 | |
847 | enum Position { |
848 | InFlow, |
849 | FloatLeft, |
850 | FloatRight |
851 | // ###### |
852 | // Absolute |
853 | }; |
854 | |
855 | enum BorderStyle { |
856 | BorderStyle_None, |
857 | BorderStyle_Dotted, |
858 | BorderStyle_Dashed, |
859 | BorderStyle_Solid, |
860 | BorderStyle_Double, |
861 | BorderStyle_DotDash, |
862 | BorderStyle_DotDotDash, |
863 | BorderStyle_Groove, |
864 | BorderStyle_Ridge, |
865 | BorderStyle_Inset, |
866 | BorderStyle_Outset |
867 | }; |
868 | |
869 | inline void setPosition(Position f) |
870 | { setProperty(propertyId: CssFloat, value: f); } |
871 | inline Position position() const |
872 | { return static_cast<Position>(intProperty(propertyId: CssFloat)); } |
873 | |
874 | inline void setBorder(qreal border); |
875 | inline qreal border() const |
876 | { return doubleProperty(propertyId: FrameBorder); } |
877 | |
878 | inline void setBorderBrush(const QBrush &brush) |
879 | { setProperty(propertyId: FrameBorderBrush, value: brush); } |
880 | inline QBrush borderBrush() const |
881 | { return brushProperty(propertyId: FrameBorderBrush); } |
882 | |
883 | inline void setBorderStyle(BorderStyle style) |
884 | { setProperty(propertyId: FrameBorderStyle, value: style); } |
885 | inline BorderStyle borderStyle() const |
886 | { return static_cast<BorderStyle>(intProperty(propertyId: FrameBorderStyle)); } |
887 | |
888 | void setMargin(qreal margin); |
889 | inline qreal margin() const |
890 | { return doubleProperty(propertyId: FrameMargin); } |
891 | |
892 | inline void setTopMargin(qreal margin); |
893 | qreal topMargin() const; |
894 | |
895 | inline void setBottomMargin(qreal margin); |
896 | qreal bottomMargin() const; |
897 | |
898 | inline void setLeftMargin(qreal margin); |
899 | qreal leftMargin() const; |
900 | |
901 | inline void setRightMargin(qreal margin); |
902 | qreal rightMargin() const; |
903 | |
904 | inline void setPadding(qreal padding); |
905 | inline qreal padding() const |
906 | { return doubleProperty(propertyId: FramePadding); } |
907 | |
908 | inline void setWidth(qreal width); |
909 | inline void setWidth(const QTextLength &length) |
910 | { setProperty(propertyId: FrameWidth, value: length); } |
911 | inline QTextLength width() const |
912 | { return lengthProperty(propertyId: FrameWidth); } |
913 | |
914 | inline void setHeight(qreal height); |
915 | inline void setHeight(const QTextLength &height); |
916 | inline QTextLength height() const |
917 | { return lengthProperty(propertyId: FrameHeight); } |
918 | |
919 | inline void setPageBreakPolicy(PageBreakFlags flags) |
920 | { setProperty(propertyId: PageBreakPolicy, value: int(flags.toInt())); } |
921 | inline PageBreakFlags pageBreakPolicy() const |
922 | { return PageBreakFlags(intProperty(propertyId: PageBreakPolicy)); } |
923 | |
924 | protected: |
925 | explicit QTextFrameFormat(const QTextFormat &fmt); |
926 | friend class QTextFormat; |
927 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFrameFormat &); |
928 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFrameFormat &); |
929 | }; |
930 | |
931 | Q_DECLARE_SHARED(QTextFrameFormat) |
932 | |
933 | inline void QTextFrameFormat::setBorder(qreal aborder) |
934 | { setProperty(propertyId: FrameBorder, value: aborder); } |
935 | |
936 | inline void QTextFrameFormat::setPadding(qreal apadding) |
937 | { setProperty(propertyId: FramePadding, value: apadding); } |
938 | |
939 | inline void QTextFrameFormat::setWidth(qreal awidth) |
940 | { setProperty(propertyId: FrameWidth, value: QTextLength(QTextLength::FixedLength, awidth)); } |
941 | |
942 | inline void QTextFrameFormat::setHeight(qreal aheight) |
943 | { setProperty(propertyId: FrameHeight, value: QTextLength(QTextLength::FixedLength, aheight)); } |
944 | inline void QTextFrameFormat::setHeight(const QTextLength &aheight) |
945 | { setProperty(propertyId: FrameHeight, value: aheight); } |
946 | |
947 | inline void QTextFrameFormat::setTopMargin(qreal amargin) |
948 | { setProperty(propertyId: FrameTopMargin, value: amargin); } |
949 | |
950 | inline void QTextFrameFormat::setBottomMargin(qreal amargin) |
951 | { setProperty(propertyId: FrameBottomMargin, value: amargin); } |
952 | |
953 | inline void QTextFrameFormat::setLeftMargin(qreal amargin) |
954 | { setProperty(propertyId: FrameLeftMargin, value: amargin); } |
955 | |
956 | inline void QTextFrameFormat::setRightMargin(qreal amargin) |
957 | { setProperty(propertyId: FrameRightMargin, value: amargin); } |
958 | |
959 | class Q_GUI_EXPORT QTextTableFormat : public QTextFrameFormat |
960 | { |
961 | public: |
962 | QTextTableFormat(); |
963 | |
964 | inline bool isValid() const { return isTableFormat(); } |
965 | |
966 | inline int columns() const |
967 | { int cols = intProperty(propertyId: TableColumns); if (cols == 0) cols = 1; return cols; } |
968 | inline void setColumns(int columns); |
969 | |
970 | inline void setColumnWidthConstraints(const QList<QTextLength> &constraints) |
971 | { setProperty(propertyId: TableColumnWidthConstraints, lengths: constraints); } |
972 | |
973 | inline QList<QTextLength> columnWidthConstraints() const |
974 | { return lengthVectorProperty(propertyId: TableColumnWidthConstraints); } |
975 | |
976 | inline void clearColumnWidthConstraints() |
977 | { clearProperty(propertyId: TableColumnWidthConstraints); } |
978 | |
979 | inline qreal cellSpacing() const |
980 | { return doubleProperty(propertyId: TableCellSpacing); } |
981 | inline void setCellSpacing(qreal spacing) |
982 | { setProperty(propertyId: TableCellSpacing, value: spacing); } |
983 | |
984 | inline qreal cellPadding() const |
985 | { return doubleProperty(propertyId: TableCellPadding); } |
986 | inline void setCellPadding(qreal padding); |
987 | |
988 | inline void setAlignment(Qt::Alignment alignment); |
989 | inline Qt::Alignment alignment() const |
990 | { return QFlag(intProperty(propertyId: BlockAlignment)); } |
991 | |
992 | inline void setHeaderRowCount(int count) |
993 | { setProperty(propertyId: TableHeaderRowCount, value: count); } |
994 | inline int headerRowCount() const |
995 | { return intProperty(propertyId: TableHeaderRowCount); } |
996 | |
997 | inline void setBorderCollapse(bool borderCollapse) |
998 | { setProperty(propertyId: TableBorderCollapse, value: borderCollapse); } |
999 | inline bool borderCollapse() const |
1000 | { return boolProperty(propertyId: TableBorderCollapse); } |
1001 | |
1002 | protected: |
1003 | explicit QTextTableFormat(const QTextFormat &fmt); |
1004 | friend class QTextFormat; |
1005 | }; |
1006 | |
1007 | Q_DECLARE_SHARED(QTextTableFormat) |
1008 | |
1009 | inline void QTextTableFormat::setColumns(int acolumns) |
1010 | { |
1011 | if (acolumns == 1) |
1012 | acolumns = 0; |
1013 | setProperty(propertyId: TableColumns, value: acolumns); |
1014 | } |
1015 | |
1016 | inline void QTextTableFormat::setCellPadding(qreal apadding) |
1017 | { setProperty(propertyId: TableCellPadding, value: apadding); } |
1018 | |
1019 | inline void QTextTableFormat::setAlignment(Qt::Alignment aalignment) |
1020 | { setProperty(propertyId: BlockAlignment, value: int(aalignment.toInt())); } |
1021 | |
1022 | class Q_GUI_EXPORT QTextTableCellFormat : public QTextCharFormat |
1023 | { |
1024 | public: |
1025 | QTextTableCellFormat(); |
1026 | |
1027 | inline bool isValid() const { return isTableCellFormat(); } |
1028 | |
1029 | inline void setTopPadding(qreal padding); |
1030 | inline qreal topPadding() const; |
1031 | |
1032 | inline void setBottomPadding(qreal padding); |
1033 | inline qreal bottomPadding() const; |
1034 | |
1035 | inline void setLeftPadding(qreal padding); |
1036 | inline qreal leftPadding() const; |
1037 | |
1038 | inline void setRightPadding(qreal padding); |
1039 | inline qreal rightPadding() const; |
1040 | |
1041 | inline void setPadding(qreal padding); |
1042 | |
1043 | inline void setTopBorder(qreal width) |
1044 | { setProperty(propertyId: TableCellTopBorder, value: width); } |
1045 | inline qreal topBorder() const |
1046 | { return doubleProperty(propertyId: TableCellTopBorder); } |
1047 | |
1048 | inline void setBottomBorder(qreal width) |
1049 | { setProperty(propertyId: TableCellBottomBorder, value: width); } |
1050 | inline qreal bottomBorder() const |
1051 | { return doubleProperty(propertyId: TableCellBottomBorder); } |
1052 | |
1053 | inline void setLeftBorder(qreal width) |
1054 | { setProperty(propertyId: TableCellLeftBorder, value: width); } |
1055 | inline qreal leftBorder() const |
1056 | { return doubleProperty(propertyId: TableCellLeftBorder); } |
1057 | |
1058 | inline void setRightBorder(qreal width) |
1059 | { setProperty(propertyId: TableCellRightBorder, value: width); } |
1060 | inline qreal rightBorder() const |
1061 | { return doubleProperty(propertyId: TableCellRightBorder); } |
1062 | |
1063 | inline void setBorder(qreal width); |
1064 | |
1065 | inline void setTopBorderStyle(QTextFrameFormat::BorderStyle style) |
1066 | { setProperty(propertyId: TableCellTopBorderStyle, value: style); } |
1067 | inline QTextFrameFormat::BorderStyle topBorderStyle() const |
1068 | { return static_cast<QTextFrameFormat::BorderStyle>(intProperty(propertyId: TableCellTopBorderStyle)); } |
1069 | |
1070 | inline void setBottomBorderStyle(QTextFrameFormat::BorderStyle style) |
1071 | { setProperty(propertyId: TableCellBottomBorderStyle, value: style); } |
1072 | inline QTextFrameFormat::BorderStyle bottomBorderStyle() const |
1073 | { return static_cast<QTextFrameFormat::BorderStyle>(intProperty(propertyId: TableCellBottomBorderStyle)); } |
1074 | |
1075 | inline void setLeftBorderStyle(QTextFrameFormat::BorderStyle style) |
1076 | { setProperty(propertyId: TableCellLeftBorderStyle, value: style); } |
1077 | inline QTextFrameFormat::BorderStyle leftBorderStyle() const |
1078 | { return static_cast<QTextFrameFormat::BorderStyle>(intProperty(propertyId: TableCellLeftBorderStyle)); } |
1079 | |
1080 | inline void setRightBorderStyle(QTextFrameFormat::BorderStyle style) |
1081 | { setProperty(propertyId: TableCellRightBorderStyle, value: style); } |
1082 | inline QTextFrameFormat::BorderStyle rightBorderStyle() const |
1083 | { return static_cast<QTextFrameFormat::BorderStyle>(intProperty(propertyId: TableCellRightBorderStyle)); } |
1084 | |
1085 | inline void setBorderStyle(QTextFrameFormat::BorderStyle style); |
1086 | |
1087 | inline void setTopBorderBrush(const QBrush &brush) |
1088 | { setProperty(propertyId: TableCellTopBorderBrush, value: brush); } |
1089 | inline QBrush topBorderBrush() const |
1090 | { return brushProperty(propertyId: TableCellTopBorderBrush); } |
1091 | |
1092 | inline void setBottomBorderBrush(const QBrush &brush) |
1093 | { setProperty(propertyId: TableCellBottomBorderBrush, value: brush); } |
1094 | inline QBrush bottomBorderBrush() const |
1095 | { return brushProperty(propertyId: TableCellBottomBorderBrush); } |
1096 | |
1097 | inline void setLeftBorderBrush(const QBrush &brush) |
1098 | { setProperty(propertyId: TableCellLeftBorderBrush, value: brush); } |
1099 | inline QBrush leftBorderBrush() const |
1100 | { return brushProperty(propertyId: TableCellLeftBorderBrush); } |
1101 | |
1102 | inline void setRightBorderBrush(const QBrush &brush) |
1103 | { setProperty(propertyId: TableCellRightBorderBrush, value: brush); } |
1104 | inline QBrush rightBorderBrush() const |
1105 | { return brushProperty(propertyId: TableCellRightBorderBrush); } |
1106 | |
1107 | inline void setBorderBrush(const QBrush &brush); |
1108 | |
1109 | protected: |
1110 | explicit QTextTableCellFormat(const QTextFormat &fmt); |
1111 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextTableCellFormat &); |
1112 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextTableCellFormat &); |
1113 | friend class QTextFormat; |
1114 | }; |
1115 | |
1116 | Q_DECLARE_SHARED(QTextTableCellFormat) |
1117 | |
1118 | inline void QTextTableCellFormat::setTopPadding(qreal padding) |
1119 | { |
1120 | setProperty(propertyId: TableCellTopPadding, value: padding); |
1121 | } |
1122 | |
1123 | inline qreal QTextTableCellFormat::topPadding() const |
1124 | { |
1125 | return doubleProperty(propertyId: TableCellTopPadding); |
1126 | } |
1127 | |
1128 | inline void QTextTableCellFormat::setBottomPadding(qreal padding) |
1129 | { |
1130 | setProperty(propertyId: TableCellBottomPadding, value: padding); |
1131 | } |
1132 | |
1133 | inline qreal QTextTableCellFormat::bottomPadding() const |
1134 | { |
1135 | return doubleProperty(propertyId: TableCellBottomPadding); |
1136 | } |
1137 | |
1138 | inline void QTextTableCellFormat::setLeftPadding(qreal padding) |
1139 | { |
1140 | setProperty(propertyId: TableCellLeftPadding, value: padding); |
1141 | } |
1142 | |
1143 | inline qreal QTextTableCellFormat::leftPadding() const |
1144 | { |
1145 | return doubleProperty(propertyId: TableCellLeftPadding); |
1146 | } |
1147 | |
1148 | inline void QTextTableCellFormat::setRightPadding(qreal padding) |
1149 | { |
1150 | setProperty(propertyId: TableCellRightPadding, value: padding); |
1151 | } |
1152 | |
1153 | inline qreal QTextTableCellFormat::rightPadding() const |
1154 | { |
1155 | return doubleProperty(propertyId: TableCellRightPadding); |
1156 | } |
1157 | |
1158 | inline void QTextTableCellFormat::setPadding(qreal padding) |
1159 | { |
1160 | setTopPadding(padding); |
1161 | setBottomPadding(padding); |
1162 | setLeftPadding(padding); |
1163 | setRightPadding(padding); |
1164 | } |
1165 | |
1166 | inline void QTextTableCellFormat::setBorder(qreal width) |
1167 | { |
1168 | setTopBorder(width); |
1169 | setBottomBorder(width); |
1170 | setLeftBorder(width); |
1171 | setRightBorder(width); |
1172 | } |
1173 | |
1174 | inline void QTextTableCellFormat::setBorderStyle(QTextFrameFormat::BorderStyle style) |
1175 | { |
1176 | setTopBorderStyle(style); |
1177 | setBottomBorderStyle(style); |
1178 | setLeftBorderStyle(style); |
1179 | setRightBorderStyle(style); |
1180 | } |
1181 | |
1182 | inline void QTextTableCellFormat::setBorderBrush(const QBrush &brush) |
1183 | { |
1184 | setTopBorderBrush(brush); |
1185 | setBottomBorderBrush(brush); |
1186 | setLeftBorderBrush(brush); |
1187 | setRightBorderBrush(brush); |
1188 | } |
1189 | |
1190 | QT_END_NAMESPACE |
1191 | |
1192 | #endif // QTEXTFORMAT_H |
1193 |
Definitions
- QTextLength
- Type
- QTextLength
- type
- value
- rawValue
- operator==
- operator!=
- QTextLength
- QTextFormat
- FormatType
- Property
- ObjectTypes
- PageBreakFlag
- swap
- isValid
- isEmpty
- objectType
- isCharFormat
- isBlockFormat
- isListFormat
- isFrameFormat
- isImageFormat
- isTableFormat
- isTableCellFormat
- operator!=
- setLayoutDirection
- layoutDirection
- setBackground
- background
- clearBackground
- setForeground
- foreground
- clearForeground
- setObjectType
- QTextCharFormat
- VerticalAlignment
- UnderlineStyle
- isValid
- FontPropertiesInheritanceBehavior
- setFontFamily
- fontFamily
- setFontFamilies
- fontFamilies
- setFontStyleName
- fontStyleName
- setFontPointSize
- fontPointSize
- setFontWeight
- fontWeight
- setFontItalic
- fontItalic
- setFontCapitalization
- fontCapitalization
- setFontLetterSpacingType
- fontLetterSpacingType
- setFontLetterSpacing
- fontLetterSpacing
- setFontWordSpacing
- fontWordSpacing
- setFontUnderline
- setFontOverline
- fontOverline
- setFontStrikeOut
- fontStrikeOut
- setUnderlineColor
- underlineColor
- setFontFixedPitch
- fontFixedPitch
- setFontStretch
- fontStretch
- setFontStyleHint
- setFontStyleStrategy
- fontStyleHint
- fontStyleStrategy
- setFontHintingPreference
- fontHintingPreference
- setFontKerning
- fontKerning
- underlineStyle
- setVerticalAlignment
- verticalAlignment
- setTextOutline
- textOutline
- setToolTip
- toolTip
- setSuperScriptBaseline
- superScriptBaseline
- setSubScriptBaseline
- subScriptBaseline
- setBaselineOffset
- baselineOffset
- setAnchor
- isAnchor
- setAnchorHref
- anchorHref
- setAnchorNames
- tableCellRowSpan
- tableCellColumnSpan
- setTableCellRowSpan
- setTableCellColumnSpan
- QTextBlockFormat
- LineHeightTypes
- MarkerType
- isValid
- alignment
- setTopMargin
- topMargin
- setBottomMargin
- bottomMargin
- setLeftMargin
- leftMargin
- setRightMargin
- rightMargin
- setTextIndent
- textIndent
- indent
- setHeadingLevel
- headingLevel
- setLineHeight
- lineHeight
- lineHeightType
- setNonBreakableLines
- nonBreakableLines
- setPageBreakPolicy
- pageBreakPolicy
- setMarker
- marker
- setAlignment
- setIndent
- lineHeight
- QTextListFormat
- isValid
- Style
- style
- indent
- numberPrefix
- numberSuffix
- start
- setStyle
- setIndent
- setNumberPrefix
- setNumberSuffix
- setStart
- QTextImageFormat
- isValid
- name
- width
- maximumWidth
- height
- setQuality
- quality
- setName
- setWidth
- setMaximumWidth
- setHeight
- setQuality
- QTextFrameFormat
- isValid
- Position
- BorderStyle
- setPosition
- position
- border
- setBorderBrush
- borderBrush
- setBorderStyle
- borderStyle
- margin
- padding
- setWidth
- width
- height
- setPageBreakPolicy
- pageBreakPolicy
- setBorder
- setPadding
- setWidth
- setHeight
- setHeight
- setTopMargin
- setBottomMargin
- setLeftMargin
- setRightMargin
- QTextTableFormat
- isValid
- columns
- setColumnWidthConstraints
- columnWidthConstraints
- clearColumnWidthConstraints
- cellSpacing
- setCellSpacing
- cellPadding
- alignment
- setHeaderRowCount
- headerRowCount
- setBorderCollapse
- borderCollapse
- setColumns
- setCellPadding
- setAlignment
- QTextTableCellFormat
- isValid
- setTopBorder
- topBorder
- setBottomBorder
- bottomBorder
- setLeftBorder
- leftBorder
- setRightBorder
- rightBorder
- setTopBorderStyle
- topBorderStyle
- setBottomBorderStyle
- bottomBorderStyle
- setLeftBorderStyle
- leftBorderStyle
- setRightBorderStyle
- rightBorderStyle
- setTopBorderBrush
- topBorderBrush
- setBottomBorderBrush
- bottomBorderBrush
- setLeftBorderBrush
- leftBorderBrush
- setRightBorderBrush
- rightBorderBrush
- setTopPadding
- topPadding
- setBottomPadding
- bottomPadding
- setLeftPadding
- leftPadding
- setRightPadding
- rightPadding
- setPadding
- setBorder
- setBorderStyle
Learn to use CMake with our Intro Training
Find out more