/**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the Qt Designer 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 Technology Preview License Agreement accompanying ** this package. ** ** 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.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "abstractformwindowcursor.h" QT_BEGIN_NAMESPACE /*! \class QDesignerFormWindowCursorInterface \brief The QDesignerFormWindowCursorInterface class allows you to query and modify a form window's widget selection, and in addition modify the properties of all the form's widgets. \inmodule QtDesigner QDesignerFormWindowCursorInterface is a convenience class that provides an interface to the associated form window's text cursor; it provides a collection of functions that enables you to query a given form window's selection and change the selection's focus according to defined modes (MoveMode) and movements (MoveOperation). You can also use the interface to query the form's widgets and change their properties. The interface is not intended to be instantiated directly, but to provide access to the selections and widgets of \QD's current form windows. QDesignerFormWindowInterface always provides an associated cursor interface. The form window for a given widget can be retrieved using the static QDesignerFormWindowInterface::findFormWindow() functions. For example: \snippet doc/src/snippets/code/tools_designer_src_lib_sdk_abstractformwindowcursor.cpp 0 You can retrieve any of \QD's current form windows through \QD's \l {QDesignerFormWindowManagerInterface}{form window manager}. Once you have a form window's cursor interface, you can check if the form window has a selection at all using the hasSelection() function. You can query the form window for its total widgetCount() and selectedWidgetCount(). You can retrieve the currently selected widget (or widgets) using the current() or selectedWidget() functions. You can retrieve any of the form window's widgets using the widget() function, and check if a widget is selected using the isWidgetSelected() function. You can use the setProperty() function to set the selected widget's properties, and the setWidgetProperty() or resetWidgetProperty() functions to modify the properties of any given widget. Finally, you can change the selection by changing the text cursor's position() using the setPosition() and movePosition() functions. \sa QDesignerFormWindowInterface, QDesignerFormWindowManagerInterface */ /*! \enum QDesignerFormWindowCursorInterface::MoveOperation This enum describes the types of text cursor operation that can occur in a form window. \value NoMove The cursor does not move. \value Start Moves the cursor to the start of the focus chain. \value End Moves the cursor to the end of the focus chain. \value Next Moves the cursor to the next widget in the focus chain. \value Prev Moves the cursor to the previous widget in the focus chain. \value Left The cursor moves to the left. \value Right The cursor moves to the right. \value Up The cursor moves upwards. \value Down The cursor moves downwards. */ /*! \enum QDesignerFormWindowCursorInterface::MoveMode This enum describes the different modes that are used when the text cursor moves. \value MoveAnchor The anchor moves with the cursor to its new location. \value KeepAnchor The anchor remains at the cursor's old location. */ /*! Returns true if the specified \a widget is selected; otherwise returns false. */ bool QDesignerFormWindowCursorInterface::isWidgetSelected(QWidget *widget) const { for (int index=0; index