0028934: Coding - Eliminate compiler warnings in OCCT samples
authornds <nds@opencascade.com>
Wed, 4 Apr 2018 03:25:02 +0000 (06:25 +0300)
committerbugmaster <bugmaster@opencascade.com>
Mon, 9 Apr 2018 07:18:38 +0000 (10:18 +0300)
- covering Qt warnings for compilation under MSVC 2013 and greater
- avoid warning about 'M_PI'(and others) redefinition warning of math.h: includes of QtWidgets should follow after other includes.

36 files changed:
samples/qt/AndroidQt/src/AndroidQt.cxx
samples/qt/AndroidQt/src/AndroidQt.h
samples/qt/AndroidQt/src/AndroidQt_TouchParameters.h
samples/qt/AndroidQt/src/Main.cxx
samples/qt/Common/src/ApplicationCommon.cxx
samples/qt/Common/src/ApplicationCommon.h
samples/qt/Common/src/Common-icon.ts
samples/qt/Common/src/DocumentCommon.cxx
samples/qt/Common/src/DocumentCommon.h
samples/qt/Common/src/MDIWindow.cxx
samples/qt/Common/src/MDIWindow.h
samples/qt/Common/src/Material.cxx
samples/qt/Common/src/Material.h
samples/qt/Common/src/OcctWindow.h
samples/qt/Common/src/Transparency.cxx
samples/qt/Common/src/Transparency.h
samples/qt/Common/src/View.cxx
samples/qt/Common/src/View.h
samples/qt/FuncDemo/src/FThread.cpp
samples/qt/FuncDemo/src/FThread.h
samples/qt/FuncDemo/src/edge.cpp
samples/qt/FuncDemo/src/edge.h
samples/qt/FuncDemo/src/graphwidget.cpp
samples/qt/FuncDemo/src/graphwidget.h
samples/qt/FuncDemo/src/main.cpp
samples/qt/FuncDemo/src/mainwindow.cpp
samples/qt/FuncDemo/src/mainwindow.h
samples/qt/FuncDemo/src/node.cpp
samples/qt/FuncDemo/src/node.h
samples/qt/IESample/src/Main.cxx
samples/qt/Interface/src/Application.cxx
samples/qt/Interface/src/Translate.cxx
samples/qt/Interface/src/Translate.h
samples/qt/Tutorial/src/ApplicationTut.cxx
samples/qt/Tutorial/src/DocumentTut.cxx
samples/qt/Tutorial/src/Main.cxx

index 54a339c..c73d00a 100644 (file)
 #include <WNT_Window.hxx>
 
 #include <EGL/egl.h>
+
+#include <Standard_WarningsDisable.hxx>
 #include <QFileInfo>
+#include <Standard_WarningsRestore.hxx>
 
 // =======================================================================
 // function : AndroidQt
@@ -218,8 +221,8 @@ void AndroidQt::paint()
 
   if (Abs (myTouchPoint.DevX()) + Abs (myTouchPoint.DevY()) > 1)
   {
-    myView->StartRotation (myTouchPoint.X().first,  myTouchPoint.Y().first);
-    myView->Rotation      (myTouchPoint.X().second, myTouchPoint.Y().second);
+    myView->StartRotation ((Standard_Integer)myTouchPoint.X().first,  (Standard_Integer)myTouchPoint.Y().first);
+    myView->Rotation      ((Standard_Integer)myTouchPoint.X().second, (Standard_Integer)myTouchPoint.Y().second);
 
     myTouchPoint.ClearDev();
   }
index 0e5462e..4b6059f 100644 (file)
 
 #include <OpenGl_Context.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 // workaround broken definitions in Qt
 #define GLdouble GLdouble
 
+#include <QMutex>
 #include <QtQuick/qquickwindow.h>
 #include <QtQuick/QQuickItem>
 
 #undef GLdouble
+#include <Standard_WarningsRestore.hxx>
 
 #include <AIS_InteractiveContext.hxx>
 #include <V3d_View.hxx>
 
-#include <QMutex>
-
 #include "AndroidQt_TouchParameters.h"
 
 //! QML item with embedded OCCT viewer.
