sane驱动微调设置界面slider

This commit is contained in:
yangjiaxuan 2023-06-09 15:26:44 +08:00
parent cf30711023
commit e353164973
2 changed files with 22 additions and 0 deletions

View File

@ -441,6 +441,13 @@ void hg_settingdialog::createUI()
widget_slider_spin->setMinimumWidth(300);
QSlider* sliderCreation = new QSlider(widget_slider_spin);
if (0 == strcmp(opt->name, SANE_STD_OPT_NAME_THRESHOLD) || 0 == strcmp(opt->name, SANE_STD_OPT_NAME_ANTI_NOISE_LEVEL) ||
0 == strcmp(opt->name, SANE_STD_OPT_NAME_MARGIN))
{
sliderCreation->installEventFilter(this);
}
sliderCreation->setOrientation(Qt::Horizontal);
sliderCreation->setMinimumWidth(120);
sliderCreation->setRange(opt->constraint.range->min, opt->constraint.range->max);
@ -706,6 +713,7 @@ void hg_settingdialog::createUI()
} //for
hlayoutOkAndCancel->insertWidget(0, buttonAbout, 0, Qt::AlignRight);
updateUIStatus();
scrollArea->setWidget(widget);
@ -1576,6 +1584,19 @@ void hg_settingdialog::closeEvent(QCloseEvent* e)
e->accept();
}
bool hg_settingdialog::eventFilter(QObject *target, QEvent *event)
{
if (target->findChild<QSlider *>("QSlider"));
{
if (event->type() == QEvent::Wheel)
{
return true;
}
}
return QDialog::eventFilter(target, event);
}
bool hg_settingdialog::createMsgBoxUi(bool add, std::string &name)
{
QString text(tr("Please select to overwrite the original configuration:"));

View File

@ -78,6 +78,7 @@ private:
const void* find_option_description(const std::string& title, int* id); // return const SANE_Option_Descriptor* pointer
virtual void closeEvent(QCloseEvent* e);
virtual bool eventFilter(QObject *target, QEvent *event) override;
bool createMsgBoxUi(bool add, std::string &name);
std::string getCurUiShemeName(std::string name);
void save_scheme(void);