diff options
28 files changed, 174 insertions, 175 deletions
diff --git a/demos/declarative/contacts/FieldText.qml b/demos/declarative/contacts/FieldText.qml index a28fbbc..392d9aa 100644 --- a/demos/declarative/contacts/FieldText.qml +++ b/demos/declarative/contacts/FieldText.qml @@ -69,7 +69,7 @@ Rect { x: 5 width: parent.width-10 anchors.verticalCenter: parent.verticalCenter - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" color: contactDetails.state == "editing" ? "#505050" : "#AAAAAA" font.italic: true font.bold: true diff --git a/demos/declarative/contacts/RemoveButton.qml b/demos/declarative/contacts/RemoveButton.qml index d42d359..c13b412 100644 --- a/demos/declarative/contacts/RemoveButton.qml +++ b/demos/declarative/contacts/RemoveButton.qml @@ -74,7 +74,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/demos/declarative/webbrowser/fieldtext/FieldText.qml b/demos/declarative/webbrowser/fieldtext/FieldText.qml index 3a9abdf..cbacfd8 100644 --- a/demos/declarative/webbrowser/fieldtext/FieldText.qml +++ b/demos/declarative/webbrowser/fieldtext/FieldText.qml @@ -82,7 +82,7 @@ Item { x: 5 width: parent.width-10 anchors.verticalCenter: parent.verticalCenter - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" color: fieldText.state == "editing" ? "#505050" : "#AAAAAA" font.italic: true font.bold: true diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index c1de69b..8f1c00e 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -96,7 +96,7 @@ Item { anchors.rightMargin: 4 anchors.top: Header.top anchors.topMargin: 4 - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" } Item { width: parent.width diff --git a/examples/declarative/listview/sections.qml b/examples/declarative/listview/sections.qml index ab9fbdf..41cc2e6 100644 --- a/examples/declarative/listview/sections.qml +++ b/examples/declarative/listview/sections.qml @@ -28,7 +28,7 @@ Rect { opacity: Wrapper.ListView.prevSection != Wrapper.ListView.section ? 1 : 0 Text { text: Wrapper.ListView.section; font.bold: true - x: 2; height: parent.height; vAlign: 'AlignVCenter' + x: 2; height: parent.height; verticalAlignment: 'AlignVCenter' } } Item { diff --git a/examples/declarative/loader/Browser.qml b/examples/declarative/loader/Browser.qml index d5887d7..78b26dc 100644 --- a/examples/declarative/loader/Browser.qml +++ b/examples/declarative/loader/Browser.qml @@ -41,7 +41,7 @@ Rect { } Text { id: NameText - anchors.fill: parent; vAlign: "AlignVCenter" + anchors.fill: parent; verticalAlignment: "AlignVCenter" text: fileName; anchors.leftMargin: 32 font.pointSize: 10 color: activePalette.windowText @@ -107,7 +107,7 @@ Rect { anchors.left: UpButton.right; anchors.right: parent.right; height: parent.height anchors.leftMargin: 4; anchors.rightMargin: 4 text: folders.folder; color: activePalette.buttonText - elide: "ElideLeft"; hAlign: "AlignRight"; vAlign: "AlignVCenter" + elide: "ElideLeft"; horizontalAlignment: "AlignRight"; verticalAlignment: "AlignVCenter" } } } diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/3/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/3/RemoveButton.qml index 6426457..f1b72ab 100644 --- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/3/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/3/RemoveButton.qml @@ -34,7 +34,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" text: "Remove" } } diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml index c97426c..dfb79a6 100644 --- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4/RemoveButton.qml @@ -73,7 +73,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml index 712471f..d4f30eb 100644 --- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/4a/RemoveButton.qml @@ -80,7 +80,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml index acc9896..292eb45 100644 --- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/5/RemoveButton.qml @@ -69,7 +69,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml index 5392154..f74ff99 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1/RemoveButton.qml @@ -69,7 +69,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml index 5392154..f74ff99 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1a/RemoveButton.qml @@ -69,7 +69,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml index e47aff2..d21b297 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/1b/lib/RemoveButton.qml @@ -71,7 +71,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml index 32e8ce0..9a7e0d7 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/2/RemoveButton.qml @@ -75,7 +75,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml index e0651c8..3130bbe 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/FieldText.qml @@ -67,7 +67,7 @@ Rect { x: 5 width: parent.width-10 anchors.verticalCenter: parent.verticalCenter - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" color: "#505050" font.italic: true text: fieldText.label diff --git a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml index 6280877..b99ab84 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/3/RemoveButton.qml @@ -72,7 +72,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml index 21e3bf2..369d34d 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/FieldText.qml @@ -69,7 +69,7 @@ Rect { x: 5 width: parent.width-10 anchors.verticalCenter: parent.verticalCenter - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" color: "#505050" font.italic: true text: fieldText.label diff --git a/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml b/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml index 03b50eec..f4a55e1 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/4/RemoveButton.qml @@ -77,7 +77,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml index 4506ec9..93ac0f8 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/FieldText.qml @@ -69,7 +69,7 @@ Rect { x: 5 width: parent.width-10 anchors.verticalCenter: parent.verticalCenter - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" color: "#505050" font.italic: true text: fieldText.label diff --git a/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml b/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml index 866a23f..d96a932 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/lib/RemoveButton.qml @@ -75,7 +75,7 @@ Rect { anchors.rightMargin: 4 font.bold: true color: "white" - hAlign: "AlignHCenter" + horizontalAlignment: "AlignHCenter" text: "Remove" opacity: 0 } diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri index 48af58e..47cce95 100644 --- a/src/declarative/fx/fx.pri +++ b/src/declarative/fx/fx.pri @@ -35,8 +35,8 @@ HEADERS += \ fx/qfxrepeater.h \ fx/qfxrepeater_p.h \ fx/qfxscalegrid_p.h \ - fx/qfxlineedit.h \ - fx/qfxlineedit_p.h \ + fx/qfxtextinput.h \ + fx/qfxtextinput_p.h \ fx/qfxtextedit.h \ fx/qfxtextedit_p.h \ fx/qfxtext.h \ @@ -69,7 +69,7 @@ SOURCES += \ fx/qfxrect.cpp \ fx/qfxrepeater.cpp \ fx/qfxscalegrid.cpp \ - fx/qfxlineedit.cpp \ + fx/qfxtextinput.cpp \ fx/qfxtext.cpp \ fx/qfxtextedit.cpp \ fx/qfxpixmapcache.cpp \ diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index cd34aa0..43f2656 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -299,14 +299,14 @@ QColor QFxText::styleColor() const } /*! - \qmlproperty enumeration Text::hAlign - \qmlproperty enumeration Text::vAlign + \qmlproperty enumeration Text::horizontalAlignment + \qmlproperty enumeration Text::verticalAlignment Sets the horizontal and vertical alignment of the text within the Text items width and height. By default, the text is top-left aligned. - The valid values for \c hAlign are \c AlignLeft, \c AlignRight and - \c AlignHCenter. The valid values for \c vAlign are \c AlignTop, \c AlignBottom + The valid values for \c horizontalAlignment are \c AlignLeft, \c AlignRight and + \c AlignHCenter. The valid values for \c verticalAlignment are \c AlignTop, \c AlignBottom and \c AlignVCenter. */ diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h index 63fb3e9..fcfe2b1 100644 --- a/src/declarative/fx/qfxtext.h +++ b/src/declarative/fx/qfxtext.h @@ -63,8 +63,8 @@ class Q_DECLARATIVE_EXPORT QFxText : public QFxItem Q_PROPERTY(QColor color READ color WRITE setColor) Q_PROPERTY(TextStyle style READ style WRITE setStyle) Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor) - Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) // ### horizontalAlignment? - Q_PROPERTY(VAlignment vAlign READ vAlign WRITE setVAlign) // ### verticalAlignment? + Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign) + Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign) Q_PROPERTY(bool wrap READ wrap WRITE setWrap) //### there are several wrap modes in Qt Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat) Q_PROPERTY(Qt::TextElideMode elide READ elideMode WRITE setElideMode) //### elideMode? diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index 5014185..f7f5f0a 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -316,14 +316,14 @@ void QFxTextEdit::setHighlightedTextColor(const QColor &color) } /*! - \qmlproperty enumeration TextEdit::hAlign - \qmlproperty enumeration TextEdit::vAlign + \qmlproperty enumeration TextEdit::horizontalAlignment + \qmlproperty enumeration TextEdit::verticalAlignment Sets the horizontal and vertical alignment of the text within the TextEdit items width and height. By default, the text is top-left aligned. - The valid values for \c hAlign are \c AlignLeft, \c AlignRight and - \c AlignHCenter. The valid values for \c vAlign are \c AlignTop, \c AlignBottom + The valid values for \c horizontalAlignment are \c AlignLeft, \c AlignRight and + \c AlignHCenter. The valid values for \c verticalAlignment are \c AlignTop, \c AlignBottom and \c AlignVCenter. */ QFxTextEdit::HAlignment QFxTextEdit::hAlign() const diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index 8c402b0..f24faf9 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -71,8 +71,8 @@ class Q_DECLARATIVE_EXPORT QFxTextEdit : public QFxPaintedItem Q_PROPERTY(QColor highlightColor READ highlightColor WRITE setHighlightColor) //### selectionColor Q_PROPERTY(QColor highlightedTextColor READ highlightedTextColor WRITE setHighlightedTextColor) //### selectedTextColor Q_PROPERTY(QFont font READ font WRITE setFont) - Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) //### horizontalAlignment - Q_PROPERTY(VAlignment vAlign READ vAlign WRITE setVAlign) //### verticalAlignment + 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) diff --git a/src/declarative/fx/qfxlineedit.cpp b/src/declarative/fx/qfxtextinput.cpp index 6e93782..1407a78 100644 --- a/src/declarative/fx/qfxlineedit.cpp +++ b/src/declarative/fx/qfxtextinput.cpp @@ -39,39 +39,41 @@ ** ****************************************************************************/ -#include "qfxlineedit.h" -#include "qfxlineedit_p.h" +#include "qfxtextinput.h" +#include "qfxtextinput_p.h" #include <QValidator> #include <QApplication> #include <QFontMetrics> #include <QPainter> QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,LineEdit,QFxLineEdit); + +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,TextInput,QFxTextInput); +QML_DEFINE_NOCREATE_TYPE(QValidator); QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QIntValidator,QIntValidator); /*! \qmlclass LineEdit The LineEdit item allows you to add an editable line of text to a scene. */ -QFxLineEdit::QFxLineEdit(QFxItem* parent) - : QFxPaintedItem(*(new QFxLineEditPrivate), parent) +QFxTextInput::QFxTextInput(QFxItem* parent) + : QFxPaintedItem(*(new QFxTextInputPrivate), parent) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); d->init(); } /* \internal */ -QFxLineEdit::QFxLineEdit(QFxLineEditPrivate &dd, QFxItem* parent) +QFxTextInput::QFxTextInput(QFxTextInputPrivate &dd, QFxItem* parent) : QFxPaintedItem(dd, parent) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); d->init(); } -QFxLineEdit::~QFxLineEdit() +QFxTextInput::~QFxTextInput() { } @@ -81,15 +83,15 @@ QFxLineEdit::~QFxLineEdit() The text in the LineEdit. */ -QString QFxLineEdit::text() const +QString QFxTextInput::text() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->control->text(); } -void QFxLineEdit::setText(const QString &s) +void QFxTextInput::setText(const QString &s) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); if(s == text()) return; d->control->setText(s); @@ -101,15 +103,15 @@ void QFxLineEdit::setText(const QString &s) Set the LineEdit's font attributes. \c font.size sets the font's point size. */ -QFont QFxLineEdit::font() const +QFont QFxTextInput::font() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->font; } -void QFxLineEdit::setFont(const QFont &font) +void QFxTextInput::setFont(const QFont &font) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); d->font = font; d->control->setFont(d->font); @@ -127,15 +129,15 @@ void QFxLineEdit::setFont(const QFont &font) The text color. */ -QColor QFxLineEdit::color() const +QColor QFxTextInput::color() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->color; } -void QFxLineEdit::setColor(const QColor &c) +void QFxTextInput::setColor(const QColor &c) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); d->color = c; } @@ -145,15 +147,15 @@ void QFxLineEdit::setColor(const QColor &c) The text highlight color, used behind selections. */ -QColor QFxLineEdit::highlightColor() const +QColor QFxTextInput::highlightColor() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->highlightColor; } -void QFxLineEdit::setHighlightColor(const QColor &color) +void QFxTextInput::setHighlightColor(const QColor &color) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); if (d->highlightColor == color) return; @@ -166,15 +168,15 @@ void QFxLineEdit::setHighlightColor(const QColor &color) The highlighted text color, used in selections. */ -QColor QFxLineEdit::highlightedTextColor() const +QColor QFxTextInput::highlightedTextColor() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->highlightedTextColor; } -void QFxLineEdit::setHighlightedTextColor(const QColor &color) +void QFxTextInput::setHighlightedTextColor(const QColor &color) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); if (d->highlightedTextColor == color) return; @@ -182,39 +184,39 @@ void QFxLineEdit::setHighlightedTextColor(const QColor &color) //TODO: implement } -QFxLineEdit::HAlignment QFxLineEdit::hAlign() const +QFxTextInput::HAlignment QFxTextInput::hAlign() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->hAlign; } -void QFxLineEdit::setHAlign(HAlignment align) +void QFxTextInput::setHAlign(HAlignment align) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); d->hAlign = align; } -bool QFxLineEdit::isReadOnly() const +bool QFxTextInput::isReadOnly() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->control->isReadOnly(); } -void QFxLineEdit::setReadOnly(bool ro) +void QFxTextInput::setReadOnly(bool ro) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); d->control->setReadOnly(ro); } -int QFxLineEdit::maxLength() const +int QFxTextInput::maxLength() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->control->maxLength(); } -void QFxLineEdit::setMaxLength(int ml) +void QFxTextInput::setMaxLength(int ml) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); d->control->setMaxLength(ml); } @@ -225,15 +227,15 @@ void QFxLineEdit::setMaxLength(int ml) This property is set and unset when the line edit gets focus, but it can also be set directly (useful, for example, if a KeyProxy might forward keys to it). */ -bool QFxLineEdit::isCursorVisible() const +bool QFxTextInput::isCursorVisible() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->cursorVisible; } -void QFxLineEdit::setCursorVisible(bool on) +void QFxTextInput::setCursorVisible(bool on) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); if (d->cursorVisible == on) return; d->cursorVisible = on; @@ -245,14 +247,14 @@ void QFxLineEdit::setCursorVisible(bool on) \qmlproperty int LineEdit::cursorPosition The position of the cursor in the LineEdit. */ -int QFxLineEdit::cursorPosition() const +int QFxTextInput::cursorPosition() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->control->cursor(); } -void QFxLineEdit::setCursorPosition(int cp) +void QFxTextInput::setCursorPosition(int cp) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); d->control->moveCursor(cp); } @@ -269,15 +271,15 @@ void QFxLineEdit::setCursorPosition(int cp) \sa selectionEnd, cursorPosition, selectedText */ -int QFxLineEdit::selectionStart() const +int QFxTextInput::selectionStart() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->lastSelectionStart; } -void QFxLineEdit::setSelectionStart(int s) +void QFxTextInput::setSelectionStart(int s) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); if(d->lastSelectionStart == s || s < 0 || s > text().length()) return; d->lastSelectionStart = s; @@ -297,75 +299,71 @@ void QFxLineEdit::setSelectionStart(int s) \sa selectionStart, cursorPosition, selectedText */ -int QFxLineEdit::selectionEnd() const +int QFxTextInput::selectionEnd() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->lastSelectionEnd; } -void QFxLineEdit::setSelectionEnd(int s) +void QFxTextInput::setSelectionEnd(int s) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); if(d->lastSelectionEnd == s || s < 0 || s > text().length()) return; d->lastSelectionEnd = s; d->control->setSelection(d->lastSelectionStart, s - d->lastSelectionStart); } -QString QFxLineEdit::selectedText() const +QString QFxTextInput::selectedText() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->control->selectedText(); } -QObject* QFxLineEdit::validator() const +QValidator* QFxTextInput::validator() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); //###const cast isn't good, but needed for property system? - //###same should be said about using QObject* as the property type return const_cast<QValidator*>(d->control->validator()); } -void QFxLineEdit::setValidator(QObject* v) +void QFxTextInput::setValidator(QValidator* v) { - Q_D(QFxLineEdit); - QValidator* valid = qobject_cast<QValidator*>(v); - if(!valid) - return; - d->control->setValidator(valid); + Q_D(QFxTextInput); + d->control->setValidator(v); if(!d->control->hasAcceptableInput()){ d->oldValidity = false; emit acceptableInputChanged(); } } -QString QFxLineEdit::inputMask() const +QString QFxTextInput::inputMask() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->control->inputMask(); } -void QFxLineEdit::setInputMask(const QString &im) +void QFxTextInput::setInputMask(const QString &im) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); d->control->setInputMask(im); } -bool QFxLineEdit::hasAcceptableInput() const +bool QFxTextInput::hasAcceptableInput() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->control->hasAcceptableInput(); } -uint QFxLineEdit::echoMode() const +uint QFxTextInput::echoMode() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->control->echoMode(); } -void QFxLineEdit::setEchoMode(uint echo) +void QFxTextInput::setEchoMode(uint echo) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); d->control->setEchoMode(echo); } @@ -382,24 +380,24 @@ void QFxLineEdit::setEchoMode(uint echo) Note that the root item of the delegate component must be a QFxItem or QFxItem derived item. */ -QmlComponent* QFxLineEdit::cursorDelegate() const +QmlComponent* QFxTextInput::cursorDelegate() const { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->cursorComponent; } -void QFxLineEdit::setCursorDelegate(QmlComponent* c) +void QFxTextInput::setCursorDelegate(QmlComponent* c) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); if(d->cursorComponent) delete d->cursorComponent; d->cursorComponent = c; d->startCreatingCursor(); } -void QFxLineEditPrivate::startCreatingCursor() +void QFxTextInputPrivate::startCreatingCursor() { - Q_Q(QFxLineEdit); + Q_Q(QFxTextInput); if(!cursorComponent){ q->disconnect(control, SIGNAL(cursorPositionChanged(int, int)), q, SLOT(moveCursor())); @@ -413,13 +411,13 @@ void QFxLineEditPrivate::startCreatingCursor() q->connect(cursorComponent, SIGNAL(statusChanged(int)), q, SLOT(createCursor())); }else{//isError - qWarning() << "You could really use the error checking for QFxLineEdit. We'll implement it soon."; + qWarning() << "You could really use the error checking for QFxTextInput. We'll implement it soon."; } } -void QFxLineEdit::createCursor() +void QFxTextInput::createCursor() { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); //Handle isError too if(!d->cursorComponent->isReady()) return; @@ -428,7 +426,7 @@ void QFxLineEdit::createCursor() delete d->cursorItem; d->cursorItem = qobject_cast<QFxItem*>(d->cursorComponent->create()); if(!d->cursorItem){ - qWarning() << "You could really use the error reporting for QFxLineEdit. We'll implement it soon."; + qWarning() << "You could really use the error reporting for QFxTextInput. We'll implement it soon."; return; } @@ -437,39 +435,39 @@ void QFxLineEdit::createCursor() d->cursorItem->setHeight(d->control->height()); } -void QFxLineEdit::moveCursor() +void QFxTextInput::moveCursor() { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); if(!d->cursorItem) return; d->cursorItem->setX(d->control->cursorToX() - d->hscroll); } -int QFxLineEdit::xToPos(int x) +int QFxTextInput::xToPos(int x) { - Q_D(const QFxLineEdit); + Q_D(const QFxTextInput); return d->control->xToPos(x - d->hscroll); } -void QFxLineEdit::focusChanged(bool hasFocus) +void QFxTextInput::focusChanged(bool hasFocus) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); d->focused = hasFocus; setCursorVisible(hasFocus); QFxItem::focusChanged(hasFocus); } -void QFxLineEdit::keyPressEvent(QKeyEvent* ev) +void QFxTextInput::keyPressEvent(QKeyEvent* ev) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); d->control->processKeyEvent(ev); if (!ev->isAccepted()) QFxPaintedItem::keyPressEvent(ev); } -void QFxLineEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) +void QFxTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); setFocus(true);//###Should we make 'focusOnPress' be optional like TextEdit? setCursorVisible(true); d->focused = true; @@ -477,9 +475,9 @@ void QFxLineEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) //event->accept(); } -bool QFxLineEdit::event(QEvent* ev) +bool QFxTextInput::event(QEvent* ev) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); //Anything we don't deal with ourselves, pass to the control switch(ev->type()){ case QEvent::GraphicsSceneMousePress: @@ -490,7 +488,7 @@ bool QFxLineEdit::event(QEvent* ev) return false; } -void QFxLineEdit::geometryChanged(const QRectF &newGeometry, +void QFxTextInput::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { if (newGeometry.width() != oldGeometry.width()) @@ -498,9 +496,9 @@ void QFxLineEdit::geometryChanged(const QRectF &newGeometry, QFxPaintedItem::geometryChanged(newGeometry, oldGeometry); } -void QFxLineEdit::drawContents(QPainter *p, const QRect &r) +void QFxTextInput::drawContents(QPainter *p, const QRect &r) { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); p->setRenderHint(QPainter::TextAntialiasing, true); p->save(); p->setPen(QPen(d->color)); @@ -528,9 +526,9 @@ void QFxLineEdit::drawContents(QPainter *p, const QRect &r) filtering at the beginning of the animation and reenable it at the conclusion. */ -void QFxLineEditPrivate::init() +void QFxTextInputPrivate::init() { - Q_Q(QFxLineEdit); + Q_Q(QFxTextInput); control->setCursorWidth(1); control->setPasswordCharacter(QLatin1Char('*')); control->setLayoutDirection(Qt::LeftToRight); @@ -559,9 +557,9 @@ void QFxLineEditPrivate::init() lastSelectionEnd = 0; } -void QFxLineEdit::cursorPosChanged() +void QFxTextInput::cursorPosChanged() { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); emit cursorPositionChanged(); if(!d->control->hasSelectedText()){ @@ -576,9 +574,9 @@ void QFxLineEdit::cursorPosChanged() } } -void QFxLineEdit::selectionChanged() +void QFxTextInput::selectionChanged() { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); emit selectedTextChanged(); if(d->lastSelectionStart != d->control->selectionStart()){ @@ -595,9 +593,9 @@ void QFxLineEdit::selectionChanged() } } -void QFxLineEdit::q_textChanged() +void QFxTextInput::q_textChanged() { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); updateAll(); emit textChanged(); if(hasAcceptableInput() != d->oldValidity){ @@ -607,16 +605,16 @@ void QFxLineEdit::q_textChanged() } //### Please replace this function with proper updating -void QFxLineEdit::updateAll() +void QFxTextInput::updateAll() { clearCache(); updateSize(); update(); } -void QFxLineEdit::updateSize() +void QFxTextInput::updateSize() { - Q_D(QFxLineEdit); + Q_D(QFxTextInput); setImplicitHeight(d->control->height()); //d->control->width() is max width, not current width QFontMetrics fm = QFontMetrics(d->font); diff --git a/src/declarative/fx/qfxlineedit.h b/src/declarative/fx/qfxtextinput.h index 1f4a5c6..fe72f1e 100644 --- a/src/declarative/fx/qfxlineedit.h +++ b/src/declarative/fx/qfxtextinput.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QFXLINEEDIT_H -#define QFXLINEEDIT_H +#ifndef QFXTEXTINPUT_H +#define QFXTEXTINPUT_H #include "qfxtext.h" #include "qfxpainteditem.h" @@ -53,10 +53,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxLineEditPrivate; +class QFxTextInputPrivate; class QValidator; -//### class QFxTextInput?? -class Q_DECLARATIVE_EXPORT QFxLineEdit : public QFxPaintedItem +class Q_DECLARATIVE_EXPORT QFxTextInput : public QFxPaintedItem { Q_OBJECT Q_ENUMS(HAlignment) @@ -66,7 +65,7 @@ class Q_DECLARATIVE_EXPORT QFxLineEdit : public QFxPaintedItem Q_PROPERTY(QColor highlightColor READ highlightColor WRITE setHighlightColor) //### selectionColor Q_PROPERTY(QColor highlightedTextColor READ highlightedTextColor WRITE setHighlightedTextColor) //### selectedTextColor Q_PROPERTY(QFont font READ font WRITE setFont) - Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) //### horizontalAlignment + Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible) @@ -76,16 +75,16 @@ class Q_DECLARATIVE_EXPORT QFxLineEdit : public QFxPaintedItem Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged) Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged) - Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength) //### maximumLength - Q_PROPERTY(QObject* validator READ validator WRITE setValidator) //### QValidator * + Q_PROPERTY(int maximumLength READ maxLength WRITE setMaxLength) + Q_PROPERTY(QValidator* validator READ validator WRITE setValidator) Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask) Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged) Q_PROPERTY(uint echoMode READ echoMode WRITE setEchoMode) //### enum //### Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress) public: - QFxLineEdit(QFxItem* parent=0); - ~QFxLineEdit(); + QFxTextInput(QFxItem* parent=0); + ~QFxTextInput(); enum HAlignment { AlignLeft = Qt::AlignLeft, @@ -135,8 +134,8 @@ public: int maxLength() const; void setMaxLength(int ml); - QObject * validator() const; - void setValidator(QObject* v); + QValidator * validator() const; + void setValidator(QValidator* v); QString inputMask() const; void setInputMask(const QString &im); @@ -160,7 +159,7 @@ Q_SIGNALS: void acceptableInputChanged(); protected: - QFxLineEdit(QFxLineEditPrivate &dd, QFxItem *parent); + QFxTextInput(QFxTextInputPrivate &dd, QFxItem *parent); virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); @@ -180,13 +179,15 @@ private Q_SLOTS: void cursorPosChanged(); private: - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxLineEdit); + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr, QFxTextInput); }; QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxLineEdit) +QML_DECLARE_TYPE(QFxTextInput) +QML_DECLARE_TYPE(QValidator) QML_DECLARE_TYPE(QIntValidator) QT_END_HEADER -#endif // QFXLINEEDIT_H + +#endif // QFXTEXTINPUT_H diff --git a/src/declarative/fx/qfxlineedit_p.h b/src/declarative/fx/qfxtextinput_p.h index 369669f..22a5306 100644 --- a/src/declarative/fx/qfxlineedit_p.h +++ b/src/declarative/fx/qfxtextinput_p.h @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#ifndef QFXLINEEDIT_P_H -#define QFXLINEEDIT_P_H +#ifndef QFXTEXTINPUT_P_H +#define QFXTEXTINPUT_P_H -#include "qfxlineedit.h" +#include "qfxtextinput.h" #include "qml.h" #include "qfxpainteditem_p.h" #include "private/qlinecontrol_p.h" @@ -59,18 +59,18 @@ QT_BEGIN_NAMESPACE -class QFxLineEditPrivate : public QFxPaintedItemPrivate +class QFxTextInputPrivate : public QFxPaintedItemPrivate { - Q_DECLARE_PUBLIC(QFxLineEdit); + Q_DECLARE_PUBLIC(QFxTextInput); public: - QFxLineEditPrivate() : control(new QLineControl(QString())), + QFxTextInputPrivate() : control(new QLineControl(QString())), color((QRgb)0), style(QFxText::Normal), - styleColor((QRgb)0), hAlign(QFxLineEdit::AlignLeft), + styleColor((QRgb)0), hAlign(QFxTextInput::AlignLeft), hscroll(0), oldScroll(0), focused(false), cursorVisible(false) { } - ~QFxLineEditPrivate() + ~QFxTextInputPrivate() { } @@ -85,7 +85,7 @@ public: QColor highlightedTextColor; QFxText::TextStyle style; QColor styleColor; - QFxLineEdit::HAlignment hAlign; + QFxTextInput::HAlignment hAlign; QPointer<QmlComponent> cursorComponent; QPointer<QFxItem> cursorItem; |