Skip to content
Permalink
Browse files

Fix some more inconsistent status bar fonts

  • Loading branch information
nyalldawson committed Oct 26, 2018
1 parent b150554 commit 7f484aba3bdd6c41d1da1512853f2f160925f63a
@@ -88,6 +88,12 @@ Removes any temporary message being shown.
.. seealso:: :py:func:`showMessage`
%End


protected:

virtual void changeEvent( QEvent *event );


};


@@ -3000,7 +3000,13 @@ void QgisApp::createStatusBar()
//remove borders from children under Windows
statusBar()->setStyleSheet( QStringLiteral( "QStatusBar::item {border: none;}" ) );

// Drop the font size in the status bar by a couple of points
QFont statusBarFont = font();
statusBarFont.setPointSize( statusBarFont.pointSize() - 2 );
statusBar()->setFont( statusBarFont );

mStatusBar = new QgsStatusBar();
mStatusBar->setFont( statusBarFont );

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

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

mTaskManagerWidget = new QgsTaskManagerStatusBarWidget( QgsApplication::taskManager(), mStatusBar );
mTaskManagerWidget->setFont( statusBarFont );
mStatusBar->addPermanentWidget( mTaskManagerWidget, 0 );

// Drop the font size in the status bar by a couple of points
QFont statusBarFont = font();
statusBarFont.setPointSize( statusBarFont.pointSize() - 2 );
statusBar()->setFont( statusBarFont );

//coords status bar widget
mCoordsEdit = new QgsStatusBarCoordinatesWidget( mStatusBar );
mCoordsEdit->setObjectName( QStringLiteral( "mCoordsEdit" ) );
@@ -20,6 +20,7 @@
#include <QLineEdit>
#include <QPalette>
#include <QTimer>
#include <QEvent>

QgsStatusBar::QgsStatusBar( QWidget *parent )
: QWidget( parent )
@@ -89,3 +90,13 @@ void QgsStatusBar::clearMessage()
{
mLineEdit->setText( QString() );
}

void QgsStatusBar::changeEvent( QEvent *event )
{
QWidget::changeEvent( event );

if ( event->type() == QEvent::FontChange )
{
mLineEdit->setFont( font() );
}
}
@@ -100,6 +100,11 @@ class GUI_EXPORT QgsStatusBar : public QWidget
*/
void clearMessage();


protected:

void changeEvent( QEvent *event ) override;

private:

QHBoxLayout *mLayout = nullptr;
@@ -609,11 +609,21 @@ QgsTaskManagerStatusBarWidget::QgsTaskManagerStatusBarWidget( QgsTaskManager *ma

QSize QgsTaskManagerStatusBarWidget::sizeHint() const
{
int width = static_cast< int >( fontMetrics().width( 'X' ) * 10 * Qgis::UI_SCALE_FACTOR );
int width = static_cast< int >( fontMetrics().width( 'X' ) * 20 * Qgis::UI_SCALE_FACTOR );
int height = QToolButton::sizeHint().height();
return QSize( width, height );
}

void QgsTaskManagerStatusBarWidget::changeEvent( QEvent *event )
{
QToolButton::changeEvent( event );

if ( event->type() == QEvent::FontChange )
{
mProgressBar->setFont( font() );
}
}

void QgsTaskManagerStatusBarWidget::toggleDisplay()
{
if ( mFloatingWidget->isVisible() )
@@ -113,6 +113,10 @@ class GUI_EXPORT QgsTaskManagerStatusBarWidget : public QToolButton

QSize sizeHint() const override;

protected:

void changeEvent( QEvent *event ) override;

private slots:

void toggleDisplay();

0 comments on commit 7f484ab

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