Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dakcarto committed Nov 26, 2017
1 parent 4f9e2a5 commit a111a1c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions images/images.qrc
Expand Up @@ -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>
Expand Down
5 changes: 5 additions & 0 deletions images/themes/default/mIconCloseTab.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions images/themes/default/mIconCloseTabHover.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/app/qgisappstylesheet.cpp
Expand Up @@ -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 ) );
Expand Down

0 comments on commit a111a1c

Please sign in to comment.