📄 qtextformat.h
字号:
{ return doubleProperty(FontPointSize); } inline void setFontWeight(int weight) { if (weight == QFont::Normal) weight = 0; setProperty(FontWeight, weight); } inline int fontWeight() const { int weight = intProperty(FontWeight); if (weight == 0) weight = QFont::Normal; return weight; } inline void setFontItalic(bool italic) { setProperty(FontItalic, italic); } inline bool fontItalic() const { return boolProperty(FontItalic); } inline void setFontUnderline(bool underline) { setProperty(FontUnderline, underline); } inline bool fontUnderline() const { return boolProperty(FontUnderline); } 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); } 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 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) { setProperty(AnchorName, name); } inline QString anchorName() const { return stringProperty(AnchorName); } 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 { return QFlag(intProperty(BlockAlignment)); } 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 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 }; 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 setMargin(qreal margin); inline qreal margin() const { return doubleProperty(FrameMargin); } 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 QTextFrameFormat::setBorder(qreal aborder){ setProperty(FrameBorder, aborder); }inline void QTextFrameFormat::setMargin(qreal amargin){ setProperty(FrameMargin, amargin); }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); }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 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 + -