69 Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) |
69 Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) |
70 Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) |
70 Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) |
71 Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) |
71 Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) |
72 Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged) |
72 Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged) |
73 Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode NOTIFY elideModeChanged) //### elideMode? |
73 Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode NOTIFY elideModeChanged) //### elideMode? |
|
74 Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged) |
|
75 Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged) |
74 |
76 |
75 public: |
77 public: |
76 QDeclarativeText(QDeclarativeItem *parent=0); |
78 QDeclarativeText(QDeclarativeItem *parent=0); |
77 ~QDeclarativeText(); |
79 ~QDeclarativeText(); |
78 |
80 |
96 ElideNone = Qt::ElideNone }; |
98 ElideNone = Qt::ElideNone }; |
97 |
99 |
98 enum WrapMode { NoWrap = QTextOption::NoWrap, |
100 enum WrapMode { NoWrap = QTextOption::NoWrap, |
99 WordWrap = QTextOption::WordWrap, |
101 WordWrap = QTextOption::WordWrap, |
100 WrapAnywhere = QTextOption::WrapAnywhere, |
102 WrapAnywhere = QTextOption::WrapAnywhere, |
101 WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere |
103 WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere, // COMPAT |
|
104 Wrap = QTextOption::WrapAtWordBoundaryOrAnywhere |
102 }; |
105 }; |
103 |
106 |
104 QString text() const; |
107 QString text() const; |
105 void setText(const QString &); |
108 void setText(const QString &); |
106 |
109 |
135 |
138 |
136 virtual void componentComplete(); |
139 virtual void componentComplete(); |
137 |
140 |
138 int resourcesLoading() const; // mainly for testing |
141 int resourcesLoading() const; // mainly for testing |
139 |
142 |
|
143 qreal paintedWidth() const; |
|
144 qreal paintedHeight() const; |
|
145 |
|
146 QRectF boundingRect() const; |
|
147 |
140 Q_SIGNALS: |
148 Q_SIGNALS: |
141 void textChanged(const QString &text); |
149 void textChanged(const QString &text); |
142 void linkActivated(const QString &link); |
150 void linkActivated(const QString &link); |
143 void fontChanged(const QFont &font); |
151 void fontChanged(const QFont &font); |
144 void colorChanged(const QColor &color); |
152 void colorChanged(const QColor &color); |
147 void horizontalAlignmentChanged(HAlignment alignment); |
155 void horizontalAlignmentChanged(HAlignment alignment); |
148 void verticalAlignmentChanged(VAlignment alignment); |
156 void verticalAlignmentChanged(VAlignment alignment); |
149 void wrapModeChanged(); |
157 void wrapModeChanged(); |
150 void textFormatChanged(TextFormat textFormat); |
158 void textFormatChanged(TextFormat textFormat); |
151 void elideModeChanged(TextElideMode mode); |
159 void elideModeChanged(TextElideMode mode); |
|
160 void paintedSizeChanged(); |
152 |
161 |
153 protected: |
162 protected: |
154 void mousePressEvent(QGraphicsSceneMouseEvent *event); |
163 void mousePressEvent(QGraphicsSceneMouseEvent *event); |
155 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
164 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
156 virtual void geometryChanged(const QRectF &newGeometry, |
165 virtual void geometryChanged(const QRectF &newGeometry, |
157 const QRectF &oldGeometry); |
166 const QRectF &oldGeometry); |
158 |
167 |
159 private: |
168 private: |
160 Q_DISABLE_COPY(QDeclarativeText) |
169 Q_DISABLE_COPY(QDeclarativeText) |
161 Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeText) |
170 Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeText) |
162 |
|
163 friend class QTextDocumentWithImageResources; |
|
164 void reloadWithResources(); |
|
165 }; |
171 }; |
166 |
172 |
167 QT_END_NAMESPACE |
173 QT_END_NAMESPACE |
168 |
174 |
169 QML_DECLARE_TYPE(QDeclarativeText) |
175 QML_DECLARE_TYPE(QDeclarativeText) |