diff --git a/images/images.qrc b/images/images.qrc index 13c0e6edff2..3786c58088c 100644 --- a/images/images.qrc +++ b/images/images.qrc @@ -365,6 +365,8 @@ themes/default/mIconColorWheel.svg themes/default/mIconConnect.png themes/default/mIconClose.svg + themes/default/mIconCloseTab.svg + themes/default/mIconCloseTabHover.svg themes/default/mIconCritical.png themes/default/mIconDataDefine.svg themes/default/mIconDataDefineError.svg diff --git a/images/themes/default/mIconCloseTab.svg b/images/themes/default/mIconCloseTab.svg new file mode 100644 index 00000000000..81e041dcae1 --- /dev/null +++ b/images/themes/default/mIconCloseTab.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/images/themes/default/mIconCloseTabHover.svg b/images/themes/default/mIconCloseTabHover.svg new file mode 100644 index 00000000000..11994ec3815 --- /dev/null +++ b/images/themes/default/mIconCloseTabHover.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/app/qgisappstylesheet.cpp b/src/app/qgisappstylesheet.cpp index 710a3684915..937e9c446fe 100644 --- a/src/app/qgisappstylesheet.cpp +++ b/src/app/qgisappstylesheet.cpp @@ -104,6 +104,21 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap &opts ) ss += QStringLiteral( "* { font: %1pt \"%2\"} " ).arg( fontSize, fontFamily ); +#if QT_VERSION >= 0x050900 + // Fix for macOS Qt 5.9+, where close boxes do not show on document mode tab bar tabs + // See: https://bugreports.qt.io/browse/QTBUG-61092 + // https://bugreports.qt.io/browse/QTBUG-61742 + // Setting any stylesheet makes the default close button disappear. + // Specifically setting a custom close button temporarily works around issue. + // TODO: Remove when regression is fixed (Qt 5.9.3 or 5.10?); though hard to tell, + // since we are overriding the default close button image now. + if ( mMacStyle ) + { + ss += QLatin1String( "QTabBar::close-button{ image: url(:/images/themes/default/mIconCloseTab.svg); }" ); + ss += QLatin1String( "QTabBar::close-button:hover{ image: url(:/images/themes/default/mIconCloseTabHover.svg); }" ); + } +#endif + // QGroupBox and QgsCollapsibleGroupBox, mostly for Ubuntu and Mac bool gbxCustom = opts.value( QStringLiteral( "groupBoxCustom" ) ).toBool(); QgsDebugMsg( QString( "groupBoxCustom: %1" ).arg( gbxCustom ) );