+ 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;
DlgCustomizeSpNavSettings::DlgCustomizeSpNavSettings(QWidget *parent) :
CustomizeActionPage(parent)
CustomizeActionPage(parent), init(false)
{
GUIApplicationNativeEventAware *app = qobject_cast<GUIApplicationNativeEventAware *>(QApplication::instance());
@ -42,6 +42,7 @@ DlgCustomizeSpNavSettings::DlgCustomizeSpNavSettings(QWidget *parent) :
this->setMessage(tr("No Spaceball Present"));
return;
}
this->init = true;
this->setupUi(this);
initialize();
}
@ -65,7 +66,14 @@ void DlgCustomizeSpNavSettings::setMessage(const QString& message)
void DlgCustomizeSpNavSettings::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
this->retranslateUi(this);
if (this->init) {
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);
}
@ -163,7 +171,6 @@ void DlgCustomizeSpNavSettings::on_CBRotations_clicked()
CBEnableSpin ->setEnabled(CBRotations->isChecked());
CBReverseSpin->setEnabled(CBRotations->isChecked() && CBEnableSpin->isChecked());
SliderSpin ->setEnabled(CBRotations->isChecked() && CBEnableSpin->isChecked());
}
void DlgCustomizeSpNavSettings::on_CBTranslations_clicked()

View File

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