📄 qtextformat.h
字号:
{ setProperty(FontItalic, italic); } inline bool fontItalic() const { return boolProperty(FontItalic); } inline void setFontUnderline(bool underline) { setProperty(TextUnderlineStyle, underline ? SingleUnderline : NoUnderline); } bool fontUnderline() const; inline void setFontOverline(bool overline) { setProperty(FontOverline, overline); } inline bool fontOverline() const { return boolProperty(FontOverline); } inline void setFontStrikeOut(bool strikeOut) { setProperty(FontStrikeOut, strikeOut); } inline bool fontStrikeOut() const { return boolProperty(FontStrikeOut); } inline void setUnderlineColor(const QColor &color) { setProperty(TextUnderlineColor, color); } inline QColor underlineColor() const { return colorProperty(TextUnderlineColor); } inline void setFontFixedPitch(bool fixedPitch) { setProperty(FontFixedPitch, fixedPitch); } inline bool fontFixedPitch() const { return boolProperty(FontFixedPitch); } void setUnderlineStyle(UnderlineStyle style); inline UnderlineStyle underlineStyle() const { return static_cast<UnderlineStyle>(intProperty(TextUnderlineStyle)); } inline void setVerticalAlignment(VerticalAlignment alignment) { setProperty(TextVerticalAlignment, alignment); } inline VerticalAlignment verticalAlignment() const { return static_cast<VerticalAlignment>(intProperty(TextVerticalAlignment)); } inline void setTextOutline(const QPen &pen) { setProperty(TextOutline, pen); } inline QPen textOutline() const { return penProperty(TextOutline); } inline void setToolTip(const QString &tip) { setProperty(TextToolTip, tip); } inline QString toolTip() const { return stringProperty(TextToolTip); } inline void setAnchor(bool anchor) { setProperty(IsAnchor, anchor); } inline bool isAnchor() const { return boolProperty(IsAnchor); } inline void setAnchorHref(const QString &value) { setProperty(AnchorHref, value); } inline QString anchorHref() const { return stringProperty(AnchorHref); } inline void setAnchorName(const QString &name) { setAnchorNames(QStringList(name)); } QString anchorName() const; inline void setAnchorNames(const QStringList &names) { setProperty(AnchorName, names); } QStringList anchorNames() const; inline void setTableCellRowSpan(int tableCellRowSpan); inline int tableCellRowSpan() const { int s = intProperty(TableCellRowSpan); if (s == 0) s = 1; return s; } inline void setTableCellColumnSpan(int tableCellColumnSpan); inline int tableCellColumnSpan() const { int s = intProperty(TableCellColumnSpan); if (s == 0) s = 1; return s; }};inline void QTextCharFormat::setTableCellRowSpan(int atableCellRowSpan){ if (atableCellRowSpan == 1) atableCellRowSpan = 0; setProperty(TableCellRowSpan, atableCellRowSpan);}inline void QTextCharFormat::setTableCellColumnSpan(int atableCellColumnSpan){ if (atableCellColumnSpan == 1) atableCellColumnSpan = 0; setProperty(TableCellColumnSpan, atableCellColumnSpan);}class Q_GUI_EXPORT QTextBlockFormat : public QTextFormat{public: QTextBlockFormat(); bool isValid() const { return isBlockFormat(); } inline void setAlignment(Qt::Alignment alignment); inline Qt::Alignment alignment() const { int a = intProperty(BlockAlignment); if (a == 0) a = Qt::AlignLeft; return QFlag(a); } inline void setTopMargin(qreal margin) { setProperty(BlockTopMargin, margin); } inline qreal topMargin() const { return doubleProperty(BlockTopMargin); } inline void setBottomMargin(qreal margin) { setProperty(BlockBottomMargin, margin); } inline qreal bottomMargin() const { return doubleProperty(BlockBottomMargin); } inline void setLeftMargin(qreal margin) { setProperty(BlockLeftMargin, margin); } inline qreal leftMargin() const { return doubleProperty(BlockLeftMargin); } inline void setRightMargin(qreal margin) { setProperty(BlockRightMargin, margin); } inline qreal rightMargin() const { return doubleProperty(BlockRightMargin); } inline void setTextIndent(qreal margin) { setProperty(TextIndent, margin); } inline qreal textIndent() const { return doubleProperty(TextIndent); } inline void setIndent(int indent); inline int indent() const { return intProperty(BlockIndent); } inline void setNonBreakableLines(bool b) { setProperty(BlockNonBreakableLines, b); } inline bool nonBreakableLines() const { return boolProperty(BlockNonBreakableLines); } inline void setPageBreakPolicy(PageBreakFlags flags) { setProperty(PageBreakPolicy, int(flags)); } inline PageBreakFlags pageBreakPolicy() const { return PageBreakFlags(intProperty(PageBreakPolicy)); }};inline void QTextBlockFormat::setAlignment(Qt::Alignment aalignment){ setProperty(BlockAlignment, int(aalignment)); }inline void QTextBlockFormat::setIndent(int aindent){ setProperty(BlockIndent, aindent); }class Q_GUI_EXPORT QTextListFormat : public QTextFormat{public: QTextListFormat(); bool isValid() const { return isListFormat(); } enum Style { ListDisc = -1, ListCircle = -2, ListSquare = -3, ListDecimal = -4, ListLowerAlpha = -5, ListUpperAlpha = -6, ListStyleUndefined = 0 }; inline void setStyle(Style style); inline Style style() const { return static_cast<Style>(intProperty(ListStyle)); } inline void setIndent(int indent); inline int indent() const { return intProperty(ListIndent); }};inline void QTextListFormat::setStyle(Style astyle){ setProperty(ListStyle, astyle); }inline void QTextListFormat::setIndent(int aindent){ setProperty(ListIndent, aindent); }class Q_GUI_EXPORT QTextImageFormat : public QTextCharFormat{public: QTextImageFormat(); bool isValid() const { return isImageFormat(); } inline void setName(const QString &name); inline QString name() const { return stringProperty(ImageName); } inline void setWidth(qreal width); inline qreal width() const { return doubleProperty(ImageWidth); } inline void setHeight(qreal height); inline qreal height() const { return doubleProperty(ImageHeight); }};inline void QTextImageFormat::setName(const QString &aname){ setProperty(ImageName, aname); }inline void QTextImageFormat::setWidth(qreal awidth){ setProperty(ImageWidth, awidth); }inline void QTextImageFormat::setHeight(qreal aheight){ setProperty(ImageHeight, aheight); }class Q_GUI_EXPORT QTextFrameFormat : public QTextFormat{public: QTextFrameFormat(); bool isValid() const { return isFrameFormat(); } enum Position { InFlow, FloatLeft, FloatRight // ######// Absolute }; enum BorderStyle { BorderStyle_None, BorderStyle_Dotted, BorderStyle_Dashed, BorderStyle_Solid, BorderStyle_Double, BorderStyle_DotDash, BorderStyle_DotDotDash, BorderStyle_Groove, BorderStyle_Ridge, BorderStyle_Inset, BorderStyle_Outset }; inline void setPosition(Position f) { setProperty(CssFloat, f); } inline Position position() const { return static_cast<Position>(intProperty(CssFloat)); } inline void setBorder(qreal border); inline qreal border() const { return doubleProperty(FrameBorder); } inline void setBorderBrush(const QBrush &brush) { setProperty(FrameBorderBrush, brush); } inline QBrush borderBrush() const { return brushProperty(FrameBorderBrush); } inline void setBorderStyle(BorderStyle style) { setProperty(FrameBorderStyle, style); } inline BorderStyle borderStyle() const { return static_cast<BorderStyle>(intProperty(FrameBorderStyle)); } void setMargin(qreal margin); inline qreal margin() const { return doubleProperty(FrameMargin); } inline void setTopMargin(qreal margin); qreal topMargin() const; inline void setBottomMargin(qreal margin); qreal bottomMargin() const; inline void setLeftMargin(qreal margin); qreal leftMargin() const; inline void setRightMargin(qreal margin); qreal rightMargin() const; inline void setPadding(qreal padding); inline qreal padding() const { return doubleProperty(FramePadding); } inline void setWidth(qreal width); inline void setWidth(const QTextLength &length) { setProperty(FrameWidth, length); } inline QTextLength width() const { return lengthProperty(FrameWidth); } inline void setHeight(qreal height); inline void setHeight(const QTextLength &height); inline QTextLength height() const { return lengthProperty(FrameHeight); } inline void setPageBreakPolicy(PageBreakFlags flags) { setProperty(PageBreakPolicy, int(flags)); } inline PageBreakFlags pageBreakPolicy() const { return PageBreakFlags(intProperty(PageBreakPolicy)); }};inline void QTextFrameFormat::setBorder(qreal aborder){ setProperty(FrameBorder, aborder); }inline void QTextFrameFormat::setPadding(qreal apadding){ setProperty(FramePadding, apadding); }inline void QTextFrameFormat::setWidth(qreal awidth){ setProperty(FrameWidth, QTextLength(QTextLength::FixedLength, awidth)); }inline void QTextFrameFormat::setHeight(qreal aheight){ setProperty(FrameHeight, QTextLength(QTextLength::FixedLength, aheight)); }inline void QTextFrameFormat::setHeight(const QTextLength &aheight){ setProperty(FrameHeight, aheight); }inline void QTextFrameFormat::setTopMargin(qreal amargin){ setProperty(FrameTopMargin, amargin); }inline void QTextFrameFormat::setBottomMargin(qreal amargin){ setProperty(FrameBottomMargin, amargin); }inline void QTextFrameFormat::setLeftMargin(qreal amargin){ setProperty(FrameLeftMargin, amargin); }inline void QTextFrameFormat::setRightMargin(qreal amargin){ setProperty(FrameRightMargin, amargin); }class Q_GUI_EXPORT QTextTableFormat : public QTextFrameFormat{public: QTextTableFormat(); inline bool isValid() const { return isTableFormat(); } inline int columns() const { int cols = intProperty(TableColumns); if (cols == 0) cols = 1; return cols; } inline void setColumns(int columns); inline void setColumnWidthConstraints(const QVector<QTextLength> &constraints) { setProperty(TableColumnWidthConstraints, constraints); } inline QVector<QTextLength> columnWidthConstraints() const { return lengthVectorProperty(TableColumnWidthConstraints); } inline void clearColumnWidthConstraints() { clearProperty(TableColumnWidthConstraints); } inline qreal cellSpacing() const { return doubleProperty(TableCellSpacing); } inline void setCellSpacing(qreal spacing) { setProperty(TableCellSpacing, spacing); } inline qreal cellPadding() const { return doubleProperty(TableCellPadding); } inline void setCellPadding(qreal padding); inline void setAlignment(Qt::Alignment alignment); inline Qt::Alignment alignment() const { return QFlag(intProperty(BlockAlignment)); } inline void setHeaderRowCount(int count) { setProperty(TableHeaderRowCount, count); } inline int headerRowCount() const { return intProperty(TableHeaderRowCount); }};inline void QTextTableFormat::setColumns(int acolumns){ if (acolumns == 1) acolumns = 0; setProperty(TableColumns, acolumns);}inline void QTextTableFormat::setCellPadding(qreal apadding){ setProperty(TableCellPadding, apadding); }inline void QTextTableFormat::setAlignment(Qt::Alignment aalignment){ setProperty(BlockAlignment, int(aalignment)); }QT_END_HEADER#endif // QTEXTFORMAT_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -