Skip to content

Commit

Permalink
Fix minimum height of font buttons on non-Windows platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 7, 2017
1 parent b500080 commit 0802586
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/gui/qgsfontbutton.sip
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class QgsFontButton : QToolButton
Use ``dialogTitle`` string to define the title to show in the text settings dialog.
%End

virtual QSize minimumSizeHint() const;

QgsFontButton::Mode mode() const;
%Docstring
Returns the current button mode.
Expand Down
10 changes: 10 additions & 0 deletions src/gui/qgsfontbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ QgsFontButton::QgsFontButton( QWidget *parent, const QString &dialogTitle )
setPopupMode( QToolButton::MenuButtonPopup );
}

QSize QgsFontButton::minimumSizeHint() const
{
//make sure height of button looks good under different platforms
#ifdef Q_OS_WIN
return QToolButton::minimumSizeHint();
#else
return QSize( 120, 28 );
#endif
}

void QgsFontButton::showSettingsDialog()
{
switch ( mMode )
Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsfontbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class GUI_EXPORT QgsFontButton : public QToolButton
*/
QgsFontButton( QWidget *parent SIP_TRANSFERTHIS = nullptr, const QString &dialogTitle = QString() );

virtual QSize minimumSizeHint() const override;

/**
* Returns the current button mode.
* \see setMode()
Expand Down

0 comments on commit 0802586

Please sign in to comment.