diff options
Diffstat (limited to 'src/gui/text/qtextformat.h')
-rw-r--r-- | src/gui/text/qtextformat.h | 88 |
1 files changed, 35 insertions, 53 deletions
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index a849ed7d3b..2fa86ed0d1 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QTEXTFORMAT_H #define QTEXTFORMAT_H @@ -73,11 +37,6 @@ class QTextCursor; class QTextDocument; class QTextLength; -#ifndef QT_NO_DATASTREAM -Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &); -Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &); -#endif - #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextLength &); #endif @@ -123,11 +82,6 @@ Q_DECLARE_TYPEINFO(QTextLength, Q_PRIMITIVE_TYPE); inline QTextLength::QTextLength(Type atype, qreal avalue) : lengthType(atype), fixedValueOrPercentage(avalue) {} -#ifndef QT_NO_DATASTREAM -Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFormat &); -Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFormat &); -#endif - #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextFormat &); #endif @@ -225,6 +179,7 @@ public: OldFontLetterSpacingType = 0x2033, OldFontStretch = 0x2034, OldTextUnderlineColor = 0x2010, + OldFontFamily = 0x2000, // same as FontFamily ObjectType = 0x2f00, @@ -233,6 +188,7 @@ public: ListIndent = 0x3001, ListNumberPrefix = 0x3002, ListNumberSuffix = 0x3003, + ListStart = 0x3004, // table and frame properties FrameBorder = 0x4000, @@ -285,6 +241,7 @@ public: ImageWidth = 0x5010, ImageHeight = 0x5011, ImageQuality = 0x5014, + ImageMaxWidth = 0x5015, // internal /* @@ -330,7 +287,7 @@ public: ~QTextFormat(); void swap(QTextFormat &other) - { qSwap(d, other.d); qSwap(format_type, other.format_type); } + { d.swap(other.d); std::swap(format_type, other.format_type); } void merge(const QTextFormat &other); @@ -624,6 +581,8 @@ public: protected: explicit QTextCharFormat(const QTextFormat &fmt); friend class QTextFormat; + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextCharFormat &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextCharFormat &); }; Q_DECLARE_SHARED(QTextCharFormat) @@ -717,7 +676,7 @@ public: { return boolProperty(BlockNonBreakableLines); } inline void setPageBreakPolicy(PageBreakFlags flags) - { setProperty(PageBreakPolicy, int(flags)); } + { setProperty(PageBreakPolicy, int(flags.toInt())); } inline PageBreakFlags pageBreakPolicy() const { return PageBreakFlags(intProperty(PageBreakPolicy)); } @@ -732,12 +691,14 @@ public: protected: explicit QTextBlockFormat(const QTextFormat &fmt); friend class QTextFormat; + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextBlockFormat &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextBlockFormat &); }; Q_DECLARE_SHARED(QTextBlockFormat) inline void QTextBlockFormat::setAlignment(Qt::Alignment aalignment) -{ setProperty(BlockAlignment, int(aalignment)); } +{ setProperty(BlockAlignment, int(aalignment.toInt())); } inline void QTextBlockFormat::setIndent(int aindent) { setProperty(BlockIndent, aindent); } @@ -794,6 +755,9 @@ public: inline QString numberSuffix() const { return stringProperty(ListNumberSuffix); } + inline void setStart(int indent); + inline int start() const { return intProperty(ListStart); } + protected: explicit QTextListFormat(const QTextFormat &fmt); friend class QTextFormat; @@ -813,6 +777,11 @@ inline void QTextListFormat::setNumberPrefix(const QString &np) inline void QTextListFormat::setNumberSuffix(const QString &ns) { setProperty(ListNumberSuffix, ns); } +inline void QTextListFormat::setStart(int astart) +{ + setProperty(ListStart, astart); +} + class Q_GUI_EXPORT QTextImageFormat : public QTextCharFormat { public: @@ -828,6 +797,10 @@ public: inline qreal width() const { return doubleProperty(ImageWidth); } + inline void setMaximumWidth(QTextLength maxWidth); + inline QTextLength maximumWidth() const + { return lengthProperty(ImageMaxWidth); } + inline void setHeight(qreal height); inline qreal height() const { return doubleProperty(ImageHeight); } @@ -843,6 +816,8 @@ public: protected: explicit QTextImageFormat(const QTextFormat &format); friend class QTextFormat; + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextListFormat &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextListFormat &); }; Q_DECLARE_SHARED(QTextImageFormat) @@ -853,6 +828,9 @@ inline void QTextImageFormat::setName(const QString &aname) inline void QTextImageFormat::setWidth(qreal awidth) { setProperty(ImageWidth, awidth); } +inline void QTextImageFormat::setMaximumWidth(QTextLength maxWidth) +{ setProperty(ImageMaxWidth, maxWidth); } + inline void QTextImageFormat::setHeight(qreal aheight) { setProperty(ImageHeight, aheight); } @@ -939,13 +917,15 @@ public: { return lengthProperty(FrameHeight); } inline void setPageBreakPolicy(PageBreakFlags flags) - { setProperty(PageBreakPolicy, int(flags)); } + { setProperty(PageBreakPolicy, int(flags.toInt())); } inline PageBreakFlags pageBreakPolicy() const { return PageBreakFlags(intProperty(PageBreakPolicy)); } protected: explicit QTextFrameFormat(const QTextFormat &fmt); friend class QTextFormat; + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFrameFormat &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFrameFormat &); }; Q_DECLARE_SHARED(QTextFrameFormat) @@ -1037,7 +1017,7 @@ inline void QTextTableFormat::setCellPadding(qreal apadding) { setProperty(TableCellPadding, apadding); } inline void QTextTableFormat::setAlignment(Qt::Alignment aalignment) -{ setProperty(BlockAlignment, int(aalignment)); } +{ setProperty(BlockAlignment, int(aalignment.toInt())); } class Q_GUI_EXPORT QTextTableCellFormat : public QTextCharFormat { @@ -1128,6 +1108,8 @@ public: protected: explicit QTextTableCellFormat(const QTextFormat &fmt); + friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextTableCellFormat &); + friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextTableCellFormat &); friend class QTextFormat; }; |