25 mCameraStyleGroup(NULL)
36 this->updateActionGroup();
41 if (mCameraStyleGroup)
42 return mCameraStyleGroup;
44 mCameraStyleGroup =
new QActionGroup(
this);
45 mCameraStyleGroup->setExclusive(
true);
47 this->addInteractorStyleAction(
"Normal Camera", mCameraStyleGroup,
49 QIcon(
":/icons/camera-n.png"),
50 "Set 3D interaction to the normal camera-oriented style.");
51 this->addInteractorStyleAction(
"Tool", mCameraStyleGroup,
53 QIcon(
":/icons/camera-t.png"),
54 "Camera following tool.");
55 this->addInteractorStyleAction(
"Angled Tool", mCameraStyleGroup,
57 QIcon(
":/icons/camera-at.png"),
58 "Camera following tool (Placed at an angle of 20 degrees).");
59 this->addInteractorStyleAction(
"Unicam", mCameraStyleGroup,
61 QIcon(
":/icons/camera-u.png"),
62 "Set 3D interaction to a single-button style, useful for touch screens.");
63 return mCameraStyleGroup;
66 void CameraStyleInteractor::addInteractorStyleAction(QString caption, QActionGroup* group, QString uid, QIcon icon,
69 QAction* action =
new QAction(caption, group);
70 action->setIcon(icon);
71 action->setCheckable(
true);
73 action->setToolTip(helptext);
74 action->setWhatsThis(helptext);
75 connect(action, SIGNAL(triggered(
bool)),
this, SLOT(setInteractionStyleActionSlot()));
78 void CameraStyleInteractor::updateActionGroup()
82 currentStyle =
enum2string(mGroup->getOptions().mCameraStyle.getStyle());
86 QList<QAction*> actions = mCameraStyleGroup->actions();
87 for (
int i=0; i<actions.size(); ++i)
89 actions[i]->setEnabled(mGroup!=0);
90 bool check = actions[i]->data().toString() == currentStyle;
91 if(actions[i]->isChecked() != check)
92 actions[i]->setChecked(check);
97 void CameraStyleInteractor::setInteractionStyleActionSlot()
99 QAction* theAction =
static_cast<QAction*
>(sender());
103 QString uid = theAction->data().toString();
104 CAMERA_STYLE_TYPE newStyle = string2enum<cx::CAMERA_STYLE_TYPE>(uid);
105 if (newStyle==cstCOUNT)
110 ViewGroupData::Options options = mGroup->getOptions();
111 options.mCameraStyle = CameraStyleData(newStyle);
112 mGroup->setOptions(options);