+ fix crash in spnav settings dialog while changing language, improve whitespaces

This commit is contained in:
wmayer 2014-12-09 13:44:25 +01:00
parent 6aa91b3622
commit 5da5be2eea
2 changed files with 45 additions and 36 deletions

View File

@ -30,7 +30,7 @@
using namespace Gui::Dialog; using namespace Gui::Dialog;
DlgCustomizeSpNavSettings::DlgCustomizeSpNavSettings(QWidget *parent) : DlgCustomizeSpNavSettings::DlgCustomizeSpNavSettings(QWidget *parent) :
CustomizeActionPage(parent) CustomizeActionPage(parent), init(false)
{ {
GUIApplicationNativeEventAware *app = qobject_cast<GUIApplicationNativeEventAware *>(QApplication::instance()); GUIApplicationNativeEventAware *app = qobject_cast<GUIApplicationNativeEventAware *>(QApplication::instance());
@ -42,6 +42,7 @@ DlgCustomizeSpNavSettings::DlgCustomizeSpNavSettings(QWidget *parent) :
this->setMessage(tr("No Spaceball Present")); this->setMessage(tr("No Spaceball Present"));
return; return;
} }
this->init = true;
this->setupUi(this); this->setupUi(this);
initialize(); initialize();
} }
@ -65,8 +66,15 @@ void DlgCustomizeSpNavSettings::setMessage(const QString& message)
void DlgCustomizeSpNavSettings::changeEvent(QEvent *e) void DlgCustomizeSpNavSettings::changeEvent(QEvent *e)
{ {
if (e->type() == QEvent::LanguageChange) { if (e->type() == QEvent::LanguageChange) {
if (this->init) {
this->retranslateUi(this); this->retranslateUi(this);
} }
else {
this->setWindowTitle(tr("Spaceball Motion"));
QLabel *messageLabel = this->findChild<QLabel*>();
if (messageLabel) messageLabel->setText(tr("No Spaceball Present"));
}
}
QWidget::changeEvent(e); QWidget::changeEvent(e);
} }
@ -163,7 +171,6 @@ void DlgCustomizeSpNavSettings::on_CBRotations_clicked()
CBEnableSpin ->setEnabled(CBRotations->isChecked()); CBEnableSpin ->setEnabled(CBRotations->isChecked());
CBReverseSpin->setEnabled(CBRotations->isChecked() && CBEnableSpin->isChecked()); CBReverseSpin->setEnabled(CBRotations->isChecked() && CBEnableSpin->isChecked());
SliderSpin ->setEnabled(CBRotations->isChecked() && CBEnableSpin->isChecked()); SliderSpin ->setEnabled(CBRotations->isChecked() && CBEnableSpin->isChecked());
} }
void DlgCustomizeSpNavSettings::on_CBTranslations_clicked() void DlgCustomizeSpNavSettings::on_CBTranslations_clicked()

View File

@ -40,7 +40,6 @@ namespace Gui
explicit DlgCustomizeSpNavSettings(QWidget *parent = 0); explicit DlgCustomizeSpNavSettings(QWidget *parent = 0);
~DlgCustomizeSpNavSettings(); ~DlgCustomizeSpNavSettings();
protected Q_SLOTS: protected Q_SLOTS:
void onAddMacroAction(const QByteArray&); void onAddMacroAction(const QByteArray&);
void onRemoveMacroAction(const QByteArray&); void onRemoveMacroAction(const QByteArray&);
@ -78,6 +77,9 @@ namespace Gui
ParameterGrp::handle spaceballMotionGroup() const; ParameterGrp::handle spaceballMotionGroup() const;
void setMessage(const QString& message); void setMessage(const QString& message);
void initialize(); void initialize();
private:
bool init;
}; };
} }
} }