]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Restriction of the number of labels (no more than 25)
authornkv <nkv@opencascade.com>
Mon, 30 May 2005 09:38:19 +0000 (09:38 +0000)
committernkv <nkv@opencascade.com>
Mon, 30 May 2005 09:38:19 +0000 (09:38 +0000)
src/VISUGUI/VisuGUI_CubeAxesDlg.cxx
src/VISUGUI/VisuGUI_CubeAxesDlg.h

index e0589924a3bec32cdae71c41ca5dee474a22a3af..0b93cb0db2bb0161a705ebb814f3567ee09ba0d3 100755 (executable)
@@ -38,6 +38,7 @@
 #include <qlineedit.h>\r
 #include <qlabel.h>\r
 #include <qobjectlist.h>\r
+#include <qvalidator.h>\r
 \r
 #include <VTKViewer_ViewFrame.h>\r
 #include <SALOME_CubeAxesActor2D.h>\r
@@ -86,6 +87,8 @@ VisuGUI_AxisWg::VisuGUI_AxisWg( QWidget* theParent )
   aHBox->setSpacing( 5 );\r
   aLabel = new QLabel( tr( "NUMBER" ), aHBox );\r
   myLabelNumber = new QLineEdit( aHBox );\r
+  myLabelNumber->setValidator(new QIntValidator(0, 25, this));\r
+  myLabelNumber->installEventFilter(this);\r
   aLabels.append( aLabel );\r
 \r
   aHBox = new QHBox( myLabelsGrp );\r
@@ -149,6 +152,16 @@ void VisuGUI_AxisWg::updateControlState()
   onTicksChecked();\r
 }\r
 \r
+bool VisuGUI_AxisWg::eventFilter(QObject* o, QEvent* e)\r
+{\r
+  if (e->type() == QEvent::FocusOut) {\r
+    bool isOK = false;\r
+    int k = myLabelNumber->text().toInt(&isOK);\r
+    if (isOK && k > 25) myLabelNumber->setText("25");\r
+  }\r
+  return false;\r
+}\r
+\r
 //=======================================================================\r
 // name    : VisuGUI_AxisWg::onNameChecked\r
 // Purpose :\r
index 73e9ec6a48c5d0335c139a256060c88b43b492a3..e77f194811d1409a1fdb70a318a3f7b465f26c3d 100755 (executable)
@@ -106,7 +106,10 @@ public:
                                            const bool );\r
   bool                        ReadData( vtkAxisActor2D* );\r
   bool                        Apply( vtkAxisActor2D* );\r
-                                           \r
+                                    \r
+\r
+ protected:\r
+  bool                        eventFilter(QObject*, QEvent*);       \r
 \r
 private slots:\r
 \r