From: rnv Date: Thu, 23 Jun 2016 11:54:21 +0000 (+0300) Subject: Porting to Qt-5.6.x: additional workaround for moc preprocessor bug. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2c962c2b246e66bfdeb67c458000e1b904a89f45;p=modules%2Fgui.git Porting to Qt-5.6.x: additional workaround for moc preprocessor bug. --- diff --git a/adm_local/cmake_files/UseQtExt.cmake b/adm_local/cmake_files/UseQtExt.cmake index 95985b7b7..db787c6ac 100644 --- a/adm_local/cmake_files/UseQtExt.cmake +++ b/adm_local/cmake_files/UseQtExt.cmake @@ -47,7 +47,47 @@ MACRO(QT_WRAP_MOC) IF (QT_VERSION VERSION_LESS "5.0") QT4_WRAP_CPP(${ARGN}) ELSE() - QT5_WRAP_CPP(${ARGN}) + QT5_WRAP_CPP(${ARGN}) + # Workaround to avoid problem with bug in moc preprocessor: + # The problem is reproduced on Linux in case if native system Qt is installed + # and "-I/usr/include" parameter is presented in the moc command line before + # custom Qt includes. This bug takes place in Qt-5.6.0 and newer. To avoid this + # bug move "-I/usr/include" parameter in the "moc parameters" file to the end + # of the "include section". + IF (NOT WIN32) + FOREACH(IT ${ARGN}) + GET_FILENAME_COMPONENT(IT ${IT} ABSOLUTE) + GET_FILENAME_COMPONENT(PFILE ${IT} NAME_WE) + SET(OUTFILE ${CMAKE_CURRENT_BINARY_DIR}/moc_${PFILE}.cpp_parameters) + IF(EXISTS ${OUTFILE}) + SET(NEW_CONTENT) + SET(IS_INCLUDE_SECTION TRUE) + SET(HAS_SYSTEM_INC FALSE) + FILE(READ ${OUTFILE} CONTENT) + STRING(REGEX REPLACE "\n" ";" CONTENT "${CONTENT}") + list(REMOVE_DUPLICATES CONTENT) + FOREACH(S ${CONTENT}) + IF("${S}" MATCHES "^-I") + IF("${S}" STREQUAL "-I/usr/include") + SET(HAS_SYSTEM_INC TRUE) + ELSE() + SET(NEW_CONTENT ${NEW_CONTENT} "${S}\n") + ENDIF() + ELSE() + SET(IS_INCLUDE_SECTION FALSE) + ENDIF() + IF(NOT IS_INCLUDE_SECTION) + IF(HAS_SYSTEM_INC) + SET(NEW_CONTENT ${NEW_CONTENT} "-I/usr/include\n") + SET(HAS_SYSTEM_INC FALSE) + ENDIF() + SET(NEW_CONTENT ${NEW_CONTENT} "${S}\n") + ENDIF() + ENDFOREACH() + FILE(WRITE ${OUTFILE} ${NEW_CONTENT}) + ENDIF() + ENDFOREACH() + ENDIF() ENDIF() ENDMACRO(QT_WRAP_MOC) diff --git a/src/Qtx/QtxWebBrowser.cxx b/src/Qtx/QtxWebBrowser.cxx index 140289998..48991f6be 100644 --- a/src/Qtx/QtxWebBrowser.cxx +++ b/src/Qtx/QtxWebBrowser.cxx @@ -51,10 +51,10 @@ #include // RNV: -// Since from Qt 5.6.0 version was removed QtWebKit tool, -// QtxWebBroswer is ported on QtWebEngine. So if it is built with -// Qt5 (Qt-5.5.1, Qt-5.6.0 and newer), it uses QtWebEngine. -// But for Qt4 QtWebKit tool is used, to provide backward compatibility. +// Since from Qt 5.6.0 version QtWebKit tool was removed, +// QtxWebBroswer is ported on QtWebEngine. So if it is built with Qt-5.6.0 +// and newer, it uses QtWebEngine. But for Qt-5.5.1 and Qt4 QtWebKit tool +// is used, to provide backward compatibility. namespace { @@ -74,7 +74,7 @@ namespace class QtxWebBrowser::Searcher : public QtxSearchTool::Searcher { public: - Searcher( QWebView* ); + Searcher( WebView* ); ~Searcher(); bool find( const QString&, QtxSearchTool* ); @@ -84,7 +84,7 @@ public: bool findLast( const QString&, QtxSearchTool* ); private: - QWebView* myView; + WebView* myView; }; /*! @@ -92,7 +92,7 @@ private: \param view web view \internal */ -QtxWebBrowser::Searcher::Searcher( QWebView* view ) : myView( view ) +QtxWebBrowser::Searcher::Searcher( WebView* view ) : myView( view ) { } @@ -113,10 +113,10 @@ QtxWebBrowser::Searcher::~Searcher() */ bool QtxWebBrowser::Searcher::find( const QString& text, QtxSearchTool* st ) { - QWebPage::FindFlags fl = 0; - if ( st->isCaseSensitive() ) fl = fl | QWebPage::FindCaseSensitively; + WebPage::FindFlags fl = 0; + if ( st->isCaseSensitive() ) fl = fl | WebPage::FindCaseSensitively; #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) - if ( st->isSearchWrapped() ) fl = fl | QWebPage::FindWrapsAroundDocument; + if ( st->isSearchWrapped() ) fl = fl | WebPage::FindWrapsAroundDocument; return myView->findText( text, fl ); #else myView->findText( text, fl, [this](bool found) { return found; }); @@ -144,10 +144,10 @@ bool QtxWebBrowser::Searcher::findNext( const QString& text, QtxSearchTool* st ) */ bool QtxWebBrowser::Searcher::findPrevious( const QString& text, QtxSearchTool* st ) { - QWebPage::FindFlags fl = QWebPage::FindBackward; - if ( st->isCaseSensitive() ) fl = fl | QWebPage::FindCaseSensitively; + WebPage::FindFlags fl = WebPage::FindBackward; + if ( st->isCaseSensitive() ) fl = fl | WebPage::FindCaseSensitively; #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) - if ( st->isSearchWrapped() ) fl = fl | QWebPage::FindWrapsAroundDocument; + if ( st->isSearchWrapped() ) fl = fl | WebPage::FindWrapsAroundDocument; return myView->findText( text, fl ); #else myView->findText( text, fl, [this](bool found) { return found; }); @@ -351,18 +351,18 @@ QtxWebBrowser::QtxWebBrowser( ) : QMainWindow( 0 ) QWidget* frame = new QWidget( this ); - myWebView = new QWebView( frame ); + myWebView = new WebView( frame ); - myWebView->pageAction( QWebPage::Copy )->setShortcut( QKeySequence::Copy ); - myWebView->addAction( myWebView->pageAction( QWebPage::Copy ) ); + myWebView->pageAction( WebPage::Copy )->setShortcut( QKeySequence::Copy ); + myWebView->addAction( myWebView->pageAction( WebPage::Copy ) ); #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) - myWebView->pageAction( QWebPage::OpenLinkInNewWindow )->setVisible( false ); + myWebView->pageAction( WebPage::OpenLinkInNewWindow )->setVisible( false ); #endif - myWebView->pageAction( QWebPage::Back )->setText( tr( "Go Back" ) ); - myWebView->pageAction( QWebPage::Forward )->setText( tr( "Go Forward" ) ); - myWebView->pageAction( QWebPage::Reload )->setText( tr( "Refresh" ) ); + myWebView->pageAction( WebPage::Back )->setText( tr( "Go Back" ) ); + myWebView->pageAction( WebPage::Forward )->setText( tr( "Go Forward" ) ); + myWebView->pageAction( WebPage::Reload )->setText( tr( "Refresh" ) ); #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) - myWebView->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks ); + myWebView->page()->setLinkDelegationPolicy( WebPage::DelegateAllLinks ); #endif myFindPanel = new QtxSearchTool( frame, myWebView, @@ -378,18 +378,18 @@ QtxWebBrowser::QtxWebBrowser( ) : QMainWindow( 0 ) myFindPanel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); QToolBar* toolbar = addToolBar( tr( "Navigation" ) ); - toolbar->addAction( myWebView->pageAction( QWebPage::Back ) ); - toolbar->addAction( myWebView->pageAction( QWebPage::Forward ) ); - toolbar->addAction( myWebView->pageAction( QWebPage::Reload ) ); + toolbar->addAction( myWebView->pageAction( WebPage::Back ) ); + toolbar->addAction( myWebView->pageAction( WebPage::Forward ) ); + toolbar->addAction( myWebView->pageAction( WebPage::Reload ) ); QMenu* fileMenu = menuBar()->addMenu( tr( "&File" ) ); fileMenu->addAction( QPixmap( ":/images/open.png" ), tr( "&Open..." ), this, SLOT( open() ), QKeySequence( QKeySequence::Open ) ); fileMenu->addSeparator(); - fileMenu->addAction( myWebView->pageAction( QWebPage::Back ) ); - fileMenu->addAction( myWebView->pageAction( QWebPage::Forward ) ); - fileMenu->addAction( myWebView->pageAction( QWebPage::Reload ) ); + 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() ), @@ -417,22 +417,22 @@ QtxWebBrowser::QtxWebBrowser( ) : QMainWindow( 0 ) connect( myWebView, SIGNAL( titleChanged( QString ) ), SLOT( adjustTitle() ) ); connect( myWebView, SIGNAL( loadFinished( bool ) ), SLOT( finished( bool ) ) ); - connect( myWebView->pageAction( QWebPage::DownloadLinkToDisk ), SIGNAL( triggered() ), + connect( myWebView->pageAction( WebPage::DownloadLinkToDisk ), SIGNAL( triggered() ), 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 ) ) ); - disconnect( myWebView->pageAction( QWebPage::OpenLink ), 0, 0, 0 ); - connect( myWebView->pageAction( QWebPage::OpenLink ), SIGNAL( triggered() ), + disconnect( myWebView->pageAction( WebPage::OpenLink ), 0, 0, 0 ); + connect( myWebView->pageAction( WebPage::OpenLink ), SIGNAL( triggered() ), SLOT( linkAction() ) ); #else //QtWebEngine (Qt-5.6.0) case: connect( myWebView->page(), SIGNAL( linkHovered( QString ) ), SLOT( linkHovered( QString ) ) ); - disconnect( myWebView->pageAction( QWebPage::OpenLinkInThisWindow ), 0, 0, 0 ); - connect( myWebView->pageAction( QWebPage::OpenLinkInThisWindow ), SIGNAL( triggered() ), + disconnect( myWebView->pageAction( WebPage::OpenLinkInThisWindow ), 0, 0, 0 ); + connect( myWebView->pageAction( WebPage::OpenLinkInThisWindow ), SIGNAL( triggered() ), SLOT( linkAction() ) ); #endif setCentralWidget( frame ); @@ -524,11 +524,11 @@ void QtxWebBrowser::about() void QtxWebBrowser::linkClicked( const QUrl& url ) { #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) - myWebView->page()->setLinkDelegationPolicy( QWebPage::DontDelegateLinks ); + myWebView->page()->setLinkDelegationPolicy( WebPage::DontDelegateLinks ); #endif myWebView->load( url ); #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) - myWebView->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks ); + myWebView->page()->setLinkDelegationPolicy( WebPage::DelegateAllLinks ); #endif } @@ -540,18 +540,16 @@ void QtxWebBrowser::linkClicked( const QUrl& url ) \internal */ - void QtxWebBrowser::linkHovered( const QString& link, const QString& /*title*/, const QString& /*context*/ ) { linkHovered(link); } void QtxWebBrowser::linkHovered( const QString& link) - { QUrl url = link; if ( !link.isEmpty() && isLocalFile( url ) ) myLastUrl = url; - statusBar()->showMessage( link ); + statusBar()->showMessage( link ); } /*! @@ -587,13 +585,13 @@ void QtxWebBrowser::finished( bool ok ) void QtxWebBrowser::linkAction() { QObject* s = sender(); - if ( s == myWebView->pageAction( QWebPage::DownloadLinkToDisk ) ) { + if ( s == myWebView->pageAction( WebPage::DownloadLinkToDisk ) ) { saveLink( myLastUrl.path() ); } #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) - if ( s == myWebView->pageAction( QWebPage::OpenLink ) ) { + if ( s == myWebView->pageAction( WebPage::OpenLink ) ) { #else - if ( s == myWebView->pageAction( QWebPage::OpenLinkInThisWindow ) ) { + if ( s == myWebView->pageAction( WebPage::OpenLinkInThisWindow ) ) { #endif QString fileName = myLastUrl.path(); QString extension = QFileInfo( fileName ).suffix(); diff --git a/src/Qtx/QtxWebBrowser.h b/src/Qtx/QtxWebBrowser.h index fcbdccfa1..5c5ff08ca 100644 --- a/src/Qtx/QtxWebBrowser.h +++ b/src/Qtx/QtxWebBrowser.h @@ -34,16 +34,21 @@ #include #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) -#define QWebView QWebEngineView -#define QWebPage QWebEnginePage +#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) +// Web Kit +#define WebView QWebView +#define WebPage QWebPage +#else +// Web Engine +#define WebView QWebEngineView +#define WebPage QWebEnginePage #endif class QButtonGroup; class QCheckBox; class QLabel; class QPushButton; -class QWebView; +class WebView; class QtxResourceMgr; class QtxSearchTool; @@ -76,9 +81,9 @@ public Q_SLOTS: protected Q_SLOTS: virtual void about(); virtual void linkClicked( const QUrl& ); - virtual void linkHovered( const QString& ); virtual void linkHovered( const QString&, const QString&, const QString& ); - + virtual void linkHovered( const QString&) ; + private Q_SLOTS: void open(); void adjustTitle(); @@ -88,7 +93,7 @@ private Q_SLOTS: private: static QtxWebBrowser* myBrowser; static QtxResourceMgr* myResourceMgr; - QWebView* myWebView; + WebView* myWebView; QtxSearchTool* myFindPanel; QUrl myLastUrl; }; diff --git a/src/Style/Style_Salome.cxx b/src/Style/Style_Salome.cxx index 65e934a86..f0c01a3ed 100644 --- a/src/Style/Style_Salome.cxx +++ b/src/Style/Style_Salome.cxx @@ -201,7 +201,7 @@ Style_Model* Style_Salome::myModel = 0; Use Style_Salome::apply() static function to set SALOME style to the application. */ -Style_Salome::Style_Salome() : QWindowsStyle() +Style_Salome::Style_Salome() : BaseStyle() { // initialize SALOME style resources Q_INIT_RESOURCE( Style ); @@ -321,7 +321,7 @@ Style_Model* Style_Salome::model() */ void Style_Salome::polish ( QApplication* app ) { - QWindowsStyle::polish( app ); + BaseStyle::polish( app ); if ( checkDebugLevel(1) ) { return; @@ -343,7 +343,7 @@ void Style_Salome::polish ( QApplication* app ) void Style_Salome::polish ( QWidget* w ) { if ( checkDebugLevel(2) ) { - QWindowsStyle::polish( w ); + BaseStyle::polish( w ); return; } @@ -356,7 +356,7 @@ void Style_Salome::polish ( QWidget* w ) qobject_cast(w) || qobject_cast(w) ) w->setAttribute( Qt::WA_Hover ); } - QWindowsStyle::polish( w ); + BaseStyle::polish( w ); } /*! @@ -372,7 +372,7 @@ void Style_Salome::polish ( QWidget* w ) void Style_Salome::unpolish( QWidget* w ) { if ( checkDebugLevel(3) ) { - QWindowsStyle::unpolish( w ); + BaseStyle::unpolish( w ); return; } @@ -385,7 +385,7 @@ void Style_Salome::unpolish( QWidget* w ) qobject_cast(w) || qobject_cast(w) ) w->setAttribute( Qt::WA_Hover, false ); } - QWindowsStyle::unpolish( w ); + BaseStyle::unpolish( w ); } /*! @@ -399,7 +399,7 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp QPainter* p, const QWidget* w ) const { if ( checkDebugLevel(4) ) { - QWindowsStyle::drawComplexControl( cc, opt, p, w ); + BaseStyle::drawComplexControl( cc, opt, p, w ); return; } @@ -551,7 +551,7 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp if ((slider->subControls & SC_SliderGroove) && groove.isValid()) { QStyleOptionSlider tmpSlider = *slider; tmpSlider.subControls = SC_SliderGroove; - QWindowsStyle::drawComplexControl(cc, &tmpSlider, p, w); + BaseStyle::drawComplexControl(cc, &tmpSlider, p, w); } if (slider->subControls & SC_SliderTickmarks) { QStyleOptionSlider tmpSlider = *slider; @@ -622,7 +622,7 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp if (w && ( qobject_cast(w->parentWidget() ) || ( toolbutton->state & State_AutoRaise && !( toolbutton->state & State_MouseOver ) ) ) ) { - QWindowsStyle::drawComplexControl( cc, opt, p, w ); + BaseStyle::drawComplexControl( cc, opt, p, w ); return; } int aMinDelta = (int)model()->widgetRounding( Style_Model::ButtonRadius ); @@ -704,7 +704,7 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp } } case CC_TitleBar: { - QWindowsStyle::drawComplexControl( cc, opt, p, w ); + BaseStyle::drawComplexControl( cc, opt, p, w ); break; } case CC_GroupBox: @@ -754,11 +754,11 @@ void Style_Salome::drawComplexControl( ComplexControl cc, const QStyleOptionComp break; } case CC_Dial: { - QWindowsStyle::drawComplexControl( cc, opt, p, w ); + BaseStyle::drawComplexControl( cc, opt, p, w ); break; } default: - QWindowsStyle::drawComplexControl( cc, opt, p, w ); + BaseStyle::drawComplexControl( cc, opt, p, w ); } } @@ -773,7 +773,7 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt, QPainter* p, const QWidget* w ) const { if ( checkDebugLevel(5) ) { - QWindowsStyle::drawControl( ce, opt, p, w ); + BaseStyle::drawControl( ce, opt, p, w ); return; } @@ -902,7 +902,7 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt, break; } case CE_Splitter: { - QWindowsStyle::drawControl( ce, opt, p, w ); + BaseStyle::drawControl( ce, opt, p, w ); QRect r = opt->rect; bool horiz = r.width() > r.height(); int aLen = model()->splitHandleLength(); @@ -959,10 +959,10 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt, } QStyleOptionTab* copyTab = (QStyleOptionTab*)tab; copyTab->rect = oldRect; - QWindowsStyle::drawControl( ce, copyTab, p, w ); + BaseStyle::drawControl( ce, copyTab, p, w ); } else - QWindowsStyle::drawControl( ce, opt, p, w ); + BaseStyle::drawControl( ce, opt, p, w ); break; } case CE_MenuBarItem: @@ -1491,7 +1491,7 @@ void Style_Salome::drawControl( ControlElement ce, const QStyleOption* opt, break; } default: - QWindowsStyle::drawControl( ce, opt, p, w ); + BaseStyle::drawControl( ce, opt, p, w ); break; } } @@ -1507,7 +1507,7 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, QPainter* p, const QWidget* w ) const { if ( checkDebugLevel(6) ) { - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + BaseStyle::drawPrimitive( pe, opt, p, w ); return; } @@ -1547,7 +1547,7 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, break; } else - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + BaseStyle::drawPrimitive( pe, opt, p, w ); } break; case PE_FrameFocusRect: { @@ -1563,7 +1563,7 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, aBrdTopCol, aBrdBotCol, false, false, isHover, true ); } else { - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + BaseStyle::drawPrimitive( pe, opt, p, w ); } break; } @@ -1830,7 +1830,7 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, break; } case PE_Widget: { - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + BaseStyle::drawPrimitive( pe, opt, p, w ); if ( !w ) break; @@ -1845,7 +1845,7 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, = qstyleoption_cast(opt)) { if (tbb->shape != QTabBar::RoundedNorth && tbb->shape != QTabBar::RoundedEast && tbb->shape != QTabBar::RoundedSouth && tbb->shape != QTabBar::RoundedWest) { - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + BaseStyle::drawPrimitive( pe, opt, p, w ); break; } QRect aSelRect = tbb->selectedTabRect; @@ -1961,11 +1961,11 @@ void Style_Salome::drawPrimitive( PrimitiveElement pe, const QStyleOption* opt, aPal.setBrush( QPalette::AlternateBase, QBrush( gr_alt ) ); aWdg->setPalette( aPal ); } - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + BaseStyle::drawPrimitive( pe, opt, p, w ); break; } default: - QWindowsStyle::drawPrimitive( pe, opt, p, w ); + BaseStyle::drawPrimitive( pe, opt, p, w ); } } @@ -1980,9 +1980,9 @@ int Style_Salome::pixelMetric( PixelMetric metric, const QStyleOption* opt, const QWidget* w ) const { if ( checkDebugLevel(7) ) { - return QWindowsStyle::pixelMetric( metric, opt, w ); + return BaseStyle::pixelMetric( metric, opt, w ); } - int aRes = QWindowsStyle::pixelMetric( metric, opt, w ); + int aRes = BaseStyle::pixelMetric( metric, opt, w ); switch( metric ) { case PM_SliderLength: { aRes += (int)((double)model()->sliderSize()/2); @@ -2019,9 +2019,9 @@ QSize Style_Salome::sizeFromContents( ContentsType ct, const QStyleOption* opt, const QSize& contentsSize, const QWidget* w ) const { if ( checkDebugLevel(8) ) { - return QWindowsStyle::sizeFromContents( ct, opt,contentsSize, w ); + return BaseStyle::sizeFromContents( ct, opt,contentsSize, w ); } - QSize sz = QWindowsStyle::sizeFromContents( ct, opt, contentsSize, w ); + QSize sz = BaseStyle::sizeFromContents( ct, opt, contentsSize, w ); switch (ct) { case CT_TabBarTab: if (const QStyleOptionTab *tab = qstyleoption_cast(opt)) { @@ -2051,7 +2051,7 @@ QSize Style_Salome::sizeFromContents( ContentsType ct, const QStyleOption* opt, int aHalfRect = (int)Style_Tools::getMaxRect( res, (int)model()->widgetRounding( Style_Model::EditRadius )/2 ); // left value - QRect old_arrow = QWindowsStyle::subControlRect( CC_ComboBox, cmb, + QRect old_arrow = BaseStyle::subControlRect( CC_ComboBox, cmb, SC_ComboBoxArrow, w ); int aDelta = res.height() - old_arrow.width(); // right value if ( cmb->editable ) @@ -2076,7 +2076,7 @@ QPixmap Style_Salome::standardPixmap(StandardPixmap stPixmap, const QStyleOption const QWidget *w) const { if ( checkDebugLevel(9) ) { - return QWindowsStyle::standardPixmap( stPixmap, opt, w ); + return BaseStyle::standardPixmap( stPixmap, opt, w ); } switch ( stPixmap ) @@ -2091,7 +2091,7 @@ QPixmap Style_Salome::standardPixmap(StandardPixmap stPixmap, const QStyleOption case SP_TitleBarMinButton: return QPixmap( minimize_xpm ); default: - return QWindowsStyle::standardPixmap( stPixmap, opt, w ); + return BaseStyle::standardPixmap( stPixmap, opt, w ); } } @@ -2108,7 +2108,7 @@ QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon, { if ( checkDebugLevel(10) ) { #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - return QWindowsStyle::standardIconImplementation( standardIcon, opt, w ); + return BaseStyle::standardIconImplementation( standardIcon, opt, w ); #else return QCommonStyle::standardIcon( standardIcon, opt, w ); #endif @@ -2128,9 +2128,9 @@ QIcon Style_Salome::standardIconImplementation( StandardPixmap standardIcon, break; } #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - return QWindowsStyle::standardIconImplementation( standardIcon, opt, w ); + return BaseStyle::standardIconImplementation( standardIcon, opt, w ); #else - return QCommonStyle::standardIcon( standardIcon, opt, w ); + return BaseStyle::standardIcon( standardIcon, opt, w ); #endif } @@ -2147,9 +2147,9 @@ int Style_Salome::styleHint( StyleHint hint, const QStyleOption* opt, const QWid QStyleHintReturn* returnData ) const { if ( checkDebugLevel(11) ) { - return QWindowsStyle::styleHint( hint, opt, w, returnData ); + return BaseStyle::styleHint( hint, opt, w, returnData ); } - int aRes = QWindowsStyle::styleHint( hint, opt, w, returnData ); + int aRes = BaseStyle::styleHint( hint, opt, w, returnData ); switch( hint ) { case SH_Table_GridLineColor: { if ( opt ) @@ -2178,14 +2178,14 @@ QRect Style_Salome::subControlRect( ComplexControl cc, const QStyleOptionComplex SubControl sc, const QWidget* wid ) const { if ( checkDebugLevel(12) ) { - return QWindowsStyle::subControlRect( cc, opt, sc, wid ); + return BaseStyle::subControlRect( cc, opt, sc, wid ); } - QRect res = QWindowsStyle::subControlRect( cc, opt, sc, wid ); + QRect res = BaseStyle::subControlRect( cc, opt, sc, wid ); switch ( cc ) { case CC_SpinBox: { int x = res.x(), w = res.width(), h = res.height(); if ( sc==SC_SpinBoxUp || sc==SC_SpinBoxDown ) { - QRect frame_r = QWindowsStyle::subControlRect( cc, opt, SC_SpinBoxFrame, wid ); + QRect frame_r = BaseStyle::subControlRect( cc, opt, SC_SpinBoxFrame, wid ); h = frame_r.height(); res.setX( x+w-h ); res.setWidth( h ); @@ -2221,7 +2221,7 @@ QRect Style_Salome::subControlRect( ComplexControl cc, const QStyleOptionComplex } case CC_ScrollBar: if (const QStyleOptionSlider *scrollbar = qstyleoption_cast(opt)) { - QRect slider_r = QWindowsStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid ); + QRect slider_r = BaseStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid ); int aRect = Style_Tools::getMaxRect( slider_r, (int)model()->widgetRounding( Style_Model::ButtonRadius ) ); switch( sc ) { case SC_ScrollBarSubPage: // between top/left button and slider @@ -2275,16 +2275,16 @@ QRect Style_Salome::subElementRect( SubElement se, const QStyleOption* opt, const QWidget* wid ) const { if ( checkDebugLevel(13) ) { - return QWindowsStyle::subElementRect( se, opt, wid ); + return BaseStyle::subElementRect( se, opt, wid ); } - QRect res = QWindowsStyle::subElementRect( se, opt, wid ); + QRect res = BaseStyle::subElementRect( se, opt, wid ); int aHalfRect = (int)Style_Tools::getMaxRect( res, (int)model()->widgetRounding( Style_Model::EditRadius )/2 ); int w = res.width(), h = res.height(); switch ( se ) { case SE_ComboBoxFocusRect: { - QRect old_r = QWindowsStyle::subControlRect( CC_ComboBox, + QRect old_r = BaseStyle::subControlRect( CC_ComboBox, qstyleoption_cast( opt ), SC_ComboBoxArrow, wid ); int old_w = old_r.width(); diff --git a/src/Style/Style_Salome.h b/src/Style/Style_Salome.h index ad2ad9066..179c8dd3a 100644 --- a/src/Style/Style_Salome.h +++ b/src/Style/Style_Salome.h @@ -27,9 +27,10 @@ #include "Style.h" #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #include +#define BaseStyle QWindowsStyle #else #include -#define QWindowsStyle QCommonStyle +#define BaseStyle QCommonStyle #endif class Style_Model; @@ -38,7 +39,7 @@ class QWidget; class QPainter; class QtxResourceMgr; -class STYLE_SALOME_EXPORT Style_Salome : public QWindowsStyle +class STYLE_SALOME_EXPORT Style_Salome : public BaseStyle { Q_OBJECT