18 #ifdef USE_PCL_BACKEND
23 #include <QApplication>
27 void ecvCustomViewpointsToolbar::constructor() {
29 this->BasePixmap.fill(QColor(0, 0, 0, 0));
30 QPainter pixPaint(&this->BasePixmap);
31 pixPaint.drawPixmap(0, 0, 48, 48,
32 QPixmap(
":/Resources/images/svg/pqCamera.png"));
35 this->PlusPixmap = this->BasePixmap.copy();
36 QPainter pixWithPlusPaint(&this->PlusPixmap);
37 pixWithPlusPaint.drawPixmap(32, 32, 32, 32,
38 QPixmap(
":/Resources/images/svg/pqPlus.png"));
39 this->ConfigPixmap = this->BasePixmap.copy();
40 QPainter pixWithConfigPaint(&this->ConfigPixmap);
41 pixWithConfigPaint.drawPixmap(
42 32, 32, 32, 32, QPixmap(
":/Resources/images/svg/pqWrench.png"));
44 this->PlusAction = this->ConfigAction =
nullptr;
46 this->setWindowTitle(tr(
"Custom Viewpoints Toolbar"));
51 this->connect(settings, SIGNAL(modified()),
58 auto actions = this->actions();
59 actions[actions.size() - 2]->setEnabled(
69 if (!this->ConfigAction) {
70 this->ConfigAction = this->addAction(
71 QIcon(this->ConfigPixmap), tr(
"Configure custom viewpoints"),
73 this->ConfigAction->setObjectName(
"ConfigAction");
76 if (!this->PlusAction) {
77 this->PlusAction = this->addAction(
78 QIcon(this->PlusPixmap),
79 tr(
"Add current viewpoint as custom viewpoint"),
this,
81 this->PlusAction->setObjectName(
"PlusAction");
85 for (
int cc = this->ViewpointActions.size(); cc > tooltips.size(); cc--) {
86 this->removeAction(this->ViewpointActions[cc - 1]);
88 if (this->ViewpointActions.size() > tooltips.size()) {
89 this->ViewpointActions.resize(tooltips.size());
93 for (
int cc = 0; cc < tooltips.size(); cc++) {
95 if (this->ViewpointActions.size() > cc) {
96 this->ViewpointActions[cc]->setToolTip(tooltips[cc]);
99 pixmap = this->BasePixmap.copy();
100 QPainter pixWithNumberPaint(&pixmap);
101 QFont font = pixWithNumberPaint.font();
102 font.setPixelSize(24);
103 pixWithNumberPaint.setFont(font);
104 pixWithNumberPaint.setPen(
105 QApplication::palette().windowText().
color());
106 pixWithNumberPaint.drawText(pixmap.rect(),
107 Qt::AlignRight | Qt::AlignBottom,
108 QString::number(cc + 1));
110 QAction* action = this->addAction(QIcon(pixmap),
"",
this,
112 action->setObjectName(QString(
"ViewpointAction%1").arg(cc));
113 action->setToolTip(tooltips[cc]);
115 this->ViewpointActions.push_back(action);
124 ecvCameraParamEditDlg::ConfigureCustomViewpoints(
this);
130 int customViewpointIndex;
131 QAction* action = qobject_cast<QAction*>(this->sender());
136 customViewpointIndex = action->data().toInt();
138 customViewpointIndex)) {
147 int customViewpointIndex;
148 QAction* action = qobject_cast<QAction*>(this->sender());
153 customViewpointIndex = action->data().toInt();
155 customViewpointIndex)) {
163 #ifdef USE_PCL_BACKEND
172 #ifdef USE_PCL_BACKEND
174 int customViewpointIndex;
175 QAction* action = qobject_cast<QAction*>(this->sender());
180 customViewpointIndex = action->data().toInt();
181 if (ecvCameraParamEditDlg::ApplyCustomViewpoint(customViewpointIndex)) {
187 "[ecvCustomViewpointsToolbar::ApplyCustomViewpoint] please use pcl "
188 "as backend and then try again!");
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
static bool SetToCurrentViewpoint(int CustomViewpointIndex)
static bool AddCurrentViewpointToCustomViewpoints()
static QStringList CustomViewpointToolTips()
static bool DeleteCustomViewpoint(int CustomViewpointIndex)
static ecvSettingManager * TheInstance(bool autoInit=true)
Returns the (unique) static instance.