index 1debd06..bd62f63 100644 (file)
@@ -14,7 +14,9 @@
 #ifndef ANDROIDQT_TOUCHPARAMETERS_H
 #define ANDROIDQT_TOUCHPARAMETERS_H
 
+#include <Standard_WarningsDisable.hxx>
 #include <QPair>
+#include <Standard_WarningsRestore.hxx>
 
 //! Class holding touch event state.
 class AndroidQt_TouchParameters
index 51ae7c1..89160d1 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <Standard_WarningsDisable.hxx>
 #include <QApplication>
 #include <QQmlApplicationEngine>
+#include <Standard_WarningsRestore.hxx>
 
 #include "AndroidQt.h"
 
index a3e9490..2dfc5ed 100755 (executable)
@@ -3,6 +3,7 @@
 #include "DocumentCommon.h"
 #include "View.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QFrame>
 #include <QVBoxLayout>
 #include <QMenuBar>
@@ -12,6 +13,7 @@
 #include <QMessageBox>
 #include <QApplication>
 #include <QSignalMapper>
+#include <Standard_WarningsRestore.hxx>
 
 #include <Graphic3d_GraphicDriver.hxx>
 #include <OpenGl_GraphicDriver.hxx>
index cdc8802..a0d7e4e 100755 (executable)
@@ -3,12 +3,14 @@
 
 #include "DocumentCommon.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QMainWindow>
 #include <QAction>
 #include <QToolBar>
 #include <QMenu>
 #include <QMdiArea>
 #include <QList>
+#include <Standard_WarningsRestore.hxx>
 
 
 class COMMONSAMPLE_EXPORT ApplicationCommonWindow: public QMainWindow
index 23469bc..972e6d4 100755 (executable)
         <source>ICON_TOOL_SHADOWS</source>
         <translation>shadows.png</translation>
     </message>
-    <message>
-        <source>ICON_TOOL_RAYTRACING</source>
-        <translation>shadows.png</translation>
-    </message>
     <message>
         <source>ICON_TOOL_REFLECTIONS</source>
         <translation>reflections.png</translation>
index f19194e..e4903bb 100755 (executable)
@@ -4,10 +4,12 @@
 #include "Transparency.h"
 #include "Material.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QStatusBar>
 #include <QApplication>
 #include <QColor>
 #include <QColorDialog>
+#include <Standard_WarningsRestore.hxx>
 
 #include <Aspect_DisplayConnection.hxx>
 #include <AIS_InteractiveObject.hxx>
@@ -188,7 +190,8 @@ void DocumentCommon::onColor()
     {
         Quantity_Color aShapeColor;
         myContext->Color( Current, aShapeColor );
-        aColor.setRgb( aShapeColor.Red() * 255, aShapeColor.Green() * 255, aShapeColor.Blue() * 255 );
+        aColor.setRgb( (Standard_Integer)(aShapeColor.Red() * 255), (Standard_Integer)(aShapeColor.Green() * 255),
+                       (Standard_Integer)(aShapeColor.Blue() * 255));
     }
     else
         aColor.setRgb( 255, 255, 255 );
index 150de48..120cb2f 100755 (executable)
@@ -4,8 +4,10 @@
 #include "MDIWindow.h"
 //#include "IESample.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QObject>
 #include <QList>
+#include <Standard_WarningsRestore.hxx>
 
 #include <AIS_InteractiveContext.hxx>
 #include <V3d_Viewer.hxx>
index f09bce4..87498ea 100755 (executable)
@@ -4,6 +4,7 @@
 #include "DocumentCommon.h"
 #include "ApplicationCommon.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QFrame>
 #include <QToolBar>
 #include <QFileDialog>
@@ -14,6 +15,7 @@
 #include <QFileInfo>
 #include <QMainWindow> 
 #include <QVBoxLayout>
