From 4c53bac7e9987400c107ef1861af83f050a1f56b Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Tue, 11 Jul 2023 18:56:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E8=89=B2=E8=B0=83=E6=9B=B2=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/twainui/hg_settingdialog.cpp | 47 ++++++++++++++++++---------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/modules/twainui/hg_settingdialog.cpp b/modules/twainui/hg_settingdialog.cpp index 36bc4280..bc2ec147 100644 --- a/modules/twainui/hg_settingdialog.cpp +++ b/modules/twainui/hg_settingdialog.cpp @@ -563,19 +563,20 @@ void hg_settingdialog::createUI() } else if (strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0) { - QWidget* widget_cbtn_pbtn = new QWidget(scrollArea); - widget_cbtn_pbtn->setMaximumWidth(200); - btn_gamma_ = new QPushButton(widget_cbtn_pbtn); - btn_gamma_->setText(tr("custom tone curve")); - btn_gamma_->setFixedWidth(150); + continue; + // QWidget* widget_cbtn_pbtn = new QWidget(scrollArea); + // widget_cbtn_pbtn->setMaximumWidth(200); + // btn_gamma_ = new QPushButton(widget_cbtn_pbtn); + // btn_gamma_->setText(tr("custom tone curve")); + // btn_gamma_->setFixedWidth(150); - QHBoxLayout *hLayout = new QHBoxLayout; - hLayout->addWidget(checkBoxCreation); - hLayout->addWidget(btn_gamma_); - widget_cbtn_pbtn->setLayout(hLayout); + // QHBoxLayout *hLayout = new QHBoxLayout; + // hLayout->addWidget(checkBoxCreation); + // hLayout->addWidget(btn_gamma_); + // widget_cbtn_pbtn->setLayout(hLayout); - reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), widget_cbtn_pbtn); - connect(btn_gamma_, SIGNAL(clicked(bool)), this, SLOT(slot_gammaButtonClicked())); + // reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), widget_cbtn_pbtn); + // connect(btn_gamma_, SIGNAL(clicked(bool)), this, SLOT(slot_gammaButtonClicked())); } else reinterpret_cast(widget->layout())->addRow(opt->title + QString(" : "), checkBoxCreation); @@ -591,7 +592,7 @@ void hg_settingdialog::createUI() } if (strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0) btn_cut_area_->setEnabled(enable); - else if (strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0) + else if (strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0 && btn_gamma_ != nullptr) btn_gamma_->setEnabled(enable); connect(checkBoxCreation, SIGNAL(stateChanged(int)), this, SLOT(slot_checkedClicked())); m_list_widgets.append(checkBoxCreation); @@ -1131,9 +1132,23 @@ void hg_settingdialog::updateUIStatus() hide = true; refresh_control_value(id); - if(w_label) - hide ? w_label->hide() : w_label->show(); - widget->setVisible(!hide); + + if (strcmp(opt->name, SANE_STD_OPT_NAME_BRIGHTNESS) == 0 || + strcmp(opt->name, SANE_STD_OPT_NAME_CONTRAST) == 0 || + strcmp(opt->name, SANE_STD_OPT_NAME_GAMMA) == 0 || + strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0) + { + if (w_label) + w_label->show(); + widget->setVisible(true); + } + else + { + if(w_label) + hide ? w_label->hide() : w_label->show(); + widget->setVisible(!hide); + } + if(strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0) { if(hide) @@ -1191,7 +1206,7 @@ void hg_settingdialog::slot_checkedClicked() if(strcmp(opt->name, SANE_STD_OPT_NAME_CUSTOM_AREA) == 0) btn_cut_area_->setEnabled(checkBoxcurrentState); - else if (strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0) + else if (strcmp(opt->name, SANE_STD_OPT_NAME_IS_CUSTOM_GAMMA) == 0 && btn_gamma_ != nullptr) btn_gamma_->setEnabled(checkBoxcurrentState); //cur_scheme_->config_changed(id, (char*)&checkBoxcurrentState, sizeof(checkBoxcurrentState));