Qt 4.8
Public Functions | Static Public Functions | Protected Functions | Properties | List of all members
QmlJSDebugger::AbstractLiveEditTool Class Referenceabstract

#include <abstractliveedittool.h>

Inheritance diagram for QmlJSDebugger::AbstractLiveEditTool:
QmlJSDebugger::AbstractTool QObject QmlJSDebugger::ColorPickerTool QmlJSDebugger::LiveSelectionTool QmlJSDebugger::ZoomTool

Public Functions

 AbstractLiveEditTool (QDeclarativeViewInspector *inspector)
 
virtual void clear ()=0
 
QList< QGraphicsItem * > items () const
 
virtual void itemsAboutToRemoved (const QList< QGraphicsItem *> &itemList)=0
 
void leaveEvent (QEvent *)
 
QString titleForItem (QGraphicsItem *item)
 
bool topItemIsMovable (const QList< QGraphicsItem *> &itemList)
 
bool topItemIsResizeHandle (const QList< QGraphicsItem *> &itemList)
 
bool topSelectedItemIsMovable (const QList< QGraphicsItem *> &itemList)
 
void updateSelectedItems ()
 
virtual ~AbstractLiveEditTool ()
 
- Public Functions inherited from QmlJSDebugger::AbstractTool
 AbstractTool (AbstractViewInspector *inspector)
 
virtual void hoverMoveEvent (QMouseEvent *event)=0
 
AbstractViewInspectorinspector () const
 
virtual void keyPressEvent (QKeyEvent *event)=0
 
virtual void keyReleaseEvent (QKeyEvent *keyEvent)=0
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)=0
 
virtual void mouseMoveEvent (QMouseEvent *event)=0
 
virtual void mousePressEvent (QMouseEvent *event)=0
 
virtual void mouseReleaseEvent (QMouseEvent *event)=0
 
virtual void wheelEvent (QWheelEvent *event)=0
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Static Public Functions

static QList< QGraphicsObject * > toGraphicsObjectList (const QList< QGraphicsItem *> &itemList)
 
static QDeclarativeItemtopMovableDeclarativeItem (const QList< QGraphicsItem *> &itemList)
 
static QGraphicsItemtopMovableGraphicsItem (const QList< QGraphicsItem *> &itemList)
 
static QDeclarativeItemtoQDeclarativeItem (QGraphicsItem *item)
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 

Protected Functions

QDeclarativeViewInspectorinspector () const
 
QGraphicsScenescene () const
 
virtual void selectedItemsChanged (const QList< QGraphicsItem *> &objectList)=0
 
QDeclarativeViewview () const
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 

Properties

QList< QGraphicsItem * > m_itemList
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 63 of file abstractliveedittool.h.

Constructors and Destructors

◆ AbstractLiveEditTool()

QmlJSDebugger::AbstractLiveEditTool::AbstractLiveEditTool ( QDeclarativeViewInspector inspector)

Definition at line 53 of file abstractliveedittool.cpp.

54  : AbstractTool(editorView)
55 {
56 }
AbstractTool(AbstractViewInspector *inspector)

◆ ~AbstractLiveEditTool()

QmlJSDebugger::AbstractLiveEditTool::~AbstractLiveEditTool ( )
virtual

Definition at line 59 of file abstractliveedittool.cpp.

60 {
61 }

Functions

◆ clear()

virtual void QmlJSDebugger::AbstractLiveEditTool::clear ( )
pure virtual

◆ inspector()

QDeclarativeViewInspector * QmlJSDebugger::AbstractLiveEditTool::inspector ( ) const
protected

◆ items()

QList< QGraphicsItem * > QmlJSDebugger::AbstractLiveEditTool::items ( ) const

Definition at line 83 of file abstractliveedittool.cpp.

Referenced by leaveEvent(), and updateSelectedItems().

84 {
85  return inspector()->selectedItems();
86 }
QDeclarativeViewInspector * inspector() const

◆ itemsAboutToRemoved()

virtual void QmlJSDebugger::AbstractLiveEditTool::itemsAboutToRemoved ( const QList< QGraphicsItem *> &  itemList)
pure virtual

◆ leaveEvent()

