Skip to content

Commit

Permalink
actionselect: bug#3437138
Browse files Browse the repository at this point in the history
  • Loading branch information
dxli committed Nov 14, 2011
1 parent 6a7c951 commit 2487aef
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
23 changes: 22 additions & 1 deletion src/actions/rs_actionselect.cpp
Expand Up @@ -37,16 +37,28 @@ RS_ActionSelect::RS_ActionSelect(RS_EntityContainer& container,
:RS_ActionInterface("Select Entities", container, graphicView) {

this->nextAction = nextAction;
selectSingle=true;
}



void RS_ActionSelect::init(int status) {
RS_ActionInterface::init(status);
graphicView->setCurrentAction(
new RS_ActionSelectSingle(*container, *graphicView));
new RS_ActionSelectSingle(*container, *graphicView,this));
}


void RS_ActionSelect::resume(){
RS_ActionInterface::resume();
if(selectSingle==false){
finish();
}
}

void RS_ActionSelect::requestFinish(){
selectSingle=false;
}


void RS_ActionSelect::mouseReleaseEvent(QMouseEvent* e) {
Expand Down Expand Up @@ -125,4 +137,13 @@ void RS_ActionSelect::updateMouseButtonHints() {
}


void RS_ActionSelect::updateMouseCursor() {
if(graphicView!=NULL){
if(isFinished()){
graphicView->setMouseCursor(RS2::ArrowCursor);
}else{
graphicView->setMouseCursor(RS2::SelectCursor);
}
}
}
// EOF
12 changes: 8 additions & 4 deletions src/actions/rs_actionselect.h
Expand Up @@ -43,14 +43,18 @@ class RS_ActionSelect : public RS_ActionInterface {
RS2::ActionType nextAction);
~RS_ActionSelect() {}

void init(int status);
virtual void init(int status);
virtual void resume();
//virtual void keyPressEvent(QKeyEvent* e);
void mouseReleaseEvent(QMouseEvent* e);
void updateToolBar();
void updateMouseButtonHints();
virtual void mouseReleaseEvent(QMouseEvent* e);
virtual void updateToolBar();
virtual void updateMouseButtonHints();
virtual void updateMouseCursor();
void requestFinish();

private:
RS2::ActionType nextAction;
bool selectSingle;
};

#endif
7 changes: 5 additions & 2 deletions src/actions/rs_actionselectsingle.cpp
Expand Up @@ -33,8 +33,9 @@


RS_ActionSelectSingle::RS_ActionSelectSingle(RS_EntityContainer& container,
RS_GraphicView& graphicView)
:RS_ActionInterface("Select Entities", container, graphicView) {
RS_GraphicView& graphicView,RS_ActionSelect* actionSelect)
:RS_ActionInterface("Select Entities", container, graphicView) {
this->actionSelect=actionSelect;

en = NULL;
}
Expand Down Expand Up @@ -69,6 +70,8 @@ void RS_ActionSelectSingle::keyPressEvent(QKeyEvent* e) {

void RS_ActionSelectSingle::mouseReleaseEvent(QMouseEvent* e) {
if (e->button()==Qt::RightButton) {
//need to finish the parent RS_ActionSelect as well, bug#3437138
actionSelect->requestFinish();
init(getStatus()-1);
} else {
en = catchEntity(e);
Expand Down
4 changes: 3 additions & 1 deletion src/actions/rs_actionselectsingle.h
Expand Up @@ -28,6 +28,7 @@
#define RS_ACTIONSELECTSINGLE_H

#include "rs_actioninterface.h"
#include "rs_actionselect.h"


/**
Expand All @@ -39,7 +40,7 @@ class RS_ActionSelectSingle : public RS_ActionInterface {
Q_OBJECT
public:
RS_ActionSelectSingle(RS_EntityContainer& container,
RS_GraphicView& graphicView);
RS_GraphicView& graphicView,RS_ActionSelect* actionSelect=NULL);
~RS_ActionSelectSingle() {}

static QAction* createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/);
Expand All @@ -55,6 +56,7 @@ class RS_ActionSelectSingle : public RS_ActionInterface {

private:
RS_Entity* en;
RS_ActionSelect* actionSelect;
};

#endif

0 comments on commit 2487aef

Please sign in to comment.