+#include <Standard_WarningsRestore.hxx>
 
 MDIWindow::MDIWindow(View* aView,
                      DocumentCommon* aDocument, 
index bf89026..06f7550 100755 (executable)
@@ -1,7 +1,10 @@
 #ifndef MDIWINDOW_H
 #define MDIWINDOW_H
 
+#include <Standard_WarningsDisable.hxx>
 #include <QMainWindow>
+#include <Standard_WarningsRestore.hxx>
+
 #include "CommonSample.h"
 
 class DocumentCommon;
index 748d93f..650174d 100755 (executable)
@@ -1,8 +1,10 @@
 #include "Material.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QPushButton>
 #include <QLayout>
 #include <QSignalMapper>
+#include <Standard_WarningsRestore.hxx>
 
 #include <Graphic3d_NameOfMaterial.hxx>
 
index a773a7b..ab8fcf6 100755 (executable)
@@ -1,9 +1,11 @@
 #ifndef MATERIAL_H
 #define MATERIAL_H
 
+#include <Standard_WarningsDisable.hxx>
 #include <QDialog>
 #include <QList>
 #include <QPushButton>
+#include <Standard_WarningsRestore.hxx>
 
 #include <AIS_InteractiveContext.hxx>
 
index b111656..34ad077 100644 (file)
@@ -3,7 +3,10 @@
 
 #include <Aspect_Window.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <QWidget>
+#include <Standard_WarningsRestore.hxx>
+
 class OcctWindow;
 
 /*
index a34fbf8..192198b 100755 (executable)
@@ -1,7 +1,9 @@
 #include "Transparency.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QHBoxLayout>
 #include <QSpinBox>
+#include <Standard_WarningsRestore.hxx>
 
 DialogTransparency::DialogTransparency( QWidget* parent, Qt::WindowFlags f, bool modal )
 : QDialog( parent, f )
index b37dd89..a8948c4 100755 (executable)
@@ -1,5 +1,8 @@
+#include <Standard_WarningsDisable.hxx>
 #include <QDialog>
 #include <QWidget>
+#include <Standard_WarningsRestore.hxx>
+
 #include <AIS_InteractiveContext.hxx>
 
 class DialogTransparency : public QDialog
index 5a3550c..718bc44 100755 (executable)
@@ -5,6 +5,7 @@
 #include "View.h"
 #include "ApplicationCommon.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QApplication>
 #include <QPainter>
 #include <QMenu>
@@ -19,6 +20,7 @@
 #if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && QT_VERSION < 0x050000
   #include <QX11Info>
 #endif
+#include <Standard_WarningsRestore.hxx>
 
 
 #include <Graphic3d_ExportFormat.hxx>
@@ -997,7 +999,7 @@ void View::onBackground()
     Standard_Real G1;
     Standard_Real B1;
     myView->BackgroundColor(Quantity_TOC_RGB,R1,G1,B1);
-    aColor.setRgb(R1*255,G1*255,B1*255);
+    aColor.setRgb((Standard_Integer)(R1 * 255), (Standard_Integer)(G1 * 255), (Standard_Integer)(B1 * 255));
 
     QColor aRetColor = QColorDialog::getColor(aColor);
 
index 6bd6720..8274454 100755 (executable)
@@ -1,9 +1,11 @@
 #ifndef VIEW_H
 #define VIEW_H
 
+#include <Standard_WarningsDisable.hxx>
 #include <QWidget>
 #include <QAction>
 #include <QList>
+#include <Standard_WarningsRestore.hxx>
 
 #include <AIS_InteractiveContext.hxx>
 #include <V3d_View.hxx>
index 48221dc..3a63943 100644 (file)
@@ -19,24 +19,24 @@ FThread::~FThread()
 
 }
 
-void FThread::setIterator(const TFunction_Iterator& itr)
+void FThread::setIterator(const TFunction_Iterator& theItr)
 {
-    this->itr = itr;
+    this->itr = theItr;
 }
 
-void FThread::setLogbook(const Handle(TFunction_Logbook)& log)
+void FThread::setLogbook(const Handle(TFunction_Logbook)& theLog)
 {
-    this->log = log;
+    this->log = theLog;
 }
 
-void FThread::setGraph(GraphWidget* graph)
+void FThread::setGraph(GraphWidget* theGraph)
 {
-    this->graph = graph;
+    this->graph = theGraph;
 }
 
-void FThread::setThreadIndex(const int thread_index)
+void FThread::setThreadIndex(const int theIndex)
 {
-    this->thread_index = thread_index;
+    this->thread_index = theIndex;
 }
 
 // Returns any free (not executed yet) function
index 30bd270..e7ab7ac 100644 (file)
@@ -1,7 +1,9 @@
 #ifndef _FTHREAD_H_
 #define _FTHREAD_H_
 
+#include <Standard_WarningsDisable.hxx>
 #include <QThread>
+#include <Standard_WarningsRestore.hxx>
 
 #include <TFunction_Logbook.hxx>
 #include <TFunction_Iterator.hxx>
index e5ad124..983b64a 100644 (file)
@@ -38,7 +38,9 @@
 **
 ****************************************************************************/
 
+#include <Standard_WarningsDisable.hxx>
 #include <QPainter>
+#include <Standard_WarningsRestore.hxx>
 
 #include "edge.h"
 #include "node.h"
index acfe2f1..5662ef0 100644 (file)
@@ -41,7 +41,9 @@
 #ifndef EDGE_H
 #define EDGE_H
 
+#include <Standard_WarningsDisable.hxx>
 #include <QGraphicsItem>
+#include <Standard_WarningsRestore.hxx>
 
 class Node;
 
index 7555a2b..1ee3a66 100644 (file)
 #include "edge.h"
 #include "node.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QDebug>
 #include <QGraphicsScene>
 #include <QWheelEvent>
 #include <QApplication>
+#include <Standard_WarningsRestore.hxx>
 
 #include <math.h>
 
index c1b21d5..d4205e6 100644 (file)
@@ -41,7 +41,9 @@
 #ifndef GRAPHWIDGET_H
 #define GRAPHWIDGET_H
 
+#include <Standard_WarningsDisable.hxx>
 #include <QGraphicsView>
+#include <Standard_WarningsRestore.hxx>
 
 #include "FThread.h"
 
index 4f35cca..4fad9cf 100644 (file)
@@ -38,7 +38,9 @@
 **
 ****************************************************************************/
 
+#include <Standard_WarningsDisable.hxx>
 #include <QApplication>
+#include <Standard_WarningsRestore.hxx>
 #include "mainwindow.h"
 
 #include <OSD_Environment.hxx>
index 40c9152..0668b35 100644 (file)
 **
 ****************************************************************************/
 
-#include <QtGui>
-#include <QtGlobal>
-#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
-#include <QtWidgets>
-#endif
-
 #include "mainwindow.h"
 #include "graphwidget.h"
 #include "node.h"
 #include <TDataStd_Name.hxx>
 #include <TDataStd_Real.hxx>
 #include <TDataStd_RealArray.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QtGui>
+#include <QtGlobal>
+#if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
+#include <QtWidgets>
+#endif
+#include <Standard_WarningsRestore.hxx>
+
 #ifdef __GNUC__
 #include <unistd.h>
 #endif
index 5455bb9..ca2b7a8 100644 (file)
 #ifndef MAINWINDOW_H
 #define MAINWINDOW_H
 
+#include <Standard_WarningsDisable.hxx>
 #include <QMainWindow>
+#include <Standard_WarningsRestore.hxx>
+
 #include <AppStd_Application.hxx>
 
 class QAction;
index f72680a..9271222 100644 (file)
 **
 ****************************************************************************/
 
+#include <Standard_WarningsDisable.hxx>
 #include <QGraphicsScene>
 #include <QGraphicsSceneMouseEvent>
 #include <QPainter>
 #include <QStyleOption>
+#include <Standard_WarningsRestore.hxx>
 
 #include "edge.h"
 #include "node.h"
index 1319e26..393cc1f 100644 (file)
 #ifndef NODE_H
 #define NODE_H
 
+#include <Standard_WarningsDisable.hxx>
 #include <QGraphicsItem>
 #include <QList>
+#include <Standard_WarningsRestore.hxx>
 
 #include <TDF_Label.hxx>
 
index 87b7924..45561b5 100755 (executable)
@@ -2,10 +2,12 @@
 
 #include <OSD_Environment.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <QApplication>
 #include <QTranslator>
 #include <QPixmap>
 #include <QLocale>
+#include <Standard_WarningsRestore.hxx>
   
 
 int main ( int argc, char* argv[] )
index ec3cdca..c99739c 100755 (executable)
@@ -2,12 +2,15 @@
 
 #include "Translate.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QMessageBox>
-#include <stdlib.h>
 #include <QMdiSubWindow>
+#include <Standard_WarningsRestore.hxx>
 
 #include <OSD_Environment.hxx>
 
+#include <stdlib.h>
+
 ApplicationWindow::ApplicationWindow()
     : ApplicationCommonWindow( ),
       myImportPopup( 0 ),
@@ -200,13 +203,13 @@ void ApplicationWindow::onSelectionChanged()
   QMdiArea* ws = getWorkspace();
   DocumentCommon* doc = qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument();
   Handle(AIS_InteractiveContext) context = doc->getContext();
-  int numSel = context->NbSelected();
+  bool anEnabled = (context->NbSelected() > 0);
 
-  myCasCadeTranslateActions.at( FileExportBREPId )->setEnabled( numSel );
-  myCasCadeTranslateActions.at( FileExportIGESId )->setEnabled( numSel );
-  myCasCadeTranslateActions.at( FileExportSTEPId )->setEnabled( numSel );
-  myCasCadeTranslateActions.at( FileExportSTLId )->setEnabled( numSel );
-  myCasCadeTranslateActions.at( FileExportVRMLId )->setEnabled( numSel );
+  myCasCadeTranslateActions.at( FileExportBREPId )->setEnabled( anEnabled );
+  myCasCadeTranslateActions.at( FileExportIGESId )->setEnabled( anEnabled );
+  myCasCadeTranslateActions.at( FileExportSTEPId )->setEnabled( anEnabled );
+  myCasCadeTranslateActions.at( FileExportSTLId )->setEnabled( anEnabled );
+  myCasCadeTranslateActions.at( FileExportVRMLId )->setEnabled( anEnabled );
 }
 
 QString ApplicationWindow::getIEResourceDir()