void QmlJSDebugger::AbstractLiveEditTool::leaveEvent ( QEvent )
inlinevirtual

Implements QmlJSDebugger::AbstractTool.

Definition at line 71 of file abstractliveedittool.h.

71 {}

◆ scene()

QGraphicsScene * QmlJSDebugger::AbstractLiveEditTool::scene ( ) const
protected

Definition at line 73 of file abstractliveedittool.cpp.

Referenced by leaveEvent().

74 {
75  return view()->scene();
76 }
QGraphicsScene * scene() const
Returns a pointer to the scene that is currently visualized in the view.

◆ selectedItemsChanged()

virtual void QmlJSDebugger::AbstractLiveEditTool::selectedItemsChanged ( const QList< QGraphicsItem *> &  objectList)
protectedpure virtual

◆ titleForItem()

QString QmlJSDebugger::AbstractLiveEditTool::titleForItem ( QGraphicsItem item)

Definition at line 160 of file abstractliveedittool.cpp.

Referenced by QmlJSDebugger::LiveSelectionTool::createContextMenu(), and leaveEvent().

161 {
162  QString className(QLatin1String("QGraphicsItem"));
163  QString objectStringId;
164 
165  QString constructedName;
166 
167  QGraphicsObject *gfxObject = item->toGraphicsObject();
168  if (gfxObject) {
169  className = QLatin1String(gfxObject->metaObject()->className());
170 
171  className.remove(QRegExp(QLatin1String("_QMLTYPE_\\d+")));
172  className.remove(QRegExp(QLatin1String("_QML_\\d+")));
173  if (className.startsWith(QLatin1String("QDeclarative")))
174  className = className.remove(QLatin1String("QDeclarative"));
175 
176  QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(gfxObject);
177  if (declarativeItem) {
178  objectStringId = inspector()->idStringForObject(declarativeItem);
179  }
180 
181  if (!objectStringId.isEmpty()) {
182  constructedName = objectStringId + QLatin1String(" (") + className + QLatin1Char(')');
183  } else {
184  if (!gfxObject->objectName().isEmpty()) {
185  constructedName = gfxObject->objectName() + QLatin1String(" (") + className + QLatin1Char(')');
186  } else {
187  constructedName = className;
188  }
189  }
190  }
191 
192  return constructedName;
193 }
QString idStringForObject(QObject *obj) const
The QRegExp class provides pattern matching using regular expressions.
Definition: qregexp.h:61
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
T * qobject_cast(QObject *object)
Definition: qobject.h:375
const char * className
Definition: qwizard.cpp:137
QGraphicsObject * toGraphicsObject()
Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object...
The QDeclarativeItem class provides the most basic of all visual items in QML.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
const char * className() const
Returns the class name.
Definition: qobjectdefs.h:491
QString objectName() const
QDeclarativeViewInspector * inspector() const
The QGraphicsObject class provides a base class for all graphics items that require signals...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.

◆ toGraphicsObjectList()

QList< QGraphicsObject * > QmlJSDebugger::AbstractLiveEditTool::toGraphicsObjectList ( const QList< QGraphicsItem *> &  itemList)
static

Definition at line 147 of file abstractliveedittool.cpp.

Referenced by leaveEvent(), and QmlJSDebugger::LiveSelectionTool::selectedItemsChanged().

149 {
150  QList<QGraphicsObject*> gfxObjects;
151  foreach (QGraphicsItem *item, itemList) {
152  QGraphicsObject *obj = item->toGraphicsObject();
153  if (obj)
154  gfxObjects << obj;
155  }
156 
157  return gfxObjects;
158 }
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
QGraphicsObject * toGraphicsObject()
Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object...
The QGraphicsObject class provides a base class for all graphics items that require signals...
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ topItemIsMovable()

bool QmlJSDebugger::AbstractLiveEditTool::topItemIsMovable ( const QList< QGraphicsItem *> &  itemList)

Definition at line 88 of file abstractliveedittool.cpp.

Referenced by leaveEvent().

89 {
90  QGraphicsItem *firstSelectableItem = topMovableGraphicsItem(itemList);
91  if (firstSelectableItem == 0)
92  return false;
93  if (toQDeclarativeItem(firstSelectableItem) != 0)
94  return true;
95 
96  return false;
97 
98 }
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
static QDeclarativeItem * toQDeclarativeItem(QGraphicsItem *item)
static QGraphicsItem * topMovableGraphicsItem(const QList< QGraphicsItem *> &itemList)

