From 3889a8947a9f8bf3a159dbd5e2c3ed1a63d3cb8d Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 3 Aug 2009 17:51:33 +1000 Subject: Renaming: FocusRealm -> FocusScope --- demos/declarative/contacts/contacts.qml | 4 +- doc/src/declarative/elements.qdoc | 2 +- doc/src/declarative/focus.qdoc | 38 ++++++------ doc/src/tutorials/declarative.qdoc | 4 +- .../contacts/1_Drawing_and_Animation/GroupBox.qml | 2 +- .../tutorials/contacts/2_Reuse/GroupBox.qml | 2 +- .../tutorials/contacts/3_Collections/GroupBox.qml | 2 +- src/declarative/fx/fx.pri | 4 +- src/declarative/fx/qfxfocusrealm.cpp | 72 ---------------------- src/declarative/fx/qfxfocusrealm.h | 67 -------------------- src/declarative/fx/qfxfocusscope.cpp | 72 ++++++++++++++++++++++ src/declarative/fx/qfxfocusscope.h | 67 ++++++++++++++++++++ tools/qmldebugger/canvasscene.cpp | 2 +- 13 files changed, 169 insertions(+), 169 deletions(-) delete mode 100644 src/declarative/fx/qfxfocusrealm.cpp delete mode 100644 src/declarative/fx/qfxfocusrealm.h create mode 100644 src/declarative/fx/qfxfocusscope.cpp create mode 100644 src/declarative/fx/qfxfocusscope.h diff --git a/demos/declarative/contacts/contacts.qml b/demos/declarative/contacts/contacts.qml index ecafd20..353040c 100644 --- a/demos/declarative/contacts/contacts.qml +++ b/demos/declarative/contacts/contacts.qml @@ -227,7 +227,7 @@ Rect { autoHighlight: true focus: false } - FocusRealm { + FocusScope { id: newContactWrapper anchors.fill: contactListView opacity: 0 @@ -257,7 +257,7 @@ Rect { } } } - FocusRealm { + FocusScope { id: searchBarWrapper height: 30 anchors.bottom: parent.bottom diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 63cd377..68db351 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -81,7 +81,7 @@ The following table lists the Qml elements provided by the Qt Declarative module \list \o \l MouseRegion \o \l KeyActions -\o \l FocusRealm +\o \l FocusScope \o \l KeyProxy \endlist diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc index e5c181d..60311da 100644 --- a/doc/src/declarative/focus.qdoc +++ b/doc/src/declarative/focus.qdoc @@ -6,7 +6,7 @@ When a key is pressed or released, a key event is generated and delivered to the focused fluid UI \l Item. To facilitate the construction of reusable components and to address some of the cases unique to fluid UIs, the fluid UI atoms add a -"realm" based extension to Qt's traditional keyboard focus model. +"scope" based extension to Qt's traditional keyboard focus model. \section1 Key Handling Overview @@ -44,7 +44,7 @@ Text { } \endcode -\section1 Acquiring Focus and Focus Realms +\section1 Acquiring Focus and Focus Scopes An \l Item requests focus by setting the \c {Item::focus} property to true. @@ -135,17 +135,17 @@ of code knows everything about the other, which is exactly how it should be. To solve this problem - allowing components to care about what they know about and ignore everything else - the fluid UI atoms introduce a concept known as a -\e {focus realm}. For existing Qt users, a \e {focus realm} is like an -automatic focus proxy. A \e {focus realm} is created using the \l FocusRealm +\e {focus scope}. For existing Qt users, a \e {focus scope} is like an +automatic focus proxy. A \e {focus scope} is created using the \l FocusScope element. -In the next example, a \l FocusRealm is added to the component, and the visual +In the next example, a \l FocusScope is added to the component, and the visual result shown. \table \row \o \code -FocusRealm { +FocusScope { width: 240; height: 25 Rect { color: "lightsteelblue"; width: 240; height: 25 @@ -162,12 +162,12 @@ FocusRealm { \o \image declarative-qmlfocus2.png \endtable -Conceptually \e {focus realms} are quite simple. +Conceptually \e {focus scopes} are quite simple. \list -\o Within each \e {focus realm} one element may have \c {Item::focus} set to true. If more than one \l Item has the \c {Item::focus} property set, the first is selected and the others are unset, just like when there are no \e {focus realms}. -\o When a \e {focus realm} receives \e {active focus}, the contained element with \c {Item::focus} set (if any) also gets \e {active focus}. If this element is -also a \l FocusRealm, the proxying behaviour continues. Both the -\e {focus realm} and the sub-focused item will have \c {Item::activeFocus} set. +\o Within each \e {focus scope} one element may have \c {Item::focus} set to true. If more than one \l Item has the \c {Item::focus} property set, the first is selected and the others are unset, just like when there are no \e {focus scopes}. +\o When a \e {focus scope} receives \e {active focus}, the contained element with \c {Item::focus} set (if any) also gets \e {active focus}. If this element is +also a \l FocusScope, the proxying behaviour continues. Both the +\e {focus scope} and the sub-focused item will have \c {Item::activeFocus} set. \endlist So far the example has the second component statically selected. It is trivial @@ -185,7 +185,7 @@ Rect { } \endcode \o \code -FocusRealm { +FocusScope { id: Page; width: 240; height: 25 MyWidget { focus: true } MouseRegion { anchors.fill: parent; onClicked: { Page.focus = true } } @@ -200,14 +200,14 @@ When a fluid UI atom explicitly relinquishes focus (by setting its does not automatically select another element to receive focus. That is, it is possible for there to be no currently \e {active focus}. -\section1 Advanced uses of Focus Realms +\section1 Advanced uses of Focus Scopes -Focus realms allow focus to allocation to be easily partitioned. Several +Focus scopes allow focus to allocation to be easily partitioned. Several fluid UI atoms use it to this effect. -\l ListView, for example, is itself a focus realm. Generally this isn't +\l ListView, for example, is itself a focus scope. Generally this isn't noticable as \l ListView doesn't usually have manually added visual children. -By being a focus realm, \l ListView can focus the current list item without +By being a focus scope, \l ListView can focus the current list item without worrying about how that will effect the rest of the application. This allows the current item delegate to react to key presses. @@ -227,7 +227,7 @@ Rect { ListElement { name: "John" } ListElement { name: "Michael" } } - delegate: FocusRealm { + delegate: FocusScope { width: contents.width; height: contents.height Text { text: name } KeyActions { return: "print(name)"; focus: true } @@ -240,10 +240,10 @@ Rect { While the example is simple, there's a lot going on behind the scenes. Whenever the current item changes, the \l ListView sets the delegate's \c {Item::focus} -property. As the \l ListView is a \e {focus realm}, this doesn't effect the +property. As the \l ListView is a \e {focus scope}, this doesn't effect the rest of the application. However, if the \l ListView itself has \e {active focus} this causes the delegate itself to receive \e {active focus}. -In this example, the root element of the delegate is also a \e {focus realm}, +In this example, the root element of the delegate is also a \e {focus scope}, which in turn gives \e {active focus} to the \c {KeyActions} element that actually performs the work of handling the \e {Return} key. diff --git a/doc/src/tutorials/declarative.qdoc b/doc/src/tutorials/declarative.qdoc index b7a4d7d..e848dfa 100644 --- a/doc/src/tutorials/declarative.qdoc +++ b/doc/src/tutorials/declarative.qdoc @@ -495,7 +495,7 @@ For an item to have key focus in QML it is required that: \list - \o If there is a FocusRealm ancestor of the component that it has focus as well. + \o If there is a FocusScope ancestor of the component that it has focus as well. \o That it is the most recent component within the focus realms descendent's to receive focus \endlist @@ -505,7 +505,7 @@ the components parent, which in turn will pass keys it doesn't handle up to its own ancestors. - Some components such as ListView components are also FocusRealm components, as they + Some components such as ListView components are also FocusScope components, as they handle focus among the child list items. At this stage of the tutorial it is sufficient to use the setting of 'focus' diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml index d3f626f..c607e75 100644 --- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml +++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml @@ -1,6 +1,6 @@ import Qt 4.6 -FocusRealm { +FocusScope { id: groupBox width: Math.max(270, subItem.width+40) height: Math.max(70, subItem.height+40) diff --git a/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml b/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml index d3f626f..c607e75 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml @@ -1,6 +1,6 @@ import Qt 4.6 -FocusRealm { +FocusScope { id: groupBox width: Math.max(270, subItem.width+40) height: Math.max(70, subItem.height+40) diff --git a/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml b/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml index d3f626f..c607e75 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml @@ -1,6 +1,6 @@ import Qt 4.6 -FocusRealm { +FocusScope { id: groupBox width: Math.max(270, subItem.width+40) height: Math.max(70, subItem.height+40) diff --git a/src/declarative/fx/fx.pri b/src/declarative/fx/fx.pri index 2c98dd3..bbb09fb 100644 --- a/src/declarative/fx/fx.pri +++ b/src/declarative/fx/fx.pri @@ -14,7 +14,7 @@ HEADERS += \ fx/qfximage_p.h \ fx/qfxitem.h \ fx/qfxitem_p.h \ - fx/qfxfocusrealm.h \ + fx/qfxfocusscope.h \ fx/qfxkeyactions.h \ fx/qfxkeyproxy.h \ fx/qfxlayouts.h \ @@ -53,7 +53,7 @@ SOURCES += \ fx/qfximage.cpp \ fx/qfxpainteditem.cpp \ fx/qfxitem.cpp \ - fx/qfxfocusrealm.cpp \ + fx/qfxfocusscope.cpp \ fx/qfxkeyactions.cpp \ fx/qfxkeyproxy.cpp \ fx/qfxlayouts.cpp \ diff --git a/src/declarative/fx/qfxfocusrealm.cpp b/src/declarative/fx/qfxfocusrealm.cpp deleted file mode 100644 index 4484378..0000000 --- a/src/declarative/fx/qfxfocusrealm.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qfxfocusrealm.h" - - -QT_BEGIN_NAMESPACE -QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusRealm,QFxFocusRealm) - -/*! - \qmlclass FocusRealm - \brief The FocusRealm object explicitly creates a focus realm. - \inherits Item - - Focus realms assist in keyboard focus handling when building reusable QML - components. All the details are covered in the - \l {qmlfocus}{keyboard focus documentation}. -*/ - -/*! - \internal - \class QFxFocusRealm -*/ - -QFxFocusRealm::QFxFocusRealm(QFxItem *parent) : - QFxItem(parent) -{ - setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy); -} - -QFxFocusRealm::~QFxFocusRealm() -{ -} -QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxfocusrealm.h b/src/declarative/fx/qfxfocusrealm.h deleted file mode 100644 index 20fc5ad..0000000 --- a/src/declarative/fx/qfxfocusrealm.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFXFOCUSREALM_H -#define QFXFOCUSREALM_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class Q_DECLARATIVE_EXPORT QFxFocusRealm : public QFxItem -{ - Q_OBJECT -public: - QFxFocusRealm(QFxItem *parent=0); - virtual ~QFxFocusRealm(); -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QFxFocusRealm) - -QT_END_HEADER - -#endif // QFXFOCUSREALM_H diff --git a/src/declarative/fx/qfxfocusscope.cpp b/src/declarative/fx/qfxfocusscope.cpp new file mode 100644 index 0000000..8981256 --- /dev/null +++ b/src/declarative/fx/qfxfocusscope.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qfxfocusscope.h" + + +QT_BEGIN_NAMESPACE +QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,FocusScope,QFxFocusScope) + +/*! + \qmlclass FocusScope + \brief The FocusScope object explicitly creates a focus scope. + \inherits Item + + Focus scopes assist in keyboard focus handling when building reusable QML + components. All the details are covered in the + \l {qmlfocus}{keyboard focus documentation}. +*/ + +/*! + \internal + \class QFxFocusScope +*/ + +QFxFocusScope::QFxFocusScope(QFxItem *parent) : + QFxItem(parent) +{ + setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy); +} + +QFxFocusScope::~QFxFocusScope() +{ +} +QT_END_NAMESPACE diff --git a/src/declarative/fx/qfxfocusscope.h b/src/declarative/fx/qfxfocusscope.h new file mode 100644 index 0000000..28a6e30 --- /dev/null +++ b/src/declarative/fx/qfxfocusscope.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFXFOCUSSCOPE_H +#define QFXFOCUSSCOPE_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class Q_DECLARATIVE_EXPORT QFxFocusScope : public QFxItem +{ + Q_OBJECT +public: + QFxFocusScope(QFxItem *parent=0); + virtual ~QFxFocusScope(); +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QFxFocusScope) + +QT_END_HEADER + +#endif // QFXFOCUSSCOPE_H diff --git a/tools/qmldebugger/canvasscene.cpp b/tools/qmldebugger/canvasscene.cpp index 65db9da..6c349f3 100644 --- a/tools/qmldebugger/canvasscene.cpp +++ b/tools/qmldebugger/canvasscene.cpp @@ -104,7 +104,7 @@ void CanvasScene::clone(QTreeWidgetItem *item, QSimpleCanvasItem *me, rect->setColor(QColor(0, 0, 0, 10)); else if(options & QSimpleCanvasItem::IsFocusPanel) rect->setColor(QColor(0, 255, 0, 10)); - else if(options & QSimpleCanvasItem::IsFocusRealm) + else if(options & QSimpleCanvasItem::IsFocusScope) rect->setColor(QColor(0, 0, 255, 10)); else rect->setColor(QColor(255, 0, 0, 10)); -- cgit v0.12