Skip to content
Permalink
Browse files

Hidpi friendly message bar icon sizes

  • Loading branch information
nyalldawson committed Nov 1, 2018
1 parent 26c3dd3 commit e83aa5a200ebad78916f26ab291bcc5915291863
Showing with 11 additions and 4 deletions.
  1. +9 −3 src/gui/qgsmessagebar.cpp
  2. +2 −1 src/gui/qgsmessagebaritem.cpp
@@ -44,7 +44,9 @@ QgsMessageBar::QgsMessageBar( QWidget *parent )
setFrameShadow( QFrame::Plain );

mLayout = new QGridLayout( this );
mLayout->setContentsMargins( 9, 1, 9, 1 );
const int xMargin = std::max( 9.0, Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 0.45 );
const int yMargin = std::max( 1.0, Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 0.05 );
mLayout->setContentsMargins( xMargin, yMargin, xMargin, yMargin );
setLayout( mLayout );

mCountProgress = new QProgressBar( this );
@@ -55,7 +57,9 @@ QgsMessageBar::QgsMessageBar( QWidget *parent )

mCountProgress->setStyleSheet( mCountStyleSheet.arg( QStringLiteral( "mIconTimerPause.svg" ) ) );
mCountProgress->setObjectName( QStringLiteral( "mCountdown" ) );
mCountProgress->setFixedSize( 25, 14 );
const int barWidth = std::max( 25.0, Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 1.25 );
const int barHeight = std::max( 14.0, Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 0.7 );
mCountProgress->setFixedSize( barWidth, barHeight );
mCountProgress->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
mCountProgress->setTextVisible( false );
mCountProgress->setRange( 0, 5 );
@@ -83,7 +87,9 @@ QgsMessageBar::QgsMessageBar( QWidget *parent )
"QToolButton::menu-button { background-color: rgba(0, 0, 0, 0); }" );
mCloseBtn->setCursor( Qt::PointingHandCursor );
mCloseBtn->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mIconClose.svg" ) ) );
mCloseBtn->setIconSize( QSize( 18, 18 ) );

const int iconSize = std::max( 18.0, Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 0.9 );
mCloseBtn->setIconSize( QSize( iconSize, iconSize ) );
mCloseBtn->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
mCloseBtn->setMenu( mCloseMenu );
mCloseBtn->setPopupMode( QToolButton::MenuButtonPopup );
@@ -109,7 +109,8 @@ void QgsMessageBarItem::writeContent()
}
icon = QgsApplication::getThemeIcon( msgIcon );
}
mLblIcon->setPixmap( icon.pixmap( 24 ) );
const int iconSize = std::max( 24.0, fontMetrics().height() * 1.2 );
mLblIcon->setPixmap( icon.pixmap( iconSize ) );


// STYLESHEETS

0 comments on commit e83aa5a

Please sign in to comment.
You can’t perform that action at this time.