}
}
-void LiveSelectionTool::createContextMenu(QList<QGraphicsItem*> itemList, QPoint globalPos)
+void LiveSelectionTool::createContextMenu(const QList<QGraphicsItem*> &itemList, QPoint globalPos)
{
QMenu contextMenu;
connect(&contextMenu, SIGNAL(hovered(QAction*)),
contextMenu.addAction(tr("Items"));
contextMenu.addSeparator();
int shortcutKey = Qt::Key_1;
- bool addKeySequence = true;
int i = 0;
foreach (QGraphicsItem * const item, itemList) {
}
elementAction->setData(i);
- if (addKeySequence)
- elementAction->setShortcut(QKeySequence(shortcutKey));
- shortcutKey++;
- if (shortcutKey > Qt::Key_9)
- addKeySequence = false;
+ if (shortcutKey <= Qt::Key_9) {
+ elementAction->setShortcut(QKeySequence(shortcutKey));
+ shortcutKey++;
+ }
++i;
}
}
}
-void LiveSelectionTool::mouseDoubleClickEvent(QMouseEvent * /*event*/)
-{
-}
-
void LiveSelectionTool::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
}
}
-void LiveSelectionTool::keyReleaseEvent(QKeyEvent * /*keyEvent*/)
-{
-
-}
-
void LiveSelectionTool::wheelEvent(QWheelEvent *event)
{
if (event->orientation() == Qt::Horizontal || m_rubberbandSelectionMode)
m_selectOnlyContentItems = selectOnlyContentItems;
}
-void LiveSelectionTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/)
-{
-}
-
void LiveSelectionTool::clear()
{
view()->setCursor(Qt::ArrowCursor);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *event);
+ void mouseDoubleClickEvent(QMouseEvent *) {}
void hoverMoveEvent(QMouseEvent *event);
void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *keyEvent);
+ void keyReleaseEvent(QKeyEvent *) {}
void wheelEvent(QWheelEvent *event);
- void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList);
+ void itemsAboutToRemoved(const QList<QGraphicsItem*> &) {}
// QVariant itemChange(const QList<QGraphicsItem*> &itemList,
// QGraphicsItem::GraphicsItemChange change,
// const QVariant &value );
void repaintBoundingRects();
private:
- void createContextMenu(QList<QGraphicsItem*> itemList, QPoint globalPos);
+ void createContextMenu(const QList<QGraphicsItem*> &itemList, QPoint globalPos);
LiveSingleSelectionManipulator::SelectionType getSelectionType(Qt::KeyboardModifiers modifiers);
bool alreadySelected(const QList<QGraphicsItem*> &itemList) const;
}
-void ZoomTool::itemsAboutToRemoved(const QList<QGraphicsItem*> &/*itemList*/)
-{
-}
-
void ZoomTool::clear()
{
view()->setCursor(Qt::ArrowCursor);
}
-void ZoomTool::selectedItemsChanged(const QList<QGraphicsItem*> &/*itemList*/)
-{
-}
-
void ZoomTool::scaleView(const QPointF ¢erPos)
{
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *keyEvent);
- void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList);
+ void itemsAboutToRemoved(const QList<QGraphicsItem*> &) {}
void clear();
protected:
- void selectedItemsChanged(const QList<QGraphicsItem*> &itemList);
+ void selectedItemsChanged(const QList<QGraphicsItem*> &) {}
private slots:
void zoomTo100();
return AbstractViewInspector::leaveEvent(event);
}
-bool QDeclarativeViewInspector::mousePressEvent(QMouseEvent *event)
-{
- data->cursorPos = event->pos();
- return AbstractViewInspector::mousePressEvent(event);
-}
-
bool QDeclarativeViewInspector::mouseMoveEvent(QMouseEvent *event)
{
- data->cursorPos = event->pos();
-
QList<QGraphicsItem*> selItems = data->selectableItems(event->pos());
if (!selItems.isEmpty()) {
declarativeView()->setToolTip(currentTool()->titleForItem(selItems.first()));
return AbstractViewInspector::mouseMoveEvent(event);
}
-bool QDeclarativeViewInspector::mouseReleaseEvent(QMouseEvent *event)
-{
- data->cursorPos = event->pos();
- return AbstractViewInspector::mouseReleaseEvent(event);
-}
-
void QDeclarativeViewInspector::reparentQmlObject(QObject *object, QObject *newParent)
{
if (!newParent)
bool eventFilter(QObject *obj, QEvent *event);
bool leaveEvent(QEvent *);
- bool mousePressEvent(QMouseEvent *event);
bool mouseMoveEvent(QMouseEvent *event);
- bool mouseReleaseEvent(QMouseEvent *event);
AbstractLiveEditTool *currentTool() const;
QDeclarativeViewInspector *q;
QWeakPointer<QWidget> viewport;
- QPointF cursorPos;
QList<QWeakPointer<QGraphicsObject> > currentSelection;
LiveSelectionTool *selectionTool;