From: nkv Date: Mon, 30 May 2005 09:38:19 +0000 (+0000) Subject: Restriction of the number of labels (no more than 25) X-Git-Tag: JFA_MERGE_TO_3_0_0__2005-07-07~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e861e849d16f1c0a32e17b37ed1bf0f9d7e59e9a;p=modules%2Fvisu.git Restriction of the number of labels (no more than 25) --- diff --git a/src/VISUGUI/VisuGUI_CubeAxesDlg.cxx b/src/VISUGUI/VisuGUI_CubeAxesDlg.cxx index e0589924..0b93cb0d 100755 --- a/src/VISUGUI/VisuGUI_CubeAxesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CubeAxesDlg.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -86,6 +87,8 @@ VisuGUI_AxisWg::VisuGUI_AxisWg( QWidget* theParent ) aHBox->setSpacing( 5 ); aLabel = new QLabel( tr( "NUMBER" ), aHBox ); myLabelNumber = new QLineEdit( aHBox ); + myLabelNumber->setValidator(new QIntValidator(0, 25, this)); + myLabelNumber->installEventFilter(this); aLabels.append( aLabel ); aHBox = new QHBox( myLabelsGrp ); @@ -149,6 +152,16 @@ void VisuGUI_AxisWg::updateControlState() onTicksChecked(); } +bool VisuGUI_AxisWg::eventFilter(QObject* o, QEvent* e) +{ + if (e->type() == QEvent::FocusOut) { + bool isOK = false; + int k = myLabelNumber->text().toInt(&isOK); + if (isOK && k > 25) myLabelNumber->setText("25"); + } + return false; +} + //======================================================================= // name : VisuGUI_AxisWg::onNameChecked // Purpose : diff --git a/src/VISUGUI/VisuGUI_CubeAxesDlg.h b/src/VISUGUI/VisuGUI_CubeAxesDlg.h index 73e9ec6a..e77f1948 100755 --- a/src/VISUGUI/VisuGUI_CubeAxesDlg.h +++ b/src/VISUGUI/VisuGUI_CubeAxesDlg.h @@ -106,7 +106,10 @@ public: const bool ); bool ReadData( vtkAxisActor2D* ); bool Apply( vtkAxisActor2D* ); - + + + protected: + bool eventFilter(QObject*, QEvent*); private slots: