Fix macOS Qt 5.9+ close boxes do not show on document mode tab bar tabs

Setting any stylesheet makes the default close button disappear.
Setting a custom close button temporarily works around issue.

See: https://bugreports.qt.io/browse/QTBUG-61092
     https://bugreports.qt.io/browse/QTBUG-61742
This commit is contained in:
Larry Shaffer 2017-11-09 19:13:07 -07:00 committed by Larry Shaffer
parent 4f9e2a5f29
commit a111a1cbe4
4 changed files with 27 additions and 0 deletions

View File

@ -365,6 +365,8 @@
<file>themes/default/mIconColorWheel.svg</file>
<file>themes/default/mIconConnect.png</file>
<file>themes/default/mIconClose.svg</file>
<file>themes/default/mIconCloseTab.svg</file>
<file>themes/default/mIconCloseTabHover.svg</file>
<file>themes/default/mIconCritical.png</file>
<file>themes/default/mIconDataDefine.svg</file>
<file>themes/default/mIconDataDefineError.svg</file>

View File

@ -0,0 +1,5 @@
<svg enable-background="new 0 0 32 32" height="32" viewBox="0 0 32 32" width="32" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="32" height="32" style="fill:#fff;fill-opacity:0;"/>
<path d="M16,1.778c-7.436,0 -13.463,6.028 -13.463,13.463c0,7.435 6.027,13.463 13.463,13.463c7.434,0 13.463,-6.028 13.463,-13.463c0,-7.435 -6.029,-13.463 -13.463,-13.463Zm6.965,17.89c0.701,0.701 0.701,1.837 0,2.538c-0.351,0.351 -0.81,0.526 -1.269,0.526c-0.46,0 -0.918,-0.175 -1.269,-0.526l-4.427,-4.427l-4.426,4.427c-0.35,0.351 -0.809,0.526 -1.269,0.526c-0.46,0 -0.919,-0.176 -1.269,-0.526c-0.701,-0.701 -0.701,-1.837 0,-2.538l4.426,-4.427l-4.426,-4.426c-0.701,-0.701 -0.701,-1.837 0,-2.538c0.7,-0.701 1.838,-0.701 2.538,0l4.426,4.426l4.427,-4.426c0.701,-0.701 1.837,-0.701 2.538,0c0.701,0.701 0.701,1.837 0,2.538l-4.427,4.426l4.427,4.427Z" opacity=".65"/>
<path d="M18.538,15.24l4.427,-4.425c0.701,-0.701 0.701,-1.838 0,-2.539c-0.701,-0.701 -1.837,-0.701 -2.538,0l-4.427,4.426l-4.426,-4.426c-0.7,-0.701 -1.838,-0.701 -2.538,0c-0.701,0.701 -0.701,1.838 0,2.539l4.426,4.425l-4.426,4.427c-0.701,0.701 -0.701,1.838 0,2.539c0.35,0.35 0.809,0.526 1.269,0.526c0.46,0 0.919,-0.176 1.269,-0.526l4.426,-4.427l4.427,4.427c0.351,0.35 0.809,0.526 1.269,0.526c0.459,0 0.918,-0.176 1.269,-0.526c0.701,-0.701 0.701,-1.838 0,-2.539l-4.427,-4.427Z" fill="#A0A0A0" opacity=".9"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,5 @@
<svg enable-background="new 0 0 32 32" height="32" viewBox="0 0 32 32" width="32" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="32" height="32" style="fill:#fff;fill-opacity:0;"/>
<path d="M16,1.778c-7.436,0 -13.463,6.028 -13.463,13.463c0,7.435 6.027,13.463 13.463,13.463c7.434,0 13.463,-6.028 13.463,-13.463c0,-7.435 -6.029,-13.463 -13.463,-13.463Zm6.965,17.89c0.701,0.701 0.701,1.837 0,2.538c-0.351,0.351 -0.81,0.526 -1.269,0.526c-0.46,0 -0.918,-0.175 -1.269,-0.526l-4.427,-4.427l-4.426,4.427c-0.35,0.351 -0.809,0.526 -1.269,0.526c-0.46,0 -0.919,-0.176 -1.269,-0.526c-0.701,-0.701 -0.701,-1.837 0,-2.538l4.426,-4.427l-4.426,-4.426c-0.701,-0.701 -0.701,-1.837 0,-2.538c0.7,-0.701 1.838,-0.701 2.538,0l4.426,4.426l4.427,-4.426c0.701,-0.701 1.837,-0.701 2.538,0c0.701,0.701 0.701,1.837 0,2.538l-4.427,4.426l4.427,4.427Z" opacity=".50"/>
<path d="M18.538,15.24l4.427,-4.425c0.701,-0.701 0.701,-1.838 0,-2.539c-0.701,-0.701 -1.837,-0.701 -2.538,0l-4.427,4.426l-4.426,-4.426c-0.7,-0.701 -1.838,-0.701 -2.538,0c-0.701,0.701 -0.701,1.838 0,2.539l4.426,4.425l-4.426,4.427c-0.701,0.701 -0.701,1.838 0,2.539c0.35,0.35 0.809,0.526 1.269,0.526c0.46,0 0.919,-0.176 1.269,-0.526l4.426,-4.427l4.427,4.427c0.351,0.35 0.809,0.526 1.269,0.526c0.459,0 0.918,-0.176 1.269,-0.526c0.701,-0.701 0.701,-1.838 0,-2.539l-4.427,-4.427Z" fill="#A0A0A0" opacity=".9"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -104,6 +104,21 @@ void QgisAppStyleSheet::buildStyleSheet( const QMap<QString, QVariant> &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 ) );