◆ topItemIsResizeHandle()

bool QmlJSDebugger::AbstractLiveEditTool::topItemIsResizeHandle ( const QList< QGraphicsItem *> &  itemList)

Definition at line 116 of file abstractliveedittool.cpp.

Referenced by leaveEvent().

117 {
118  return false;
119 }

◆ topMovableDeclarativeItem()

QDeclarativeItem * QmlJSDebugger::AbstractLiveEditTool::topMovableDeclarativeItem ( const QList< QGraphicsItem *> &  itemList)
static

Definition at line 135 of file abstractliveedittool.cpp.

Referenced by leaveEvent().

137 {
138  foreach (QGraphicsItem *item, itemList) {
139  QDeclarativeItem *declarativeItem = toQDeclarativeItem(item);
140  if (declarativeItem /*&& (declarativeItem->qmlItemNode().hasShowContent())*/)
141  return declarativeItem;
142  }
143 
144  return 0;
145 }
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
static QDeclarativeItem * toQDeclarativeItem(QGraphicsItem *item)
The QDeclarativeItem class provides the most basic of all visual items in QML.

◆ topMovableGraphicsItem()

QGraphicsItem * QmlJSDebugger::AbstractLiveEditTool::topMovableGraphicsItem ( const QList< QGraphicsItem *> &  itemList)
static

Definition at line 126 of file abstractliveedittool.cpp.

Referenced by leaveEvent(), and topItemIsMovable().

127 {
128  foreach (QGraphicsItem *item, itemList) {
129  if (item->flags().testFlag(QGraphicsItem::ItemIsMovable))
130  return item;
131  }
132  return 0;
133 }
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
GraphicsItemFlags flags() const
Returns this item&#39;s flags.

◆ topSelectedItemIsMovable()

bool QmlJSDebugger::AbstractLiveEditTool::topSelectedItemIsMovable ( const QList< QGraphicsItem *> &  itemList)

Definition at line 100 of file abstractliveedittool.cpp.

Referenced by leaveEvent().

101 {
102  QList<QGraphicsItem*> selectedItems = inspector()->selectedItems();
103 
104  foreach (QGraphicsItem *item, itemList) {
105  QDeclarativeItem *declarativeItem = toQDeclarativeItem(item);
106  if (declarativeItem
107  && selectedItems.contains(declarativeItem)
108  /*&& (declarativeItem->qmlItemNode().hasShowContent() || selectNonContentItems)*/)
109  return true;
110  }
111 
112  return false;
113 
114 }
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
static QDeclarativeItem * toQDeclarativeItem(QGraphicsItem *item)
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
The QDeclarativeItem class provides the most basic of all visual items in QML.
QDeclarativeViewInspector * inspector() const
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ toQDeclarativeItem()

QDeclarativeItem * QmlJSDebugger::AbstractLiveEditTool::toQDeclarativeItem ( QGraphicsItem item)
static

Definition at line 121 of file abstractliveedittool.cpp.

Referenced by leaveEvent(), topItemIsMovable(), topMovableDeclarativeItem(), and topSelectedItemIsMovable().

122 {
124 }
T * qobject_cast(QObject *object)
Definition: qobject.h:375
QGraphicsObject * toGraphicsObject()
Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object...
The QDeclarativeItem class provides the most basic of all visual items in QML.

◆ updateSelectedItems()

void QmlJSDebugger::AbstractLiveEditTool::updateSelectedItems ( )

Definition at line 78 of file abstractliveedittool.cpp.

Referenced by leaveEvent().

79 {
81 }
QList< QGraphicsItem * > items() const
virtual void selectedItemsChanged(const QList< QGraphicsItem *> &objectList)=0

◆ view()

QDeclarativeView * QmlJSDebugger::AbstractLiveEditTool::view ( ) const
protected

Properties

◆ m_itemList

QList<QGraphicsItem*> QmlJSDebugger::AbstractLiveEditTool::m_itemList
private

Definition at line 99 of file abstractliveedittool.h.


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