Skip to content
Permalink
Browse files

Fix locator widget's width on hi-dpi screens

It was too short to see the whole placeholder text...
  • Loading branch information
wonder-sk committed May 18, 2017
1 parent e505ebc commit bba631305f17c3154edebf89a76fd67f75b72a52
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/gui/locator/qgslocatorwidget.cpp
@@ -36,12 +36,14 @@ QgsLocatorWidget::QgsLocatorWidget( QWidget *parent )
mLineEdit->setShowClearButton( true );
mLineEdit->setPlaceholderText( tr( "Type to locate (Ctrl+K)" ) );

resize( 200, 30 );
int placeholderMinWidth = mLineEdit->fontMetrics().width( mLineEdit->placeholderText() );
int minWidth = qMax( 200, ( int )( placeholderMinWidth * 1.3 ) );
resize( minWidth, 30 );
QSizePolicy sizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
sizePolicy.setHorizontalStretch( 0 );
sizePolicy.setVerticalStretch( 0 );
setSizePolicy( sizePolicy );
setMinimumSize( QSize( 200, 0 ) );
setMinimumSize( QSize( minWidth, 0 ) );

QHBoxLayout *layout = new QHBoxLayout();
layout->setMargin( 0 );

0 comments on commit bba6313

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