summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@nokia.com>2010-01-07 17:44:13 (GMT)
committerMarco Bubke <marco.bubke@nokia.com>2010-01-07 17:44:13 (GMT)
commit7fea1d69bef9ec3627fd86b81ac37da808b9a6c4 (patch)
treeca5601631367fe60a7a7d991a4c89fe9bd4b96c5 /src
parent570338ab3cbca8df3ca8f89579a8f460915e5a1e (diff)
downloadQt-7fea1d69bef9ec3627fd86b81ac37da808b9a6c4.zip
Qt-7fea1d69bef9ec3627fd86b81ac37da808b9a6c4.tar.gz
Qt-7fea1d69bef9ec3627fd86b81ac37da808b9a6c4.tar.bz2
Add notifier for QmlGraphicsTextEdit
Bauhaus needs the notifier to track changes in the items. Task-number: BAUHAUS-243 Reviewed-by: Thomas Hartmann
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstextedit.cpp20
-rw-r--r--src/declarative/graphicsitems/qmlgraphicstextedit_p.h42
2 files changed, 47 insertions, 15 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp
index 747e2fb..6e14d3a 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp
@@ -206,6 +206,7 @@ void QmlGraphicsTextEdit::setTextFormat(TextFormat format)
updateSize();
}
d->format = format;
+ emit textFormatChanged(d->format);
}
QFont QmlGraphicsTextEdit::font() const
@@ -260,6 +261,7 @@ void QmlGraphicsTextEdit::setColor(const QColor &color)
pal.setColor(QPalette::Text, color);
d->control->setPalette(pal);
update();
+ emit colorChanged(d->color);
}
/*!
@@ -285,6 +287,7 @@ void QmlGraphicsTextEdit::setSelectionColor(const QColor &color)
pal.setColor(QPalette::Highlight, color);
d->control->setPalette(pal);
update();
+ emit selectionColorChanged(d->selectionColor);
}
/*!
@@ -310,6 +313,7 @@ void QmlGraphicsTextEdit::setSelectedTextColor(const QColor &color)
pal.setColor(QPalette::HighlightedText, color);
d->control->setPalette(pal);
update();
+ emit selectedTextColorChanged(d->selectedTextColor);
}
/*!
@@ -337,6 +341,7 @@ void QmlGraphicsTextEdit::setHAlign(QmlGraphicsTextEdit::HAlignment alignment)
d->hAlign = alignment;
d->updateDefaultTextOption();
updateSize();
+ emit horizontalAlignmentChanged(d->hAlign);
}
QmlGraphicsTextEdit::VAlignment QmlGraphicsTextEdit::vAlign() const
@@ -353,6 +358,7 @@ void QmlGraphicsTextEdit::setVAlign(QmlGraphicsTextEdit::VAlignment alignment)
d->vAlign = alignment;
d->updateDefaultTextOption();
updateSize();
+ emit verticalAlignmentChanged(d->vAlign);
}
bool QmlGraphicsTextEdit::wrap() const
@@ -377,6 +383,7 @@ void QmlGraphicsTextEdit::setWrap(bool w)
d->wrap = w;
d->updateDefaultTextOption();
updateSize();
+ emit wrapChanged(d->wrap);
}
/*!
@@ -402,6 +409,7 @@ void QmlGraphicsTextEdit::setCursorVisible(bool on)
if (!on && !d->persistentSelection)
d->control->setCursorIsFocusIndicator(true);
d->control->processEvent(&focusEvent, QPointF(0, 0));
+ emit cursorVisibleChanged(d->cursorVisible);
}
/*!
@@ -464,6 +472,8 @@ void QmlGraphicsTextEdit::setCursorDelegate(QmlComponent* c)
connect(c, SIGNAL(statusChanged()),
this, SLOT(loadCursorDelegate()));
}
+
+ emit cursorDelegateChanged();
}
void QmlGraphicsTextEdit::loadCursorDelegate()
@@ -579,6 +589,7 @@ void QmlGraphicsTextEdit::setFocusOnPress(bool on)
if (d->focusOnPress == on)
return;
d->focusOnPress = on;
+ emit focusOnPressChanged(d->focusOnPress);
}
/*!
@@ -599,6 +610,7 @@ void QmlGraphicsTextEdit::setPersistentSelection(bool on)
if (d->persistentSelection == on)
return;
d->persistentSelection = on;
+ emit persistentSelectionChanged(d->persistentSelection);
}
qreal QmlGraphicsTextEdit::textMargin() const
@@ -614,6 +626,7 @@ void QmlGraphicsTextEdit::setTextMargin(qreal margin)
return;
d->textMargin = margin;
d->document->setDocumentMargin(d->textMargin);
+ emit textMarginChanged(d->textMargin);
}
void QmlGraphicsTextEdit::geometryChanged(const QRectF &newGeometry,
@@ -648,7 +661,10 @@ void QmlGraphicsTextEdit::componentComplete()
*/
void QmlGraphicsTextEdit::setReadOnly(bool r)
{
- Q_D(QmlGraphicsTextEdit);
+ Q_D(QmlGraphicsTextEdit);
+ if (r == isReadOnly())
+ return;
+
Qt::TextInteractionFlags flags = Qt::NoTextInteraction;
if (r) {
@@ -659,6 +675,8 @@ void QmlGraphicsTextEdit::setReadOnly(bool r)
d->control->setTextInteractionFlags(flags);
if (!r)
d->control->moveCursor(QTextCursor::End);
+
+ emit readOnlyChanged(r);
}
bool QmlGraphicsTextEdit::isReadOnly() const
diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit_p.h b/src/declarative/graphicsitems/qmlgraphicstextedit_p.h
index 0fe09f3..97c3fae 100644
--- a/src/declarative/graphicsitems/qmlgraphicstextedit_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicstextedit_p.h
@@ -66,24 +66,24 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsTextEdit : public QmlGraphicsPaintedItem
Q_ENUMS(TextFormat)
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
- Q_PROPERTY(QColor color READ color WRITE setColor)
- Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor)
- Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor)
- Q_PROPERTY(QFont font READ font WRITE setFont)
- Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign)
- Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign)
- Q_PROPERTY(bool wrap READ wrap WRITE setWrap) //### other wrap modes
- Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat)
- Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
- Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor NOTIFY selectionColorChanged)
+ Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged)
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
+ Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged)
+ Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged)
+ Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged) //### other wrap modes
+ Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged)
+ Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged)
+ Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged)
Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
- Q_PROPERTY(QmlComponent* cursorDelegate READ cursorDelegate WRITE setCursorDelegate)
+ Q_PROPERTY(QmlComponent* cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged)
Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged)
Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)
Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectionChanged)
- Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress)
- Q_PROPERTY(bool persistentSelection READ persistentSelection WRITE setPersistentSelection)
- Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin)
+ Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY focusOnPressChanged)
+ Q_PROPERTY(bool persistentSelection READ persistentSelection WRITE setPersistentSelection NOTIFY persistentSelectionChanged)
+ Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin NOTIFY textMarginChanged)
public:
QmlGraphicsTextEdit(QmlGraphicsItem *parent=0);
@@ -178,6 +178,20 @@ Q_SIGNALS:
void selectionStartChanged();
void selectionEndChanged();
void selectionChanged();
+ void colorChanged(const QColor &color);
+ void selectionColorChanged(const QColor &color);
+ void selectedTextColorChanged(const QColor &color);
+ void fontChanged(const QFont &font);
+ void horizontalAlignmentChanged(HAlignment alignment);
+ void verticalAlignmentChanged(VAlignment alignment);
+ void wrapChanged(bool isWrapped);
+ void textFormatChanged(TextFormat textFormat);
+ void readOnlyChanged(bool isReadOnly);
+ void cursorVisibleChanged(bool isCursorVisible);
+ void cursorDelegateChanged();
+ void focusOnPressChanged(bool focusIsPressed);
+ void persistentSelectionChanged(bool isPersistentSelection);
+ void textMarginChanged(qreal textMargin);
public Q_SLOTS:
void selectAll();