46 mCameraStyleGroup(NULL)
57 this->updateActionGroup();
62 if (mCameraStyleGroup)
63 return mCameraStyleGroup;
65 mCameraStyleGroup =
new QActionGroup(
this);
66 mCameraStyleGroup->setExclusive(
true);
68 this->addInteractorStyleAction(
"Normal Camera", mCameraStyleGroup,
70 QIcon(
":/icons/camera-n.png"),
71 "Set 3D interaction to the normal camera-oriented style.");
72 this->addInteractorStyleAction(
"Tool", mCameraStyleGroup,
74 QIcon(
":/icons/camera-t.png"),
75 "Camera following tool.");
76 this->addInteractorStyleAction(
"Angled Tool", mCameraStyleGroup,
78 QIcon(
":/icons/camera-at.png"),
79 "Camera following tool (Placed at an angle of 20 degrees).");
80 this->addInteractorStyleAction(
"Unicam", mCameraStyleGroup,
82 QIcon(
":/icons/camera-u.png"),
83 "Set 3D interaction to a single-button style, useful for touch screens.");
84 return mCameraStyleGroup;
87 void CameraStyleInteractor::addInteractorStyleAction(QString caption, QActionGroup* group, QString uid, QIcon icon,
90 QAction* action =
new QAction(caption, group);
91 action->setIcon(icon);
92 action->setCheckable(
true);
94 action->setToolTip(helptext);
95 action->setWhatsThis(helptext);
96 connect(action, SIGNAL(triggered(
bool)),
this, SLOT(setInteractionStyleActionSlot()));
99 void CameraStyleInteractor::updateActionGroup()
101 QString currentStyle;
103 currentStyle =
enum2string(mGroup->getOptions().mCameraStyle.getStyle());
105 if(mCameraStyleGroup)
107 QList<QAction*> actions = mCameraStyleGroup->actions();
108 for (
int i=0; i<actions.size(); ++i)
110 actions[i]->setEnabled(mGroup!=0);
111 bool check = actions[i]->data().toString() == currentStyle;
112 if(actions[i]->isChecked() != check)
113 actions[i]->setChecked(check);
118 void CameraStyleInteractor::setInteractionStyleActionSlot()
120 QAction* theAction =
static_cast<QAction*
>(sender());
124 QString uid = theAction->data().toString();
125 CAMERA_STYLE_TYPE newStyle = string2enum<cx::CAMERA_STYLE_TYPE>(uid);
126 if (newStyle==cstCOUNT)
133 mGroup->setOptions(options);
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
void connectCameraStyle(ViewGroupDataPtr vg)
CameraStyleData mCameraStyle
QActionGroup * getInteractorStyleActionGroup()
QString enum2string(const ENUM &val)
Namespace for all CustusX production code.