Salome HOME
updated copyright message
[modules/gui.git] / src / OCCViewer / OCCViewer_ViewSketcher.cxx
index 195af5a6e6b16f8e968e82309ede10c8d08c267a..5c29da2eddaf57b3968ce1689755b0291e724373 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -256,7 +256,7 @@ void OCCViewer_RectSketcher::onMouse( QMouseEvent* e )
   else
     avp->setCursor( Qt::ForbiddenCursor );
 
-  if ( e->type() == QEvent::MouseButtonRelease && e->button() == sketchButton() )
+  if ( e->type() == QEvent::MouseButtonRelease && (int)e->button() == sketchButton() ) // todo Qt::MouseButton is unsigned int: comparison of int with uint
   {
     myResult = Accept;
     QApplication::postEvent( avp, new QMouseEvent( e->type(), e->pos(),
@@ -473,7 +473,7 @@ void OCCViewer_PolygonSketcher::onMouse( QMouseEvent* e )
 
   if ( e->type() == QEvent::MouseButtonRelease && ( e->button() & sketchButton() ) )
   {
-    myResult = Reject;
+    myResult = (closed && (points->count() > 2)) ? Accept : Reject;
     QApplication::postEvent( avp, new QMouseEvent( e->type(), e->pos(),
                                                    e->globalPos(), e->button(), 
                                                    e->buttons(), e->modifiers() ) );
@@ -554,7 +554,7 @@ bool OCCViewer_PolygonSketcher::isValid( const QPolygon* aPoints, const QPoint&
     return true;
 
   bool res = true;
-  for ( uint i = 0; i < aPoints->count() - 1 && res; i++ )
+  for ( int i = 0; i < aPoints->count() - 1 && res; i++ )
   {
     const QPoint& aStart = aPoints->point( i );
     const QPoint& anEnd  = aPoints->point( i + 1 );