summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-07-29 01:49:56 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-07-29 01:49:56 (GMT)
commita490b9f584887c2569a751fde063e883b7bf79ab (patch)
tree9340a5cd5c0c0b32da54ccbe11dac8faa0245bbb /src/declarative
parent00daed26e5cc52729d00b235addfe08b766a9c73 (diff)
downloadQt-a490b9f584887c2569a751fde063e883b7bf79ab.zip
Qt-a490b9f584887c2569a751fde063e883b7bf79ab.tar.gz
Qt-a490b9f584887c2569a751fde063e883b7bf79ab.tar.bz2
Implement the font property for QFxLineEdit
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/fx/qfxlineedit.cpp17
-rw-r--r--src/declarative/fx/qfxlineedit.h3
2 files changed, 19 insertions, 1 deletions
diff --git a/src/declarative/fx/qfxlineedit.cpp b/src/declarative/fx/qfxlineedit.cpp
index c88f1d0..4ff3504 100644
--- a/src/declarative/fx/qfxlineedit.cpp
+++ b/src/declarative/fx/qfxlineedit.cpp
@@ -108,6 +108,22 @@ QmlFont *QFxLineEdit::font()
}
/*!
+This signal is emitted when the font of the item changes.
+*/
+void QFxLineEdit::fontChanged()
+{
+ Q_D(QFxLineEdit);
+ d->control->setFont(d->font->font());
+ if(d->cursorItem){
+ d->cursorItem->setHeight(QFontMetrics(d->font->font()).height());
+ moveCursor();
+ }
+ //updateSize();
+ updateAll();//TODO: Only necessary updates
+ emit update();
+}
+
+/*!
\qmlproperty color LineEdit::color
The text color.
@@ -478,6 +494,7 @@ void QFxLineEditPrivate::init()
q, SLOT(updateAll()));
if(!font)
font = new QmlFont();
+ q->connect(font, SIGNAL(updated()), q, SLOT(fontChanged()));
q->updateSize();
oldValidity = control->hasAcceptableInput();
lastSelectionStart = 0;
diff --git a/src/declarative/fx/qfxlineedit.h b/src/declarative/fx/qfxlineedit.h
index 2c22d4b..0f56818 100644
--- a/src/declarative/fx/qfxlineedit.h
+++ b/src/declarative/fx/qfxlineedit.h
@@ -147,8 +147,9 @@ protected:
void focusChanged(bool hasFocus);
-private slots:
+private Q_SLOTS:
void updateSize();
+ void fontChanged();
void q_textChanged();
void selectionChanged();
void updateAll();