diff options
Diffstat (limited to 'src/declarative/fx')
-rw-r--r-- | src/declarative/fx/qfxtextedit.cpp | 14 | ||||
-rw-r--r-- | src/declarative/fx/qfxtextedit.h | 6 | ||||
-rw-r--r-- | src/declarative/fx/qfxtextedit_p.h | 4 | ||||
-rw-r--r-- | src/declarative/fx/qfxtextinput.cpp | 1 | ||||
-rw-r--r-- | src/declarative/fx/qfxvisualitemmodel.cpp | 38 |
5 files changed, 32 insertions, 31 deletions
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index f4c2e4c..07444bb 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -407,7 +407,7 @@ void QFxTextEdit::setCursorVisible(bool on) return; d->cursorVisible = on; QFocusEvent focusEvent(on ? QEvent::FocusIn : QEvent::FocusOut); - if (!on && !d->preserveSelection) + if (!on && !d->persistentSelection) d->control->setCursorIsFocusIndicator(true); d->control->processEvent(&focusEvent, QPointF(0, 0)); } @@ -590,23 +590,23 @@ void QFxTextEdit::setFocusOnPress(bool on) } /*! - \qmlproperty bool TextEdit::preserveSelection + \qmlproperty bool TextEdit::persistentSelection Whether the TextEdit should keep the selection visible when it loses focus to another item in the scene. By default this is set to true; */ -bool QFxTextEdit::preserveSelection() const +bool QFxTextEdit::persistentSelection() const { Q_D(const QFxTextEdit); - return d->preserveSelection; + return d->persistentSelection; } -void QFxTextEdit::setPreserveSelection(bool on) +void QFxTextEdit::setPersistentSelection(bool on) { Q_D(QFxTextEdit); - if (d->preserveSelection == on) + if (d->persistentSelection == on) return; - d->preserveSelection = on; + d->persistentSelection = on; } qreal QFxTextEdit::textMargin() const diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index 1a5d968..f4f101a 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -83,7 +83,7 @@ class Q_DECLARATIVE_EXPORT QFxTextEdit : public QFxPaintedItem 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 preserveSelection READ preserveSelection WRITE setPreserveSelection) + Q_PROPERTY(bool persistentSelection READ persistentSelection WRITE setPersistentSelection) Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin) public: @@ -154,8 +154,8 @@ public: bool focusOnPress() const; void setFocusOnPress(bool on); - bool preserveSelection() const; - void setPreserveSelection(bool on); + bool persistentSelection() const; + void setPersistentSelection(bool on); qreal textMargin() const; void setTextMargin(qreal margin); diff --git a/src/declarative/fx/qfxtextedit_p.h b/src/declarative/fx/qfxtextedit_p.h index 9c73db9..82481ff 100644 --- a/src/declarative/fx/qfxtextedit_p.h +++ b/src/declarative/fx/qfxtextedit_p.h @@ -70,7 +70,7 @@ public: QFxTextEditPrivate() : color("black"), imgDirty(true), hAlign(QFxTextEdit::AlignLeft), vAlign(QFxTextEdit::AlignTop), dirty(false), wrap(false), richText(false), cursorVisible(false), focusOnPress(false), - preserveSelection(true), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), + persistentSelection(true), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), cursorComponent(0), cursor(0), format(QFxTextEdit::AutoText), document(0) { } @@ -98,7 +98,7 @@ public: bool richText; bool cursorVisible; bool focusOnPress; - bool preserveSelection; + bool persistentSelection; qreal textMargin; int lastSelectionStart; int lastSelectionEnd; diff --git a/src/declarative/fx/qfxtextinput.cpp b/src/declarative/fx/qfxtextinput.cpp index b7b155a..05d2260 100644 --- a/src/declarative/fx/qfxtextinput.cpp +++ b/src/declarative/fx/qfxtextinput.cpp @@ -594,6 +594,7 @@ bool QFxTextInput::event(QEvent* ev) bool handled = false; switch(ev->type()){ case QEvent::KeyPress: + case QEvent::KeyRelease://###Should the control be doing anything with release? case QEvent::GraphicsSceneMousePress: break; default: diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp index fb1cfcf..b7248ea 100644 --- a/src/declarative/fx/qfxvisualitemmodel.cpp +++ b/src/declarative/fx/qfxvisualitemmodel.cpp @@ -264,10 +264,10 @@ public: } if (m_roles.count() == 1) m_roleNames.insert(QLatin1String("modelData"), m_roles.at(0)); - } else if (m_modelList) { + } else if (m_listAccessor) { m_roleNames.insert(QLatin1String("modelData"), 0); - if (m_modelList->type() == QmlListAccessor::Instance) { - if (QObject *object = m_modelList->at(0).value<QObject*>()) { + if (m_listAccessor->type() == QmlListAccessor::Instance) { + if (QObject *object = m_listAccessor->at(0).value<QObject*>()) { int count = object->metaObject()->propertyCount(); for (int ii = 1; ii < count; ++ii) { const QMetaProperty &prop = object->metaObject()->property(ii); @@ -330,7 +330,7 @@ public: QFxVisualDataModelData *data(QObject *item); QVariant m_modelVariant; - QmlListAccessor *m_modelList; + QmlListAccessor *m_listAccessor; int modelCount() const { if (m_visualItemModel) @@ -339,8 +339,8 @@ public: return m_listModelInterface->count(); if (m_abstractItemModel) return m_abstractItemModel->rowCount(); - if (m_modelList) - return m_modelList->count(); + if (m_listAccessor) + return m_listAccessor->count(); return 0; } }; @@ -405,7 +405,7 @@ int QFxVisualDataModelDataMetaObject::createProperty(const char *name, const cha static_cast<QFxVisualDataModelData *>(object()); if ((!data->m_model->m_listModelInterface || !data->m_model->m_abstractItemModel) - && data->m_model->m_modelList) { + && data->m_model->m_listAccessor) { data->m_model->ensureRoles(); if (data->m_model->m_roleNames.contains(QLatin1String(name))) return QmlOpenMetaObject::createProperty(name, type); @@ -427,16 +427,16 @@ QFxVisualDataModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &pro static_cast<QFxVisualDataModelData *>(object()); QString name = QLatin1String(prop.name()); if ((!data->m_model->m_listModelInterface || !data->m_model->m_abstractItemModel) - && data->m_model->m_modelList) { + && data->m_model->m_listAccessor) { if (name == QLatin1String("modelData")) { - if (data->m_model->m_modelList->type() == QmlListAccessor::Instance) { - QObject *object = data->m_model->m_modelList->at(0).value<QObject*>(); + if (data->m_model->m_listAccessor->type() == QmlListAccessor::Instance) { + QObject *object = data->m_model->m_listAccessor->at(0).value<QObject*>(); return object->metaObject()->property(1).read(object); // the first property after objectName } - return data->m_model->m_modelList->at(data->m_index); + return data->m_model->m_listAccessor->at(data->m_index); } else { // return any property of a single object instance. - QObject *object = data->m_model->m_modelList->at(0).value<QObject*>(); + QObject *object = data->m_model->m_listAccessor->at(0).value<QObject*>(); return object->property(prop.name()); } } else if (data->m_model->m_listModelInterface) { @@ -531,7 +531,7 @@ QFxVisualDataModelParts::QFxVisualDataModelParts(QFxVisualDataModel *parent) QFxVisualDataModelPrivate::QFxVisualDataModelPrivate(QmlContext *ctxt) : m_listModelInterface(0), m_abstractItemModel(0), m_visualItemModel(0), m_delegate(0) -, m_context(ctxt), m_parts(0), m_modelList(0) +, m_context(ctxt), m_parts(0), m_listAccessor(0) { } @@ -556,8 +556,8 @@ QFxVisualDataModel::QFxVisualDataModel(QmlContext *ctxt) QFxVisualDataModel::~QFxVisualDataModel() { Q_D(QFxVisualDataModel); - if (d->m_modelList) - delete d->m_modelList; + if (d->m_listAccessor) + delete d->m_listAccessor; } QVariant QFxVisualDataModel::model() const @@ -569,8 +569,8 @@ QVariant QFxVisualDataModel::model() const void QFxVisualDataModel::setModel(const QVariant &model) { Q_D(QFxVisualDataModel); - delete d->m_modelList; - d->m_modelList = 0; + delete d->m_listAccessor; + d->m_listAccessor = 0; d->m_modelVariant = model; if (d->m_listModelInterface) { // Assume caller has released all items. @@ -642,8 +642,8 @@ void QFxVisualDataModel::setModel(const QVariant &model) this, SLOT(_q_destroyingPackage(QmlPackage*))); return; } - d->m_modelList = new QmlListAccessor; - d->m_modelList->setList(model, d->m_context?d->m_context->engine():qmlEngine(this)); + d->m_listAccessor = new QmlListAccessor; + d->m_listAccessor->setList(model, d->m_context?d->m_context->engine():qmlEngine(this)); if (d->m_delegate && d->modelCount()) { emit itemsInserted(0, d->modelCount()); emit countChanged(); |