index 1b2bdb4..13eec9b 100755 (executable)
@@ -2,6 +2,7 @@
 
 #include "Application.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QDir>
 #include <QLayout>
 #include <QComboBox>
@@ -12,6 +13,7 @@
 #include <QApplication>
 #include <QWidget>
 #include <QStyleFactory>
+#include <Standard_WarningsRestore.hxx>
 
 #include <AIS_Shape.hxx>
 #include <AIS_InteractiveObject.hxx>
@@ -305,7 +307,7 @@ QString Translate::selectFileName( const int format, const bool import )
     if ( idx != -1 )
     {
       QString tail = selFilter.mid( idx + 3 );
-                       int idx = tail.indexOf( " " );
+                       idx = tail.indexOf( " " );
       if ( idx == -1 )
         idx = tail.indexOf( ")" );
       QString ext = tail.left( idx );
index f7a9e19..a19d5f9 100755 (executable)
@@ -2,7 +2,9 @@
 #define TRANSLATE_H
 #include "IESample.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QObject>
+#include <Standard_WarningsRestore.hxx>
 
 #include <AIS_InteractiveContext.hxx>
 #include <TopTools_HSequenceOfShape.hxx>
index 5be0008..e2ea797 100755 (executable)
@@ -3,9 +3,11 @@
 
 #include <OSD_Environment.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <QFileDialog>
 #include <QStatusBar>
 #include <QMdiSubWindow>
+#include <Standard_WarningsRestore.hxx>
 
 ApplicationTut::ApplicationTut()
     : ApplicationCommonWindow( )
index df00e62..8a579a8 100755 (executable)
@@ -1,8 +1,10 @@
 #include "DocumentTut.h"
 
+#include <Standard_WarningsDisable.hxx>
 #include <QFileDialog>
 #include <QMessageBox>
 #include <QApplication>
+#include <Standard_WarningsRestore.hxx>
 
 #include <TopoDS_Shape.hxx>
 #include <AIS_Shape.hxx>
index 1603de2..c9a08d8 100755 (executable)
@@ -2,8 +2,10 @@
 
 #include <OSD_Environment.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <QApplication>
 #include <QTranslator>
+#include <Standard_WarningsRestore.hxx>
 
 int main ( int argc, char* argv[] )
 {