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 | = 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 | |
245 | // internal |
246 | /* |
247 | SuppressText = 0x5012, |
248 | SuppressBackground = 0x513 |
249 | */ |
250 | |
251 | // selection properties |
252 | FullWidthSelection = 0x06000, |
253 | |
254 | // page break properties |
255 | PageBreakPolicy = 0x7000, |
256 | |
257 | // -- |
258 | UserProperty = 0x100000 |
259 | }; |
260 | Q_ENUM(Property) |
261 | |
262 | enum ObjectTypes { |
263 | NoObject, |
264 | ImageObject, |
265 | TableObject, |
266 | TableCellObject, |
267 | |
268 | UserObject = 0x1000 |
269 | }; |
270 | Q_ENUM(ObjectTypes) |
271 | |
272 | enum PageBreakFlag { |
273 | PageBreak_Auto = 0, |
274 | PageBreak_AlwaysBefore = 0x001, |
275 | PageBreak_AlwaysAfter = 0x010 |
276 | // PageBreak_AlwaysInside = 0x100 |
277 | }; |
278 | Q_DECLARE_FLAGS(PageBreakFlags, PageBreakFlag) |
279 | |
280 | QTextFormat(); |
281 | |
282 | explicit QTextFormat(int type); |
283 | |
284 | QTextFormat(const QTextFormat &rhs); |
285 | QTextFormat &operator=(const QTextFormat &rhs); |
286 | ~QTextFormat(); |
287 | |
288 | void swap(QTextFormat &other) |
289 | { d.swap(other&: other.d); std::swap(a&: format_type, b&: other.format_type); } |
290 | |
291 | void merge(const QTextFormat &other); |
292 | |
293 | inline bool isValid() const { return type() != InvalidFormat; } |
294 | inline bool isEmpty() const { return propertyCount() == 0; } |
295 | |
296 | int type() const; |
297 | |
298 | int objectIndex() const; |
299 | void setObjectIndex(int object); |
300 | |
301 | QVariant property(int propertyId) const; |
302 | void setProperty(int propertyId, const QVariant &value); |
303 | void clearProperty(int propertyId); |
304 | bool hasProperty(int propertyId) const; |
305 | |
306 | bool boolProperty(int propertyId) const; |
307 | int intProperty(int propertyId) const; |
308 | qreal doubleProperty(int propertyId) const; |
309 | QString stringProperty(int propertyId) const; |
310 | QColor colorProperty(int propertyId) const; |
311 | QPen penProperty(int propertyId) const; |
312 | QBrush brushProperty(int propertyId) const; |
313 | QTextLength lengthProperty(int propertyId) const; |
314 | QList<QTextLength> lengthVectorProperty(int propertyId) const; |
315 | |
316 | void setProperty(int propertyId, const QList<QTextLength> &lengths); |
317 | |
318 | QMap<int, QVariant> properties() const; |
319 | int propertyCount() const; |
320 | |
321 | inline void setObjectType(int type); |
322 | inline int objectType() const |
323 | { return intProperty(propertyId: ObjectType); } |
324 | |
325 | inline bool isCharFormat() const { return type() == CharFormat; } |
326 | inline bool isBlockFormat() const { return type() == BlockFormat; } |
327 | inline bool isListFormat() const { return type() == ListFormat; } |
328 | inline bool isFrameFormat() const { return type() == FrameFormat; } |
329 | inline bool isImageFormat() const { return type() == CharFormat && objectType() == ImageObject; } |
330 | inline bool isTableFormat() const { return type() == FrameFormat && objectType() == TableObject; } |
331 | inline bool isTableCellFormat() const { return type() == CharFormat && objectType() == TableCellObject; } |
332 | |
333 | QTextBlockFormat toBlockFormat() const; |
334 | QTextCharFormat toCharFormat() const; |
335 | QTextListFormat toListFormat() const; |
336 | QTextTableFormat toTableFormat() const; |
337 | QTextFrameFormat toFrameFormat() const; |
338 | QTextImageFormat toImageFormat() const; |
339 | QTextTableCellFormat toTableCellFormat() const; |
340 | |
341 | bool operator==(const QTextFormat &rhs) const; |
342 | inline bool operator!=(const QTextFormat &rhs) const { return !operator==(rhs); } |
343 | operator QVariant() const; |
344 | |
345 | inline void setLayoutDirection(Qt::LayoutDirection direction) |
346 | { setProperty(propertyId: QTextFormat::LayoutDirection, value: direction); } |
347 | inline Qt::LayoutDirection layoutDirection() const |
348 | { return Qt::LayoutDirection(intProperty(propertyId: QTextFormat::LayoutDirection)); } |
349 | |
350 | inline void setBackground(const QBrush &brush) |
351 | { setProperty(propertyId: BackgroundBrush, value: brush); } |
352 | inline QBrush background() const |
353 | { return brushProperty(propertyId: BackgroundBrush); } |
354 | inline void clearBackground() |
355 | { clearProperty(propertyId: BackgroundBrush); } |
356 | |
357 | inline void setForeground(const QBrush &brush) |
358 | { setProperty(propertyId: ForegroundBrush, value: brush); } |
359 | inline QBrush foreground() const |
360 | { return brushProperty(propertyId: ForegroundBrush); } |
361 | inline void clearForeground() |
362 | { clearProperty(propertyId: ForegroundBrush); } |
363 | |
364 | private: |
365 | QSharedDataPointer<QTextFormatPrivate> d; |
366 | qint32 format_type; |
367 | |
368 | friend class QTextFormatCollection; |
369 | friend class QTextCharFormat; |
370 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFormat &); |
371 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFormat &); |
372 | }; |
373 | |
374 | Q_DECLARE_SHARED(QTextFormat) |
375 | |
376 | inline void QTextFormat::setObjectType(int atype) |
377 | { setProperty(propertyId: ObjectType, value: atype); } |
378 | |
379 | Q_DECLARE_OPERATORS_FOR_FLAGS(QTextFormat::PageBreakFlags) |
380 | |
381 | class Q_GUI_EXPORT QTextCharFormat : public QTextFormat |
382 | { |
383 | public: |
384 | enum VerticalAlignment { |
385 | AlignNormal = 0, |
386 | AlignSuperScript, |
387 | AlignSubScript, |
388 | AlignMiddle, |
389 | AlignTop, |
390 | AlignBottom, |
391 | AlignBaseline |
392 | }; |
393 | enum UnderlineStyle { // keep in sync with Qt::PenStyle! |
394 | NoUnderline, |
395 | SingleUnderline, |
396 | DashUnderline, |
397 | DotLine, |
398 | DashDotLine, |
399 | DashDotDotLine, |
400 | WaveUnderline, |
401 | SpellCheckUnderline |
402 | }; |
403 | |
404 | QTextCharFormat(); |
405 | |
406 | bool isValid() const { return isCharFormat(); } |
407 | |
408 | enum FontPropertiesInheritanceBehavior { |
409 | FontPropertiesSpecifiedOnly, |
410 | FontPropertiesAll |
411 | }; |
412 | void setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior = FontPropertiesAll); |
413 | QFont font() const; |
414 | |
415 | #if QT_DEPRECATED_SINCE(6, 1) |
416 | QT_DEPRECATED_VERSION_X_6_1("Use setFontFamilies instead" ) inline void setFontFamily(const QString &family) |
417 | { setProperty(propertyId: FontFamilies, value: QVariant(QStringList(family))); } |
418 | QT_DEPRECATED_VERSION_X_6_1("Use fontFamilies instead" ) inline QString fontFamily() const |
419 | { return property(propertyId: FontFamilies).toStringList().first(); } |
420 | #endif |
421 | |
422 | inline void setFontFamilies(const QStringList &families) |
423 | { setProperty(propertyId: FontFamilies, value: QVariant(families)); } |
424 | #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) |
425 | inline QVariant fontFamilies() const |
426 | { return property(propertyId: FontFamilies); } |
427 | #else |
428 | inline QStringList fontFamilies() const |
429 | { return property(FontFamilies).toStringList(); } |
430 | #endif |
431 | |
432 | inline void setFontStyleName(const QString &styleName) |
433 | { setProperty(propertyId: FontStyleName, value: styleName); } |
434 | #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) |
435 | inline QVariant fontStyleName() const |
436 | { return property(propertyId: FontStyleName); } |
437 | #else |
438 | inline QStringList fontStyleName() const |
439 | { return property(FontStyleName).toStringList(); } |
440 | #endif |
441 | |
442 | inline void setFontPointSize(qreal size) |
443 | { setProperty(propertyId: FontPointSize, value: size); } |
444 | inline qreal fontPointSize() const |
445 | { return doubleProperty(propertyId: FontPointSize); } |
446 | |
447 | inline void setFontWeight(int weight) |
448 | { setProperty(propertyId: FontWeight, value: weight); } |
449 | inline int fontWeight() const |
450 | { return hasProperty(propertyId: FontWeight) ? intProperty(propertyId: FontWeight) : QFont::Normal; } |
451 | inline void setFontItalic(bool italic) |
452 | { setProperty(propertyId: FontItalic, value: italic); } |
453 | inline bool fontItalic() const |
454 | { return boolProperty(propertyId: FontItalic); } |
455 | inline void setFontCapitalization(QFont::Capitalization capitalization) |
456 | { setProperty(propertyId: FontCapitalization, value: capitalization); } |
457 | inline QFont::Capitalization fontCapitalization() const |
458 | { return static_cast<QFont::Capitalization>(intProperty(propertyId: FontCapitalization)); } |
459 | inline void setFontLetterSpacingType(QFont::SpacingType letterSpacingType) |
460 | { setProperty(propertyId: FontLetterSpacingType, value: letterSpacingType); } |
461 | inline QFont::SpacingType fontLetterSpacingType() const |
462 | { return static_cast<QFont::SpacingType>(intProperty(propertyId: FontLetterSpacingType)); } |
463 | inline void setFontLetterSpacing(qreal spacing) |
464 | { setProperty(propertyId: FontLetterSpacing, value: spacing); } |
465 | inline qreal fontLetterSpacing() const |
466 | { return doubleProperty(propertyId: FontLetterSpacing); } |
467 | inline void setFontWordSpacing(qreal spacing) |
468 | { setProperty(propertyId: FontWordSpacing, value: spacing); } |
469 | inline qreal fontWordSpacing() const |
470 | { return doubleProperty(propertyId: FontWordSpacing); } |
471 | |
472 | inline void setFontUnderline(bool underline) |
473 | { setProperty(propertyId: TextUnderlineStyle, value: underline ? SingleUnderline : NoUnderline); } |
474 | bool fontUnderline() const; |
475 | |
476 | inline void setFontOverline(bool overline) |
477 | { setProperty(propertyId: FontOverline, value: overline); } |
478 | inline bool fontOverline() const |
479 | { return boolProperty(propertyId: FontOverline); } |
480 | |
481 | inline void setFontStrikeOut(bool strikeOut) |
482 | { setProperty(propertyId: FontStrikeOut, value: strikeOut); } |
483 | inline bool fontStrikeOut() const |
484 | { return boolProperty(propertyId: FontStrikeOut); } |
485 | |
486 | inline void setUnderlineColor(const QColor &color) |
487 | { setProperty(propertyId: TextUnderlineColor, value: color); } |
488 | inline QColor underlineColor() const |
489 | { return colorProperty(propertyId: TextUnderlineColor); } |
490 | |
491 | inline void setFontFixedPitch(bool fixedPitch) |
492 | { setProperty(propertyId: FontFixedPitch, value: fixedPitch); } |
493 | inline bool fontFixedPitch() const |
494 | { return boolProperty(propertyId: FontFixedPitch); } |
495 | |
496 | inline void setFontStretch(int factor) |
497 | { setProperty(propertyId: FontStretch, value: factor); } |
498 | inline int fontStretch() const |
499 | { return intProperty(propertyId: FontStretch); } |
500 | |
501 | inline void setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy = QFont::PreferDefault) |
502 | { setProperty(propertyId: FontStyleHint, value: hint); setProperty(propertyId: FontStyleStrategy, value: strategy); } |
503 | inline void setFontStyleStrategy(QFont::StyleStrategy strategy) |
504 | { setProperty(propertyId: FontStyleStrategy, value: strategy); } |
505 | QFont::StyleHint fontStyleHint() const |
506 | { return static_cast<QFont::StyleHint>(intProperty(propertyId: FontStyleHint)); } |
507 | QFont::StyleStrategy fontStyleStrategy() const |
508 | { return static_cast<QFont::StyleStrategy>(intProperty(propertyId: FontStyleStrategy)); } |
509 | |
510 | inline void setFontHintingPreference(QFont::HintingPreference hintingPreference) |
511 | { |
512 | setProperty(propertyId: FontHintingPreference, value: hintingPreference); |
513 | } |
514 | |
515 | inline QFont::HintingPreference fontHintingPreference() const |
516 | { |
517 | return static_cast<QFont::HintingPreference>(intProperty(propertyId: FontHintingPreference)); |
518 | } |
519 | |
520 | inline void setFontKerning(bool enable) |
521 | { setProperty(propertyId: FontKerning, value: enable); } |
522 | inline bool fontKerning() const |
523 | { return boolProperty(propertyId: FontKerning); } |
524 | |
525 | void setUnderlineStyle(UnderlineStyle style); |
526 | inline UnderlineStyle underlineStyle() const |
527 | { return static_cast<UnderlineStyle>(intProperty(propertyId: TextUnderlineStyle)); } |
528 | |
529 | inline void setVerticalAlignment(VerticalAlignment alignment) |
530 | { setProperty(propertyId: TextVerticalAlignment, value: alignment); } |
531 | inline VerticalAlignment verticalAlignment() const |
532 | { return static_cast<VerticalAlignment>(intProperty(propertyId: TextVerticalAlignment)); } |
533 | |
534 | inline void setTextOutline(const QPen &pen) |
535 | { setProperty(propertyId: TextOutline, value: pen); } |
536 | inline QPen textOutline() const |
537 | { return penProperty(propertyId: TextOutline); } |
538 | |
539 | inline void setToolTip(const QString &tip) |
540 | { setProperty(propertyId: TextToolTip, value: tip); } |
541 | inline QString toolTip() const |
542 | { return stringProperty(propertyId: TextToolTip); } |
543 | |
544 | inline void setSuperScriptBaseline(qreal baseline) |
545 | { setProperty(propertyId: TextSuperScriptBaseline, value: baseline); } |
546 | inline qreal superScriptBaseline() const |
547 | { return hasProperty(propertyId: TextSuperScriptBaseline) ? doubleProperty(propertyId: TextSuperScriptBaseline) : 50.0; } |
548 | |
549 | inline void setSubScriptBaseline(qreal baseline) |
550 | { setProperty(propertyId: TextSubScriptBaseline, value: baseline); } |
551 | inline qreal subScriptBaseline() const |
552 | { return hasProperty(propertyId: TextSubScriptBaseline) ? doubleProperty(propertyId: TextSubScriptBaseline) : 100.0 / 6.0; } |
553 | |
554 | inline void setBaselineOffset(qreal baseline) |
555 | { setProperty(propertyId: TextBaselineOffset, value: baseline); } |
556 | inline qreal baselineOffset() const |
557 | { return hasProperty(propertyId: TextBaselineOffset) ? doubleProperty(propertyId: TextBaselineOffset) : 0.0; } |
558 | |
559 | inline void setAnchor(bool anchor) |
560 | { setProperty(propertyId: IsAnchor, value: anchor); } |
561 | inline bool isAnchor() const |
562 | { return boolProperty(propertyId: IsAnchor); } |
563 | |
564 | inline void setAnchorHref(const QString &value) |
565 | { setProperty(propertyId: AnchorHref, value); } |
566 | inline QString anchorHref() const |
567 | { return stringProperty(propertyId: AnchorHref); } |
568 | |
569 | inline void setAnchorNames(const QStringList &names) |
570 | { setProperty(propertyId: AnchorName, value: names); } |
571 | QStringList anchorNames() const; |
572 | |
573 | inline void setTableCellRowSpan(int tableCellRowSpan); |
574 | inline int tableCellRowSpan() const |
575 | { int s = intProperty(propertyId: TableCellRowSpan); if (s == 0) s = 1; return s; } |
576 | inline void setTableCellColumnSpan(int tableCellColumnSpan); |
577 | inline int tableCellColumnSpan() const |
578 | { int s = intProperty(propertyId: TableCellColumnSpan); if (s == 0) s = 1; return s; } |
579 | |
580 | protected: |
581 | explicit QTextCharFormat(const QTextFormat &fmt); |
582 | friend class QTextFormat; |
583 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextCharFormat &); |
584 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextCharFormat &); |
585 | }; |
586 | |
587 | Q_DECLARE_SHARED(QTextCharFormat) |
588 | |
589 | inline void QTextCharFormat::setTableCellRowSpan(int _tableCellRowSpan) |
590 | { |
591 | if (_tableCellRowSpan <= 1) |
592 | clearProperty(propertyId: TableCellRowSpan); // the getter will return 1 here. |
593 | else |
594 | setProperty(propertyId: TableCellRowSpan, value: _tableCellRowSpan); |
595 | } |
596 | |
597 | inline void QTextCharFormat::setTableCellColumnSpan(int _tableCellColumnSpan) |
598 | { |
599 | if (_tableCellColumnSpan <= 1) |
600 | clearProperty(propertyId: TableCellColumnSpan); // the getter will return 1 here. |
601 | else |
602 | setProperty(propertyId: TableCellColumnSpan, value: _tableCellColumnSpan); |
603 | } |
604 | |
605 | class Q_GUI_EXPORT QTextBlockFormat : public QTextFormat |
606 | { |
607 | public: |
608 | enum LineHeightTypes { |
609 | SingleHeight = 0, |
610 | ProportionalHeight = 1, |
611 | FixedHeight = 2, |
612 | MinimumHeight = 3, |
613 | LineDistanceHeight = 4 |
614 | }; |
615 | |
616 | enum class MarkerType { |
617 | NoMarker = 0, |
618 | Unchecked = 1, |
619 | Checked = 2 |
620 | }; |
621 | |
622 | QTextBlockFormat(); |
623 | |
624 | bool isValid() const { return isBlockFormat(); } |
625 | |
626 | inline void setAlignment(Qt::Alignment alignment); |
627 | inline Qt::Alignment alignment() const |
628 | { int a = intProperty(propertyId: BlockAlignment); if (a == 0) a = Qt::AlignLeft; return QFlag(a); } |
629 | |
630 | inline void setTopMargin(qreal margin) |
631 | { setProperty(propertyId: BlockTopMargin, value: margin); } |
632 | inline qreal topMargin() const |
633 | { return doubleProperty(propertyId: BlockTopMargin); } |
634 | |
635 | inline void setBottomMargin(qreal margin) |
636 | { setProperty(propertyId: BlockBottomMargin, value: margin); } |
637 | inline qreal bottomMargin() const |
638 | { return doubleProperty(propertyId: BlockBottomMargin); } |
639 | |
640 | inline void setLeftMargin(qreal margin) |
641 | { setProperty(propertyId: BlockLeftMargin, value: margin); } |
642 | inline qreal leftMargin() const |
643 | { return doubleProperty(propertyId: BlockLeftMargin); } |
644 | |
645 | inline void setRightMargin(qreal margin) |
646 | { setProperty(propertyId: BlockRightMargin, value: margin); } |
647 | inline qreal rightMargin() const |
648 | { return doubleProperty(propertyId: BlockRightMargin); } |
649 | |
650 | inline void setTextIndent(qreal aindent) |
651 | { setProperty(propertyId: TextIndent, value: aindent); } |
652 | inline qreal textIndent() const |
653 | { return doubleProperty(propertyId: TextIndent); } |
654 | |
655 | inline void setIndent(int indent); |
656 | inline int indent() const |
657 | { return intProperty(propertyId: BlockIndent); } |
658 | |
659 | inline void setHeadingLevel(int alevel) |
660 | { setProperty(propertyId: HeadingLevel, value: alevel); } |
661 | inline int headingLevel() const |
662 | { return intProperty(propertyId: HeadingLevel); } |
663 | |
664 | inline void setLineHeight(qreal height, int heightType) |
665 | { setProperty(propertyId: LineHeight, value: height); setProperty(propertyId: LineHeightType, value: heightType); } |
666 | inline qreal lineHeight(qreal scriptLineHeight, qreal scaling) const; |
667 | inline qreal lineHeight() const |
668 | { return doubleProperty(propertyId: LineHeight); } |
669 | inline int lineHeightType() const |
670 | { return intProperty(propertyId: LineHeightType); } |
671 | |
672 | inline void setNonBreakableLines(bool b) |
673 | { setProperty(propertyId: BlockNonBreakableLines, value: b); } |
674 | inline bool nonBreakableLines() const |
675 | { return boolProperty(propertyId: BlockNonBreakableLines); } |
676 | |
677 | inline void setPageBreakPolicy(PageBreakFlags flags) |
678 | { setProperty(propertyId: PageBreakPolicy, value: int(flags.toInt())); } |
679 | inline PageBreakFlags pageBreakPolicy() const |
680 | { return PageBreakFlags(intProperty(propertyId: PageBreakPolicy)); } |
681 | |
682 | void setTabPositions(const QList<QTextOption::Tab> &tabs); |
683 | QList<QTextOption::Tab> tabPositions() const; |
684 | |
685 | inline void setMarker(MarkerType marker) |
686 | { setProperty(propertyId: BlockMarker, value: int(marker)); } |
687 | inline MarkerType marker() const |
688 | { return MarkerType(intProperty(propertyId: BlockMarker)); } |
689 | |
690 | protected: |
691 | explicit QTextBlockFormat(const QTextFormat &fmt); |
692 | friend class QTextFormat; |
693 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextBlockFormat &); |
694 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextBlockFormat &); |
695 | }; |
696 | |
697 | Q_DECLARE_SHARED(QTextBlockFormat) |
698 | |
699 | inline void QTextBlockFormat::setAlignment(Qt::Alignment aalignment) |
700 | { setProperty(propertyId: BlockAlignment, value: int(aalignment.toInt())); } |
701 | |
702 | inline void QTextBlockFormat::setIndent(int aindent) |
703 | { setProperty(propertyId: BlockIndent, value: aindent); } |
704 | |
705 | inline qreal QTextBlockFormat::lineHeight(qreal scriptLineHeight, qreal scaling = 1.0) const |
706 | { |
707 | switch(intProperty(propertyId: LineHeightType)) { |
708 | case SingleHeight: |
709 | return(scriptLineHeight); |
710 | case ProportionalHeight: |
711 | return(scriptLineHeight * doubleProperty(propertyId: LineHeight) / 100.0); |
712 | case FixedHeight: |
713 | return(doubleProperty(propertyId: LineHeight) * scaling); |
714 | case MinimumHeight: |
715 | return(qMax(a: scriptLineHeight, b: doubleProperty(propertyId: LineHeight) * scaling)); |
716 | case LineDistanceHeight: |
717 | return(scriptLineHeight + doubleProperty(propertyId: LineHeight) * scaling); |
718 | } |
719 | return(0); |
720 | } |
721 | |
722 | class Q_GUI_EXPORT QTextListFormat : public QTextFormat |
723 | { |
724 | public: |
725 | QTextListFormat(); |
726 | |
727 | bool isValid() const { return isListFormat(); } |
728 | |
729 | enum Style { |
730 | ListDisc = -1, |
731 | ListCircle = -2, |
732 | ListSquare = -3, |
733 | ListDecimal = -4, |
734 | ListLowerAlpha = -5, |
735 | ListUpperAlpha = -6, |
736 | ListLowerRoman = -7, |
737 | ListUpperRoman = -8, |
738 | ListStyleUndefined = 0 |
739 | }; |
740 | |
741 | inline void setStyle(Style style); |
742 | inline Style style() const |
743 | { return static_cast<Style>(intProperty(propertyId: ListStyle)); } |
744 | |
745 | inline void setIndent(int indent); |
746 | inline int indent() const |
747 | { return intProperty(propertyId: ListIndent); } |
748 | |
749 | inline void setNumberPrefix(const QString &numberPrefix); |
750 | inline QString numberPrefix() const |
751 | { return stringProperty(propertyId: ListNumberPrefix); } |
752 | |
753 | inline void setNumberSuffix(const QString &numberSuffix); |
754 | inline QString numberSuffix() const |
755 | { return stringProperty(propertyId: ListNumberSuffix); } |
756 | |
757 | inline void setStart(int indent); |
758 | inline int start() const { return intProperty(propertyId: ListStart); } |
759 | |
760 | protected: |
761 | explicit QTextListFormat(const QTextFormat &fmt); |
762 | friend class QTextFormat; |
763 | }; |
764 | |
765 | Q_DECLARE_SHARED(QTextListFormat) |
766 | |
767 | inline void QTextListFormat::setStyle(Style astyle) |
768 | { setProperty(propertyId: ListStyle, value: astyle); } |
769 | |
770 | inline void QTextListFormat::setIndent(int aindent) |
771 | { setProperty(propertyId: ListIndent, value: aindent); } |
772 | |
773 | inline void QTextListFormat::setNumberPrefix(const QString &np) |
774 | { setProperty(propertyId: ListNumberPrefix, value: np); } |
775 | |
776 | inline void QTextListFormat::setNumberSuffix(const QString &ns) |
777 | { setProperty(propertyId: ListNumberSuffix, value: ns); } |
778 | |
779 | inline void QTextListFormat::setStart(int astart) |
780 | { |
781 | setProperty(propertyId: ListStart, value: astart); |
782 | } |
783 | |
784 | class Q_GUI_EXPORT QTextImageFormat : public QTextCharFormat |
785 | { |
786 | public: |
787 | QTextImageFormat(); |
788 | |
789 | bool isValid() const { return isImageFormat(); } |
790 | |
791 | inline void setName(const QString &name); |
792 | inline QString name() const |
793 | { return stringProperty(propertyId: ImageName); } |
794 | |
795 | inline void setWidth(qreal width); |
796 | inline qreal width() const |
797 | { return doubleProperty(propertyId: ImageWidth); } |
798 | |
799 | inline void setHeight(qreal height); |
800 | inline qreal height() const |
801 | { return doubleProperty(propertyId: ImageHeight); } |
802 | |
803 | inline void setQuality(int quality); |
804 | #if QT_DEPRECATED_SINCE(6, 3) |
805 | QT_DEPRECATED_VERSION_X_6_3("Pass a quality value, the default is 100" ) inline void setQuality() |
806 | { setQuality(100); } |
807 | #endif |
808 | inline int quality() const |
809 | { return intProperty(propertyId: ImageQuality); } |
810 | |
811 | protected: |
812 | explicit QTextImageFormat(const QTextFormat &format); |
813 | friend class QTextFormat; |
814 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextListFormat &); |
815 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextListFormat &); |
816 | }; |
817 | |
818 | Q_DECLARE_SHARED(QTextImageFormat) |
819 | |
820 | inline void QTextImageFormat::setName(const QString &aname) |
821 | { setProperty(propertyId: ImageName, value: aname); } |
822 | |
823 | inline void QTextImageFormat::setWidth(qreal awidth) |
824 | { setProperty(propertyId: ImageWidth, value: awidth); } |
825 | |
826 | inline void QTextImageFormat::setHeight(qreal aheight) |
827 | { setProperty(propertyId: ImageHeight, value: aheight); } |
828 | |
829 | inline void QTextImageFormat::setQuality(int aquality) |
830 | { setProperty(propertyId: ImageQuality, value: aquality); } |
831 | |
832 | class Q_GUI_EXPORT QTextFrameFormat : public QTextFormat |
833 | { |
834 | public: |
835 | QTextFrameFormat(); |
836 | |
837 | bool isValid() const { return isFrameFormat(); } |
838 | |
839 | enum Position { |
840 | InFlow, |
841 | FloatLeft, |
842 | FloatRight |
843 | // ###### |
844 | // Absolute |
845 | }; |
846 | |
847 | enum BorderStyle { |
848 | BorderStyle_None, |
849 | BorderStyle_Dotted, |
850 | BorderStyle_Dashed, |
851 | BorderStyle_Solid, |
852 | BorderStyle_Double, |
853 | BorderStyle_DotDash, |
854 | BorderStyle_DotDotDash, |
855 | BorderStyle_Groove, |
856 | BorderStyle_Ridge, |
857 | BorderStyle_Inset, |
858 | BorderStyle_Outset |
859 | }; |
860 | |
861 | inline void setPosition(Position f) |
862 | { setProperty(propertyId: CssFloat, value: f); } |
863 | inline Position position() const |
864 | { return static_cast<Position>(intProperty(propertyId: CssFloat)); } |
865 | |
866 | inline void setBorder(qreal border); |
867 | inline qreal border() const |
868 | { return doubleProperty(propertyId: FrameBorder); } |
869 | |
870 | inline void setBorderBrush(const QBrush &brush) |
871 | { setProperty(propertyId: FrameBorderBrush, value: brush); } |
872 | inline QBrush borderBrush() const |
873 | { return brushProperty(propertyId: FrameBorderBrush); } |
874 | |
875 | inline void setBorderStyle(BorderStyle style) |
876 | { setProperty(propertyId: FrameBorderStyle, value: style); } |
877 | inline BorderStyle borderStyle() const |
878 | { return static_cast<BorderStyle>(intProperty(propertyId: FrameBorderStyle)); } |
879 | |
880 | void setMargin(qreal margin); |
881 | inline qreal margin() const |
882 | { return doubleProperty(propertyId: FrameMargin); } |
883 | |
884 | inline void setTopMargin(qreal margin); |
885 | qreal topMargin() const; |
886 | |
887 | inline void setBottomMargin(qreal margin); |
888 | qreal bottomMargin() const; |
889 | |
890 | inline void setLeftMargin(qreal margin); |
891 | qreal leftMargin() const; |
892 | |
893 | inline void setRightMargin(qreal margin); |
894 | qreal rightMargin() const; |
895 | |
896 | inline void setPadding(qreal padding); |
897 | inline qreal padding() const |
898 | { return doubleProperty(propertyId: FramePadding); } |
899 | |
900 | inline void setWidth(qreal width); |
901 | inline void setWidth(const QTextLength &length) |
902 | { setProperty(propertyId: FrameWidth, value: length); } |
903 | inline QTextLength width() const |
904 | { return lengthProperty(propertyId: FrameWidth); } |
905 | |
906 | inline void setHeight(qreal height); |
907 | inline void setHeight(const QTextLength &height); |
908 | inline QTextLength height() const |
909 | { return lengthProperty(propertyId: FrameHeight); } |
910 | |
911 | inline void setPageBreakPolicy(PageBreakFlags flags) |
912 | { setProperty(propertyId: PageBreakPolicy, value: int(flags.toInt())); } |
913 | inline PageBreakFlags pageBreakPolicy() const |
914 | { return PageBreakFlags(intProperty(propertyId: PageBreakPolicy)); } |
915 | |
916 | protected: |
917 | explicit QTextFrameFormat(const QTextFormat &fmt); |
918 | friend class QTextFormat; |
919 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFrameFormat &); |
920 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFrameFormat &); |
921 | }; |
922 | |
923 | Q_DECLARE_SHARED(QTextFrameFormat) |
924 | |
925 | inline void QTextFrameFormat::setBorder(qreal aborder) |
926 | { setProperty(propertyId: FrameBorder, value: aborder); } |
927 | |
928 | inline void QTextFrameFormat::setPadding(qreal apadding) |
929 | { setProperty(propertyId: FramePadding, value: apadding); } |
930 | |
931 | inline void QTextFrameFormat::setWidth(qreal awidth) |
932 | { setProperty(propertyId: FrameWidth, value: QTextLength(QTextLength::FixedLength, awidth)); } |
933 | |
934 | inline void QTextFrameFormat::setHeight(qreal aheight) |
935 | { setProperty(propertyId: FrameHeight, value: QTextLength(QTextLength::FixedLength, aheight)); } |
936 | inline void QTextFrameFormat::setHeight(const QTextLength &aheight) |
937 | { setProperty(propertyId: FrameHeight, value: aheight); } |
938 | |
939 | inline void QTextFrameFormat::setTopMargin(qreal amargin) |
940 | { setProperty(propertyId: FrameTopMargin, value: amargin); } |
941 | |
942 | inline void QTextFrameFormat::setBottomMargin(qreal amargin) |
943 | { setProperty(propertyId: FrameBottomMargin, value: amargin); } |
944 | |
945 | inline void QTextFrameFormat::setLeftMargin(qreal amargin) |
946 | { setProperty(propertyId: FrameLeftMargin, value: amargin); } |
947 | |
948 | inline void QTextFrameFormat::setRightMargin(qreal amargin) |
949 | { setProperty(propertyId: FrameRightMargin, value: amargin); } |
950 | |
951 | class Q_GUI_EXPORT QTextTableFormat : public QTextFrameFormat |
952 | { |
953 | public: |
954 | QTextTableFormat(); |
955 | |
956 | inline bool isValid() const { return isTableFormat(); } |
957 | |
958 | inline int columns() const |
959 | { int cols = intProperty(propertyId: TableColumns); if (cols == 0) cols = 1; return cols; } |
960 | inline void setColumns(int columns); |
961 | |
962 | inline void setColumnWidthConstraints(const QList<QTextLength> &constraints) |
963 | { setProperty(propertyId: TableColumnWidthConstraints, lengths: constraints); } |
964 | |
965 | inline QList<QTextLength> columnWidthConstraints() const |
966 | { return lengthVectorProperty(propertyId: TableColumnWidthConstraints); } |
967 | |
968 | inline void clearColumnWidthConstraints() |
969 | { clearProperty(propertyId: TableColumnWidthConstraints); } |
970 | |
971 | inline qreal cellSpacing() const |
972 | { return doubleProperty(propertyId: TableCellSpacing); } |
973 | inline void setCellSpacing(qreal spacing) |
974 | { setProperty(propertyId: TableCellSpacing, value: spacing); } |
975 | |
976 | inline qreal cellPadding() const |
977 | { return doubleProperty(propertyId: TableCellPadding); } |
978 | inline void setCellPadding(qreal padding); |
979 | |
980 | inline void setAlignment(Qt::Alignment alignment); |
981 | inline Qt::Alignment alignment() const |
982 | { return QFlag(intProperty(propertyId: BlockAlignment)); } |
983 | |
984 | inline void (int count) |
985 | { setProperty(propertyId: TableHeaderRowCount, value: count); } |
986 | inline int () const |
987 | { return intProperty(propertyId: TableHeaderRowCount); } |
988 | |
989 | inline void setBorderCollapse(bool borderCollapse) |
990 | { setProperty(propertyId: TableBorderCollapse, value: borderCollapse); } |
991 | inline bool borderCollapse() const |
992 | { return boolProperty(propertyId: TableBorderCollapse); } |
993 | |
994 | protected: |
995 | explicit QTextTableFormat(const QTextFormat &fmt); |
996 | friend class QTextFormat; |
997 | }; |
998 | |
999 | Q_DECLARE_SHARED(QTextTableFormat) |
1000 | |
1001 | inline void QTextTableFormat::setColumns(int acolumns) |
1002 | { |
1003 | if (acolumns == 1) |
1004 | acolumns = 0; |
1005 | setProperty(propertyId: TableColumns, value: acolumns); |
1006 | } |
1007 | |
1008 | inline void QTextTableFormat::setCellPadding(qreal apadding) |
1009 | { setProperty(propertyId: TableCellPadding, value: apadding); } |
1010 | |
1011 | inline void QTextTableFormat::setAlignment(Qt::Alignment aalignment) |
1012 | { setProperty(propertyId: BlockAlignment, value: int(aalignment.toInt())); } |
1013 | |
1014 | class Q_GUI_EXPORT QTextTableCellFormat : public QTextCharFormat |
1015 | { |
1016 | public: |
1017 | QTextTableCellFormat(); |
1018 | |
1019 | inline bool isValid() const { return isTableCellFormat(); } |
1020 | |
1021 | inline void setTopPadding(qreal padding); |
1022 | inline qreal topPadding() const; |
1023 | |
1024 | inline void setBottomPadding(qreal padding); |
1025 | inline qreal bottomPadding() const; |
1026 | |
1027 | inline void setLeftPadding(qreal padding); |
1028 | inline qreal leftPadding() const; |
1029 | |
1030 | inline void setRightPadding(qreal padding); |
1031 | inline qreal rightPadding() const; |
1032 | |
1033 | inline void setPadding(qreal padding); |
1034 | |
1035 | inline void setTopBorder(qreal width) |
1036 | { setProperty(propertyId: TableCellTopBorder, value: width); } |
1037 | inline qreal topBorder() const |
1038 | { return doubleProperty(propertyId: TableCellTopBorder); } |
1039 | |
1040 | inline void setBottomBorder(qreal width) |
1041 | { setProperty(propertyId: TableCellBottomBorder, value: width); } |
1042 | inline qreal bottomBorder() const |
1043 | { return doubleProperty(propertyId: TableCellBottomBorder); } |
1044 | |
1045 | inline void setLeftBorder(qreal width) |
1046 | { setProperty(propertyId: TableCellLeftBorder, value: width); } |
1047 | inline qreal leftBorder() const |
1048 | { return doubleProperty(propertyId: TableCellLeftBorder); } |
1049 | |
1050 | inline void setRightBorder(qreal width) |
1051 | { setProperty(propertyId: TableCellRightBorder, value: width); } |
1052 | inline qreal rightBorder() const |
1053 | { return doubleProperty(propertyId: TableCellRightBorder); } |
1054 | |
1055 | inline void setBorder(qreal width); |
1056 | |
1057 | inline void setTopBorderStyle(QTextFrameFormat::BorderStyle style) |
1058 | { setProperty(propertyId: TableCellTopBorderStyle, value: style); } |
1059 | inline QTextFrameFormat::BorderStyle topBorderStyle() const |
1060 | { return static_cast<QTextFrameFormat::BorderStyle>(intProperty(propertyId: TableCellTopBorderStyle)); } |
1061 | |
1062 | inline void setBottomBorderStyle(QTextFrameFormat::BorderStyle style) |
1063 | { setProperty(propertyId: TableCellBottomBorderStyle, value: style); } |
1064 | inline QTextFrameFormat::BorderStyle bottomBorderStyle() const |
1065 | { return static_cast<QTextFrameFormat::BorderStyle>(intProperty(propertyId: TableCellBottomBorderStyle)); } |
1066 | |
1067 | inline void setLeftBorderStyle(QTextFrameFormat::BorderStyle style) |
1068 | { setProperty(propertyId: TableCellLeftBorderStyle, value: style); } |
1069 | inline QTextFrameFormat::BorderStyle leftBorderStyle() const |
1070 | { return static_cast<QTextFrameFormat::BorderStyle>(intProperty(propertyId: TableCellLeftBorderStyle)); } |
1071 | |
1072 | inline void setRightBorderStyle(QTextFrameFormat::BorderStyle style) |
1073 | { setProperty(propertyId: TableCellRightBorderStyle, value: style); } |
1074 | inline QTextFrameFormat::BorderStyle rightBorderStyle() const |
1075 | { return static_cast<QTextFrameFormat::BorderStyle>(intProperty(propertyId: TableCellRightBorderStyle)); } |
1076 | |
1077 | inline void setBorderStyle(QTextFrameFormat::BorderStyle style); |
1078 | |
1079 | inline void setTopBorderBrush(const QBrush &brush) |
1080 | { setProperty(propertyId: TableCellTopBorderBrush, value: brush); } |
1081 | inline QBrush topBorderBrush() const |
1082 | { return brushProperty(propertyId: TableCellTopBorderBrush); } |
1083 | |
1084 | inline void setBottomBorderBrush(const QBrush &brush) |
1085 | { setProperty(propertyId: TableCellBottomBorderBrush, value: brush); } |
1086 | inline QBrush bottomBorderBrush() const |
1087 | { return brushProperty(propertyId: TableCellBottomBorderBrush); } |
1088 | |
1089 | inline void setLeftBorderBrush(const QBrush &brush) |
1090 | { setProperty(propertyId: TableCellLeftBorderBrush, value: brush); } |
1091 | inline QBrush leftBorderBrush() const |
1092 | { return brushProperty(propertyId: TableCellLeftBorderBrush); } |
1093 | |
1094 | inline void setRightBorderBrush(const QBrush &brush) |
1095 | { setProperty(propertyId: TableCellRightBorderBrush, value: brush); } |
1096 | inline QBrush rightBorderBrush() const |
1097 | { return brushProperty(propertyId: TableCellRightBorderBrush); } |
1098 | |
1099 | inline void setBorderBrush(const QBrush &brush); |
1100 | |
1101 | protected: |
1102 | explicit QTextTableCellFormat(const QTextFormat &fmt); |
1103 | friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextTableCellFormat &); |
1104 | friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextTableCellFormat &); |
1105 | friend class QTextFormat; |
1106 | }; |
1107 | |
1108 | Q_DECLARE_SHARED(QTextTableCellFormat) |
1109 | |
1110 | inline void QTextTableCellFormat::setTopPadding(qreal padding) |
1111 | { |
1112 | setProperty(propertyId: TableCellTopPadding, value: padding); |
1113 | } |
1114 | |
1115 | inline qreal QTextTableCellFormat::topPadding() const |
1116 | { |
1117 | return doubleProperty(propertyId: TableCellTopPadding); |
1118 | } |
1119 | |
1120 | inline void QTextTableCellFormat::setBottomPadding(qreal padding) |
1121 | { |
1122 | setProperty(propertyId: TableCellBottomPadding, value: padding); |
1123 | } |
1124 | |
1125 | inline qreal QTextTableCellFormat::bottomPadding() const |
1126 | { |
1127 | return doubleProperty(propertyId: TableCellBottomPadding); |
1128 | } |
1129 | |
1130 | inline void QTextTableCellFormat::setLeftPadding(qreal padding) |
1131 | { |
1132 | setProperty(propertyId: TableCellLeftPadding, value: padding); |
1133 | } |
1134 | |
1135 | inline qreal QTextTableCellFormat::leftPadding() const |
1136 | { |
1137 | return doubleProperty(propertyId: TableCellLeftPadding); |
1138 | } |
1139 | |
1140 | inline void QTextTableCellFormat::setRightPadding(qreal padding) |
1141 | { |
1142 | setProperty(propertyId: TableCellRightPadding, value: padding); |
1143 | } |
1144 | |
1145 | inline qreal QTextTableCellFormat::rightPadding() const |
1146 | { |
1147 | return doubleProperty(propertyId: TableCellRightPadding); |
1148 | } |
1149 | |
1150 | inline void QTextTableCellFormat::setPadding(qreal padding) |
1151 | { |
1152 | setTopPadding(padding); |
1153 | setBottomPadding(padding); |
1154 | setLeftPadding(padding); |
1155 | setRightPadding(padding); |
1156 | } |
1157 | |
1158 | inline void QTextTableCellFormat::setBorder(qreal width) |
1159 | { |
1160 | setTopBorder(width); |
1161 | setBottomBorder(width); |
1162 | setLeftBorder(width); |
1163 | setRightBorder(width); |
1164 | } |
1165 | |
1166 | inline void QTextTableCellFormat::setBorderStyle(QTextFrameFormat::BorderStyle style) |
1167 | { |
1168 | setTopBorderStyle(style); |
1169 | setBottomBorderStyle(style); |
1170 | setLeftBorderStyle(style); |
1171 | setRightBorderStyle(style); |
1172 | } |
1173 | |
1174 | inline void QTextTableCellFormat::setBorderBrush(const QBrush &brush) |
1175 | { |
1176 | setTopBorderBrush(brush); |
1177 | setBottomBorderBrush(brush); |
1178 | setLeftBorderBrush(brush); |
1179 | setRightBorderBrush(brush); |
1180 | } |
1181 | |
1182 | QT_END_NAMESPACE |
1183 | |
1184 | #endif // QTEXTFORMAT_H |
1185 | |