Skip to content

Commit 7f484ab

Browse files
committed
Fix some more inconsistent status bar fonts
1 parent b150554 commit 7f484ab

File tree

6 files changed

+44
-6
lines changed

6 files changed

+44
-6
lines changed

python/gui/auto_generated/qgsstatusbar.sip.in

+6
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ Removes any temporary message being shown.
8888
.. seealso:: :py:func:`showMessage`
8989
%End
9090

91+
92+
protected:
93+
94+
virtual void changeEvent( QEvent *event );
95+
96+
9197
};
9298

9399

src/app/qgisapp.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -3000,7 +3000,13 @@ void QgisApp::createStatusBar()
30003000
//remove borders from children under Windows
30013001
statusBar()->setStyleSheet( QStringLiteral( "QStatusBar::item {border: none;}" ) );
30023002

3003+
// Drop the font size in the status bar by a couple of points
3004+
QFont statusBarFont = font();
3005+
statusBarFont.setPointSize( statusBarFont.pointSize() - 2 );
3006+
statusBar()->setFont( statusBarFont );
3007+
30033008
mStatusBar = new QgsStatusBar();
3009+
mStatusBar->setFont( statusBarFont );
30043010

30053011
statusBar()->addPermanentWidget( mStatusBar, 10 );
30063012

@@ -3017,13 +3023,9 @@ void QgisApp::createStatusBar()
30173023
connect( mMapCanvas, &QgsMapCanvas::mapCanvasRefreshed, this, &QgisApp::canvasRefreshFinished );
30183024

30193025
mTaskManagerWidget = new QgsTaskManagerStatusBarWidget( QgsApplication::taskManager(), mStatusBar );
3026+
mTaskManagerWidget->setFont( statusBarFont );
30203027
mStatusBar->addPermanentWidget( mTaskManagerWidget, 0 );
30213028

3022-
// Drop the font size in the status bar by a couple of points
3023-
QFont statusBarFont = font();
3024-
statusBarFont.setPointSize( statusBarFont.pointSize() - 2 );
3025-
statusBar()->setFont( statusBarFont );
3026-
30273029
//coords status bar widget
30283030
mCoordsEdit = new QgsStatusBarCoordinatesWidget( mStatusBar );
30293031
mCoordsEdit->setObjectName( QStringLiteral( "mCoordsEdit" ) );

src/gui/qgsstatusbar.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <QLineEdit>
2121
#include <QPalette>
2222
#include <QTimer>
23+
#include <QEvent>
2324

2425
QgsStatusBar::QgsStatusBar( QWidget *parent )
2526
: QWidget( parent )
@@ -89,3 +90,13 @@ void QgsStatusBar::clearMessage()
8990
{
9091
mLineEdit->setText( QString() );
9192
}
93+
94+
void QgsStatusBar::changeEvent( QEvent *event )
95+
{
96+
QWidget::changeEvent( event );
97+
98+
if ( event->type() == QEvent::FontChange )
99+
{
100+
mLineEdit->setFont( font() );
101+
}
102+
}

src/gui/qgsstatusbar.h

+5
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ class GUI_EXPORT QgsStatusBar : public QWidget
100100
*/
101101
void clearMessage();
102102

103+
104+
protected:
105+
106+
void changeEvent( QEvent *event ) override;
107+
103108
private:
104109

105110
QHBoxLayout *mLayout = nullptr;

src/gui/qgstaskmanagerwidget.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,21 @@ QgsTaskManagerStatusBarWidget::QgsTaskManagerStatusBarWidget( QgsTaskManager *ma
609609

610610
QSize QgsTaskManagerStatusBarWidget::sizeHint() const
611611
{
612-
int width = static_cast< int >( fontMetrics().width( 'X' ) * 10 * Qgis::UI_SCALE_FACTOR );
612+
int width = static_cast< int >( fontMetrics().width( 'X' ) * 20 * Qgis::UI_SCALE_FACTOR );
613613
int height = QToolButton::sizeHint().height();
614614
return QSize( width, height );
615615
}
616616

617+
void QgsTaskManagerStatusBarWidget::changeEvent( QEvent *event )
618+
{
619+
QToolButton::changeEvent( event );
620+
621+
if ( event->type() == QEvent::FontChange )
622+
{
623+
mProgressBar->setFont( font() );
624+
}
625+
}
626+
617627
void QgsTaskManagerStatusBarWidget::toggleDisplay()
618628
{
619629
if ( mFloatingWidget->isVisible() )

src/gui/qgstaskmanagerwidget.h

+4
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ class GUI_EXPORT QgsTaskManagerStatusBarWidget : public QToolButton
113113

114114
QSize sizeHint() const override;
115115

116+
protected:
117+
118+
void changeEvent( QEvent *event ) override;
119+
116120
private slots:
117121

118122
void toggleDisplay();

0 commit comments

Comments
 (0)