1 /****************************************************************************
2 ** $Id: rs_actionmodifydeletequick.cpp 1144 2004-08-18 17:07:54Z andrew $
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
6 ** This file is part of the qcadlib Library project.
8 ** This file may be distributed and/or modified under the terms of the
9 ** GNU General Public License version 2 as published by the Free Software
10 ** Foundation and appearing in the file LICENSE.GPL included in the
11 ** packaging of this file.
13 ** Licensees holding valid qcadlib Professional Edition licenses may use
14 ** this file in accordance with the qcadlib Commercial License
15 ** Agreement provided with the Software.
17 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 ** See http://www.ribbonsoft.com for further details.
22 ** Contact info@ribbonsoft.com if any conditions of this licensing are
25 **********************************************************************/
27 #include "rs_actionmodifydeletequick.h"
29 #include "rs_actionselectsingle.h"
30 #include "rs_snapper.h"
33 RS_ActionModifyDeleteQuick::RS_ActionModifyDeleteQuick(
34 RS_EntityContainer& container, RS_GraphicView& graphicView):
35 RS_ActionInterface("Quick Delete Entities", container, graphicView)
40 QAction * RS_ActionModifyDeleteQuick::createGUIAction(RS2::ActionType /*type*/, QObject * parent)
42 QAction * action = new QAction(tr("&Delete selected"), parent);
44 action->setShortcut(Qt::Key_Backspace);
46 action->setShortcut(Qt::Key_Delete);
48 // QAction* action = new QAction(tr("Delete selected"),
49 // tr("&Delete selected"),
51 action->setStatusTip(tr("Delete selected entities"));
56 * Deletes all entities that were selected.
58 void RS_ActionModifyDeleteQuick::trigger()
60 RS_DEBUG->print("RS_ActionModifyDeleteQuick::trigger()");
64 RS_DEBUG->print("Entity found");
65 RS_EntityContainer* parent = en->getParent();
67 en->setSelected(false);
68 graphicView->deleteEntity(en);
69 en->changeUndoState();
72 document->startUndoCycle();
73 document->addUndoable(en);
74 document->endUndoCycle();
78 RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
80 RS_DEBUG->print("RS_ActionModifyDeleteQuick::mousePressEvent:"
87 void RS_ActionModifyDeleteQuick::mouseReleaseEvent(QMouseEvent* e) {
88 if (RS2::qtToRsButtonState(e->button())==RS2::RightButton) {
98 void RS_ActionModifyDeleteQuick::updateMouseButtonHints() {
99 switch (getStatus()) {
101 RS_DIALOGFACTORY->updateMouseWidget(tr("Pick entity to delete"),
105 RS_DIALOGFACTORY->updateMouseWidget("", "");
112 void RS_ActionModifyDeleteQuick::updateMouseCursor() {
113 graphicView->setMouseCursor(RS2::DelCursor);