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