Fixes #1151 (applied the same trick to the GeneralEdit window)
This commit is contained in:
@@ -88,7 +88,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
|||||||
if (!GetCurrentFirmware()->getCapability(MultiLangVoice)) {
|
if (!GetCurrentFirmware()->getCapability(MultiLangVoice)) {
|
||||||
ui->VoiceLang_label->hide();
|
ui->VoiceLang_label->hide();
|
||||||
ui->voiceLang_CB->hide();
|
ui->voiceLang_CB->hide();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
voiceLangEditLock=true;
|
voiceLangEditLock=true;
|
||||||
populateVoiceLangCB(ui->voiceLang_CB, g_eeGeneral.ttsLanguage);
|
populateVoiceLangCB(ui->voiceLang_CB, g_eeGeneral.ttsLanguage);
|
||||||
voiceLangEditLock=false;
|
voiceLangEditLock=false;
|
||||||
@@ -97,7 +98,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
|||||||
if (!mavlink) {
|
if (!mavlink) {
|
||||||
ui->mavbaud_CB->hide();
|
ui->mavbaud_CB->hide();
|
||||||
ui->mavbaud_label->hide();
|
ui->mavbaud_label->hide();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
mavbaudEditLock=true;
|
mavbaudEditLock=true;
|
||||||
ui->mavbaud_CB->setCurrentIndex(g_eeGeneral.mavbaud);
|
ui->mavbaud_CB->setCurrentIndex(g_eeGeneral.mavbaud);
|
||||||
populateVoiceLangCB(ui->voiceLang_CB, g_eeGeneral.ttsLanguage);
|
populateVoiceLangCB(ui->voiceLang_CB, g_eeGeneral.ttsLanguage);
|
||||||
@@ -170,7 +172,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
|||||||
ui->volume_SB->hide();
|
ui->volume_SB->hide();
|
||||||
ui->volume_SB->setDisabled(true);
|
ui->volume_SB->setDisabled(true);
|
||||||
ui->label_volume->hide();
|
ui->label_volume->hide();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ui->volume_SB->setMaximum(GetCurrentFirmware()->getCapability(MaxVolume));
|
ui->volume_SB->setMaximum(GetCurrentFirmware()->getCapability(MaxVolume));
|
||||||
}
|
}
|
||||||
if (!GetCurrentFirmware()->getCapability(HasBrightness)) {
|
if (!GetCurrentFirmware()->getCapability(HasBrightness)) {
|
||||||
@@ -314,6 +317,8 @@ GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) :
|
|||||||
ui->switchesDelayLabel->hide();
|
ui->switchesDelayLabel->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disableMouseScrolling();
|
||||||
|
|
||||||
ga.sendPageView(getBoardName(GetCurrentFirmware()->getBoard()) + " GeneralEdit");
|
ga.sendPageView(getBoardName(GetCurrentFirmware()->getBoard()) + " GeneralEdit");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1076,7 +1081,8 @@ void GeneralEdit::on_calstore_PB_clicked()
|
|||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
ui->calstore_PB->setDisabled(true);
|
ui->calstore_PB->setDisabled(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
QString calib=g.profile[profile_id].stickPotCalib();
|
QString calib=g.profile[profile_id].stickPotCalib();
|
||||||
if (!(calib.isEmpty())) {
|
if (!(calib.isEmpty())) {
|
||||||
int ret = QMessageBox::question(this, "Companion",
|
int ret = QMessageBox::question(this, "Companion",
|
||||||
@@ -1115,7 +1121,50 @@ void GeneralEdit::on_calstore_PB_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralEdit::shrink() {
|
void GeneralEdit::shrink()
|
||||||
resize(100,100);
|
{
|
||||||
resize(0,0);
|
resize(100, 100);
|
||||||
|
resize(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GeneralEdit::eventFilter(QObject *object, QEvent * event)
|
||||||
|
{
|
||||||
|
QWidget * widget = qobject_cast<QWidget*>(object);
|
||||||
|
if (widget) {
|
||||||
|
if (event->type() == QEvent::Wheel) {
|
||||||
|
if (widget->focusPolicy() == Qt::WheelFocus) {
|
||||||
|
event->accept();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
event->ignore();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (event->type() == QEvent::FocusIn) {
|
||||||
|
widget->setFocusPolicy(Qt::WheelFocus);
|
||||||
|
}
|
||||||
|
else if (event->type() == QEvent::FocusOut) {
|
||||||
|
widget->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QWidget::eventFilter(object, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneralEdit::disableMouseScrolling()
|
||||||
|
{
|
||||||
|
Q_FOREACH(QComboBox * cb, findChildren<QComboBox*>()) {
|
||||||
|
cb->installEventFilter(this);
|
||||||
|
cb->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_FOREACH(QAbstractSpinBox * sb, findChildren<QAbstractSpinBox*>()) {
|
||||||
|
sb->installEventFilter(this);
|
||||||
|
sb->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_FOREACH(QSlider * slider, findChildren<QSlider*>()) {
|
||||||
|
slider->installEventFilter(this);
|
||||||
|
slider->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ class GeneralEdit : public QDialog
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GeneralEdit(RadioData &radioData, QWidget *parent = 0);
|
explicit GeneralEdit(RadioData &radioData, QWidget *parent = 0);
|
||||||
~GeneralEdit();
|
~GeneralEdit();
|
||||||
void updateSettings();
|
void updateSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::GeneralEdit *ui;
|
Ui::GeneralEdit *ui;
|
||||||
RadioData &radioData;
|
RadioData &radioData;
|
||||||
GeneralSettings g_eeGeneral;
|
GeneralSettings g_eeGeneral;
|
||||||
@@ -28,6 +28,10 @@ private:
|
|||||||
void getGeneralSwitchDefPos(int i, bool val);
|
void getGeneralSwitchDefPos(int i, bool val);
|
||||||
void setSwitchDefPos();
|
void setSwitchDefPos();
|
||||||
void updateVarioPitchRange();
|
void updateVarioPitchRange();
|
||||||
|
void disableMouseScrolling();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool eventFilter(QObject *obj, QEvent *event);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void modelValuesChanged();
|
void modelValuesChanged();
|
||||||
|
|||||||
Reference in New Issue
Block a user