Qt 4.8
Public Types | Public Functions | Properties | List of all members
QmlJSDebugger::LiveSingleSelectionManipulator Class Reference

#include <livesingleselectionmanipulator.h>

Public Types

enum  SelectionType { ReplaceSelection, AddToSelection, RemoveFromSelection, InvertSelection }
 

Public Functions

void begin (const QPointF &beginPoint)
 
QPointF beginPoint () const
 
void clear ()
 
void end (const QPointF &updatePoint)
 
bool isActive () const
 
 LiveSingleSelectionManipulator (QDeclarativeViewInspector *editorView)
 
void select (SelectionType selectionType, const QList< QGraphicsItem *> &items, bool selectOnlyContentItems)
 
void select (SelectionType selectionType, bool selectOnlyContentItems)
 
void update (const QPointF &updatePoint)
 

Properties

QPointF m_beginPoint
 
QDeclarativeViewInspectorm_editorView
 
bool m_isActive
 
QList< QGraphicsItem * > m_oldSelectionList
 

Detailed Description

Definition at line 54 of file livesingleselectionmanipulator.h.

Enumerations

◆ SelectionType

Constructors and Destructors

◆ LiveSingleSelectionManipulator()

QmlJSDebugger::LiveSingleSelectionManipulator::LiveSingleSelectionManipulator ( QDeclarativeViewInspector editorView)

Functions

◆ begin()

void QmlJSDebugger::LiveSingleSelectionManipulator::begin ( const QPointF beginPoint)

Definition at line 57 of file livesingleselectionmanipulator.cpp.

Referenced by QmlJSDebugger::LiveSelectionTool::contextMenuElementSelected(), QmlJSDebugger::LiveSelectionTool::mousePressEvent(), QmlJSDebugger::LiveSelectionTool::mouseReleaseEvent(), QmlJSDebugger::LiveSelectionTool::selectUnderPoint(), and QmlJSDebugger::LiveSelectionTool::wheelEvent().

◆ beginPoint()

QPointF QmlJSDebugger::LiveSingleSelectionManipulator::beginPoint ( ) const

◆ clear()

void QmlJSDebugger::LiveSingleSelectionManipulator::clear ( void  )

Definition at line 69 of file livesingleselectionmanipulator.cpp.

Referenced by QmlJSDebugger::LiveSelectionTool::clear().

70 {
73 }
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
void clear()
Removes all items from the list.
Definition: qlist.h:764

◆ end()

void QmlJSDebugger::LiveSingleSelectionManipulator::end ( const QPointF updatePoint)

◆ isActive()

bool QmlJSDebugger::LiveSingleSelectionManipulator::isActive ( ) const

◆ select() [1/2]

void QmlJSDebugger::LiveSingleSelectionManipulator::select ( SelectionType  selectionType,
const QList< QGraphicsItem *> &  items,
bool  selectOnlyContentItems 
)

Definition at line 82 of file livesingleselectionmanipulator.cpp.

Referenced by QmlJSDebugger::LiveSelectionTool::contextMenuElementSelected(), QmlJSDebugger::LiveSelectionTool::mousePressEvent(), QmlJSDebugger::LiveSelectionTool::mouseReleaseEvent(), select(), QmlJSDebugger::LiveSelectionTool::selectUnderPoint(), and QmlJSDebugger::LiveSelectionTool::wheelEvent().

85 {
86  QGraphicsItem *selectedItem = 0;
87 
88  foreach (QGraphicsItem* item, items)
89  {
90  //FormEditorItem *formEditorItem = FormEditorItem::fromQGraphicsItem(item);
91  if (item
92  /*&& !formEditorItem->qmlItemNode().isRootNode()
93  && (formEditorItem->qmlItemNode().hasShowContent() || !selectOnlyContentItems)*/)
94  {
95  selectedItem = item;
96  break;
97  }
98  }
99 
100  QList<QGraphicsItem*> resultList;
101 
102  switch (selectionType) {
103  case AddToSelection: {
104  resultList.append(m_oldSelectionList);
105  if (selectedItem && !m_oldSelectionList.contains(selectedItem))
106  resultList.append(selectedItem);
107  }
108  break;
109  case ReplaceSelection: {
110  if (selectedItem)
111  resultList.append(selectedItem);
112  }
113  break;
114  case RemoveFromSelection: {
115  resultList.append(m_oldSelectionList);
116  if (selectedItem)
117  resultList.removeAll(selectedItem);
118  }
119  break;
120  case InvertSelection: {
121  if (selectedItem
122  && !m_oldSelectionList.contains(selectedItem))
123  {
124  resultList.append(selectedItem);
125  }
126  }
127  }
128 
129  m_editorView->setSelectedItems(resultList);
130 }
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
void setSelectedItems(QList< QGraphicsItem *> items)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770

◆ select() [2/2]

void QmlJSDebugger::LiveSingleSelectionManipulator::select ( SelectionType  selectionType,
bool  selectOnlyContentItems 
)

Definition at line 132 of file livesingleselectionmanipulator.cpp.

133 {
134  QDeclarativeViewInspectorPrivate *inspectorPrivate =
136  QList<QGraphicsItem*> itemList = inspectorPrivate->selectableItems(m_beginPoint);
137  select(selectionType, itemList, selectOnlyContentItems);
138 }
void select(SelectionType selectionType, const QList< QGraphicsItem *> &items, bool selectOnlyContentItems)
static QDeclarativeViewInspectorPrivate * get(QDeclarativeViewInspector *v)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ update()

void QmlJSDebugger::LiveSingleSelectionManipulator::update ( const QPointF updatePoint)

Definition at line 64 of file livesingleselectionmanipulator.cpp.

65 {
67 }
void clear()
Removes all items from the list.
Definition: qlist.h:764

Properties

◆ m_beginPoint

QPointF QmlJSDebugger::LiveSingleSelectionManipulator::m_beginPoint
private

Definition at line 82 of file livesingleselectionmanipulator.h.

Referenced by begin(), beginPoint(), clear(), and select().

◆ m_editorView

QDeclarativeViewInspector* QmlJSDebugger::LiveSingleSelectionManipulator::m_editorView
private

Definition at line 83 of file livesingleselectionmanipulator.h.

Referenced by begin(), and select().

◆ m_isActive

bool QmlJSDebugger::LiveSingleSelectionManipulator::m_isActive
private

Definition at line 84 of file livesingleselectionmanipulator.h.

Referenced by begin(), end(), and isActive().

◆ m_oldSelectionList

QList<QGraphicsItem*> QmlJSDebugger::LiveSingleSelectionManipulator::m_oldSelectionList
private

Definition at line 81 of file livesingleselectionmanipulator.h.

Referenced by begin(), clear(), end(), select(), and update().


The documentation for this class was generated from the following files: