Skip to content
Permalink
Browse files

Fix size of some color widgets on hidpi displays

  • Loading branch information
nyalldawson committed Jul 25, 2017
1 parent aacc316 commit f121286e38e5180e47775c53921d6d8d5fae8b82
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/gui/qgscolorwidgets.cpp
@@ -397,7 +397,8 @@ QgsColorWheel::~QgsColorWheel()

QSize QgsColorWheel::sizeHint() const
{
return QSize( 200, 200 );
int size = fontMetrics().width( QStringLiteral( "XXXXXXXXXXXXXXXXXXXXXX" ) );
return QSize( size, size );
}

void QgsColorWheel::paintEvent( QPaintEvent *event )
@@ -757,7 +758,8 @@ QgsColorBox::~QgsColorBox()

QSize QgsColorBox::sizeHint() const
{
return QSize( 200, 200 );
int size = fontMetrics().width( QStringLiteral( "XXXXXXXXXXXXXXXXXXXXXX" ) );
return QSize( size, size );
}

void QgsColorBox::paintEvent( QPaintEvent *event )
@@ -989,12 +991,12 @@ QSize QgsColorRampWidget::sizeHint() const
if ( mOrientation == QgsColorRampWidget::Horizontal )
{
//horizontal
return QSize( 200, 28 );
return QSize( fontMetrics().width( QStringLiteral( "XXXXXXXXXXXXXXXXXXXXXX" ) ), fontMetrics().height() * 1.3 );
}
else
{
//vertical
return QSize( 18, 200 );
return QSize( fontMetrics().height() * 1.3, fontMetrics().width( QStringLiteral( "XXXXXXXXXXXXXXXXXXXXXX" ) ) );
}
}

@@ -1596,7 +1598,7 @@ void QgsColorPreviewWidget::paintEvent( QPaintEvent *event )

QSize QgsColorPreviewWidget::sizeHint() const
{
return QSize( 200, 150 );
return QSize( fontMetrics().width( QStringLiteral( "XXXXXXXXXXXXXXXXXXXXXX" ) ), fontMetrics().width( QStringLiteral( "XXXXXXXXXXXXXXXXXXXXXX" ) ) * 0.75 );
}

void QgsColorPreviewWidget::setColor2( const QColor &color )

0 comments on commit f121286

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