From a65e481422631d6d183c712f8e3db49a2d82d84b Mon Sep 17 00:00:00 2001 From: Charles PIGNEROL <> Date: Wed, 6 Sep 2023 13:58:30 +0200 Subject: [PATCH] =?UTF-8?q?Version=206.3.0=20du=2006/09/23.=20QtCoordinate?= =?UTF-8?q?sDialog=20:=20possibilit=C3=A9=20d'afficher=20le=20domaine=20de?= =?UTF-8?q?s=20composantes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/version.cmake | 4 +- src/QtUtil/QtCoordinatesDialog.cpp | 82 +++++++++++++++---- .../public/QtUtil/QtCoordinatesDialog.h | 68 +++++++++++---- versions.txt | 8 ++ 4 files changed, 126 insertions(+), 36 deletions(-) diff --git a/cmake/version.cmake b/cmake/version.cmake index 53acc8f..a2461c5 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -3,8 +3,8 @@ # set (QT_UTIL_MAJOR_VERSION "6") -set (QT_UTIL_MINOR_VERSION "2") -set (QT_UTIL_RELEASE_VERSION "1") +set (QT_UTIL_MINOR_VERSION "3") +set (QT_UTIL_RELEASE_VERSION "0") set (QT_UTIL_VERSION ${QT_UTIL_MAJOR_VERSION}.${QT_UTIL_MINOR_VERSION}.${QT_UTIL_RELEASE_VERSION}) diff --git a/src/QtUtil/QtCoordinatesDialog.cpp b/src/QtUtil/QtCoordinatesDialog.cpp index e12aa29..16ecf72 100644 --- a/src/QtUtil/QtCoordinatesDialog.cpp +++ b/src/QtUtil/QtCoordinatesDialog.cpp @@ -29,19 +29,33 @@ USE_ENCODING_AUTODETECTION QtCoordinatesDialog::QtCoordinatesDialog ( - QWidget* parent, const UTF8String& title, - const UTF8String& xLabel, - const UTF8String& yLabel, - const UTF8String& zLabel, - double x, double y, double z, - bool checkboxesEnabled, - bool xEnabled, bool yEnabled, bool zEnabled, + QWidget* parent, const UTF8String& title, const UTF8String& xLabel, const UTF8String& yLabel, const UTF8String& zLabel, + double x, double y, double z, bool checkboxesEnabled, bool xEnabled, bool yEnabled, bool zEnabled, const string& helpURL, const string& helpTag) : QDialog (parent, QtConfiguration::modalDialogWFlags), - _xTextField (0), _yTextField (0), _zTextField (0), - _modifyXCheckBox (0), _modifyYCheckBox (0), _modifyZCheckBox (0), - _closurePanel (0) -{ + _xTextField (0), _yTextField (0), _zTextField (0), _modifyXCheckBox (0), _modifyYCheckBox (0), _modifyZCheckBox (0), _closurePanel (0) +{ + createGui (title, xLabel, yLabel, zLabel, x, y, z, 1., -1., 1., -1., 1., -1., checkboxesEnabled, xEnabled, yEnabled, zEnabled, helpURL, helpTag); // v 6.3.0 +} // QtCoordinatesDialog::QtCoordinatesDialog + + +QtCoordinatesDialog::QtCoordinatesDialog ( // v 6.3.0 + QWidget* parent, const UTF8String& title, const UTF8String& xLabel, const UTF8String& yLabel, const UTF8String& zLabel, + double x, double y, double z, bool checkboxesEnabled, bool xEnabled, bool yEnabled, bool zEnabled, + double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, + const string& helpURL, const string& helpTag) + : QDialog (parent, QtConfiguration::modalDialogWFlags), + _xTextField (0), _yTextField (0), _zTextField (0), _modifyXCheckBox (0), _modifyYCheckBox (0), _modifyZCheckBox (0), _closurePanel (0) +{ + createGui (title, xLabel, yLabel, zLabel, x, y, z, checkboxesEnabled, xEnabled, yEnabled, zEnabled, xmin, xmax, ymin, ymax, zmin, zmax, helpURL, helpTag); +} // QtCoordinatesDialog::QtCoordinatesDialog + + +void QtCoordinatesDialog::createGui (const UTF8String& title, const UTF8String& xLabel, const UTF8String& yLabel, const UTF8String& zLabel, + double x, double y, double z, bool checkboxesEnabled, bool xEnabled, bool yEnabled, bool zEnabled, + double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, + const string& helpURL, const string& helpTag) +{ setModal (true); setWindowTitle (UTF8TOQSTRING (title)); @@ -74,6 +88,16 @@ QtCoordinatesDialog::QtCoordinatesDialog ( hboxLayout->addWidget (label); hboxLayout->addWidget (_xTextField); hboxLayout->addWidget (_modifyXCheckBox); + if (xmax >= xmin) + { // v 6.3.0 + UTF8String rangeLabel; + rangeLabel << "[" << xmin << ", " << xmax << "]"; + UTF8String tooltip = UTF8String ("Domaine : ", charset) + rangeLabel; + label->setToolTip (UTF8TOQSTRING (tooltip)); + _xTextField->setToolTip (UTF8TOQSTRING (tooltip)); + label = new QLabel (UTF8TOQSTRING (rangeLabel), hbox); + hboxLayout->addWidget (label); + } // if (xmax >= xmin) // Ligne 2 : Y hbox = new QWidget (groupBox); @@ -92,6 +116,16 @@ QtCoordinatesDialog::QtCoordinatesDialog ( hboxLayout->addWidget (label); hboxLayout->addWidget (_yTextField); hboxLayout->addWidget (_modifyYCheckBox); + if (ymax >= ymin) + { // v 6.3.0 + UTF8String rangeLabel; + rangeLabel << "[" << ymin << ", " << ymax << "]"; + UTF8String tooltip = UTF8String ("Domaine : ", charset) + rangeLabel; + label->setToolTip (UTF8TOQSTRING (tooltip)); + _yTextField->setToolTip (UTF8TOQSTRING (tooltip)); + label = new QLabel (UTF8TOQSTRING (rangeLabel), hbox); + hboxLayout->addWidget (label); + } // if (ymax >= ymin) // Ligne 3 : Y hbox = new QWidget (groupBox); @@ -110,18 +144,30 @@ QtCoordinatesDialog::QtCoordinatesDialog ( hboxLayout->addWidget (label); hboxLayout->addWidget (_zTextField); hboxLayout->addWidget (_modifyZCheckBox); + if (zmax >= zmin) + { // v 6.3.0 + UTF8String rangeLabel; + rangeLabel << "[" << zmin << ", " << zmax << "]"; + UTF8String tooltip = UTF8String ("Domaine : ", charset) + rangeLabel; + label->setToolTip (UTF8TOQSTRING (tooltip)); + _zTextField->setToolTip (UTF8TOQSTRING (tooltip)); + label = new QLabel (UTF8TOQSTRING (rangeLabel), hbox); + hboxLayout->addWidget (label); + } // if (zmax >= zmin) + + int width = _xTextField->sizeHint ( ).width ( ) > _yTextField->sizeHint ( ).width ( ) ? _xTextField->sizeHint ( ).width ( ) : _yTextField->sizeHint ( ).width ( ); + width = _zTextField->sizeHint ( ).width ( ) > width ? _zTextField->sizeHint ( ).width ( ) : width; + _xTextField->setMinimumWidth (width); // v 6.3.0 + _yTextField->setMinimumWidth (width); // v 6.3.0 + _zTextField->setMinimumWidth (width); // v 6.3.0 // Les boutons : layout->addWidget (new QLabel (" ", this)); - _closurePanel = - new QtDlgClosurePanel (this, false, "Appliquer", "", "Annuler", - helpURL, helpTag); + _closurePanel = new QtDlgClosurePanel (this, false, "Appliquer", "", "Annuler", helpURL, helpTag); layout->addWidget (_closurePanel); _closurePanel->setMinimumSize (_closurePanel->sizeHint ( )); - connect (_closurePanel->getApplyButton ( ), SIGNAL(clicked ( )), this, - SLOT(accept ( ))); - connect (_closurePanel->getCancelButton ( ), SIGNAL(clicked ( )), this, - SLOT(reject ( ))); + connect (_closurePanel->getApplyButton ( ), SIGNAL(clicked ( )), this, SLOT(accept ( ))); + connect (_closurePanel->getCancelButton ( ), SIGNAL(clicked ( )), this, SLOT(reject ( ))); // Par defaut le bouton OK est artificellement clique par QDialog quand // l'utilisateur fait return dans un champ de texte => on inhibe ce diff --git a/src/QtUtil/public/QtUtil/QtCoordinatesDialog.h b/src/QtUtil/public/QtUtil/QtCoordinatesDialog.h index 25b7d32..fcce8f5 100644 --- a/src/QtUtil/public/QtUtil/QtCoordinatesDialog.h +++ b/src/QtUtil/public/QtUtil/QtCoordinatesDialog.h @@ -22,32 +22,47 @@ class QtCoordinatesDialog : public QDialog public : /** - * Constructeur. Délègue à la classe QtDlgClosurePanel l'éventuelle - * aide contextuelle. + * Constructeur. Délègue à la classe QtDlgClosurePanel l'éventuelle aide contextuelle. * @param Widget parent * @param Titre de la fenêtre * @param titre de la première composante. * @param titre de la seconde composante. * @param titre de la troisème composante. * @param valeurs par défaut des composantes. - * @param True si les cases à cocher "active" doivent être activées, - * false dans le cas contraire. - * @param true si la composante est active, false dans le cas - * contraire. + * @param True si les cases à cocher "active" doivent être activées, false dans le cas contraire. + * @param true si la composante est active, false dans le cas contraire. * @param URL de l'aide * @param Balise de l'aide * @see QtDlgClosurePanel + * @see createGui */ - QtCoordinatesDialog ( - QWidget* parent, const IN_UTIL UTF8String& title, - const IN_UTIL UTF8String& xLabel, - const IN_UTIL UTF8String& yLabel, - const IN_UTIL UTF8String& zLabel, - double x, double y, double z, - bool checkboxesEnabled, - bool xEnabled, bool yEnabled, bool zEnabled, - const IN_STD string& helpURL = "", - const IN_STD string& helpTag = ""); + QtCoordinatesDialog (QWidget* parent, const IN_UTIL UTF8String& title, + const IN_UTIL UTF8String& xLabel, const IN_UTIL UTF8String& yLabel, const IN_UTIL UTF8String& zLabel, + double x, double y, double z, bool checkboxesEnabled, bool xEnabled, bool yEnabled, bool zEnabled, + const IN_STD string& helpURL = "", const IN_STD string& helpTag = ""); + + /** + * Constructeur. Délègue à la classe QtDlgClosurePanel l'éventuelle aide contextuelle. + * @param Widget parent + * @param Titre de la fenêtre + * @param titre de la première composante. + * @param titre de la seconde composante. + * @param titre de la troisème composante. + * @param valeurs par défaut des composantes. + * @param True si les cases à cocher "active" doivent être activées, false dans le cas contraire. + * @param true si la composante est active, false dans le cas contraire. + * @param Valeurs min et max des 3 composantes. Utilisé pour affichage informatif lorsque min <= max. + * @param URL de l'aide + * @param Balise de l'aide + * @see QtDlgClosurePanel + * @see createGui + * @since 6.3.0 + */ + QtCoordinatesDialog (QWidget* parent, const IN_UTIL UTF8String& title, + const IN_UTIL UTF8String& xLabel, const IN_UTIL UTF8String& yLabel, const IN_UTIL UTF8String& zLabel, + double x, double y, double z, bool checkboxesEnabled, bool xEnabled, bool yEnabled, bool zEnabled, + double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, + const IN_STD string& helpURL = "", const IN_STD string& helpTag = ""); /** * Destructeur : RAS. @@ -84,6 +99,27 @@ class QtCoordinatesDialog : public QDialog * Opérateur = : interdit. */ QtCoordinatesDialog& operator = (const QtCoordinatesDialog&); + + /** + * Création de l'IHM. Délègue à la classe QtDlgClosurePanel l'éventuelle aide contextuelle. + * @param Titre de la fenêtre + * @param titre de la première composante. + * @param titre de la seconde composante. + * @param titre de la troisème composante. + * @param valeurs par défaut des composantes. + * @param True si les cases à cocher "active" doivent être activées, false dans le cas contraire. + * @param true si la composante est active, false dans le cas contraire. + * @param Valeurs min et max des 3 composantes. Utilisé pour affichage informatif lorsque min <= max. + * @param URL de l'aide + * @param Balise de l'aide + * @see QtDlgClosurePanel + * @since 6.3.0 + */ + void createGui (const IN_UTIL UTF8String& title, + const IN_UTIL UTF8String& xLabel, const IN_UTIL UTF8String& yLabel, const IN_UTIL UTF8String& zLabel, + double x, double y, double z, bool checkboxesEnabled, bool xEnabled, bool yEnabled, bool zEnabled, + double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, + const IN_STD string& helpURL = "", const IN_STD string& helpTag = ""); /** * La saisie des composantes. diff --git a/versions.txt b/versions.txt index 03c3341..b163bb6 100644 --- a/versions.txt +++ b/versions.txt @@ -1,3 +1,11 @@ +Version 6.3.0 : 06/09/23 +=============== + +QtCoordinatesDialog : +- Constructeur prenant en arguments les domaines des composantes x, y, z. +- Méthode createGui pour factoriser le code de construction de l'IHM. + + Version 6.2.0 : 21/06/23 ===============