Skip to content

Commit

Permalink
Fix task manager UI sizes on hidpi displays
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 9, 2018
1 parent c14e6ca commit 82057b8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/gui/qgstaskmanagerwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ QgsTaskManagerWidget::QgsTaskManagerWidget( QgsTaskManager *manager, QWidget *pa
mTreeView->setHeaderHidden( true );
mTreeView->setRootIsDecorated( false );
mTreeView->setSelectionBehavior( QAbstractItemView::SelectRows );
mTreeView->setColumnWidth( 2, 28 );
int progressColWidth = fontMetrics().width( "X" ) * 10 * Qgis::UI_SCALE_FACTOR;
mTreeView->setColumnWidth( QgsTaskManagerModel::Progress, progressColWidth );
int statusColWidth = fontMetrics().width( "X" ) * 2 * Qgis::UI_SCALE_FACTOR;
mTreeView->setColumnWidth( QgsTaskManagerModel::Status, statusColWidth );
mTreeView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
mTreeView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
mTreeView->header()->setStretchLastSection( false );
mTreeView->header()->setSectionResizeMode( 0, QHeaderView::Stretch );
mTreeView->header()->setSectionResizeMode( QgsTaskManagerModel::Description, QHeaderView::Stretch );

vLayout->addWidget( mTreeView );

Expand Down Expand Up @@ -469,7 +472,9 @@ QgsTaskManagerFloatingWidget::QgsTaskManagerFloatingWidget( QgsTaskManager *mana
{
setLayout( new QVBoxLayout() );
QgsTaskManagerWidget *w = new QgsTaskManagerWidget( manager );
setMinimumSize( 350, 270 );
int minWidth = fontMetrics().width( 'X' ) * 60 * Qgis::UI_SCALE_FACTOR;
int minHeight = fontMetrics().height() * 15 * Qgis::UI_SCALE_FACTOR;
setMinimumSize( minWidth, minHeight );
layout()->addWidget( w );
setStyleSheet( ".QgsTaskManagerFloatingWidget { border-top-left-radius: 8px;"
"border-top-right-radius: 8px; background-color: rgb(0, 0, 0, 70%); }" );
Expand Down Expand Up @@ -506,7 +511,7 @@ QgsTaskManagerStatusBarWidget::QgsTaskManagerStatusBarWidget( QgsTaskManager *ma

QSize QgsTaskManagerStatusBarWidget::sizeHint() const
{
int width = 100;
int width = fontMetrics().width( 'X' ) * 10 * Qgis::UI_SCALE_FACTOR;
int height = QToolButton::sizeHint().height();
return QSize( width, height );
}
Expand Down

0 comments on commit 82057b8

Please sign in to comment.