All: Reformat according to new standard
This commit is contained in:
committed by
Kacper Donat
parent
eafd18dac0
commit
25c3ba7338
@@ -34,15 +34,16 @@ class QLabel;
|
||||
class QDoubleSpinBox;
|
||||
class QComboBox;
|
||||
|
||||
namespace Gui {
|
||||
namespace Gui
|
||||
{
|
||||
class QuantitySpinBox;
|
||||
|
||||
class GuiExport LocationWidget : public QWidget
|
||||
class GuiExport LocationWidget: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LocationWidget (QWidget * parent = nullptr);
|
||||
LocationWidget(QWidget* parent = nullptr);
|
||||
~LocationWidget() override;
|
||||
QSize sizeHint() const override;
|
||||
|
||||
@@ -50,7 +51,7 @@ public:
|
||||
void setPosition(const Base::Vector3d&);
|
||||
void setDirection(const Base::Vector3d& dir);
|
||||
Base::Vector3d getDirection() const;
|
||||
Base::Vector3d getUserDirection(bool* ok=nullptr) const;
|
||||
Base::Vector3d getUserDirection(bool* ok = nullptr) const;
|
||||
|
||||
private:
|
||||
void onDirectionActivated(int);
|
||||
@@ -60,22 +61,22 @@ private:
|
||||
void retranslateUi();
|
||||
|
||||
private:
|
||||
QGridLayout *box;
|
||||
QLabel *xLabel;
|
||||
QLabel *yLabel;
|
||||
QLabel *zLabel;
|
||||
QLabel *dLabel;
|
||||
QuantitySpinBox *xValue;
|
||||
QuantitySpinBox *yValue;
|
||||
QuantitySpinBox *zValue;
|
||||
QComboBox *dValue;
|
||||
QGridLayout* box;
|
||||
QLabel* xLabel;
|
||||
QLabel* yLabel;
|
||||
QLabel* zLabel;
|
||||
QLabel* dLabel;
|
||||
QuantitySpinBox* xValue;
|
||||
QuantitySpinBox* yValue;
|
||||
QuantitySpinBox* zValue;
|
||||
QComboBox* dValue;
|
||||
};
|
||||
|
||||
/** This is the abstract base dialog class that defines the interface for
|
||||
* specifying a direction vector by the user.
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
class GuiExport LocationDialog : public QDialog
|
||||
class GuiExport LocationDialog: public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -84,14 +85,14 @@ protected:
|
||||
~LocationDialog() override;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e) override = 0;
|
||||
void changeEvent(QEvent* e) override = 0;
|
||||
|
||||
private:
|
||||
void onDirectionActivated(int);
|
||||
|
||||
public:
|
||||
virtual Base::Vector3d getDirection() const = 0;
|
||||
Base::Vector3d getUserDirection(bool* ok=nullptr) const;
|
||||
Base::Vector3d getUserDirection(bool* ok = nullptr) const;
|
||||
|
||||
private:
|
||||
virtual void directionActivated(int) = 0;
|
||||
@@ -109,11 +110,12 @@ private:
|
||||
* with the generated Ui class.
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
template <class Ui>
|
||||
class LocationDialogUi : public LocationDialog, public Ui
|
||||
template<class Ui>
|
||||
class LocationDialogUi: public LocationDialog, public Ui
|
||||
{
|
||||
public:
|
||||
LocationDialogUi(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags()) : LocationDialog(parent, fl)
|
||||
LocationDialogUi(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags())
|
||||
: LocationDialog(parent, fl)
|
||||
{
|
||||
this->setupUi(this);
|
||||
this->retranslate();
|
||||
@@ -125,26 +127,38 @@ public:
|
||||
Ui::retranslateUi(this);
|
||||
|
||||
if (this->direction->count() == 0) {
|
||||
this->direction->insertItems(0, QStringList()
|
||||
<< QApplication::translate("Gui::LocationDialog", "X")
|
||||
<< QApplication::translate("Gui::LocationDialog", "Y")
|
||||
<< QApplication::translate("Gui::LocationDialog", "Z")
|
||||
<< QApplication::translate("Gui::LocationDialog", "User defined…")
|
||||
this->direction->insertItems(
|
||||
0,
|
||||
QStringList() << QApplication::translate("Gui::LocationDialog", "X")
|
||||
<< QApplication::translate("Gui::LocationDialog", "Y")
|
||||
<< QApplication::translate("Gui::LocationDialog", "Z")
|
||||
<< QApplication::translate("Gui::LocationDialog", "User defined…")
|
||||
);
|
||||
|
||||
this->direction->setCurrentIndex(2);
|
||||
|
||||
// Vector3d declared to use with QVariant see Gui/propertyeditor/PropertyItem.h
|
||||
this->direction->setItemData(0, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(1,0,0)));
|
||||
this->direction->setItemData(1, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0,1,0)));
|
||||
this->direction->setItemData(2, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0,0,1)));
|
||||
this->direction->setItemData(
|
||||
0,
|
||||
QVariant::fromValue<Base::Vector3d>(Base::Vector3d(1, 0, 0))
|
||||
);
|
||||
this->direction->setItemData(
|
||||
1,
|
||||
QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0, 1, 0))
|
||||
);
|
||||
this->direction->setItemData(
|
||||
2,
|
||||
QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0, 0, 1))
|
||||
);
|
||||
}
|
||||
else {
|
||||
this->direction->setItemText(0, QApplication::translate("Gui::LocationDialog", "X"));
|
||||
this->direction->setItemText(1, QApplication::translate("Gui::LocationDialog", "Y"));
|
||||
this->direction->setItemText(2, QApplication::translate("Gui::LocationDialog", "Z"));
|
||||
this->direction->setItemText(this->direction->count()-1,
|
||||
QApplication::translate("Gui::LocationDialog", "User defined…"));
|
||||
this->direction->setItemText(
|
||||
this->direction->count() - 1,
|
||||
QApplication::translate("Gui::LocationDialog", "User defined…")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,24 +171,26 @@ public:
|
||||
|
||||
Base::Vector3d getPosition() const
|
||||
{
|
||||
return Base::Vector3d(this->xPos->value().getValue(),
|
||||
this->yPos->value().getValue(),
|
||||
this->zPos->value().getValue());
|
||||
return Base::Vector3d(
|
||||
this->xPos->value().getValue(),
|
||||
this->yPos->value().getValue(),
|
||||
this->zPos->value().getValue()
|
||||
);
|
||||
}
|
||||
|
||||
Base::Vector3d getDirection() const override
|
||||
{
|
||||
QVariant data = this->direction->itemData (this->direction->currentIndex());
|
||||
QVariant data = this->direction->itemData(this->direction->currentIndex());
|
||||
if (data.canConvert<Base::Vector3d>()) {
|
||||
return data.value<Base::Vector3d>();
|
||||
}
|
||||
else {
|
||||
return Base::Vector3d(0,0,1);
|
||||
return Base::Vector3d(0, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e) override
|
||||
void changeEvent(QEvent* e) override
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
this->retranslate();
|
||||
@@ -192,8 +208,8 @@ private:
|
||||
}
|
||||
|
||||
// check if the user-defined direction is already there
|
||||
for (int i=0; i<this->direction->count()-1; i++) {
|
||||
QVariant data = this->direction->itemData (i);
|
||||
for (int i = 0; i < this->direction->count() - 1; i++) {
|
||||
QVariant data = this->direction->itemData(i);
|
||||
if (data.canConvert<Base::Vector3d>()) {
|
||||
const auto val = data.value<Base::Vector3d>();
|
||||
if (val == dir) {
|
||||
@@ -204,24 +220,27 @@ private:
|
||||
}
|
||||
|
||||
// add a new item before the very last item
|
||||
QString display = QStringLiteral("(%1,%2,%3)")
|
||||
.arg(dir.x)
|
||||
.arg(dir.y)
|
||||
.arg(dir.z);
|
||||
this->direction->insertItem(this->direction->count()-1, display,
|
||||
QVariant::fromValue<Base::Vector3d>(dir));
|
||||
this->direction->setCurrentIndex(this->direction->count()-2);
|
||||
QString display = QStringLiteral("(%1,%2,%3)").arg(dir.x).arg(dir.y).arg(dir.z);
|
||||
this->direction->insertItem(
|
||||
this->direction->count() - 1,
|
||||
display,
|
||||
QVariant::fromValue<Base::Vector3d>(dir)
|
||||
);
|
||||
this->direction->setCurrentIndex(this->direction->count() - 2);
|
||||
}
|
||||
void directionActivated(int index) override
|
||||
{
|
||||
// last item is selected to define direction by user
|
||||
if (index+1 == this->direction->count()) {
|
||||
if (index + 1 == this->direction->count()) {
|
||||
bool ok;
|
||||
Base::Vector3d dir = this->getUserDirection(&ok);
|
||||
if (ok) {
|
||||
if (dir.Length() < Base::Vector3d::epsilon()) {
|
||||
QMessageBox::critical(this, LocationDialog::tr("Wrong direction"),
|
||||
LocationDialog::tr("Direction must not be the null vector"));
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
LocationDialog::tr("Wrong direction"),
|
||||
LocationDialog::tr("Direction must not be the null vector")
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -238,42 +257,54 @@ private:
|
||||
* declared, then.
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
template <class Ui>
|
||||
class LocationUi : public Ui
|
||||
template<class Ui>
|
||||
class LocationUi: public Ui
|
||||
{
|
||||
public:
|
||||
LocationUi(QDialog *dlg)
|
||||
LocationUi(QDialog* dlg)
|
||||
{
|
||||
this->setupUi(dlg);
|
||||
this->retranslate(dlg);
|
||||
}
|
||||
~LocationUi() = default;
|
||||
|
||||
void retranslate(QDialog *dlg)
|
||||
void retranslate(QDialog* dlg)
|
||||
{
|
||||
Ui::retranslateUi(dlg);
|
||||
|
||||
if (this->direction->count() == 0) {
|
||||
this->direction->insertItems(0, QStringList()
|
||||
<< QApplication::translate("Gui::LocationDialog", "X")
|
||||
<< QApplication::translate("Gui::LocationDialog", "Y")
|
||||
<< QApplication::translate("Gui::LocationDialog", "Z")
|
||||
<< QApplication::translate("Gui::LocationDialog", "User defined…")
|
||||
this->direction->insertItems(
|
||||
0,
|
||||
QStringList() << QApplication::translate("Gui::LocationDialog", "X")
|
||||
<< QApplication::translate("Gui::LocationDialog", "Y")
|
||||
<< QApplication::translate("Gui::LocationDialog", "Z")
|
||||
<< QApplication::translate("Gui::LocationDialog", "User defined…")
|
||||
);
|
||||
|
||||
this->direction->setCurrentIndex(2);
|
||||
|
||||
// Vector3d declared to use with QVariant see Gui/propertyeditor/PropertyItem.h
|
||||
this->direction->setItemData(0, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(1,0,0)));
|
||||
this->direction->setItemData(1, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0,1,0)));
|
||||
this->direction->setItemData(2, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0,0,1)));
|
||||
this->direction->setItemData(
|
||||
0,
|
||||
QVariant::fromValue<Base::Vector3d>(Base::Vector3d(1, 0, 0))
|
||||
);
|
||||
this->direction->setItemData(
|
||||
1,
|
||||
QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0, 1, 0))
|
||||
);
|
||||
this->direction->setItemData(
|
||||
2,
|
||||
QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0, 0, 1))
|
||||
);
|
||||
}
|
||||
else {
|
||||
this->direction->setItemText(0, QApplication::translate("Gui::LocationDialog", "X"));
|
||||
this->direction->setItemText(1, QApplication::translate("Gui::LocationDialog", "Y"));
|
||||
this->direction->setItemText(2, QApplication::translate("Gui::LocationDialog", "Z"));
|
||||
this->direction->setItemText(this->direction->count()-1,
|
||||
QApplication::translate("Gui::LocationDialog", "User defined…"));
|
||||
this->direction->setItemText(
|
||||
this->direction->count() - 1,
|
||||
QApplication::translate("Gui::LocationDialog", "User defined…")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,19 +317,21 @@ public:
|
||||
|
||||
Base::Vector3d getPosition() const
|
||||
{
|
||||
return Base::Vector3d(this->xPos->value().getValue(),
|
||||
this->yPos->value().getValue(),
|
||||
this->zPos->value().getValue());
|
||||
return Base::Vector3d(
|
||||
this->xPos->value().getValue(),
|
||||
this->yPos->value().getValue(),
|
||||
this->zPos->value().getValue()
|
||||
);
|
||||
}
|
||||
|
||||
Base::Vector3d getDirection() const
|
||||
{
|
||||
QVariant data = this->direction->itemData (this->direction->currentIndex());
|
||||
QVariant data = this->direction->itemData(this->direction->currentIndex());
|
||||
if (data.canConvert<Base::Vector3d>()) {
|
||||
return data.value<Base::Vector3d>();
|
||||
}
|
||||
else {
|
||||
return Base::Vector3d(0,0,1);
|
||||
return Base::Vector3d(0, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,8 +343,8 @@ public:
|
||||
}
|
||||
|
||||
// check if the user-defined direction is already there
|
||||
for (int i=0; i<this->direction->count()-1; i++) {
|
||||
QVariant data = this->direction->itemData (i);
|
||||
for (int i = 0; i < this->direction->count() - 1; i++) {
|
||||
QVariant data = this->direction->itemData(i);
|
||||
if (data.canConvert<Base::Vector3d>()) {
|
||||
const auto val = data.value<Base::Vector3d>();
|
||||
if (val == dir) {
|
||||
@@ -322,24 +355,27 @@ public:
|
||||
}
|
||||
|
||||
// add a new item before the very last item
|
||||
QString display = QStringLiteral("(%1,%2,%3)")
|
||||
.arg(dir.x)
|
||||
.arg(dir.y)
|
||||
.arg(dir.z);
|
||||
this->direction->insertItem(this->direction->count()-1, display,
|
||||
QVariant::fromValue<Base::Vector3d>(dir));
|
||||
this->direction->setCurrentIndex(this->direction->count()-2);
|
||||
QString display = QStringLiteral("(%1,%2,%3)").arg(dir.x).arg(dir.y).arg(dir.z);
|
||||
this->direction->insertItem(
|
||||
this->direction->count() - 1,
|
||||
display,
|
||||
QVariant::fromValue<Base::Vector3d>(dir)
|
||||
);
|
||||
this->direction->setCurrentIndex(this->direction->count() - 2);
|
||||
}
|
||||
bool directionActivated(LocationDialog* dlg, int index)
|
||||
{
|
||||
// last item is selected to define direction by user
|
||||
if (index+1 == this->direction->count()) {
|
||||
if (index + 1 == this->direction->count()) {
|
||||
bool ok;
|
||||
Base::Vector3d dir = dlg->getUserDirection(&ok);
|
||||
if (ok) {
|
||||
if (dir.Length() < Base::Vector3d::epsilon()) {
|
||||
QMessageBox::critical(dlg, LocationDialog::tr("Wrong direction"),
|
||||
LocationDialog::tr("Direction must not be the null vector"));
|
||||
QMessageBox::critical(
|
||||
dlg,
|
||||
LocationDialog::tr("Wrong direction"),
|
||||
LocationDialog::tr("Direction must not be the null vector")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
setDirection(dir);
|
||||
@@ -357,14 +393,14 @@ public:
|
||||
* must be used instead of whereas the Ui_-class can be forward declared.
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
template <class Ui>
|
||||
class LocationDialogImp : public LocationDialog
|
||||
template<class Ui>
|
||||
class LocationDialogImp: public LocationDialog
|
||||
{
|
||||
public:
|
||||
LocationDialogImp(QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags())
|
||||
: LocationDialog(parent, fl), ui(this)
|
||||
{
|
||||
}
|
||||
: LocationDialog(parent, fl)
|
||||
, ui(this)
|
||||
{}
|
||||
~LocationDialogImp() override = default;
|
||||
|
||||
Base::Vector3d getDirection() const override
|
||||
@@ -373,7 +409,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e) override
|
||||
void changeEvent(QEvent* e) override
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
ui.retranslate(this);
|
||||
@@ -386,7 +422,7 @@ protected:
|
||||
private:
|
||||
void directionActivated(int index) override
|
||||
{
|
||||
ui.directionActivated(this,index);
|
||||
ui.directionActivated(this, index);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -402,7 +438,7 @@ class AbstractUi
|
||||
{
|
||||
public:
|
||||
virtual ~AbstractUi() = default;
|
||||
virtual void retranslate(QDialog *dlg) = 0;
|
||||
virtual void retranslate(QDialog* dlg) = 0;
|
||||
virtual void setPosition(const Base::Vector3d& v) = 0;
|
||||
virtual Base::Vector3d getPosition() const = 0;
|
||||
virtual Base::Vector3d getDirection() const = 0;
|
||||
@@ -416,13 +452,13 @@ public:
|
||||
* .ui file.
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
template <class Ui>
|
||||
class LocationImpUi : public AbstractUi
|
||||
template<class Ui>
|
||||
class LocationImpUi: public AbstractUi
|
||||
{
|
||||
public:
|
||||
LocationImpUi(Ui* ui) : ui(ui)
|
||||
{
|
||||
}
|
||||
LocationImpUi(Ui* ui)
|
||||
: ui(ui)
|
||||
{}
|
||||
~LocationImpUi() override = default;
|
||||
|
||||
boost::any get() override
|
||||
@@ -430,7 +466,7 @@ public:
|
||||
return ui;
|
||||
}
|
||||
|
||||
void retranslate(QDialog *dlg) override
|
||||
void retranslate(QDialog* dlg) override
|
||||
{
|
||||
ui->retranslateUi(dlg);
|
||||
|
||||
@@ -440,14 +476,15 @@ public:
|
||||
QStringList() << QApplication::translate("Gui::LocationDialog", "X")
|
||||
<< QApplication::translate("Gui::LocationDialog", "Y")
|
||||
<< QApplication::translate("Gui::LocationDialog", "Z")
|
||||
<< QApplication::translate("Gui::LocationDialog", "User defined…"));
|
||||
<< QApplication::translate("Gui::LocationDialog", "User defined…")
|
||||
);
|
||||
|
||||
ui->direction->setCurrentIndex(2);
|
||||
|
||||
// Vector3d declared to use with QVariant see Gui/propertyeditor/PropertyItem.h
|
||||
ui->direction->setItemData(0, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(1,0,0)));
|
||||
ui->direction->setItemData(1, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0,1,0)));
|
||||
ui->direction->setItemData(2, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0,0,1)));
|
||||
ui->direction->setItemData(0, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(1, 0, 0)));
|
||||
ui->direction->setItemData(1, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0, 1, 0)));
|
||||
ui->direction->setItemData(2, QVariant::fromValue<Base::Vector3d>(Base::Vector3d(0, 0, 1)));
|
||||
}
|
||||
else {
|
||||
ui->direction->setItemText(0, QApplication::translate("Gui::LocationDialog", "X"));
|
||||
@@ -455,7 +492,8 @@ public:
|
||||
ui->direction->setItemText(2, QApplication::translate("Gui::LocationDialog", "Z"));
|
||||
ui->direction->setItemText(
|
||||
ui->direction->count() - 1,
|
||||
QApplication::translate("Gui::LocationDialog", "User defined…"));
|
||||
QApplication::translate("Gui::LocationDialog", "User defined…")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,19 +506,21 @@ public:
|
||||
|
||||
Base::Vector3d getPosition() const override
|
||||
{
|
||||
return Base::Vector3d(ui->xPos->value().getValue(),
|
||||
ui->yPos->value().getValue(),
|
||||
ui->zPos->value().getValue());
|
||||
return Base::Vector3d(
|
||||
ui->xPos->value().getValue(),
|
||||
ui->yPos->value().getValue(),
|
||||
ui->zPos->value().getValue()
|
||||
);
|
||||
}
|
||||
|
||||
Base::Vector3d getDirection() const override
|
||||
{
|
||||
QVariant data = ui->direction->itemData (ui->direction->currentIndex());
|
||||
QVariant data = ui->direction->itemData(ui->direction->currentIndex());
|
||||
if (data.canConvert<Base::Vector3d>()) {
|
||||
return data.value<Base::Vector3d>();
|
||||
}
|
||||
else {
|
||||
return Base::Vector3d(0,0,1);
|
||||
return Base::Vector3d(0, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,8 +532,8 @@ public:
|
||||
}
|
||||
|
||||
// check if the user-defined direction is already there
|
||||
for (int i=0; i<ui->direction->count()-1; i++) {
|
||||
QVariant data = ui->direction->itemData (i);
|
||||
for (int i = 0; i < ui->direction->count() - 1; i++) {
|
||||
QVariant data = ui->direction->itemData(i);
|
||||
if (data.canConvert<Base::Vector3d>()) {
|
||||
const auto val = data.value<Base::Vector3d>();
|
||||
if (val == dir) {
|
||||
@@ -504,24 +544,27 @@ public:
|
||||
}
|
||||
|
||||
// add a new item before the very last item
|
||||
QString display = QStringLiteral("(%1,%2,%3)")
|
||||
.arg(dir.x)
|
||||
.arg(dir.y)
|
||||
.arg(dir.z);
|
||||
ui->direction->insertItem(ui->direction->count()-1, display,
|
||||
QVariant::fromValue<Base::Vector3d>(dir));
|
||||
ui->direction->setCurrentIndex(ui->direction->count()-2);
|
||||
QString display = QStringLiteral("(%1,%2,%3)").arg(dir.x).arg(dir.y).arg(dir.z);
|
||||
ui->direction->insertItem(
|
||||
ui->direction->count() - 1,
|
||||
display,
|
||||
QVariant::fromValue<Base::Vector3d>(dir)
|
||||
);
|
||||
ui->direction->setCurrentIndex(ui->direction->count() - 2);
|
||||
}
|
||||
bool directionActivated(LocationDialog* dlg, int index) override
|
||||
{
|
||||
// last item is selected to define direction by user
|
||||
if (index+1 == ui->direction->count()) {
|
||||
if (index + 1 == ui->direction->count()) {
|
||||
bool ok;
|
||||
Base::Vector3d dir = dlg->getUserDirection(&ok);
|
||||
if (ok) {
|
||||
if (dir.Length() < Base::Vector3d::epsilon()) {
|
||||
QMessageBox::critical(dlg, LocationDialog::tr("Wrong direction"),
|
||||
LocationDialog::tr("Direction must not be the null vector"));
|
||||
QMessageBox::critical(
|
||||
dlg,
|
||||
LocationDialog::tr("Wrong direction"),
|
||||
LocationDialog::tr("Direction must not be the null vector")
|
||||
);
|
||||
return false;
|
||||
}
|
||||
setDirection(dir);
|
||||
@@ -543,14 +586,15 @@ private:
|
||||
* sub-classes because it uses "type erasure with templates".
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
class GuiExport LocationDialogUiImp : public LocationDialog
|
||||
class GuiExport LocationDialogUiImp: public LocationDialog
|
||||
{
|
||||
public:
|
||||
template<class T>
|
||||
LocationDialogUiImp(T* t, QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags())
|
||||
: LocationDialog(parent, fl), ui(new LocationImpUi<T>(t))
|
||||
LocationDialogUiImp(T* t, QWidget* parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags())
|
||||
: LocationDialog(parent, fl)
|
||||
, ui(new LocationImpUi<T>(t))
|
||||
{
|
||||
std::shared_ptr<T> uit = boost::any_cast< std::shared_ptr<T> >(ui->get());
|
||||
std::shared_ptr<T> uit = boost::any_cast<std::shared_ptr<T>>(ui->get());
|
||||
uit->setupUi(this);
|
||||
ui->retranslate(this);
|
||||
}
|
||||
@@ -561,7 +605,7 @@ public:
|
||||
Base::Vector3d getPosition() const;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e) override;
|
||||
void changeEvent(QEvent* e) override;
|
||||
|
||||
private:
|
||||
void directionActivated(int index) override;
|
||||
@@ -570,6 +614,6 @@ protected:
|
||||
std::unique_ptr<AbstractUi> ui;
|
||||
};
|
||||
|
||||
} // namespace Gui
|
||||
} // namespace Gui
|
||||
|
||||
#endif // GUI_INPUTVECTOR_H
|
||||
#endif // GUI_INPUTVECTOR_H
|
||||
|
||||
Reference in New Issue
Block a user