From 78a1ceb440510e148b98b0d0d894063756f1b4b6 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 19 Aug 2009 14:40:46 +1000 Subject: Update demos Remove uses of margin for positioners. Update MediaLineEdit to use a TextInput, in the process added a selectAll() slot to TextInput (like TextEdit has). --- demos/declarative/calculator/calculator.qml | 2 +- demos/declarative/contacts/Contact.qml | 5 +++-- demos/declarative/flickr/content/MediaLineEdit.qml | 2 +- src/declarative/fx/qfxtextinput.cpp | 8 ++++++++ src/declarative/fx/qfxtextinput.h | 3 +++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml index f766a30..56bdc4d 100644 --- a/demos/declarative/calculator/calculator.qml +++ b/demos/declarative/calculator/calculator.qml @@ -8,7 +8,7 @@ Rect { Script { source: "calculator.js" } VerticalPositioner { - x: 2; spacing: 10; margin: 2 + x: 2; spacing: 10; Rect { id: Container diff --git a/demos/declarative/contacts/Contact.qml b/demos/declarative/contacts/Contact.qml index c6ed906..d02157c 100644 --- a/demos/declarative/contacts/Contact.qml +++ b/demos/declarative/contacts/Contact.qml @@ -82,9 +82,10 @@ Item { } VerticalPositioner { id: layout - anchors.fill: parent + width: contents.width + height:contents.height + anchors.centerIn: parent spacing: 5 - margin: 5 ContactField { id: labelField anchors.left: layout.left diff --git a/demos/declarative/flickr/content/MediaLineEdit.qml b/demos/declarative/flickr/content/MediaLineEdit.qml index e175b4e..1642d44 100644 --- a/demos/declarative/flickr/content/MediaLineEdit.qml +++ b/demos/declarative/flickr/content/MediaLineEdit.qml @@ -86,7 +86,7 @@ Item { text: Container.label + "..." } - TextEdit { + TextInput { id: Editor font.bold: true color: "white" diff --git a/src/declarative/fx/qfxtextinput.cpp b/src/declarative/fx/qfxtextinput.cpp index 1407a78..eb6c5bf 100644 --- a/src/declarative/fx/qfxtextinput.cpp +++ b/src/declarative/fx/qfxtextinput.cpp @@ -194,6 +194,7 @@ void QFxTextInput::setHAlign(HAlignment align) { Q_D(QFxTextInput); d->hAlign = align; + //TODO: implement } bool QFxTextInput::isReadOnly() const @@ -513,6 +514,13 @@ void QFxTextInput::drawContents(QPainter *p, const QRect &r) p->restore(); } +void QFxTextInput::selectAll() +{ + Q_D(QFxTextInput); + d->control->setSelection(0, d->control->text().length()); +} + + /*! \qmlproperty bool LineEdit::smooth diff --git a/src/declarative/fx/qfxtextinput.h b/src/declarative/fx/qfxtextinput.h index fe72f1e..b5812d4 100644 --- a/src/declarative/fx/qfxtextinput.h +++ b/src/declarative/fx/qfxtextinput.h @@ -169,6 +169,9 @@ protected: void focusChanged(bool hasFocus); +public Q_SLOTS: + void selectAll(); + private Q_SLOTS: void updateSize(); void q_textChanged(); -- cgit v0.12