From b088841991262c0eb81b94650d94eaf3cba707de Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 7 Dec 2016 17:31:11 +0300 Subject: [PATCH] Fix some compilation warnings --- src/GLViewer/GLViewer_BaseObjects.cxx | 2 +- src/GLViewer/GLViewer_MimeData.cxx | 8 +-- src/Qtx/QtxWebBrowser.cxx | 59 ++++++++++++---------- src/SUIT/SUIT_FileValidator.h | 5 +- src/VTKViewer/VTKViewer_PolyDataMapper.cxx | 2 + tools/PyEditor/src/PyEditor_Settings.h | 19 +++---- 6 files changed, 52 insertions(+), 43 deletions(-) diff --git a/src/GLViewer/GLViewer_BaseObjects.cxx b/src/GLViewer/GLViewer_BaseObjects.cxx index 0a45bb38a..cf12ae7ba 100644 --- a/src/GLViewer/GLViewer_BaseObjects.cxx +++ b/src/GLViewer/GLViewer_BaseObjects.cxx @@ -1096,7 +1096,7 @@ GLboolean GLViewer_Polyline::select( GLfloat x, GLfloat y, GLfloat tol, GLViewer GLfloat xa, xb, ya, yb, l; GLfloat rsin, rcos, r, ra, rb; // GLboolean update; - GLboolean selected = myIsSel; + // GLboolean selected = myIsSel; myIsSel = GL_FALSE; diff --git a/src/GLViewer/GLViewer_MimeData.cxx b/src/GLViewer/GLViewer_MimeData.cxx index 73fee0412..2b5408467 100644 --- a/src/GLViewer/GLViewer_MimeData.cxx +++ b/src/GLViewer/GLViewer_MimeData.cxx @@ -235,8 +235,8 @@ const char* GLViewer_MimeData::format( int theIndex ) const */ QByteArray GLViewer_MimeData::encodedData( const char* theObjectType ) const { - if( theObjectType == "GLViewer_Objects" ) - return myByteArray; - - return QByteArray(); + if ( theObjectType && strcmp( theObjectType, "GLViewer_Objects" ) == 0 ) + return myByteArray; + + return QByteArray(); } diff --git a/src/Qtx/QtxWebBrowser.cxx b/src/Qtx/QtxWebBrowser.cxx index 48991f6be..3141d68be 100644 --- a/src/Qtx/QtxWebBrowser.cxx +++ b/src/Qtx/QtxWebBrowser.cxx @@ -119,7 +119,9 @@ bool QtxWebBrowser::Searcher::find( const QString& text, QtxSearchTool* st ) if ( st->isSearchWrapped() ) fl = fl | WebPage::FindWrapsAroundDocument; return myView->findText( text, fl ); #else - myView->findText( text, fl, [this](bool found) { return found; }); + bool textFound; + myView->findText( text, fl, [&](bool found) { textFound = found; }); + return textFound; #endif } @@ -150,7 +152,9 @@ bool QtxWebBrowser::Searcher::findPrevious( const QString& text, QtxSearchTool* if ( st->isSearchWrapped() ) fl = fl | WebPage::FindWrapsAroundDocument; return myView->findText( text, fl ); #else - myView->findText( text, fl, [this](bool found) { return found; }); + bool textFound; + myView->findText( text, fl, [&](bool found) { textFound = found; }); + return textFound; #endif } @@ -222,10 +226,10 @@ QtxWebBrowser::Downloader::Downloader( const QString& fileName, int action, cons QGridLayout* l = new QGridLayout( this ); l->addWidget( new QLabel( QtxWebBrowser::tr( "You are opening the file" ), this ), - 0, 0, 1, 4 ); + 0, 0, 1, 4 ); l->addWidget( myFileName, 1, 1, 1, 3 ); l->addWidget( new QLabel( QtxWebBrowser::tr( "Please choose the action to be done" ), this ), - 3, 0, 1, 4 ); + 3, 0, 1, 4 ); l->addWidget( rbOpen, 4, 1, 1, 1 ); l->addWidget( myBrowse, 4, 2, 1, 1 ); l->addWidget( rbSave, 5, 1, 1, 3 ); @@ -367,11 +371,11 @@ QtxWebBrowser::QtxWebBrowser( ) : QMainWindow( 0 ) myFindPanel = new QtxSearchTool( frame, myWebView, #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) - QtxSearchTool::Basic | QtxSearchTool::Case | QtxSearchTool::Wrap, + QtxSearchTool::Basic | QtxSearchTool::Case | QtxSearchTool::Wrap, #else - QtxSearchTool::Basic | QtxSearchTool::Case, -#endif - Qt::Horizontal ); + QtxSearchTool::Basic | QtxSearchTool::Case, +#endif + Qt::Horizontal ); myFindPanel->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); myFindPanel->setActivators( QtxSearchTool::SlashKey ); myFindPanel->setSearcher( new Searcher( myWebView ) ); @@ -384,29 +388,29 @@ QtxWebBrowser::QtxWebBrowser( ) : QMainWindow( 0 ) QMenu* fileMenu = menuBar()->addMenu( tr( "&File" ) ); fileMenu->addAction( QPixmap( ":/images/open.png" ), tr( "&Open..." ), - this, SLOT( open() ), - QKeySequence( QKeySequence::Open ) ); + this, SLOT( open() ), + QKeySequence( QKeySequence::Open ) ); fileMenu->addSeparator(); fileMenu->addAction( myWebView->pageAction( WebPage::Back ) ); fileMenu->addAction( myWebView->pageAction( WebPage::Forward ) ); fileMenu->addAction( myWebView->pageAction( WebPage::Reload ) ); fileMenu->addSeparator(); fileMenu->addAction( tr( "&Find in text..." ), - myFindPanel, SLOT( find() ), - QKeySequence( QKeySequence::Find ) ); + myFindPanel, SLOT( find() ), + QKeySequence( QKeySequence::Find ) ); fileMenu->addAction( tr( "&Find next" ), - myFindPanel, SLOT( findNext() ), - QKeySequence( QKeySequence::FindNext ) ); + myFindPanel, SLOT( findNext() ), + QKeySequence( QKeySequence::FindNext ) ); fileMenu->addAction( tr( "&Find previous" ), - myFindPanel, SLOT( findPrevious() ), - QKeySequence( QKeySequence::FindPrevious ) ); + myFindPanel, SLOT( findPrevious() ), + QKeySequence( QKeySequence::FindPrevious ) ); fileMenu->addSeparator(); fileMenu->addAction( QPixmap( ":/images/close.png" ), tr( "&Close" ), - this, SLOT( close() ) ); + this, SLOT( close() ) ); QMenu* helpMenu = menuBar()->addMenu( tr( "&Help" ) ); helpMenu->addAction( tr( "&About..." ), - this, SLOT( about() ) ); + this, SLOT( about() ) ); QVBoxLayout* main = new QVBoxLayout( frame ); main->addWidget( myWebView ); @@ -418,22 +422,22 @@ QtxWebBrowser::QtxWebBrowser( ) : QMainWindow( 0 ) connect( myWebView, SIGNAL( loadFinished( bool ) ), SLOT( finished( bool ) ) ); connect( myWebView->pageAction( WebPage::DownloadLinkToDisk ), SIGNAL( triggered() ), - SLOT( linkAction() ) ); + SLOT( linkAction() ) ); #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) //QtWebKit case: connect( myWebView, SIGNAL( linkClicked( QUrl ) ), SLOT( linkClicked( QUrl ) ) ); connect( myWebView->page(), SIGNAL( linkHovered( QString, QString, QString ) ), - SLOT( linkHovered( QString, QString, QString ) ) ); + SLOT( linkHovered( QString, QString, QString ) ) ); disconnect( myWebView->pageAction( WebPage::OpenLink ), 0, 0, 0 ); connect( myWebView->pageAction( WebPage::OpenLink ), SIGNAL( triggered() ), - SLOT( linkAction() ) ); + SLOT( linkAction() ) ); #else //QtWebEngine (Qt-5.6.0) case: connect( myWebView->page(), SIGNAL( linkHovered( QString ) ), - SLOT( linkHovered( QString ) ) ); + SLOT( linkHovered( QString ) ) ); disconnect( myWebView->pageAction( WebPage::OpenLinkInThisWindow ), 0, 0, 0 ); connect( myWebView->pageAction( WebPage::OpenLinkInThisWindow ), SIGNAL( triggered() ), - SLOT( linkAction() ) ); + SLOT( linkAction() ) ); #endif setCentralWidget( frame ); setFocusProxy( myWebView ); @@ -513,7 +517,7 @@ QtxResourceMgr* QtxWebBrowser::resourceMgr() const void QtxWebBrowser::about() { QMessageBox::about( this, tr( "About %1" ).arg( tr( "Help Browser" ) ), - QString( "SALOME %1" ).arg( tr( "Help Browser" ) ) ); + QString( "SALOME %1" ).arg( tr( "Help Browser" ) ) ); } /*! @@ -636,7 +640,7 @@ void QtxWebBrowser::openLink( const QString& fileName, bool force ) myResourceMgr->setValue( resSection, actionParam, defAction ); myResourceMgr->setValue( resSection, repeatParam, defRepeat ); if ( defAction == Downloader::mOpen ) - myResourceMgr->setValue( resSection, programParam, defProgram ); + myResourceMgr->setValue( resSection, programParam, defProgram ); } } switch( defAction ) { @@ -689,12 +693,13 @@ void QtxWebBrowser::load( const QString& link ) void QtxWebBrowser::saveLink( const QString& fileName ) { QString newFileName = QFileDialog::getSaveFileName( this, tr( "Save file" ), fileName, - QString( "*.%1" ).arg( QFileInfo( fileName ).suffix() ) ); + QString( "*.%1" ).arg( QFileInfo( fileName ).suffix() ) ); if ( !newFileName.isEmpty() && QFileInfo( newFileName ).canonicalFilePath() != QFileInfo( fileName ).canonicalFilePath() ) { QFile toFile( newFileName ); QFile fromFile( fileName ); - if ( toFile.exists() && !toFile.remove() || !fromFile.copy( newFileName ) ) + if (( toFile.exists() && !toFile.remove() ) || + ( !fromFile.copy( newFileName ) )) QMessageBox::warning( this, tr( "Error"), tr( "Can't save file:\n%1" ).arg( newFileName ) ); } } diff --git a/src/SUIT/SUIT_FileValidator.h b/src/SUIT/SUIT_FileValidator.h index f8506842d..c4ffd6615 100755 --- a/src/SUIT/SUIT_FileValidator.h +++ b/src/SUIT/SUIT_FileValidator.h @@ -33,9 +33,10 @@ class QString; class SUIT_EXPORT SUIT_FileValidator { -public: + public: SUIT_FileValidator( QWidget* = 0 ); - + virtual ~SUIT_FileValidator() {} + virtual bool canOpen( const QString&, bool = true ); virtual bool canSave( const QString&, bool = true ); diff --git a/src/VTKViewer/VTKViewer_PolyDataMapper.cxx b/src/VTKViewer/VTKViewer_PolyDataMapper.cxx index d34ea33c3..7dca2f88d 100644 --- a/src/VTKViewer/VTKViewer_PolyDataMapper.cxx +++ b/src/VTKViewer/VTKViewer_PolyDataMapper.cxx @@ -593,6 +593,8 @@ namespace VTK virtual void get( TVertex& theVertex, vtkIdType thePointId, vtkIdType theCellId ) = 0; + + virtual ~TColorFunctorBase() {} }; //----------------------------------------------------------------------------- diff --git a/tools/PyEditor/src/PyEditor_Settings.h b/tools/PyEditor/src/PyEditor_Settings.h index 2f1c9be6c..aa6de0419 100644 --- a/tools/PyEditor/src/PyEditor_Settings.h +++ b/tools/PyEditor/src/PyEditor_Settings.h @@ -31,21 +31,22 @@ class PYEDITOR_EXPORT PyEditor_Settings { protected: enum Option { snEditor, - snHighlightCurrentLine, - snTextWrapping, - snCenterCursorOnScroll, - snLineNumberArea, - snVerticalEdge, - snNumberColumns, - snTabSpaceVisible, - snTabSize, - snFont }; + snHighlightCurrentLine, + snTextWrapping, + snCenterCursorOnScroll, + snLineNumberArea, + snVerticalEdge, + snNumberColumns, + snTabSpaceVisible, + snTabSize, + snFont }; public: static PyEditor_Settings* settings(); static void setSettings( PyEditor_Settings* ); PyEditor_Settings(); + virtual ~PyEditor_Settings() {} void setHighlightCurrentLine( bool ); bool highlightCurrentLine() const; -- 2.39.2