45 #include "../qdeclarativeviewinspector_p.h" 47 #include <QtGui/QApplication> 48 #include <QtGui/QWheelEvent> 49 #include <QtGui/QMouseEvent> 50 #include <QtGui/QClipboard> 51 #include <QtGui/QMenu> 52 #include <QtGui/QAction> 53 #include <QtGui/QGraphicsObject> 55 #include <QtDeclarative/QDeclarativeItem> 56 #include <QtDeclarative/QDeclarativeEngine> 58 #include <QtCore/QDebug> 64 m_rubberbandSelectionMode(false),
65 m_rubberbandSelectionManipulator(
67 m_singleSelectionManipulator(editorView),
68 m_selectionIndicator(editorView,
71 m_selectOnlyContentItems(true)
153 if (
inspector()->selectedItems().contains(item)) {
156 elementAction->
setFont(boldFont);
173 contextMenu.
exec(globalPos);
180 int itemListIndex = senderAction->
data().
toInt();
195 int itemListIndex = action->
data().
toInt();
255 if (!selectableItemList.
isEmpty()) {
308 switch (event->
key()) {
335 if (selectedIdx >= 0) {
336 if (event->
delta() > 0) {
338 if (selectedIdx == itemList.
length())
340 }
else if (event->
delta() < 0) {
342 if (selectedIdx == -1)
343 selectedIdx = itemList.
length() - 1;
The QKeyEvent class describes a key event.
void setShortcut(const QKeySequence &shortcut)
void setFont(const QFont &font)
The QWheelEvent class contains parameters that describe a wheel event.
void start()
Sets this time to the current time.
void setItems(const QList< QWeakPointer< QGraphicsObject > > &itemList)
The QPointF class defines a point in the plane using floating point precision.
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
QList< QGraphicsItem * > selectedItems() const
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
The QString class provides a Unicode character string.
QList< QGraphicsItem * > selectedItems() const
bool isNull() const
Returns true if this object is holding a reference to a null pointer.
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
void setData(const QVariant &var)
Sets the action's internal data to the given userData.
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
int toInt(bool *ok=0) const
Returns the variant as an int if the variant has type() Int , Bool , ByteArray , Char ...
QGraphicsObject * toGraphicsObject()
Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object...
int key() const
Returns the code of the key that was pressed or released.
static const int DragStartDistance
void append(const T &t)
Inserts value at the end of the list.
void setBold(bool)
If enable is true sets the font's weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
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 rece...
const T & at(int i) const
Returns the item at index position i in the list.
int manhattanLength() const
Returns the sum of the absolute values of x() and y(), traditionally known as the "Manhattan length" ...
QFont font
the action's font
int delta() const
Returns the distance that the wheel is rotated, in eighths of a degree.
void end(const QPointF &updatePoint)
void clear()
Removes all items from the list.
static const int DragStartTime
Qt::Orientation orientation() const
Returns the wheel's orientation.
QList< QGraphicsItem * > selectableItems(const QPoint &pos) const
The QMouseEvent class contains parameters that describe a mouse event.
void update(const QPointF &updatePoint)
const QPoint & pos() const
Returns the position of the mouse cursor relative to the widget that received the event...
T & first()
Returns a reference to the first item in the list.
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.
QPointF beginPoint() const
int elapsed() const
Returns the number of milliseconds that have elapsed since the last time start() or restart() was cal...
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
The QFont class specifies a font used for drawing text.
QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
int length() const
This function is identical to count().
The QPoint class defines a point in the plane using integer precision.
QVariant data() const
Returns the user data as set in QAction::setData.
static const char * get(QDBusError::ErrorType code)
void begin(const QPointF &beginPoint)
void select(SelectionType selectionType)
void highlight(const QList< QGraphicsObject *> &item)
The QGraphicsObject class provides a base class for all graphics items that require signals...
void begin(const QPointF &beginPoint)
const QPoint & globalPos() const
Returns the global position of the mouse cursor at the time of the event.
void select(SelectionType selectionType, const QList< QGraphicsItem *> &items, bool selectOnlyContentItems)
The QAction class provides an abstract user interface action that can be inserted into widgets...
QPointF beginPoint() const
static QDeclarativeViewInspectorPrivate * get(QDeclarativeViewInspector *v)
The QList class is a template class that provides lists.