ccAskThreeDoubleValuesDlg.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //##########################################################################
  2. //# #
  3. //# CLOUDCOMPARE #
  4. //# #
  5. //# This program is free software; you can redistribute it and/or modify #
  6. //# it under the terms of the GNU General Public License as published by #
  7. //# the Free Software Foundation; version 2 or later of the License. #
  8. //# #
  9. //# This program is distributed in the hope that it will be useful, #
  10. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  11. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  12. //# GNU General Public License for more details. #
  13. //# #
  14. //# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
  15. //# #
  16. //##########################################################################
  17. #include "ccAskThreeDoubleValuesDlg.h"
  18. ccAskThreeDoubleValuesDlg::ccAskThreeDoubleValuesDlg( const QString& vName1,
  19. const QString& vName2,
  20. const QString& vName3,
  21. double minVal,
  22. double maxVal,
  23. double defaultVal1,
  24. double defaultVal2,
  25. double defaultVal3,
  26. int precision/*=6*/,
  27. const QString windowTitle/*=QString()*/,
  28. QWidget* parent/*=nullptr*/)
  29. : QDialog(parent, Qt::Tool)
  30. , Ui::AskThreeDoubleValuesDialog()
  31. {
  32. setupUi(this);
  33. checkBox->setVisible(false);
  34. label1->setText(vName1);
  35. label2->setText(vName2);
  36. label3->setText(vName3);
  37. doubleSpinBox1->setRange(minVal,maxVal);
  38. doubleSpinBox2->setRange(minVal,maxVal);
  39. doubleSpinBox3->setRange(minVal,maxVal);
  40. doubleSpinBox1->setValue(defaultVal1);
  41. doubleSpinBox2->setValue(defaultVal2);
  42. doubleSpinBox3->setValue(defaultVal3);
  43. doubleSpinBox1->setDecimals(precision);
  44. doubleSpinBox2->setDecimals(precision);
  45. doubleSpinBox3->setDecimals(precision);
  46. if (!windowTitle.isEmpty())
  47. {
  48. setWindowTitle(windowTitle);
  49. }
  50. }
  51. void ccAskThreeDoubleValuesDlg::showCheckbox(const QString& label, bool state, QString tooltip/*=QString()*/)
  52. {
  53. checkBox->setVisible(true);
  54. checkBox->setEnabled(true);
  55. checkBox->setChecked(state);
  56. checkBox->setText(label);
  57. checkBox->setToolTip(tooltip);
  58. }
  59. bool ccAskThreeDoubleValuesDlg::getCheckboxState() const
  60. {
  61. return checkBox->isChecked();
  62. }