Skip to content

Commit

Permalink
Don't hardcode arial font for georeferencer status bar text
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 2, 2022
1 parent e870bfe commit 35608f6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/app/georeferencer/qgsgeorefmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1103,9 +1103,8 @@ void QgsGeoreferencerMainWindow::createDockWidgets()

QLabel *QgsGeoreferencerMainWindow::createBaseLabelStatus()
{
QFont myFont( QStringLiteral( "Arial" ), 9 );
QLabel *label = new QLabel( statusBar() );
label->setFont( myFont );
label->setFont( statusBarFont() );
label->setMinimumWidth( 10 );
label->setMaximumHeight( 20 );
label->setMargin( 3 );
Expand All @@ -1114,8 +1113,24 @@ QLabel *QgsGeoreferencerMainWindow::createBaseLabelStatus()
return label;
}

QFont QgsGeoreferencerMainWindow::statusBarFont()
{
// Drop the font size in the status bar by a couple of points (match main window)
QFont barFont = font();
int fontSize = barFont.pointSize();
#ifdef Q_OS_WIN
fontSize = std::max( fontSize - 1, 8 ); // bit less on windows, due to poor rendering of small point sizes
#else
fontSize = std::max( fontSize - 2, 6 );
#endif
barFont.setPointSize( fontSize );
return barFont;
}

void QgsGeoreferencerMainWindow::createStatusBar()
{
statusBar()->setFont( statusBarFont() );

// add a widget to show/set current rotation
mRotationLabel = createBaseLabelStatus();
mRotationLabel->setObjectName( QStringLiteral( "mRotationLabel" ) );
Expand Down
1 change: 1 addition & 0 deletions src/app/georeferencer/qgsgeorefmainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class QgsGeoreferencerMainWindow : public QMainWindow, private Ui::QgsGeorefPlug
void createMenus();
void createDockWidgets();
QLabel *createBaseLabelStatus();
QFont statusBarFont();
void createStatusBar();
void setupConnections();
void removeOldLayer();
Expand Down

0 comments on commit 35608f6

Please sign in to comment.