@@ -44,7 +44,9 @@ QgsMessageBar::QgsMessageBar( QWidget *parent )
44
44
setFrameShadow ( QFrame::Plain );
45
45
46
46
mLayout = new QGridLayout ( this );
47
- mLayout ->setContentsMargins ( 9 , 1 , 9 , 1 );
47
+ const int xMargin = std::max ( 9.0 , Qgis::UI_SCALE_FACTOR * fontMetrics ().height () * 0.45 );
48
+ const int yMargin = std::max ( 1.0 , Qgis::UI_SCALE_FACTOR * fontMetrics ().height () * 0.05 );
49
+ mLayout ->setContentsMargins ( xMargin, yMargin, xMargin, yMargin );
48
50
setLayout ( mLayout );
49
51
50
52
mCountProgress = new QProgressBar ( this );
@@ -55,7 +57,9 @@ QgsMessageBar::QgsMessageBar( QWidget *parent )
55
57
56
58
mCountProgress ->setStyleSheet ( mCountStyleSheet .arg ( QStringLiteral ( " mIconTimerPause.svg" ) ) );
57
59
mCountProgress ->setObjectName ( QStringLiteral ( " mCountdown" ) );
58
- mCountProgress ->setFixedSize ( 25 , 14 );
60
+ const int barWidth = std::max ( 25.0 , Qgis::UI_SCALE_FACTOR * fontMetrics ().height () * 1.25 );
61
+ const int barHeight = std::max ( 14.0 , Qgis::UI_SCALE_FACTOR * fontMetrics ().height () * 0.7 );
62
+ mCountProgress ->setFixedSize ( barWidth, barHeight );
59
63
mCountProgress ->setSizePolicy ( QSizePolicy::Fixed, QSizePolicy::Fixed );
60
64
mCountProgress ->setTextVisible ( false );
61
65
mCountProgress ->setRange ( 0 , 5 );
@@ -83,7 +87,9 @@ QgsMessageBar::QgsMessageBar( QWidget *parent )
83
87
" QToolButton::menu-button { background-color: rgba(0, 0, 0, 0); }" );
84
88
mCloseBtn ->setCursor ( Qt::PointingHandCursor );
85
89
mCloseBtn ->setIcon ( QgsApplication::getThemeIcon ( QStringLiteral ( " /mIconClose.svg" ) ) );
86
- mCloseBtn ->setIconSize ( QSize ( 18 , 18 ) );
90
+
91
+ const int iconSize = std::max ( 18.0 , Qgis::UI_SCALE_FACTOR * fontMetrics ().height () * 0.9 );
92
+ mCloseBtn ->setIconSize ( QSize ( iconSize, iconSize ) );
87
93
mCloseBtn ->setSizePolicy ( QSizePolicy::Maximum, QSizePolicy::Maximum );
88
94
mCloseBtn ->setMenu ( mCloseMenu );
89
95
mCloseBtn ->setPopupMode ( QToolButton::MenuButtonPopup );
0 commit comments