2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-07-08 14:00:33 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
2010-07-08 14:00:33 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-07-08 14:00:33 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2010-07-08 14:00:33 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2011-02-09 16:59:43 +01:00
|
|
|
#ifndef LIVESELECTIONTOOL_H
|
|
|
|
|
#define LIVESELECTIONTOOL_H
|
2010-07-08 14:00:33 +02:00
|
|
|
|
|
|
|
|
|
2011-02-09 17:34:03 +01:00
|
|
|
#include "abstractliveedittool.h"
|
|
|
|
|
#include "liverubberbandselectionmanipulator.h"
|
|
|
|
|
#include "livesingleselectionmanipulator.h"
|
|
|
|
|
#include "liveselectionindicator.h"
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QList>
|
|
|
|
|
#include <QTime>
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2011-01-24 12:30:21 +01:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QGraphicsItem)
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QMouseEvent)
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QKeyEvent)
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QAction)
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2010-09-22 09:59:18 +02:00
|
|
|
namespace QmlJSDebugger {
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2011-02-09 16:59:43 +01:00
|
|
|
class LiveSelectionTool : public AbstractLiveEditTool
|
2010-07-08 14:00:33 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2011-05-30 16:32:25 +02:00
|
|
|
LiveSelectionTool(QDeclarativeViewInspector* editorView);
|
2011-02-09 16:59:43 +01:00
|
|
|
~LiveSelectionTool();
|
2010-07-08 14:00:33 +02:00
|
|
|
|
|
|
|
|
void mousePressEvent(QMouseEvent *event);
|
|
|
|
|
void mouseMoveEvent(QMouseEvent *event);
|
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event);
|
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event);
|
|
|
|
|
void hoverMoveEvent(QMouseEvent *event);
|
|
|
|
|
void keyPressEvent(QKeyEvent *event);
|
|
|
|
|
void keyReleaseEvent(QKeyEvent *keyEvent);
|
|
|
|
|
void wheelEvent(QWheelEvent *event);
|
|
|
|
|
|
2010-12-01 11:46:49 +01:00
|
|
|
void itemsAboutToRemoved(const QList<QGraphicsItem*> &itemList);
|
|
|
|
|
// QVariant itemChange(const QList<QGraphicsItem*> &itemList,
|
2010-07-08 14:00:33 +02:00
|
|
|
// QGraphicsItem::GraphicsItemChange change,
|
|
|
|
|
// const QVariant &value );
|
|
|
|
|
|
|
|
|
|
// void update();
|
|
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
|
|
void selectedItemsChanged(const QList<QGraphicsItem*> &itemList);
|
|
|
|
|
|
|
|
|
|
void selectUnderPoint(QMouseEvent *event);
|
|
|
|
|
|
|
|
|
|
void setSelectOnlyContentItems(bool selectOnlyContentItems);
|
|
|
|
|
|
|
|
|
|
void setRubberbandSelectionMode(bool value);
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void contextMenuElementSelected();
|
|
|
|
|
void contextMenuElementHovered(QAction *action);
|
2010-08-03 11:01:02 +02:00
|
|
|
void repaintBoundingRects();
|
2010-07-08 14:00:33 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void createContextMenu(QList<QGraphicsItem*> itemList, QPoint globalPos);
|
2011-02-09 17:34:03 +01:00
|
|
|
LiveSingleSelectionManipulator::SelectionType getSelectionType(Qt::KeyboardModifiers modifiers);
|
2010-07-08 14:00:33 +02:00
|
|
|
bool alreadySelected(const QList<QGraphicsItem*> &itemList) const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool m_rubberbandSelectionMode;
|
2011-02-09 16:59:43 +01:00
|
|
|
LiveRubberBandSelectionManipulator m_rubberbandSelectionManipulator;
|
2011-02-09 17:34:03 +01:00
|
|
|
LiveSingleSelectionManipulator m_singleSelectionManipulator;
|
2011-02-09 16:59:43 +01:00
|
|
|
LiveSelectionIndicator m_selectionIndicator;
|
2010-07-08 14:00:33 +02:00
|
|
|
//ResizeIndicator m_resizeIndicator;
|
|
|
|
|
QTime m_mousePressTimer;
|
|
|
|
|
bool m_selectOnlyContentItems;
|
|
|
|
|
|
2010-08-03 11:01:02 +02:00
|
|
|
QList<QWeakPointer<QGraphicsObject> > m_selectedItemList;
|
|
|
|
|
|
2010-07-08 14:00:33 +02:00
|
|
|
QList<QGraphicsItem*> m_contextMenuItemList;
|
|
|
|
|
};
|
|
|
|
|
|
2011-02-09 16:59:43 +01:00
|
|
|
} // namespace QmlJSDebugger
|
2010-07-08 14:00:33 +02:00
|
|
|
|
2011-02-09 16:59:43 +01:00
|
|
|
#endif // LIVESELECTIONTOOL_H
|