Ensure QgsPropertyOverrideButtons always look correct

We shouldn't require the main window stylesheet to be applied
for these buttons to look right
This commit is contained in:
Nyall Dawson 2024-07-15 11:40:17 +10:00
parent 1d206075c4
commit eaf84540fd
2 changed files with 6 additions and 5 deletions

View File

@ -171,11 +171,6 @@ void QgisAppStyleSheet::applyStyleSheet( const QMap<QString, QVariant> &opts )
"}" )
.arg( palette.highlight().color().name(),
palette.highlightedText().color().name() );
ss += QLatin1String( "QgsPropertyOverrideButton { background: none; border: 1px solid rgba(0, 0, 0, 0%); } QgsPropertyOverrideButton:focus { border: 1px solid palette(highlight); }" );
#ifdef Q_OS_MACX
ss += QLatin1String( "QgsPropertyOverrideButton::menu-indicator { width: 5px; }" );
#endif
}
QgsDebugMsgLevel( QStringLiteral( "Stylesheet built: %1" ).arg( ss ), 2 );

View File

@ -42,6 +42,12 @@ QgsPropertyOverrideButton::QgsPropertyOverrideButton( QWidget *parent,
{
setFocusPolicy( Qt::StrongFocus );
QString ss = QStringLiteral( "QgsPropertyOverrideButton { background: none; border: 1px solid rgba(0, 0, 0, 0%); } QgsPropertyOverrideButton:focus { border: 1px solid palette(highlight); }" );
#ifdef Q_OS_MACX
ss += QLatin1String( "QgsPropertyOverrideButton::menu-indicator { width: 5px; }" );
#endif
setStyleSheet( ss );
int iconSize = QgsGuiUtils::scaleIconSize( 24 );
// button width is 1.25 * icon size, height 1.1 * icon size. But we round to ensure even pixel sizes for equal margins