1
/****************************************************************************
3
** This file is part of the LibreCAD project, a 2D CAD program
5
** Copyright (C) 2011 Rallaz (rallazz@gmail.com)
6
** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl)
9
** This file is free software; you can redistribute it and/or modify
10
** it under the terms of the GNU General Public License as published by
11
** the Free Software Foundation; either version 2 of the License, or
12
** (at your option) any later version.
14
** This program is distributed in the hope that it will be useful,
15
** but WITHOUT ANY WARRANTY; without even the implied warranty of
16
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
** GNU General Public License for more details.
19
** You should have received a copy of the GNU General Public License
20
** along with this program; if not, write to the Free Software
21
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
** This copyright notice MUST APPEAR in all copies of the script!
25
**********************************************************************/
27
#include "doc_plugin_interface.h"
28
#include "qc_actiongetent.h"
29
#include "rs_dialogfactory.h"
30
#include "rs_selection.h"
31
#include "rs_snapper.h"
34
QC_ActionGetEnt::QC_ActionGetEnt(RS_EntityContainer& container,
35
RS_GraphicView& graphicView)
36
:RS_ActionInterface("Get Entity", container, graphicView) {
38
mesage = tr("Select object:");
43
void QC_ActionGetEnt::updateMouseButtonHints() {
45
RS_DIALOGFACTORY->updateMouseWidget(mesage, tr("Cancel"));
47
RS_DIALOGFACTORY->updateMouseWidget("", "");
51
void QC_ActionGetEnt::updateMouseCursor() {
52
graphicView->setMouseCursor(RS2::SelectCursor);
55
void QC_ActionGetEnt::setMesage(QString msg){
59
void QC_ActionGetEnt::trigger() {
61
RS_Selection s(*container, graphicView);
64
updateMouseButtonHints();
66
RS_DEBUG->print("QC_ActionGetEnt::trigger: Entity is NULL\n");
70
void QC_ActionGetEnt::mouseReleaseEvent(QMouseEvent* e) {
71
if (e->button()==Qt::RightButton) {
80
* Add selected entity from 'container' to the selection.
82
Plugin_Entity *QC_ActionGetEnt::getSelected(Doc_plugin_interface* d) {
83
Plugin_Entity *pe = new Plugin_Entity(en, d);