Fix minimum height of font buttons on non-Windows platforms

This commit is contained in:
Nyall Dawson 2017-07-07 16:50:03 +10:00
parent b500080a31
commit 0802586a13
3 changed files with 14 additions and 0 deletions

View File

@ -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.

View File

@ -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 )

View File

@ -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()