Gui: add toolbar button for toggling selection bounding box

This commit is contained in:
Zheng, Lei
2019-09-21 10:38:02 +08:00
committed by wwmayer
parent bb3baefdb5
commit 8b65a94f28
4 changed files with 334 additions and 2 deletions

View File

@@ -60,6 +60,7 @@
#include "SoAxisCrossKit.h"
#include "View3DInventor.h"
#include "View3DInventorViewer.h"
#include "ViewParams.h"
#include "WaitCursor.h"
#include "ViewProviderMeasureDistance.h"
#include "ViewProviderGeometryObject.h"
@@ -3445,6 +3446,50 @@ void StdCmdTreeViewActions::activated(int iMsg)
}
}
//======================================================================
// Std_SelBoundingBox
//===========================================================================
DEF_STD_CMD_AC(StdCmdSelBoundingBox);
StdCmdSelBoundingBox::StdCmdSelBoundingBox()
:Command("Std_SelBoundingBox")
{
sGroup = QT_TR_NOOP("View");
sMenuText = QT_TR_NOOP("&Bounding box");
sToolTipText = QT_TR_NOOP("Show selection bounding box");
sWhatsThis = "Std_SelBack";
sStatusTip = QT_TR_NOOP("Show selection bounding box");
sPixmap = "sel-bbox";
eType = Alter3DView;
}
void StdCmdSelBoundingBox::activated(int iMsg)
{
bool checked = !!iMsg;
if(checked != ViewParams::instance()->getShowSelectionBoundingBox()) {
ViewParams::instance()->setShowSelectionBoundingBox(checked);
if(_pcAction)
_pcAction->setChecked(checked,true);
}
}
bool StdCmdSelBoundingBox::isActive(void)
{
if(_pcAction) {
bool checked = _pcAction->isChecked();
if(checked != ViewParams::instance()->getShowSelectionBoundingBox())
_pcAction->setChecked(!checked,true);
}
return true;
}
Action * StdCmdSelBoundingBox::createAction(void)
{
Action *pcAction = Command::createAction();
pcAction->setCheckable(true);
return pcAction;
}
//===========================================================================
// Instantiation
//===========================================================================
@@ -3518,6 +3563,7 @@ void CreateViewStdCommands(void)
rcCmdMgr.addCommand(new StdCmdAxisCross());
rcCmdMgr.addCommand(new CmdViewMeasureClearAll());
rcCmdMgr.addCommand(new CmdViewMeasureToggleAll());
rcCmdMgr.addCommand(new StdCmdSelBoundingBox());
rcCmdMgr.addCommand(new StdCmdSelBack());
rcCmdMgr.addCommand(new StdCmdSelForward());
rcCmdMgr.addCommand(new StdCmdTreeViewActions());