1// qtextformat.sip generated by MetaSIP 2// 3// This file is part of the QtGui Python extension module. 4// 5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com> 6// 7// This file is part of PyQt5. 8// 9// This file may be used under the terms of the GNU General Public License 10// version 3.0 as published by the Free Software Foundation and appearing in 11// the file LICENSE included in the packaging of this file. Please review the 12// following information to ensure the GNU General Public License version 3.0 13// requirements will be met: http://www.gnu.org/copyleft/gpl.html. 14// 15// If you do not wish to use this file under the terms of the GPL version 3.0 16// then you may purchase a commercial license. For more information contact 17// info@riverbankcomputing.com. 18// 19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 21 22 23class QTextLength 24{ 25%TypeHeaderCode 26#include <qtextformat.h> 27%End 28 29public: 30 enum Type 31 { 32 VariableLength, 33 FixedLength, 34 PercentageLength, 35 }; 36 37 QTextLength(); 38 QTextLength::Type type() const; 39 QTextLength(QTextLength::Type atype, qreal avalue); 40 qreal value(qreal maximumLength) const; 41 qreal rawValue() const; 42 bool operator==(const QTextLength &other) const; 43 bool operator!=(const QTextLength &other) const; 44 QTextLength(const QVariant &variant /GetWrapper/) /NoDerived/; 45%MethodCode 46 if (a0->canConvert<QTextLength>()) 47 sipCpp = new QTextLength(a0->value<QTextLength>()); 48 else 49 sipError = sipBadCallableArg(0, a0Wrapper); 50%End 51}; 52 53QDataStream &operator<<(QDataStream &, const QTextLength & /Constrained/) /ReleaseGIL/; 54QDataStream &operator>>(QDataStream &, QTextLength & /Constrained/) /ReleaseGIL/; 55 56class QTextFormat 57{ 58%TypeHeaderCode 59#include <qtextformat.h> 60%End 61 62public: 63 enum FormatType 64 { 65 InvalidFormat, 66 BlockFormat, 67 CharFormat, 68 ListFormat, 69 TableFormat, 70 FrameFormat, 71 UserFormat, 72 }; 73 74 enum ObjectTypes 75 { 76 NoObject, 77 ImageObject, 78 TableObject, 79 TableCellObject, 80 UserObject, 81 }; 82 83 enum PageBreakFlag 84 { 85 PageBreak_Auto, 86 PageBreak_AlwaysBefore, 87 PageBreak_AlwaysAfter, 88 }; 89 90 typedef QFlags<QTextFormat::PageBreakFlag> PageBreakFlags; 91 92 enum Property 93 { 94 ObjectIndex, 95 CssFloat, 96 LayoutDirection, 97 OutlinePen, 98 BackgroundBrush, 99 ForegroundBrush, 100 BlockAlignment, 101 BlockTopMargin, 102 BlockBottomMargin, 103 BlockLeftMargin, 104 BlockRightMargin, 105 TextIndent, 106 BlockIndent, 107 BlockNonBreakableLines, 108 BlockTrailingHorizontalRulerWidth, 109 FontFamily, 110 FontPointSize, 111 FontSizeAdjustment, 112 FontSizeIncrement, 113 FontWeight, 114 FontItalic, 115 FontUnderline, 116 FontOverline, 117 FontStrikeOut, 118 FontFixedPitch, 119 FontPixelSize, 120 TextUnderlineColor, 121 TextVerticalAlignment, 122 TextOutline, 123 IsAnchor, 124 AnchorHref, 125 AnchorName, 126 ObjectType, 127 ListStyle, 128 ListIndent, 129 FrameBorder, 130 FrameMargin, 131 FramePadding, 132 FrameWidth, 133 FrameHeight, 134 TableColumns, 135 TableColumnWidthConstraints, 136 TableCellSpacing, 137 TableCellPadding, 138 TableCellRowSpan, 139 TableCellColumnSpan, 140 ImageName, 141 ImageWidth, 142 ImageHeight, 143 TextUnderlineStyle, 144 TableHeaderRowCount, 145 FullWidthSelection, 146 PageBreakPolicy, 147 TextToolTip, 148 FrameTopMargin, 149 FrameBottomMargin, 150 FrameLeftMargin, 151 FrameRightMargin, 152 FrameBorderBrush, 153 FrameBorderStyle, 154 BackgroundImageUrl, 155 TabPositions, 156 FirstFontProperty, 157 FontCapitalization, 158 FontLetterSpacing, 159 FontWordSpacing, 160 LastFontProperty, 161 TableCellTopPadding, 162 TableCellBottomPadding, 163 TableCellLeftPadding, 164 TableCellRightPadding, 165 FontStyleHint, 166 FontStyleStrategy, 167 FontKerning, 168 LineHeight, 169 LineHeightType, 170 FontHintingPreference, 171 ListNumberPrefix, 172 ListNumberSuffix, 173 FontStretch, 174 FontLetterSpacingType, 175%If (Qt_5_12_0 -) 176 HeadingLevel, 177%End 178%If (Qt_5_12_0 -) 179 ImageQuality, 180%End 181%If (Qt_5_13_0 -) 182 FontFamilies, 183%End 184%If (Qt_5_13_0 -) 185 FontStyleName, 186%End 187%If (Qt_5_14_0 -) 188 BlockQuoteLevel, 189%End 190%If (Qt_5_14_0 -) 191 BlockCodeLanguage, 192%End 193%If (Qt_5_14_0 -) 194 BlockCodeFence, 195%End 196%If (Qt_5_14_0 -) 197 BlockMarker, 198%End 199%If (Qt_5_14_0 -) 200 TableBorderCollapse, 201%End 202%If (Qt_5_14_0 -) 203 TableCellTopBorder, 204%End 205%If (Qt_5_14_0 -) 206 TableCellBottomBorder, 207%End 208%If (Qt_5_14_0 -) 209 TableCellLeftBorder, 210%End 211%If (Qt_5_14_0 -) 212 TableCellRightBorder, 213%End 214%If (Qt_5_14_0 -) 215 TableCellTopBorderStyle, 216%End 217%If (Qt_5_14_0 -) 218 TableCellBottomBorderStyle, 219%End 220%If (Qt_5_14_0 -) 221 TableCellLeftBorderStyle, 222%End 223%If (Qt_5_14_0 -) 224 TableCellRightBorderStyle, 225%End 226%If (Qt_5_14_0 -) 227 TableCellTopBorderBrush, 228%End 229%If (Qt_5_14_0 -) 230 TableCellBottomBorderBrush, 231%End 232%If (Qt_5_14_0 -) 233 TableCellLeftBorderBrush, 234%End 235%If (Qt_5_14_0 -) 236 TableCellRightBorderBrush, 237%End 238%If (Qt_5_14_0 -) 239 ImageTitle, 240%End 241%If (Qt_5_14_0 -) 242 ImageAltText, 243%End 244 UserProperty, 245 }; 246 247 QTextFormat(); 248 explicit QTextFormat(int type); 249 QTextFormat(const QTextFormat &rhs); 250 QTextFormat(const QVariant &variant /GetWrapper/) /NoDerived/; 251%MethodCode 252 if (a0->canConvert<QTextFormat>()) 253 sipCpp = new QTextFormat(a0->value<QTextFormat>()); 254 else 255 sipError = sipBadCallableArg(0, a0Wrapper); 256%End 257 258 ~QTextFormat(); 259 void merge(const QTextFormat &other); 260 bool isValid() const; 261 int type() const; 262 int objectIndex() const; 263 void setObjectIndex(int object); 264 QVariant property(int propertyId) const; 265 void setProperty(int propertyId, const QVariant &value); 266 void clearProperty(int propertyId); 267 bool hasProperty(int propertyId) const; 268 bool boolProperty(int propertyId) const; 269 int intProperty(int propertyId) const; 270 qreal doubleProperty(int propertyId) const; 271 QString stringProperty(int propertyId) const; 272 QColor colorProperty(int propertyId) const; 273 QPen penProperty(int propertyId) const; 274 QBrush brushProperty(int propertyId) const; 275 QTextLength lengthProperty(int propertyId) const; 276 QVector<QTextLength> lengthVectorProperty(int propertyId) const; 277 void setProperty(int propertyId, const QVector<QTextLength> &lengths); 278 QMap<int, QVariant> properties() const; 279 int objectType() const; 280 bool isCharFormat() const; 281 bool isBlockFormat() const; 282 bool isListFormat() const; 283 bool isFrameFormat() const; 284 bool isImageFormat() const; 285 bool isTableFormat() const; 286 QTextBlockFormat toBlockFormat() const; 287 QTextCharFormat toCharFormat() const; 288 QTextListFormat toListFormat() const; 289 QTextTableFormat toTableFormat() const; 290 QTextFrameFormat toFrameFormat() const; 291 QTextImageFormat toImageFormat() const; 292 bool operator==(const QTextFormat &rhs) const; 293 bool operator!=(const QTextFormat &rhs) const; 294 void setLayoutDirection(Qt::LayoutDirection direction); 295 Qt::LayoutDirection layoutDirection() const; 296 void setBackground(const QBrush &brush); 297 QBrush background() const; 298 void clearBackground(); 299 void setForeground(const QBrush &brush); 300 QBrush foreground() const; 301 void clearForeground(); 302 void setObjectType(int atype); 303 int propertyCount() const; 304 bool isTableCellFormat() const; 305 QTextTableCellFormat toTableCellFormat() const; 306 void swap(QTextFormat &other /Constrained/); 307%If (Qt_5_3_0 -) 308 bool isEmpty() const; 309%End 310}; 311 312QDataStream &operator<<(QDataStream &, const QTextFormat & /Constrained/) /ReleaseGIL/; 313QDataStream &operator>>(QDataStream &, QTextFormat & /Constrained/) /ReleaseGIL/; 314 315class QTextCharFormat : QTextFormat 316{ 317%TypeHeaderCode 318#include <qtextformat.h> 319%End 320 321public: 322 enum VerticalAlignment 323 { 324 AlignNormal, 325 AlignSuperScript, 326 AlignSubScript, 327 AlignMiddle, 328 AlignTop, 329 AlignBottom, 330 AlignBaseline, 331 }; 332 333 QTextCharFormat(); 334 bool isValid() const; 335 void setFont(const QFont &font); 336 QFont font() const; 337 void setFontFamily(const QString &family); 338 QString fontFamily() const; 339 void setFontPointSize(qreal size); 340 qreal fontPointSize() const; 341 void setFontWeight(int weight); 342 int fontWeight() const; 343 void setFontItalic(bool italic); 344 bool fontItalic() const; 345 void setFontUnderline(bool underline); 346 bool fontUnderline() const; 347 void setFontOverline(bool overline); 348 bool fontOverline() const; 349 void setFontStrikeOut(bool strikeOut); 350 bool fontStrikeOut() const; 351 void setUnderlineColor(const QColor &color); 352 QColor underlineColor() const; 353 void setFontFixedPitch(bool fixedPitch); 354 bool fontFixedPitch() const; 355 void setVerticalAlignment(QTextCharFormat::VerticalAlignment alignment); 356 QTextCharFormat::VerticalAlignment verticalAlignment() const; 357 void setAnchor(bool anchor); 358 bool isAnchor() const; 359 void setAnchorHref(const QString &value); 360 QString anchorHref() const; 361 int tableCellRowSpan() const; 362 int tableCellColumnSpan() const; 363 void setTableCellRowSpan(int atableCellRowSpan); 364 void setTableCellColumnSpan(int atableCellColumnSpan); 365 void setTextOutline(const QPen &pen); 366 QPen textOutline() const; 367 368 enum UnderlineStyle 369 { 370 NoUnderline, 371 SingleUnderline, 372 DashUnderline, 373 DotLine, 374 DashDotLine, 375 DashDotDotLine, 376 WaveUnderline, 377 SpellCheckUnderline, 378 }; 379 380 void setUnderlineStyle(QTextCharFormat::UnderlineStyle style); 381 QTextCharFormat::UnderlineStyle underlineStyle() const; 382 void setToolTip(const QString &tip); 383 QString toolTip() const; 384 void setAnchorNames(const QStringList &names); 385 QStringList anchorNames() const; 386 void setFontCapitalization(QFont::Capitalization capitalization); 387 QFont::Capitalization fontCapitalization() const; 388 void setFontLetterSpacing(qreal spacing); 389 qreal fontLetterSpacing() const; 390 void setFontWordSpacing(qreal spacing); 391 qreal fontWordSpacing() const; 392 void setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy = QFont::PreferDefault); 393 void setFontStyleStrategy(QFont::StyleStrategy strategy); 394 QFont::StyleHint fontStyleHint() const; 395 QFont::StyleStrategy fontStyleStrategy() const; 396 void setFontKerning(bool enable); 397 bool fontKerning() const; 398 void setFontHintingPreference(QFont::HintingPreference hintingPreference); 399 QFont::HintingPreference fontHintingPreference() const; 400 int fontStretch() const; 401 void setFontStretch(int factor); 402 void setFontLetterSpacingType(QFont::SpacingType letterSpacingType); 403 QFont::SpacingType fontLetterSpacingType() const; 404%If (Qt_5_3_0 -) 405 406 enum FontPropertiesInheritanceBehavior 407 { 408 FontPropertiesSpecifiedOnly, 409 FontPropertiesAll, 410 }; 411 412%End 413%If (Qt_5_3_0 -) 414 void setFont(const QFont &font, QTextCharFormat::FontPropertiesInheritanceBehavior behavior); 415%End 416%If (Qt_5_13_0 -) 417 void setFontFamilies(const QStringList &families); 418%End 419%If (Qt_5_13_0 -) 420 QVariant fontFamilies() const; 421%End 422%If (Qt_5_13_0 -) 423 void setFontStyleName(const QString &styleName); 424%End 425%If (Qt_5_13_0 -) 426 QVariant fontStyleName() const; 427%End 428}; 429 430class QTextBlockFormat : QTextFormat 431{ 432%TypeHeaderCode 433#include <qtextformat.h> 434%End 435 436public: 437 QTextBlockFormat(); 438 bool isValid() const; 439 Qt::Alignment alignment() const; 440 void setTopMargin(qreal margin); 441 qreal topMargin() const; 442 void setBottomMargin(qreal margin); 443 qreal bottomMargin() const; 444 void setLeftMargin(qreal margin); 445 qreal leftMargin() const; 446 void setRightMargin(qreal margin); 447 qreal rightMargin() const; 448 void setTextIndent(qreal margin); 449 qreal textIndent() const; 450 int indent() const; 451 void setNonBreakableLines(bool b); 452 bool nonBreakableLines() const; 453 void setAlignment(Qt::Alignment aalignment); 454 void setIndent(int aindent); 455 void setPageBreakPolicy(QTextFormat::PageBreakFlags flags); 456 QTextFormat::PageBreakFlags pageBreakPolicy() const; 457 void setTabPositions(const QList<QTextOption::Tab> &tabs); 458 QList<QTextOption::Tab> tabPositions() const; 459 460 enum LineHeightTypes 461 { 462 SingleHeight, 463 ProportionalHeight, 464 FixedHeight, 465 MinimumHeight, 466 LineDistanceHeight, 467 }; 468 469 void setLineHeight(qreal height, int heightType); 470 qreal lineHeight() const; 471 qreal lineHeight(qreal scriptLineHeight, qreal scaling = 1.) const; 472 int lineHeightType() const; 473%If (Qt_5_12_0 -) 474 void setHeadingLevel(int alevel); 475%End 476%If (Qt_5_12_0 -) 477 int headingLevel() const; 478%End 479%If (Qt_5_14_0 -) 480 481 enum class MarkerType 482 { 483 NoMarker, 484 Unchecked, 485 Checked, 486 }; 487 488%End 489%If (Qt_5_14_0 -) 490 void setMarker(QTextBlockFormat::MarkerType marker); 491%End 492%If (Qt_5_14_0 -) 493 QTextBlockFormat::MarkerType marker() const; 494%End 495}; 496 497class QTextListFormat : QTextFormat 498{ 499%TypeHeaderCode 500#include <qtextformat.h> 501%End 502 503public: 504 QTextListFormat(); 505 bool isValid() const; 506 507 enum Style 508 { 509 ListDisc, 510 ListCircle, 511 ListSquare, 512 ListDecimal, 513 ListLowerAlpha, 514 ListUpperAlpha, 515 ListLowerRoman, 516 ListUpperRoman, 517 }; 518 519 QTextListFormat::Style style() const; 520 int indent() const; 521 void setStyle(QTextListFormat::Style astyle); 522 void setIndent(int aindent); 523 QString numberPrefix() const; 524 QString numberSuffix() const; 525 void setNumberPrefix(const QString &np); 526 void setNumberSuffix(const QString &ns); 527}; 528 529class QTextImageFormat : QTextCharFormat 530{ 531%TypeHeaderCode 532#include <qtextformat.h> 533%End 534 535public: 536 QTextImageFormat(); 537 bool isValid() const; 538 QString name() const; 539 qreal width() const; 540 qreal height() const; 541%If (Qt_5_12_0 -) 542 int quality() const; 543%End 544 void setName(const QString &aname); 545 void setWidth(qreal awidth); 546 void setHeight(qreal aheight); 547%If (Qt_5_12_0 -) 548 void setQuality(int quality = 100); 549%End 550}; 551 552class QTextFrameFormat : QTextFormat 553{ 554%TypeHeaderCode 555#include <qtextformat.h> 556%End 557 558public: 559 QTextFrameFormat(); 560 bool isValid() const; 561 562 enum Position 563 { 564 InFlow, 565 FloatLeft, 566 FloatRight, 567 }; 568 569 void setPosition(QTextFrameFormat::Position f); 570 QTextFrameFormat::Position position() const; 571 qreal border() const; 572 qreal margin() const; 573 qreal padding() const; 574 void setWidth(const QTextLength &length); 575 QTextLength width() const; 576 QTextLength height() const; 577 void setBorder(qreal aborder); 578 void setMargin(qreal amargin); 579 void setPadding(qreal apadding); 580 void setWidth(qreal awidth); 581 void setHeight(qreal aheight); 582 void setHeight(const QTextLength &aheight); 583 void setPageBreakPolicy(QTextFormat::PageBreakFlags flags); 584 QTextFormat::PageBreakFlags pageBreakPolicy() const; 585 586 enum BorderStyle 587 { 588 BorderStyle_None, 589 BorderStyle_Dotted, 590 BorderStyle_Dashed, 591 BorderStyle_Solid, 592 BorderStyle_Double, 593 BorderStyle_DotDash, 594 BorderStyle_DotDotDash, 595 BorderStyle_Groove, 596 BorderStyle_Ridge, 597 BorderStyle_Inset, 598 BorderStyle_Outset, 599 }; 600 601 void setBorderBrush(const QBrush &brush); 602 QBrush borderBrush() const; 603 void setBorderStyle(QTextFrameFormat::BorderStyle style); 604 QTextFrameFormat::BorderStyle borderStyle() const; 605 qreal topMargin() const; 606 qreal bottomMargin() const; 607 qreal leftMargin() const; 608 qreal rightMargin() const; 609 void setTopMargin(qreal amargin); 610 void setBottomMargin(qreal amargin); 611 void setLeftMargin(qreal amargin); 612 void setRightMargin(qreal amargin); 613}; 614 615class QTextTableFormat : QTextFrameFormat 616{ 617%TypeHeaderCode 618#include <qtextformat.h> 619%End 620 621public: 622 QTextTableFormat(); 623 bool isValid() const; 624 int columns() const; 625 void setColumnWidthConstraints(const QVector<QTextLength> &constraints); 626 QVector<QTextLength> columnWidthConstraints() const; 627 void clearColumnWidthConstraints(); 628 qreal cellSpacing() const; 629 void setCellSpacing(qreal spacing); 630 qreal cellPadding() const; 631 Qt::Alignment alignment() const; 632 void setColumns(int acolumns); 633 void setCellPadding(qreal apadding); 634 void setAlignment(Qt::Alignment aalignment); 635 void setHeaderRowCount(int count); 636 int headerRowCount() const; 637%If (Qt_5_14_0 -) 638 void setBorderCollapse(bool borderCollapse); 639%End 640%If (Qt_5_14_0 -) 641 bool borderCollapse() const; 642%End 643}; 644 645QFlags<QTextFormat::PageBreakFlag> operator|(QTextFormat::PageBreakFlag f1, QFlags<QTextFormat::PageBreakFlag> f2); 646 647class QTextTableCellFormat : QTextCharFormat 648{ 649%TypeHeaderCode 650#include <qtextformat.h> 651%End 652 653public: 654 QTextTableCellFormat(); 655 bool isValid() const; 656 void setTopPadding(qreal padding); 657 qreal topPadding() const; 658 void setBottomPadding(qreal padding); 659 qreal bottomPadding() const; 660 void setLeftPadding(qreal padding); 661 qreal leftPadding() const; 662 void setRightPadding(qreal padding); 663 qreal rightPadding() const; 664 void setPadding(qreal padding); 665%If (Qt_5_14_0 -) 666 void setTopBorder(qreal width); 667%End 668%If (Qt_5_14_0 -) 669 qreal topBorder() const; 670%End 671%If (Qt_5_14_0 -) 672 void setBottomBorder(qreal width); 673%End 674%If (Qt_5_14_0 -) 675 qreal bottomBorder() const; 676%End 677%If (Qt_5_14_0 -) 678 void setLeftBorder(qreal width); 679%End 680%If (Qt_5_14_0 -) 681 qreal leftBorder() const; 682%End 683%If (Qt_5_14_0 -) 684 void setRightBorder(qreal width); 685%End 686%If (Qt_5_14_0 -) 687 qreal rightBorder() const; 688%End 689%If (Qt_5_14_0 -) 690 void setBorder(qreal width); 691%End 692%If (Qt_5_14_0 -) 693 void setTopBorderStyle(QTextFrameFormat::BorderStyle style); 694%End 695%If (Qt_5_14_0 -) 696 QTextFrameFormat::BorderStyle topBorderStyle() const; 697%End 698%If (Qt_5_14_0 -) 699 void setBottomBorderStyle(QTextFrameFormat::BorderStyle style); 700%End 701%If (Qt_5_14_0 -) 702 QTextFrameFormat::BorderStyle bottomBorderStyle() const; 703%End 704%If (Qt_5_14_0 -) 705 void setLeftBorderStyle(QTextFrameFormat::BorderStyle style); 706%End 707%If (Qt_5_14_0 -) 708 QTextFrameFormat::BorderStyle leftBorderStyle() const; 709%End 710%If (Qt_5_14_0 -) 711 void setRightBorderStyle(QTextFrameFormat::BorderStyle style); 712%End 713%If (Qt_5_14_0 -) 714 QTextFrameFormat::BorderStyle rightBorderStyle() const; 715%End 716%If (Qt_5_14_0 -) 717 void setBorderStyle(QTextFrameFormat::BorderStyle style); 718%End 719%If (Qt_5_14_0 -) 720 void setTopBorderBrush(const QBrush &brush); 721%End 722%If (Qt_5_14_0 -) 723 QBrush topBorderBrush() const; 724%End 725%If (Qt_5_14_0 -) 726 void setBottomBorderBrush(const QBrush &brush); 727%End 728%If (Qt_5_14_0 -) 729 QBrush bottomBorderBrush() const; 730%End 731%If (Qt_5_14_0 -) 732 void setLeftBorderBrush(const QBrush &brush); 733%End 734%If (Qt_5_14_0 -) 735 QBrush leftBorderBrush() const; 736%End 737%If (Qt_5_14_0 -) 738 void setRightBorderBrush(const QBrush &brush); 739%End 740%If (Qt_5_14_0 -) 741 QBrush rightBorderBrush() const; 742%End 743%If (Qt_5_14_0 -) 744 void setBorderBrush(const QBrush &brush); 745%End 746}; 747